[Android] SwipeRefreshLayout: use a lighter color on dark theme

Nicolas Pomepuy git at videolan.org
Mon Sep 5 05:29:50 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Sep  5 07:20:29 2022 +0200| [60931c47bc3029414a730d40df22453f92259878] | committer: Nicolas Pomepuy

SwipeRefreshLayout: use a lighter color on dark theme

> https://code.videolan.org/videolan/vlc-android/commit/60931c47bc3029414a730d40df22453f92259878
---

 application/resources/src/main/res/values/attrs.xml              | 1 +
 application/vlc-android/res/values/styles.xml                    | 2 ++
 application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/application/resources/src/main/res/values/attrs.xml b/application/resources/src/main/res/values/attrs.xml
index e99feb88f..ab188686d 100644
--- a/application/resources/src/main/res/values/attrs.xml
+++ b/application/resources/src/main/res/values/attrs.xml
@@ -78,6 +78,7 @@
     <attr name="tips_item_background" format="color" />
     <attr name="about_text_primary" format="color" />
     <attr name="widget_preview_rounded_bg" format="reference" />
+    <attr name="swipe_refresh_background" format="reference|color" />
 
     <!--Main Icons-->
     <attr name="gridview_progressbar" format="reference" />
diff --git a/application/vlc-android/res/values/styles.xml b/application/vlc-android/res/values/styles.xml
index ceaa5a6a7..81aef1899 100644
--- a/application/vlc-android/res/values/styles.xml
+++ b/application/vlc-android/res/values/styles.xml
@@ -72,6 +72,7 @@
         <item name="fast_scroller_bubble">@drawable/fastscroller_bubble</item>
         <item name="fast_scroller_handle">@drawable/fastscroller_handle</item>
         <item name="primary_focus">@color/orange_800_transparent_20</item>
+        <item name="swipe_refresh_background">?attr/background_default</item>
 
         <item name="gridview_progressbar">@drawable/gridview_progressbar</item>
         <item name="progress_mini_player">@drawable/progress_mini_player</item>
@@ -219,6 +220,7 @@
         <item name="fast_scroller_bubble">@drawable/fastscroller_bubble_black</item>
         <item name="fast_scroller_handle">@drawable/fastscroller_handle_black</item>
         <item name="primary_focus">@color/orange_500_transparent_20</item>
+        <item name="swipe_refresh_background">?attr/background_default_darker</item>
 
         <item name="gridview_progressbar">@drawable/gridview_progressbar_w</item>
         <item name="progress_mini_player">@drawable/progress_mini_player_black</item>
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
index 71ef32069..886ef35cf 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
@@ -56,7 +56,7 @@ abstract class BaseFragment : Fragment(), ActionMode.Callback {
         super.onViewCreated(view, savedInstanceState)
         view.findViewById<SwipeRefreshLayout>(R.id.swipeLayout)?.let {
             swipeRefreshLayout = it
-            val a: TypedArray = requireActivity().obtainStyledAttributes(TypedValue().data, intArrayOf(R.attr.colorPrimary, R.attr.background_default))
+            val a: TypedArray = requireActivity().obtainStyledAttributes(TypedValue().data, intArrayOf(R.attr.colorPrimary, R.attr.swipe_refresh_background))
             val color = a.getColor(0, 0)
             val bColor = a.getColor(1, Color.WHITE)
             a.recycle()



More information about the Android mailing list