Skip to content

Commit fa72da2

Browse files
t895thestinger
authored andcommitted
Adapt swipe to refresh indicator to system theme
Now the indicator will change when changing between light/dark mode instead of always using the light mode colors.
1 parent cd9fd87 commit fa72da2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

app/src/main/java/app/grapheneos/apps/ui/MainScreen.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import app.grapheneos.apps.databinding.MainScreenBinding
2121
import app.grapheneos.apps.util.intent
2222
import com.google.android.material.badge.BadgeDrawable
2323
import com.google.android.material.badge.BadgeUtils
24+
import com.google.android.material.color.MaterialColors
2425
import com.google.android.material.snackbar.Snackbar
2526
import kotlinx.coroutines.CoroutineScope
2627
import kotlinx.coroutines.Dispatchers
@@ -38,6 +39,21 @@ open class MainScreen : PackageListFragment<MainScreenBinding>(), MenuProvider {
3839
override fun onViewsCreated(views: MainScreenBinding, savedInstanceState: Bundle?) {
3940
createListAdapter(views.appList)
4041

42+
views.swipeRefreshContainer.apply {
43+
setProgressBackgroundColorSchemeColor(
44+
MaterialColors.getColor(
45+
this,
46+
com.google.android.material.R.attr.colorSurface
47+
)
48+
)
49+
setColorSchemeColors(
50+
MaterialColors.getColor(
51+
this,
52+
com.google.android.material.R.attr.colorPrimary
53+
)
54+
)
55+
}
56+
4157
views.swipeRefreshContainer.setOnRefreshListener {
4258
CoroutineScope(Dispatchers.Main).launch {
4359
PackageStates.requestRepoUpdate(force = true, isManuallyRequested = true)

0 commit comments

Comments
 (0)