From 072f31a1e830bad0a8c70aa699e820512c056447 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 18 Jul 2022 19:36:21 +0200 Subject: [PATCH] cleanup --- .../github/libretube/activities/MainActivity.kt | 16 +++++++++------- .../github/libretube/fragments/PlayerFragment.kt | 1 - .../libretube/preferences/InstanceSettings.kt | 3 ++- .../libretube/preferences/PlayerSettings.kt | 6 ++++-- .../com/github/libretube/util/PlayerHelper.kt | 3 ++- app/src/main/res/drawable/ic_invert_colors.xml | 6 +++--- app/src/main/res/drawable/ic_rewind.xml | 6 +++--- .../layout/exo_styled_player_control_view.xml | 6 +++--- app/src/main/res/layout/fragment_channel.xml | 6 +++--- .../main/res/layout/fragment_subscriptions.xml | 4 ++-- app/src/main/res/xml/appearance_settings.xml | 4 ++-- app/src/main/res/xml/history_settings.xml | 4 ++-- app/src/main/res/xml/network_security_config.xml | 3 ++- 13 files changed, 37 insertions(+), 31 deletions(-) diff --git a/app/src/main/java/com/github/libretube/activities/MainActivity.kt b/app/src/main/java/com/github/libretube/activities/MainActivity.kt index fb989dd3a..d0408e20c 100644 --- a/app/src/main/java/com/github/libretube/activities/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/activities/MainActivity.kt @@ -99,17 +99,19 @@ class MainActivity : AppCompatActivity() { window.navigationBarColor = color // hide the trending page if enabled - val hideTrendingPage = PreferenceHelper.getBoolean(PreferenceKeys.HIDE_TRENDING_PAGE, false) + val hideTrendingPage = + PreferenceHelper.getBoolean(PreferenceKeys.HIDE_TRENDING_PAGE, false) if (hideTrendingPage) binding.bottomNav.menu.findItem(R.id.homeFragment).isVisible = false // save start tab fragment id - startFragmentId = when (PreferenceHelper.getString(PreferenceKeys.DEFAULT_TAB, "home")) { - "home" -> R.id.homeFragment - "subscriptions" -> R.id.subscriptionsFragment - "library" -> R.id.libraryFragment - else -> R.id.homeFragment - } + startFragmentId = + when (PreferenceHelper.getString(PreferenceKeys.DEFAULT_TAB, "home")) { + "home" -> R.id.homeFragment + "subscriptions" -> R.id.subscriptionsFragment + "library" -> R.id.libraryFragment + else -> R.id.homeFragment + } // set default tab as start fragment navController.graph.setStartDestination(startFragmentId) diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index 8736460df..7486e70a2 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -58,7 +58,6 @@ import com.github.libretube.obj.Streams import com.github.libretube.obj.Subscribe import com.github.libretube.preferences.PreferenceHelper import com.github.libretube.preferences.PreferenceKeys -import com.github.libretube.services.IS_DOWNLOAD_RUNNING import com.github.libretube.util.BackgroundMode import com.github.libretube.util.ConnectionHelper import com.github.libretube.util.CronetHelper diff --git a/app/src/main/java/com/github/libretube/preferences/InstanceSettings.kt b/app/src/main/java/com/github/libretube/preferences/InstanceSettings.kt index 0b7799539..34f874622 100644 --- a/app/src/main/java/com/github/libretube/preferences/InstanceSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/InstanceSettings.kt @@ -143,7 +143,8 @@ class InstanceSettings : PreferenceFragmentCompat() { true } - val authInstanceToggle = findPreference(PreferenceKeys.AUTH_INSTANCE_TOGGLE) + val authInstanceToggle = + findPreference(PreferenceKeys.AUTH_INSTANCE_TOGGLE) authInstanceToggle?.setOnPreferenceChangeListener { _, newValue -> authInstance.isVisible = newValue == true logout() diff --git a/app/src/main/java/com/github/libretube/preferences/PlayerSettings.kt b/app/src/main/java/com/github/libretube/preferences/PlayerSettings.kt index 5d90b3aec..ac599363d 100644 --- a/app/src/main/java/com/github/libretube/preferences/PlayerSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/PlayerSettings.kt @@ -16,8 +16,10 @@ class PlayerSettings : PreferenceFragmentCompat() { val settingsActivity = activity as SettingsActivity settingsActivity.changeTopBarText(getString(R.string.audio_video)) - val playerOrientation = findPreference(PreferenceKeys.FULLSCREEN_ORIENTATION) - val autoRotateToFullscreen = findPreference(PreferenceKeys.AUTO_FULLSCREEN) + val playerOrientation = + findPreference(PreferenceKeys.FULLSCREEN_ORIENTATION) + val autoRotateToFullscreen = + findPreference(PreferenceKeys.AUTO_FULLSCREEN) // only show the player orientation option if auto fullscreen is disabled playerOrientation?.isEnabled != PreferenceHelper.getBoolean( diff --git a/app/src/main/java/com/github/libretube/util/PlayerHelper.kt b/app/src/main/java/com/github/libretube/util/PlayerHelper.kt index 43237e428..3f6743996 100644 --- a/app/src/main/java/com/github/libretube/util/PlayerHelper.kt +++ b/app/src/main/java/com/github/libretube/util/PlayerHelper.kt @@ -24,7 +24,8 @@ object PlayerHelper { // get the system default caption style fun getCaptionStyle(context: Context): CaptionStyleCompat { - val captioningManager = context.getSystemService(Context.CAPTIONING_SERVICE) as CaptioningManager + val captioningManager = + context.getSystemService(Context.CAPTIONING_SERVICE) as CaptioningManager return if (!captioningManager.isEnabled) { // system captions are disabled, using android default captions style CaptionStyleCompat.DEFAULT diff --git a/app/src/main/res/drawable/ic_invert_colors.xml b/app/src/main/res/drawable/ic_invert_colors.xml index ece905850..eae4278ef 100644 --- a/app/src/main/res/drawable/ic_invert_colors.xml +++ b/app/src/main/res/drawable/ic_invert_colors.xml @@ -4,7 +4,7 @@ android:tint="?android:attr/colorControlNormal" android:viewportWidth="24" android:viewportHeight="24"> - + diff --git a/app/src/main/res/drawable/ic_rewind.xml b/app/src/main/res/drawable/ic_rewind.xml index a34fc6a9c..7145b9ecf 100644 --- a/app/src/main/res/drawable/ic_rewind.xml +++ b/app/src/main/res/drawable/ic_rewind.xml @@ -4,7 +4,7 @@ android:tint="@android:color/white" android:viewportWidth="24" android:viewportHeight="24"> - + diff --git a/app/src/main/res/layout/exo_styled_player_control_view.xml b/app/src/main/res/layout/exo_styled_player_control_view.xml index 5502c1eb0..604c3a678 100644 --- a/app/src/main/res/layout/exo_styled_player_control_view.xml +++ b/app/src/main/res/layout/exo_styled_player_control_view.xml @@ -15,8 +15,8 @@ android:layout_gravity="top" android:animateLayoutChanges="true" android:orientation="vertical" - android:paddingTop="5dp" android:paddingStart="5dp" + android:paddingTop="5dp" android:paddingEnd="10dp"> @@ -130,7 +130,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingStart="10dp" - android:paddingEnd="15dp" > + android:paddingEnd="15dp"> + app:cornerRadius="20dp" + app:elevation="20dp" /> diff --git a/app/src/main/res/layout/fragment_subscriptions.xml b/app/src/main/res/layout/fragment_subscriptions.xml index daf569237..02d31f998 100644 --- a/app/src/main/res/layout/fragment_subscriptions.xml +++ b/app/src/main/res/layout/fragment_subscriptions.xml @@ -67,8 +67,8 @@ android:layout_marginEnd="16dp" android:layout_marginBottom="16dp" android:visibility="gone" - app:cardElevation="20dp" - app:cardCornerRadius="18dp"> + app:cardCornerRadius="18dp" + app:cardElevation="20dp"> + app:title="@string/system_caption_style" /> diff --git a/app/src/main/res/xml/history_settings.xml b/app/src/main/res/xml/history_settings.xml index cc95a9ca4..71f1b9df8 100644 --- a/app/src/main/res/xml/history_settings.xml +++ b/app/src/main/res/xml/history_settings.xml @@ -44,9 +44,9 @@ app:title="@string/watch_positions" /> + app:key="reset_watch_positions" + app:title="@string/reset_watch_positions" /> diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml index 09c787419..07094ef0c 100644 --- a/app/src/main/res/xml/network_security_config.xml +++ b/app/src/main/res/xml/network_security_config.xml @@ -8,7 +8,8 @@ -