[Android] Make the SwipeRefreshLayout background color follow the theme
Nicolas Pomepuy
git at videolan.org
Fri Sep 2 06:16:59 UTC 2022
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Aug 29 07:34:19 2022 +0200| [49f1e0c5e7a2d37cfd76851a5925c407304b9ec0] | committer: Nicolas Pomepuy
Make the SwipeRefreshLayout background color follow the theme
Fixes #2666
> https://code.videolan.org/videolan/vlc-android/commit/49f1e0c5e7a2d37cfd76851a5925c407304b9ec0
---
application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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 9858c1627..71ef32069 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
@@ -2,6 +2,7 @@ package org.videolan.vlc.gui
import android.content.Intent
import android.content.res.TypedArray
+import android.graphics.Color
import android.os.Bundle
import android.util.TypedValue
import android.view.Menu
@@ -55,10 +56,12 @@ 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))
+ val a: TypedArray = requireActivity().obtainStyledAttributes(TypedValue().data, intArrayOf(R.attr.colorPrimary, R.attr.background_default))
val color = a.getColor(0, 0)
+ val bColor = a.getColor(1, Color.WHITE)
a.recycle()
it.setColorSchemeColors(color)
+ it.setProgressBackgroundColorSchemeColor(bColor)
}
val fab = requireActivity().findViewById<FloatingActionButton?>(R.id.fab)
((fab?.layoutParams as? CoordinatorLayout.LayoutParams)?.behavior as? FloatingActionButtonBehavior)?.shouldNeverShow = !hasFAB()
More information about the Android
mailing list