Skip to content

Commit

Permalink
Bring back semitransparent TV app via build variants (#2741)
Browse files Browse the repository at this point in the history
This creates two variants for tv, freedom containing the original design, and google containing one matching Google's nonsense guideline. The former should be published on GitHub and elsewhere.

Revert "Revert "Revert "Revert "Revert "Make app fullscreen to match guidelines"""""

This reverts commit 0c67ac6.
  • Loading branch information
Mygod authored May 25, 2021
1 parent c62d405 commit cc9e26a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
17 changes: 16 additions & 1 deletion tv/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,22 @@ plugins {

setupApp()

android.defaultConfig.applicationId = "com.github.shadowsocks.tv"

This comment has been minimized.

Copy link
@tigerdadd

tigerdadd Jun 16, 2021

C:\Users\Ersan.vscode\Untitled-1.py

android {
defaultConfig {
applicationId = "com.github.shadowsocks.tv"
buildConfigField("boolean", "FULLSCREEN", "false")
}
flavorDimensions("market")
productFlavors {
create("freedom") {
dimension("market")
}
create("google") {
dimension("market")
buildConfigField("boolean", "FULLSCREEN", "true")
}
}
}

dependencies {
implementation("androidx.leanback:leanback-preference:1.1.0-rc01")
Expand Down
8 changes: 8 additions & 0 deletions tv/src/freedom/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Shadowsocks.TV" parent="@style/Theme.Shadowsocks.TVBase">
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
</resources>
6 changes: 4 additions & 2 deletions tv/src/main/java/com/github/shadowsocks/tv/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ class MainFragment : LeanbackSettingsFragmentCompat() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.findViewById<View>(R.id.settings_preference_fragment_container).updateLayoutParams {
width = ViewGroup.LayoutParams.MATCH_PARENT
if (BuildConfig.FULLSCREEN) {
view.findViewById<View>(R.id.settings_preference_fragment_container).updateLayoutParams {
width = ViewGroup.LayoutParams.MATCH_PARENT
}
}
}
}
3 changes: 2 additions & 1 deletion tv/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Shadowsocks.TV" parent="@style/Theme.AppCompat.Leanback">
<style name="Theme.Shadowsocks.TVBase" parent="@style/Theme.AppCompat.Leanback">
<item name="android:colorAccent">@color/material_accent_200</item>
<item name="android:colorButtonNormal">@color/material_accent_200</item>
<item name="android:colorPrimary">@color/color_primary</item>
<item name="android:colorPrimaryDark">@color/color_primary_dark</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.Shadowsocks.TV</item>
</style>
<style name="Theme.Shadowsocks.TV" parent="@style/Theme.Shadowsocks.TVBase" />
<style name="PreferenceThemeOverlay.Shadowsocks.TV" parent="@style/PreferenceThemeOverlay.v14.Leanback">
<item name="android:colorAccent">@color/material_accent_200</item>
<item name="android:colorButtonNormal">@color/material_accent_200</item>
Expand Down

0 comments on commit cc9e26a

Please sign in to comment.