Skip to content

Commit

Permalink
feat: added tv support to carousels
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanYuuki committed Feb 2, 2025
1 parent d291760 commit f85dbac
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 23 deletions.
42 changes: 29 additions & 13 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.ryan.anymex">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<!-- android:banner="@drawable/tv_banner" -->
<!-- TV app permissions and features -->
<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />

<application android:label="AnymeX" android:name="${applicationName}" android:roundIcon="@mipmap/ic_rounded_launcher" android:icon="@mipmap/ic_launcher" android:requestLegacyExternalStorage="true" android:enableOnBackInvokedCallback="true">
<application android:label="AnymeX"
android:name="${applicationName}"
android:roundIcon="@mipmap/ic_rounded_launcher"
android:icon="@mipmap/ic_launcher"
android:requestLegacyExternalStorage="true"
android:enableOnBackInvokedCallback="true">

<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:taskAffinity="" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<activity android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">

<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme"/>
<meta-data android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"/>

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<!-- Add LEANBACK_LAUNCHER for TV -->
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
</intent-filter>
</activity>

<activity android:name="com.linusu.flutter_web_auth_2.CallbackActivity" android:exported="true">
<intent-filter android:label="flutter_web_auth_2">
<activity android:name="com.linusu.flutter_web_auth_2.CallbackActivity"
android:exported="true">
<intent-filter android:label="AnymeX">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="anymex"/>
</intent-filter>
</activity>
</intent-filter>
</activity>

<meta-data android:name="flutterEmbedding" android:value="2"/>
<meta-data android:name="flutter.deeplinking.enabled" android:value="true"/>
Expand All @@ -41,17 +62,12 @@
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="sms"/>
</intent>

<intent>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="tel"/>
</intent>

<intent>
<action android:name="android.support.customtabs.action.CustomTabsService"/>
</intent>

</queries>


</manifest>
</manifest>
24 changes: 14 additions & 10 deletions lib/widgets/common/reusable_carousel.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:math' show Random;
import 'package:anymex/controllers/settings/settings.dart';
import 'package:anymex/core/Model/Source.dart';
import 'package:anymex/controllers/settings/methods.dart';
import 'package:anymex/controllers/source/source_controller.dart';
Expand Down Expand Up @@ -109,6 +110,7 @@ class ReusableCarousel extends StatelessWidget {

Widget _buildCarousel(
BuildContext context, List<dynamic> newData, bool isDesktop) {
final settings = Get.find<Settings>();
return SizedBox(
height: isDesktop ? 280 : 220,
child: ListView.builder(
Expand All @@ -119,16 +121,18 @@ class ReusableCarousel extends StatelessWidget {
final itemData = newData[index];
final tag = generateTag('${itemData.id}-$index');

return Obx(() => GestureDetector(
onTap: () => _navigateToDetailsPage(itemData, tag),
child: SlideAndScaleAnimation(
initialScale: 0.0,
finalScale: 1.0,
initialOffset: const Offset(1.0, 0.0),
duration: Duration(milliseconds: getAnimationDuration()),
child: _buildCarouselItem(context, itemData, tag, isDesktop),
),
));
return Obx(() => InkWell(
onTap: () => _navigateToDetailsPage(itemData, tag),
child: settings.enableAnimation
? SlideAndScaleAnimation(
initialScale: 0.0,
finalScale: 1.0,
initialOffset: const Offset(1.0, 0.0),
duration: Duration(milliseconds: getAnimationDuration()),
child:
_buildCarouselItem(context, itemData, tag, isDesktop),
)
: _buildCarouselItem(context, itemData, tag, isDesktop)));
},
),
);
Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import FlutterMacOS
import Foundation

import desktop_webview_window
import device_info_plus
import dynamic_color
import flutter_inappwebview_macos
import flutter_local_notifications
Expand All @@ -26,6 +27,7 @@ import window_to_front

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DesktopWebviewWindowPlugin.register(with: registry.registrar(forPlugin: "DesktopWebviewWindowPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
Expand Down

0 comments on commit f85dbac

Please sign in to comment.