[Android] Make the picker dialog follow the app's theme
Nicolas Pomepuy
git at videolan.org
Mon Feb 15 12:38:48 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Feb 9 11:52:31 2021 +0100| [6f8720c4e20aed6e600a4830d79635a91fc79138] | committer: Nicolas Pomepuy
Make the picker dialog follow the app's theme
> https://code.videolan.org/videolan/vlc-android/commit/6f8720c4e20aed6e600a4830d79635a91fc79138
---
.../src/main/res/drawable/ic_close_small.xml | 2 +-
.../vlc-android/res/values-night/styles.xml | 2 ++
application/vlc-android/res/values-v27/styles.xml | 19 ++++++++++++++--
application/vlc-android/res/values/styles.xml | 25 ++++++++++++++++++++--
.../videolan/vlc/gui/browser/FilePickerActivity.kt | 9 ++++++++
5 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/application/resources/src/main/res/drawable/ic_close_small.xml b/application/resources/src/main/res/drawable/ic_close_small.xml
index 784a22a25..4292f7052 100644
--- a/application/resources/src/main/res/drawable/ic_close_small.xml
+++ b/application/resources/src/main/res/drawable/ic_close_small.xml
@@ -4,6 +4,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
- android:fillColor="#ffffff"
+ android:fillColor="?attr/font_default"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>
diff --git a/application/vlc-android/res/values-night/styles.xml b/application/vlc-android/res/values-night/styles.xml
index 9e81f27e9..4d692e2b3 100644
--- a/application/vlc-android/res/values-night/styles.xml
+++ b/application/vlc-android/res/values-night/styles.xml
@@ -11,4 +11,6 @@
<item name="colorControlNormal">@color/grey400</item>
<item name="popupMenuBackground">@color/grey875</item>
</style>
+
+ <style name="Theme.VLC.PickerDialog" parent="Theme.VLC.PickerDialog.Dark"/>
</resources>
\ No newline at end of file
diff --git a/application/vlc-android/res/values-v27/styles.xml b/application/vlc-android/res/values-v27/styles.xml
index eeb00bb33..1dcf94474 100644
--- a/application/vlc-android/res/values-v27/styles.xml
+++ b/application/vlc-android/res/values-v27/styles.xml
@@ -30,12 +30,27 @@
<item name="android:windowLightStatusBar">true</item>
<item name="android:navigationBarColor">@color/white</item>
<item name="android:windowLightNavigationBar">true</item>
- </style>
+ </style>
<style name="Theme.VLC.Black" parent="Theme.VLC.Black.19">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/black</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:navigationBarColor">@color/grey875</item>
- </style>
+ </style>
+
+ <style name="Theme.VLC.PickerDialog.Dark" parent="Theme.VLC.PickerDialog.Dark.7">
+ <item name="android:windowDrawsSystemBarBackgrounds">true</item>
+ <item name="android:statusBarColor">@color/black</item>
+ <item name="android:windowLightStatusBar">false</item>
+ <item name="android:navigationBarColor">@color/grey875</item>
+ </style>
+
+ <style name="Theme.VLC.PickerDialog.Light" parent="Theme.VLC.PickerDialog.Light.7">
+ <item name="android:windowDrawsSystemBarBackgrounds">true</item>
+ <item name="android:statusBarColor">@color/white</item>
+ <item name="android:windowLightStatusBar">true</item>
+ <item name="android:navigationBarColor">@color/white</item>
+ <item name="android:windowLightNavigationBar">true</item>
+ </style>
</resources>
\ No newline at end of file
diff --git a/application/vlc-android/res/values/styles.xml b/application/vlc-android/res/values/styles.xml
index 5d2d3d6e4..b8335df76 100644
--- a/application/vlc-android/res/values/styles.xml
+++ b/application/vlc-android/res/values/styles.xml
@@ -46,7 +46,7 @@
<item name="bottom_navigation_color">@color/grey700</item>
<item name="header_background">@color/whitetransparent_ea</item>
<item name="background_default_darker">@color/grey200</item>
- <item name="background_actionbar">@color/white</item>
+ <item name="background_actionbar">@color/white</item>Dark
<item name="background_audio_tips">@color/grey50transparent</item>
<item name="audio_player_background_tint">@color/whitetransparent</item>
<item name="audio_browser_separator">@color/orange500</item>
@@ -94,7 +94,10 @@
<item name="rounded_corners_bottom_default_darker">@drawable/rounded_corners_bottom_default_darker_light</item>
</style>
- <style name="Theme.VLC.PickerDialog" parent="Theme.MaterialComponents.Dialog">
+ <style name="Theme.VLC.PickerDialog" parent="Theme.VLC.PickerDialog.Light"/>
+ <style name="Theme.VLC.PickerDialog.Dark" parent="Theme.VLC.PickerDialog.Dark.7"/>
+ <style name="Theme.VLC.PickerDialog.Light" parent="Theme.VLC.PickerDialog.Light.7"/>
+ <style name="Theme.VLC.PickerDialog.Dark.7" parent="Theme.MaterialComponents.Dialog">
<item name="colorPrimary">@color/orange500</item>
<item name="colorPrimaryDark">@color/orange700</item>
<item name="colorSecondary">@color/orange500</item>
@@ -112,6 +115,24 @@
<item name="android:textViewStyle">@style/VLC.TextView</item>
</style>
+ <style name="Theme.VLC.PickerDialog.Light.7" parent="Theme.MaterialComponents.Dialog">
+ <item name="colorPrimary">@color/orange500</item>
+ <item name="colorPrimaryDark">@color/orange700</item>
+ <item name="colorSecondary">@color/orange500</item>
+ <item name="windowNoTitle">true</item>
+ <item name="android:gridViewStyle">@style/Theme.VLC.List</item>
+ <item name="background_default">@color/white</item>
+ <item name="background_default_darker">@color/grey200</item>
+ <item name="font_default">@color/black</item>
+ <item name="font_light">@color/grey300</item>
+ <item name="list_subtitle">@color/grey600</item>
+ <item name="list_title">@color/black</item>
+ <item name="ariane_text_color">@color/grey900</item>
+ <item name="ariane_text_size">14sp</item>
+ <item name="android:windowBackground">@color/grey200</item>
+ <item name="android:textViewStyle">@style/VLC.TextView</item>
+ </style>
+
<style name="Theme.VLC.SendCrashDialog" parent="Theme.MaterialComponents.Dialog">
<item name="windowNoTitle">true</item>
<item name="colorPrimary">@color/orange800</item>
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.kt
index e528b9972..edc4702ee 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/FilePickerActivity.kt
@@ -27,17 +27,26 @@ import android.os.Bundle
import android.view.Gravity
import android.view.View
import androidx.appcompat.app.AppCompatActivity
+import androidx.appcompat.app.AppCompatDelegate
import androidx.core.os.bundleOf
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.ObsoleteCoroutinesApi
import org.videolan.medialibrary.interfaces.media.MediaWrapper
+import org.videolan.tools.KEY_APP_THEME
+import org.videolan.tools.Settings
import org.videolan.vlc.R
+import org.videolan.vlc.gui.video.VideoPlayerActivity
+import kotlin.reflect.jvm.jvmName
@ObsoleteCoroutinesApi
@ExperimentalCoroutinesApi
class FilePickerActivity : AppCompatActivity() {
public override fun onCreate(savedInstanceState: Bundle?) {
+ if (callingActivity?.className != VideoPlayerActivity::class.jvmName)
+ AppCompatDelegate.setDefaultNightMode(Integer.valueOf(Settings.getInstance(this).getString(KEY_APP_THEME, "-1")!!))
+ else
+ AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
super.onCreate(savedInstanceState)
setContentView(R.layout.file_picker_activity)
val ft = supportFragmentManager.beginTransaction()
More information about the Android
mailing list