Skip to content

Commit

Permalink
[Feature] Add TV support.
Browse files Browse the repository at this point in the history
Fixes: #987
  • Loading branch information
zhanghai committed Aug 10, 2023
1 parent f1d9b74 commit 3dca5a7
Show file tree
Hide file tree
Showing 10 changed files with 308 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-feature android:name="android.hardware.wifi" android:required="false" />
<uses-feature android:name="android.software.leanback" android:required="false" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Expand Down Expand Up @@ -38,6 +40,7 @@
-->
<application
android:allowBackup="true"
android:banner="@drawable/banner"
android:fullBackupContent="true"
android:icon="@mipmap/launcher_icon"
android:label="@string/app_name"
Expand All @@ -57,6 +60,7 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />
Expand Down
Binary file added app/src/main/res/drawable-xhdpi/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<item name="android:colorBackground">?colorSurface</item>
<item name="dropDownListViewStyle">@style/Widget.MaterialFiles.ListView.DropDown</item>
<item name="windowActionBar">false</item>
<!-- https://developer.android.com/training/tv/start/start#transition-color -->
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="windowNoTitle">true</item>

<item name="colorPrimary">@color/color_primary</item>
Expand Down Expand Up @@ -67,6 +70,9 @@
<item name="android:colorBackground">?colorSurface</item>
<item name="dropDownListViewStyle">@style/Widget.MaterialFiles.ListView.DropDown</item>
<item name="windowActionBar">false</item>
<!-- https://developer.android.com/training/tv/start/start#transition-color -->
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowBackground">@android:color/black</item>
<item name="windowNoTitle">true</item>

Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/values/themes_material3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<item name="android:colorBackground">?colorSurface</item>
<item name="dropDownListViewStyle">@style/Widget.MaterialFiles.ListView.DropDown</item>
<item name="windowActionBar">false</item>
<!-- https://developer.android.com/training/tv/start/start#transition-color -->
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="windowNoTitle">true</item>

<item name="colorAccent">?colorPrimary</item>
Expand Down Expand Up @@ -71,6 +74,9 @@
<item name="android:colorBackground">?colorSurface</item>
<item name="dropDownListViewStyle">@style/Widget.MaterialFiles.ListView.DropDown</item>
<item name="windowActionBar">false</item>
<!-- https://developer.android.com/training/tv/start/start#transition-color -->
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowBackground">@android:color/black</item>
<item name="windowNoTitle">true</item>

Expand Down
Binary file added art/banner-play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/banner-xhdpi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
286 changes: 286 additions & 0 deletions art/banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions art/deploy-png.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ for shortcut in directory downloads file ftp_server; do
cp "${shortcut}_shortcut_icon-${dpi}.png" "../app/src/main/res/mipmap-${dpi}/${shortcut}_shortcut_icon.png"
done
done

cp banner-xhdpi.png ../app/src/main/res/drawable-xhdpi/banner.png
cp banner-play.png ../fastlane/metadata/android/en-US/images/tvBanner.png
3 changes: 3 additions & 0 deletions art/generate-png.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ for shortcut in directory downloads file ftp_server; do
inkscape -o "${shortcut}_shortcut_icon-xxhdpi.png" --export-area=15:15:93:93 -w 144 -h 144 "${shortcut}_shortcut_icon.svg"
inkscape -o "${shortcut}_shortcut_icon-xxxhdpi.png" --export-area=15:15:93:93 -w 192 -h 192 "${shortcut}_shortcut_icon.svg"
done

inkscape -o banner-xhdpi.png --export-area=0:0:320:180 -w 320 -h 180 banner.svg
inkscape -o banner-play.png --export-area=0:0:320:180 -w 1280 -h 720 banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3dca5a7

Please sign in to comment.