Browse Source

Fix tint on AMOLED theme (#966)

Fix tint on AMOLED theme
Bram van de Kerkhof 7 years ago
parent
commit
75cb94b51a

+ 5 - 0
app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChapterHolder.kt

@@ -6,7 +6,9 @@ import eu.davidea.viewholders.FlexibleViewHolder
 import eu.kanade.tachiyomi.R
 import eu.kanade.tachiyomi.data.database.models.Manga
 import eu.kanade.tachiyomi.data.download.model.Download
+import eu.kanade.tachiyomi.util.getResourceColor
 import eu.kanade.tachiyomi.util.gone
+import eu.kanade.tachiyomi.util.setVectorCompat
 import kotlinx.android.synthetic.main.chapters_item.view.*
 import java.util.*
 
@@ -33,6 +35,9 @@ class ChapterHolder(
             else -> chapter.name
         }
 
+        // Set the correct drawable for dropdown and update the tint to match theme.
+        view.chapter_menu.setVectorCompat(R.drawable.ic_more_horiz_black_24dp, view.context.getResourceColor(R.attr.icon_color))
+
         // Set correct text color
         chapter_title.setTextColor(if (chapter.read) adapter.readColor else adapter.unreadColor)
         if (chapter.bookmark) chapter_title.setTextColor(adapter.bookmarkedColor)

+ 4 - 0
app/src/main/java/eu/kanade/tachiyomi/ui/recent_updates/RecentChapterHolder.kt

@@ -8,6 +8,7 @@ import eu.davidea.viewholders.FlexibleViewHolder
 import eu.kanade.tachiyomi.R
 import eu.kanade.tachiyomi.data.download.model.Download
 import eu.kanade.tachiyomi.util.getResourceColor
+import eu.kanade.tachiyomi.util.setVectorCompat
 import jp.wasabeef.glide.transformations.CropCircleTransformation
 import kotlinx.android.synthetic.main.recent_chapters_item.view.*
 
@@ -63,6 +64,9 @@ class RecentChapterHolder(private val view: View, private val adapter: RecentCha
         // Set manga title
         view.manga_title.text = item.manga.title
 
+        // Set the correct drawable for dropdown and update the tint to match theme.
+        view.chapter_menu_icon.setVectorCompat(R.drawable.ic_more_horiz_black_24dp, view.context.getResourceColor(R.attr.icon_color))
+
         // Set cover
         Glide.clear(itemView.manga_cover)
         if (!item.manga.thumbnail_url.isNullOrEmpty()) {

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

@@ -76,12 +76,12 @@
         app:layout_constraintTop_toTopOf="parent">
 
         <ImageView
+            android:id="@+id/chapter_menu_icon"
             android:layout_width="24dp"
             android:layout_height="24dp"
             android:layout_gravity="center|end"
             android:layout_marginEnd="16dp"
-            android:layout_marginRight="16dp"
-            app:srcCompat="@drawable/ic_more_horiz_black_24dp" />
+            android:layout_marginRight="16dp" />
 
     </FrameLayout>
 

+ 1 - 0
app/src/main/res/values/attrs.xml

@@ -25,4 +25,5 @@
     <attr name="selectable_library_drawable" format="reference|integer"/>
     <attr name="text_color_primary" format="reference|integer"/>
     <attr name="background_card" format="reference|integer"/>
+    <attr name="icon_color" format="reference|integer"/>
 </resources>

+ 3 - 0
app/src/main/res/values/colors.xml

@@ -20,6 +20,7 @@
     <color name="dialogLight">@color/md_white_1000</color>
 
     <color name="selectorColorLight">@color/md_blue_A400_38</color>
+    <color name="iconColorLight">@color/md_black_1000</color>
 
     <!-- Dark Theme -->
     <color name="colorAccentDark">#3399ff</color>
@@ -35,6 +36,7 @@
     <color name="dialogDark">@color/md_grey_800</color>
 
     <color name="selectorColorDark">@color/md_blue_A200_50</color>
+    <color name="iconColorDark">@color/md_white_1000_54</color>
 
     <!-- Reader Theme -->
     <color name="pageNumberBackgroundLight">@color/md_grey_50_75</color>
@@ -48,6 +50,7 @@
 
     <color name="md_white_1000">#FFFFFFFF</color>
     <color name="md_white_1000_70">#B3FFFFFF</color>
+    <color name="md_white_1000_54">#8AFFFFFF</color>
     <color name="md_white_1000_50">#80FFFFFF</color>
     <color name="md_white_1000_20">#33FFFFFF</color>
     <color name="md_white_1000_12">#1FFFFFFF</color>

+ 2 - 0
app/src/main/res/values/themes.xml

@@ -36,6 +36,7 @@
         <item name="selectable_library_drawable">@drawable/library_item_selector_light</item>
         <item name="text_color_primary">@color/textColorPrimaryLight</item>
         <item name="background_card">@color/dialogLight</item>
+        <item name="icon_color">@color/iconColorLight</item>
     </style>
 
     <style name="Theme.Tachiyomi" parent="Theme.Base">
@@ -74,6 +75,7 @@
         <item name="selectable_library_drawable">@drawable/library_item_selector_dark</item>
         <item name="text_color_primary">@color/textColorPrimaryDark</item>
         <item name="background_card">@color/dialogDark</item>
+        <item name="icon_color">@color/iconColorDark</item>
     </style>
 
     <style name="Theme.Tachiyomi.Dark" parent="Theme.Base.Dark">