Merge pull request #820 from Bnyro/master

cleanup
This commit is contained in:
Bnyro 2022-07-18 19:36:37 +02:00 committed by GitHub
commit 5e8ba03400
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 37 additions and 31 deletions

View File

@ -99,17 +99,19 @@ class MainActivity : AppCompatActivity() {
window.navigationBarColor = color window.navigationBarColor = color
// hide the trending page if enabled // 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 = if (hideTrendingPage) binding.bottomNav.menu.findItem(R.id.homeFragment).isVisible =
false false
// save start tab fragment id // save start tab fragment id
startFragmentId = when (PreferenceHelper.getString(PreferenceKeys.DEFAULT_TAB, "home")) { startFragmentId =
"home" -> R.id.homeFragment when (PreferenceHelper.getString(PreferenceKeys.DEFAULT_TAB, "home")) {
"subscriptions" -> R.id.subscriptionsFragment "home" -> R.id.homeFragment
"library" -> R.id.libraryFragment "subscriptions" -> R.id.subscriptionsFragment
else -> R.id.homeFragment "library" -> R.id.libraryFragment
} else -> R.id.homeFragment
}
// set default tab as start fragment // set default tab as start fragment
navController.graph.setStartDestination(startFragmentId) navController.graph.setStartDestination(startFragmentId)

View File

@ -58,7 +58,6 @@ import com.github.libretube.obj.Streams
import com.github.libretube.obj.Subscribe import com.github.libretube.obj.Subscribe
import com.github.libretube.preferences.PreferenceHelper import com.github.libretube.preferences.PreferenceHelper
import com.github.libretube.preferences.PreferenceKeys 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.BackgroundMode
import com.github.libretube.util.ConnectionHelper import com.github.libretube.util.ConnectionHelper
import com.github.libretube.util.CronetHelper import com.github.libretube.util.CronetHelper

View File

@ -143,7 +143,8 @@ class InstanceSettings : PreferenceFragmentCompat() {
true true
} }
val authInstanceToggle = findPreference<SwitchPreferenceCompat>(PreferenceKeys.AUTH_INSTANCE_TOGGLE) val authInstanceToggle =
findPreference<SwitchPreferenceCompat>(PreferenceKeys.AUTH_INSTANCE_TOGGLE)
authInstanceToggle?.setOnPreferenceChangeListener { _, newValue -> authInstanceToggle?.setOnPreferenceChangeListener { _, newValue ->
authInstance.isVisible = newValue == true authInstance.isVisible = newValue == true
logout() logout()

View File

@ -16,8 +16,10 @@ class PlayerSettings : PreferenceFragmentCompat() {
val settingsActivity = activity as SettingsActivity val settingsActivity = activity as SettingsActivity
settingsActivity.changeTopBarText(getString(R.string.audio_video)) settingsActivity.changeTopBarText(getString(R.string.audio_video))
val playerOrientation = findPreference<ListPreference>(PreferenceKeys.FULLSCREEN_ORIENTATION) val playerOrientation =
val autoRotateToFullscreen = findPreference<SwitchPreferenceCompat>(PreferenceKeys.AUTO_FULLSCREEN) findPreference<ListPreference>(PreferenceKeys.FULLSCREEN_ORIENTATION)
val autoRotateToFullscreen =
findPreference<SwitchPreferenceCompat>(PreferenceKeys.AUTO_FULLSCREEN)
// only show the player orientation option if auto fullscreen is disabled // only show the player orientation option if auto fullscreen is disabled
playerOrientation?.isEnabled != PreferenceHelper.getBoolean( playerOrientation?.isEnabled != PreferenceHelper.getBoolean(

View File

@ -24,7 +24,8 @@ object PlayerHelper {
// get the system default caption style // get the system default caption style
fun getCaptionStyle(context: Context): CaptionStyleCompat { 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) { return if (!captioningManager.isEnabled) {
// system captions are disabled, using android default captions style // system captions are disabled, using android default captions style
CaptionStyleCompat.DEFAULT CaptionStyleCompat.DEFAULT

View File

@ -4,7 +4,7 @@
android:tint="?android:attr/colorControlNormal" android:tint="?android:attr/colorControlNormal"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:pathData="M12,4.81L12,19c-3.31,0 -6,-2.63 -6,-5.87c0,-1.56 0.62,-3.03 1.75,-4.14L12,4.81M6.35,7.56L6.35,7.56C4.9,8.99 4,10.96 4,13.13C4,17.48 7.58,21 12,21c4.42,0 8,-3.52 8,-7.87c0,-2.17 -0.9,-4.14 -2.35,-5.57l0,0L12,2L6.35,7.56z" android:fillColor="#000000"
android:fillColor="#000000"/> android:pathData="M12,4.81L12,19c-3.31,0 -6,-2.63 -6,-5.87c0,-1.56 0.62,-3.03 1.75,-4.14L12,4.81M6.35,7.56L6.35,7.56C4.9,8.99 4,10.96 4,13.13C4,17.48 7.58,21 12,21c4.42,0 8,-3.52 8,-7.87c0,-2.17 -0.9,-4.14 -2.35,-5.57l0,0L12,2L6.35,7.56z" />
</vector> </vector>

View File

@ -4,7 +4,7 @@
android:tint="@android:color/white" android:tint="@android:color/white"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:pathData="m6,13c0,3.31 2.69,6 6,6 3.31,0 6,-2.69 6,-6 0,-3.31 -2.69,-6 -6,-6v4L7,6 12,1v4c4.42,0 8,3.58 8,8 0,4.42 -3.58,8 -8,8 -4.42,0 -8,-3.58 -8,-8z" android:fillColor="@android:color/white"
android:fillColor="@android:color/white"/> android:pathData="m6,13c0,3.31 2.69,6 6,6 3.31,0 6,-2.69 6,-6 0,-3.31 -2.69,-6 -6,-6v4L7,6 12,1v4c4.42,0 8,3.58 8,8 0,4.42 -3.58,8 -8,8 -4.42,0 -8,-3.58 -8,-8z" />
</vector> </vector>

View File

@ -15,8 +15,8 @@
android:layout_gravity="top" android:layout_gravity="top"
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:orientation="vertical" android:orientation="vertical"
android:paddingTop="5dp"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingTop="5dp"
android:paddingEnd="10dp"> android:paddingEnd="10dp">
<LinearLayout <LinearLayout
@ -92,8 +92,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end" android:layout_gravity="end"
android:layout_marginEnd="3dp"
android:layout_marginTop="-12dp" android:layout_marginTop="-12dp"
android:layout_marginEnd="3dp"
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="gone"> android:visibility="gone">
@ -130,7 +130,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="10dp" android:paddingStart="10dp"
android:paddingEnd="15dp" > android:paddingEnd="15dp">
<LinearLayout <LinearLayout
android:id="@id/exo_time" android:id="@id/exo_time"

View File

@ -80,12 +80,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_bell_small" android:drawableLeft="@drawable/ic_bell_small"
android:drawableTint="?android:attr/textColorPrimary" android:drawableTint="?android:attr/textColorPrimary"
android:stateListAnimator="@null"
android:text="@string/subscribe" android:text="@string/subscribe"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp" android:textSize="12sp"
android:stateListAnimator="@null" app:cornerRadius="20dp"
app:elevation="20dp" app:elevation="20dp" />
app:cornerRadius="20dp" />
</LinearLayout> </LinearLayout>

View File

@ -67,8 +67,8 @@
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:visibility="gone" android:visibility="gone"
app:cardElevation="20dp" app:cardCornerRadius="18dp"
app:cardCornerRadius="18dp"> app:cardElevation="20dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -82,9 +82,9 @@
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:icon="@drawable/ic_caption" android:icon="@drawable/ic_caption"
app:defaultValue="true"
app:key="system_caption_style" app:key="system_caption_style"
app:title="@string/system_caption_style" app:title="@string/system_caption_style" />
app:defaultValue="true" />
</PreferenceCategory> </PreferenceCategory>

View File

@ -44,9 +44,9 @@
app:title="@string/watch_positions" /> app:title="@string/watch_positions" />
<Preference <Preference
app:title="@string/reset_watch_positions"
android:icon="@drawable/ic_reset" android:icon="@drawable/ic_reset"
app:key="reset_watch_positions" /> app:key="reset_watch_positions"
app:title="@string/reset_watch_positions" />
</PreferenceCategory> </PreferenceCategory>

View File

@ -8,7 +8,8 @@
<!-- Trust preinstalled CAs --> <!-- Trust preinstalled CAs -->
<certificates src="system" /> <certificates src="system" />
<!-- Additionally trust user added CAs --> <!-- Additionally trust user added CAs -->
<certificates src="user" <certificates
src="user"
tools:ignore="AcceptsUserCertificates" /> tools:ignore="AcceptsUserCertificates" />
</trust-anchors> </trust-anchors>
</base-config> </base-config>