Skip to content

Commit

Permalink
added Google and Android TV compatibility, updated channel list
Browse files Browse the repository at this point in the history
  • Loading branch information
aldrinzigmundv committed Apr 13, 2024
1 parent 0e2c587 commit 5cfcba0
Show file tree
Hide file tree
Showing 26 changed files with 1,041 additions and 364 deletions.
5 changes: 3 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 20
targetSdkVersion 33
versionCode 8
versionName "1.9.2"
versionCode 9
versionName "2.0.0"
multiDexEnabled true
}
signingConfigs {
Expand All @@ -85,4 +85,5 @@ flutter {

dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation "androidx.activity:activity:1.6.0-alpha05"
}
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
android:label="Digilog TV"
android:name="${applicationName}"
android:icon="@mipmap/launcher_icon"
android:usesCleartextTraffic="true">
android:usesCleartextTraffic="true"
android:enableOnBackInvokedCallback="true">
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
75 changes: 45 additions & 30 deletions lib/pages/channelpage-iptv.dart → lib/pages/channelpage_iptv.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:digilogtv/services/storage.dart';

import 'package:video_player/video_player.dart';
import 'package:wakelock_plus/wakelock_plus.dart';

import 'package:digilogtv/services/storage.dart';

class ChannelPageIPTV extends StatefulWidget {
const ChannelPageIPTV(
{super.key, required this.index, required this.storage});
{super.key,
required this.index,
required this.storage,
required this.isTV});

final int index;
final StorageProvider storage;
final bool isTV;

@override
State<ChannelPageIPTV> createState() => _ChannelPageIPTVState();
Expand All @@ -22,6 +26,7 @@ class _ChannelPageIPTVState extends State<ChannelPageIPTV> {

late int index;
late StorageProvider storage;
late bool isTV;

late VideoPlayerController _videoPlayerController;

Expand All @@ -37,52 +42,61 @@ class _ChannelPageIPTVState extends State<ChannelPageIPTV> {
}

_hideUnhideAppBar() {
setState(() {
_appBarVisibility = !_appBarVisibility;
if (!_appBarVisibility) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight
]);
} else {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]);
SystemChrome.setPreferredOrientations(DeviceOrientation.values);
}
});
if (!isTV) {
setState(() {
_appBarVisibility = !_appBarVisibility;
if (!_appBarVisibility) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight
]);
} else {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]);
SystemChrome.setPreferredOrientations(DeviceOrientation.values);
}
});
}
}

@override
void initState() {
super.initState();
index = widget.index;
storage = widget.storage;
isTV = widget.isTV;
WakelockPlus.enable();
_setupVideoPlayerController();
}

@override
void dispose() {
WakelockPlus.disable();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]);
if (!isTV) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]);
}
_videoPlayerController.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: _appBarVisibility
? AppBar(
title: Text(storage.channels.channelList[index].channelName),
titleTextStyle: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
centerTitle: true,
backgroundColor: Colors.indigo[900],
foregroundColor: Colors.white,
)
: null,
appBar: (isTV)
? null
: _appBarVisibility
? AppBar(
title:
Text(storage.channels.channelList[index].channelName),
titleTextStyle: const TextStyle(
color: Colors.white, fontWeight: FontWeight.bold),
centerTitle: true,
backgroundColor: Colors.indigo[900],
foregroundColor: Colors.white,
)
: null,
backgroundColor: Colors.black,
body: GestureDetector(
onTap: () => _hideUnhideAppBar(),
Expand All @@ -96,8 +110,9 @@ class _ChannelPageIPTVState extends State<ChannelPageIPTV> {
child: CircularProgressIndicator()),
),
),
bottomNavigationBar:
(MediaQuery.of(context).orientation == Orientation.portrait)
bottomNavigationBar: (isTV)
? null
: (MediaQuery.of(context).orientation == Orientation.portrait)
? Padding(
padding: const EdgeInsets.all(27.0),
child: Text(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:digilogtv/services/storage.dart';

import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:wakelock_plus/wakelock_plus.dart';

import 'package:digilogtv/services/storage.dart';

class ChannelPageYouTube extends StatefulWidget {
const ChannelPageYouTube(
{super.key, required this.index, required this.storageProvider});
{super.key,
required this.index,
required this.storageProvider,
required this.isTV});

final int index;
final StorageProvider storageProvider;
final bool isTV;

@override
State<ChannelPageYouTube> createState() => _ChannelPageYouTubeState();
Expand All @@ -22,32 +26,39 @@ class _ChannelPageYouTubeState extends State<ChannelPageYouTube> {

late int index;
late StorageProvider storageProvider;
late bool isTV;

@override
void initState() {
super.initState();
index = widget.index;
storageProvider = widget.storageProvider;
isTV = widget.isTV;
WakelockPlus.enable();
}

@override
void dispose() {
WakelockPlus.disable();
SystemChrome.setPreferredOrientations(DeviceOrientation.values);
if (!isTV) {
SystemChrome.setPreferredOrientations(DeviceOrientation.values);
}
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(storageProvider.channels.channelList[index].channelName),
titleTextStyle: const TextStyle(color: Colors.white),
centerTitle: true,
backgroundColor: Colors.indigo[900],
foregroundColor: Colors.white,
),
appBar: (isTV)
? null
: AppBar(
title: Text(
storageProvider.channels.channelList[index].channelName),
titleTextStyle: const TextStyle(color: Colors.white),
centerTitle: true,
backgroundColor: Colors.indigo[900],
foregroundColor: Colors.white,
),
backgroundColor: Colors.black,
body: InAppWebView(
initialUrlRequest: URLRequest(
Expand Down
Loading

0 comments on commit 5cfcba0

Please sign in to comment.