diff --git a/application/resources/src/main/java/org/videolan/resources/AndroidDevices.kt b/application/resources/src/main/java/org/videolan/resources/AndroidDevices.kt
index 51bb3b5f7..f715c9c6c 100644
--- a/application/resources/src/main/java/org/videolan/resources/AndroidDevices.kt
+++ b/application/resources/src/main/java/org/videolan/resources/AndroidDevices.kt
@@ -166,7 +166,7 @@ object AndroidDevices {
}
fun canUseSystemNightMode(): Boolean {
- return Build.VERSION.SDK_INT > Build.VERSION_CODES.P || Build.VERSION.SDK_INT == Build.VERSION_CODES.P && "samsung" == Build.MANUFACTURER.toLowerCase()
+ return Build.VERSION.SDK_INT > VERSION_CODES.P || Build.VERSION.SDK_INT == VERSION_CODES.P && "samsung" == Build.MANUFACTURER.toLowerCase(Locale.US)
}
private fun hasPlayServices(pm: PackageManager): Boolean {
diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index f89d14f8d..de90c241b 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -695,7 +695,8 @@
Make yourself at home
Done
Auto-discover your media
- VLC will automatically switch to night mode at appropriate time
+ VLC will automatically switch to dark mode accordingly with system setting
+ VLC will automatically switch to night mode at appropriate time
Let VLC scan my device for media content
VLC will scan my whole SDCard
Let me choose which folders VLC will scan
diff --git a/application/vlc-android/res/layout/onboarding_theme.xml b/application/vlc-android/res/layout/onboarding_theme.xml
index 786084772..b758e77c8 100644
--- a/application/vlc-android/res/layout/onboarding_theme.xml
+++ b/application/vlc-android/res/layout/onboarding_theme.xml
@@ -117,41 +117,10 @@
android:maxWidth="250dp"
android:background="@drawable/theme_selection_rounded"
android:padding="8dp"
- android:text="@string/daynight_explanation"
+ android:text="@string/daynight_legacy_explanation"
android:textAlignment="center"
android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/darkTheme" />
-
-
-
-
\ No newline at end of file
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingThemeFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingThemeFragment.kt
index 6ecfb80a0..d4d4dc9b0 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingThemeFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingThemeFragment.kt
@@ -13,7 +13,7 @@ import kotlinx.android.synthetic.main.onboarding_theme.*
import org.videolan.vlc.R
import org.videolan.resources.AndroidDevices
-class OnboardingThemeFragment : Fragment(), CompoundButton.OnCheckedChangeListener, View.OnClickListener {
+class OnboardingThemeFragment : Fragment(), View.OnClickListener {
private lateinit var viewModel: OnboardingViewModel
@@ -29,19 +29,10 @@ class OnboardingThemeFragment : Fragment(), CompoundButton.OnCheckedChangeListen
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) follow_system_switch.visibility = View.VISIBLE
-
+ themeDescription.setText(if (AndroidDevices.canUseSystemNightMode())R.string.daynight_system_explanation else R.string.daynight_legacy_explanation)
lightTheme.setOnClickListener(this)
darkTheme.setOnClickListener(this)
dayNightTheme.setOnClickListener(this)
- follow_system_switch.isChecked = AndroidDevices.canUseSystemNightMode()
- follow_system_switch.setOnCheckedChangeListener(this)
- }
-
- override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
- when (buttonView) {
- follow_system_switch -> viewModel.theme = if (isChecked) AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM else AppCompatDelegate.MODE_NIGHT_AUTO
- }
}
override fun onClick(view: View) {
@@ -52,21 +43,18 @@ class OnboardingThemeFragment : Fragment(), CompoundButton.OnCheckedChangeListen
dayNightTheme.background = null
viewModel.theme = AppCompatDelegate.MODE_NIGHT_NO
themeDescription.setText(R.string.light_theme)
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) follow_system_switch.visibility = View.GONE
}
darkTheme -> {
themeDescription.setText(R.string.enable_black_theme)
lightTheme.background = null
dayNightTheme.background = null
viewModel.theme = AppCompatDelegate.MODE_NIGHT_YES
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) follow_system_switch.visibility = View.GONE
}
dayNightTheme -> {
- themeDescription.setText(R.string.daynight_explanation)
+ themeDescription.setText(if (AndroidDevices.canUseSystemNightMode())R.string.daynight_system_explanation else R.string.daynight_legacy_explanation)
lightTheme.background = null
darkTheme.background = null
- viewModel.theme = AppCompatDelegate.MODE_NIGHT_AUTO
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) follow_system_switch.visibility = View.VISIBLE
+ viewModel.theme = if (AndroidDevices.canUseSystemNightMode()) AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM else AppCompatDelegate.MODE_NIGHT_AUTO
}
}
}