Use black background for AMOLED theme cards, dialogs

Fixed layout of catalouge grid itesm

Co-Authored-By: arkon <arkon@users.noreply.github.com>
This commit is contained in:
Jay 2020-02-22 00:33:58 -08:00
parent a9bfa47a2f
commit 21cc5a6a6f
5 changed files with 15 additions and 16 deletions

View File

@ -7,13 +7,9 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.IFlexible import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.glide.GlideApp import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.ui.library.LibraryCategoryAdapter import eu.kanade.tachiyomi.ui.library.LibraryCategoryAdapter
import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
import eu.kanade.tachiyomi.widget.StateImageViewTarget import eu.kanade.tachiyomi.widget.StateImageViewTarget
import kotlinx.android.synthetic.main.catalogue_grid_item.* import kotlinx.android.synthetic.main.catalogue_grid_item.*
import kotlinx.android.synthetic.main.unread_download_badge.* import kotlinx.android.synthetic.main.unread_download_badge.*
@ -40,8 +36,6 @@ class CatalogueGridHolder(
*/ */
override fun onSetValues(manga: Manga) { override fun onSetValues(manga: Manga) {
// Update the title of the manga. // Update the title of the manga.
subtitle.gone()
title.gone()
compact_title.text = manga.currentTitle() compact_title.text = manga.currentTitle()
badge_view.setInLibrary(manga.favorite) badge_view.setInLibrary(manga.favorite)

View File

@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.widget.AutofitRecyclerView import eu.kanade.tachiyomi.widget.AutofitRecyclerView
import kotlinx.android.synthetic.main.catalogue_grid_item.view.* import kotlinx.android.synthetic.main.catalogue_grid_item.view.*
@ -37,6 +38,7 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Bo
val marginParams = card.layoutParams as ConstraintLayout.LayoutParams val marginParams = card.layoutParams as ConstraintLayout.LayoutParams
marginParams.bottomMargin = 10.dpToPx marginParams.bottomMargin = 10.dpToPx
card.layoutParams = marginParams card.layoutParams = marginParams
text_layout.gone()
constraint_layout.minHeight = 0 constraint_layout.minHeight = 0
cover_thumbnail.adjustViewBounds = false cover_thumbnail.adjustViewBounds = false
cover_thumbnail.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight) cover_thumbnail.layoutParams = FrameLayout.LayoutParams(MATCH_PARENT, coverHeight)

View File

@ -13,6 +13,7 @@ import android.os.Build
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowInsets import android.view.WindowInsets
import android.widget.Button
import android.widget.TextView import android.widget.TextView
import androidx.annotation.Px import androidx.annotation.Px
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
@ -50,13 +51,6 @@ fun View.getCoordinates() = Point((left + right) / 2, (top + bottom) / 2)
fun View.snack(message: String, length: Int = Snackbar.LENGTH_SHORT, f: (Snackbar.() -> fun View.snack(message: String, length: Int = Snackbar.LENGTH_SHORT, f: (Snackbar.() ->
Unit)? = null): Snackbar { Unit)? = null): Snackbar {
val snack = Snackbar.make(this, message, length) val snack = Snackbar.make(this, message, length)
val theme = Injekt.get<PreferencesHelper>().theme()
if (theme == 3 || theme == 6) {
val textView: TextView =
snack.view.findViewById(com.google.android.material.R.id.snackbar_text)
textView.setTextColor(context.getResourceColor(R.attr.snackbar_text))
snack.config(context)
}
/* when { /* when {
Build.VERSION.SDK_INT >= 23 -> { Build.VERSION.SDK_INT >= 23 -> {
val leftM = if (this is CoordinatorLayout) 0 else rootWindowInsets.systemWindowInsetLeft val leftM = if (this is CoordinatorLayout) 0 else rootWindowInsets.systemWindowInsetLeft
@ -70,6 +64,16 @@ Unit)? = null): Snackbar {
if (f != null) { if (f != null) {
snack.f() snack.f()
} }
val theme = Injekt.get<PreferencesHelper>().theme()
if (theme == 3 || theme == 6) {
val textView: TextView =
snack.view.findViewById(com.google.android.material.R.id.snackbar_text)
val button: Button? =
snack.view.findViewById(com.google.android.material.R.id.snackbar_action)
textView.setTextColor(context.getResourceColor(R.attr.snackbar_text))
button?.setTextColor(context.getResourceColor(R.attr.snackbar_text))
snack.config(context)
}
// if (Build.VERSION.SDK_INT < 23) { // if (Build.VERSION.SDK_INT < 23) {
/* val view = if (this !is CoordinatorLayout) this else snack.view /* val view = if (this !is CoordinatorLayout) this else snack.view
view.doOnApplyWindowInsets { _, insets, _ -> view.doOnApplyWindowInsets { _, insets, _ ->

View File

@ -33,14 +33,14 @@
<!-- Custom Attributes--> <!-- Custom Attributes-->
<item name="selectable_list_drawable">@drawable/list_item_selector</item> <item name="selectable_list_drawable">@drawable/list_item_selector</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_amoled</item> <item name="selectable_library_drawable">@drawable/library_item_selector_amoled</item>
<item name="background_card">@color/dialog_amoled</item> <item name="background_card">@color/colorAmoledPrimary</item>
<!-- Material Dialog colors --> <!-- Material Dialog colors -->
<item name="md_color_title">@color/textColorPrimary</item> <item name="md_color_title">@color/textColorPrimary</item>
<item name="md_color_content">@color/textColorSecondary</item> <item name="md_color_content">@color/textColorSecondary</item>
<item name="md_color_button_text">@color/colorAccent</item> <item name="md_color_button_text">@color/colorAccent</item>
<item name="md_background_color">@color/dialog_amoled</item> <item name="md_background_color">@color/colorAmoledPrimary</item>
<item name="md_corner_radius">16dp</item> <item name="md_corner_radius">16dp</item>
</style> </style>
</resources> </resources>

View File

@ -19,7 +19,6 @@
<color name="actionModeShadow">@color/md_black_1000_38</color> <color name="actionModeShadow">@color/md_black_1000_38</color>
<!-- Dark Application Colors --> <!-- Dark Application Colors -->
<color name="colorAmoledPrimary">@color/md_black_1000</color> <color name="colorAmoledPrimary">@color/md_black_1000</color>
<color name="dialog_amoled">@color/darkPrimaryColor</color>
<color name="readerPrimary">#212121</color> <color name="readerPrimary">#212121</color>
<color name="readerDarkBackground">#1C1C1D</color> <color name="readerDarkBackground">#1C1C1D</color>
<color name="button_bg">@color/md_white_1000</color> <color name="button_bg">@color/md_white_1000</color>