Browse Source

Use accent color for refresh circle

arkon 5 years ago
parent
commit
937fb85376

+ 24 - 0
app/src/main/java/eu/kanade/tachiyomi/widget/ThemedSwipeRefreshLayout.kt

@@ -0,0 +1,24 @@
+package eu.kanade.tachiyomi.widget
+
+import android.content.Context
+import android.util.AttributeSet
+import androidx.core.content.ContextCompat
+import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
+import eu.kanade.tachiyomi.R
+import eu.kanade.tachiyomi.util.system.getResourceColor
+
+class ThemedSwipeRefreshLayout @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
+        SwipeRefreshLayout(context, attrs) {
+
+    init {
+        setColors()
+    }
+
+    private fun setColors() {
+        setProgressBackgroundColorSchemeColor(context.getResourceColor(R.attr.colorAccent))
+        setColorSchemeColors(
+                ContextCompat.getColor(context, R.color.md_white_1000),
+                ContextCompat.getColor(context, R.color.md_white_1000),
+                ContextCompat.getColor(context, R.color.md_white_1000))
+    }
+}

+ 2 - 2
app/src/main/res/layout-land/manga_info_controller.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@id/swipe_refresh"
@@ -247,4 +247,4 @@
 
     </androidx.constraintlayout.widget.ConstraintLayout>
 
-</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+</eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout>

+ 2 - 2
app/src/main/res/layout/chapters_controller.xml

@@ -15,7 +15,7 @@
         android:elevation="5dp"
         android:visibility="invisible"/>
 
-    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
+    <eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout
         android:id="@+id/swipe_refresh"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
@@ -33,7 +33,7 @@
             android:descendantFocusability="blocksDescendants"
             tools:listitem="@layout/chapters_item" />
 
-    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+    </eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout>
 
     <eu.davidea.fastscroller.FastScroller
         android:id="@+id/fast_scroller"

+ 2 - 2
app/src/main/res/layout/extension_controller.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/ext_swipe_refresh"
     android:layout_width="match_parent"
@@ -11,4 +11,4 @@
         android:layout_height="wrap_content"
         tools:listitem="@layout/extension_card_header" />
 
-</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+</eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout>

+ 1 - 1
app/src/main/res/layout/library_category.xml

@@ -3,7 +3,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
+    <eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout
         android:id="@+id/swipe_refresh"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />

+ 2 - 2
app/src/main/res/layout/manga_info_controller.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@id/swipe_refresh"
@@ -295,4 +295,4 @@
 
     </androidx.constraintlayout.widget.ConstraintLayout>
 
-</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+</eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout>

+ 2 - 2
app/src/main/res/layout/track_controller.xml

@@ -5,7 +5,7 @@
     android:layout_height="match_parent"
     android:orientation="vertical">
 
-    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
+    <eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout
         android:id="@+id/swipe_refresh"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
@@ -19,6 +19,6 @@
             android:layout_height="match_parent"
             tools:listitem="@layout/track_item" />
 
-    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+    </eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout>
 
 </LinearLayout>

+ 2 - 2
app/src/main/res/layout/updates_controller.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/swipe_refresh"
     android:layout_width="match_parent"
@@ -33,4 +33,4 @@
 
     </FrameLayout>
 
-</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+</eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout>

+ 2 - 2
app/src/main/res/layout/webview_activity.xml

@@ -21,7 +21,7 @@
 
     </com.google.android.material.appbar.AppBarLayout>
 
-    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
+    <eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout
         android:id="@id/swipe_refresh"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
@@ -50,6 +50,6 @@
 
         </androidx.core.widget.NestedScrollView>
 
-    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
+    </eu.kanade.tachiyomi.widget.ThemedSwipeRefreshLayout>
 
 </androidx.coordinatorlayout.widget.CoordinatorLayout>