diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt index 2b17c3189..84885bc3d 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt @@ -18,6 +18,7 @@ import io.legado.app.databinding.ItemBookSourceBinding import io.legado.app.lib.theme.backgroundColor import io.legado.app.ui.widget.recycler.DragSelectTouchHelper import io.legado.app.ui.widget.recycler.ItemTouchCallback.Callback +import io.legado.app.utils.ColorUtils import io.legado.app.utils.invisible import io.legado.app.utils.visible @@ -86,7 +87,7 @@ class BookSourceAdapter(context: Context, val callBack: CallBack) : with(binding) { val payload = payloads.getOrNull(0) as? Bundle if (payload == null) { - root.setBackgroundColor(context.backgroundColor) + root.setBackgroundColor(ColorUtils.withAlpha(context.backgroundColor, 0.5f)) if (item.bookSourceGroup.isNullOrEmpty()) { cbBookSource.text = item.bookSourceName } else { diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt index f8897ca9e..286c13b74 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt @@ -7,7 +7,8 @@ import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.constant.BookType import io.legado.app.data.entities.Book import io.legado.app.databinding.ItemBookshelfGridBinding -import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.backgroundColor +import io.legado.app.utils.ColorUtils import io.legado.app.utils.invisible import splitties.views.onLongClick @@ -23,18 +24,18 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) : binding: ItemBookshelfGridBinding, item: Book, payloads: MutableList - ) { + ) = with(binding) { val bundle = payloads.getOrNull(0) as? Bundle if (bundle == null) { - ATH.applyBackgroundTint(binding.root) - binding.tvName.text = item.name - binding.ivCover.load(item.getDisplayCover(), item.name, item.author) + root.setBackgroundColor(ColorUtils.withAlpha(context.backgroundColor, 0.5f)) + tvName.text = item.name + ivCover.load(item.getDisplayCover(), item.name, item.author) upRefresh(binding, item) } else { bundle.keySet().forEach { when (it) { - "name" -> binding.tvName.text = item.name - "cover" -> binding.ivCover.load(item.getDisplayCover(), item.name, item.author) + "name" -> tvName.text = item.name + "cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author) "refresh" -> upRefresh(binding, item) } } diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt index 343ba19fd..95d027042 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt @@ -7,7 +7,8 @@ import io.legado.app.base.adapter.ItemViewHolder import io.legado.app.constant.BookType import io.legado.app.data.entities.Book import io.legado.app.databinding.ItemBookshelfListBinding -import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.backgroundColor +import io.legado.app.utils.ColorUtils import io.legado.app.utils.invisible import splitties.views.onLongClick @@ -23,24 +24,24 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) : binding: ItemBookshelfListBinding, item: Book, payloads: MutableList - ) { + ) = with(binding) { val bundle = payloads.getOrNull(0) as? Bundle if (bundle == null) { - ATH.applyBackgroundTint(binding.root) - binding.tvName.text = item.name - binding.tvAuthor.text = item.author - binding.tvRead.text = item.durChapterTitle - binding.tvLast.text = item.latestChapterTitle - binding.ivCover.load(item.getDisplayCover(), item.name, item.author) + root.setBackgroundColor(ColorUtils.withAlpha(context.backgroundColor, 0.5f)) + tvName.text = item.name + tvAuthor.text = item.author + tvRead.text = item.durChapterTitle + tvLast.text = item.latestChapterTitle + ivCover.load(item.getDisplayCover(), item.name, item.author) upRefresh(binding, item) } else { - binding.tvRead.text = item.durChapterTitle - binding.tvLast.text = item.latestChapterTitle + tvRead.text = item.durChapterTitle + tvLast.text = item.latestChapterTitle bundle.keySet().forEach { when (it) { - "name" -> binding.tvName.text = item.name - "author" -> binding.tvAuthor.text = item.author - "cover" -> binding.ivCover.load(item.getDisplayCover(), item.name, item.author) + "name" -> tvName.text = item.name + "author" -> tvAuthor.text = item.author + "cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author) "refresh" -> upRefresh(binding, item) } } diff --git a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt index f4e68d9a2..1972674b1 100644 --- a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt @@ -16,6 +16,7 @@ import io.legado.app.databinding.ItemReplaceRuleBinding import io.legado.app.lib.theme.backgroundColor import io.legado.app.ui.widget.recycler.DragSelectTouchHelper import io.legado.app.ui.widget.recycler.ItemTouchCallback +import io.legado.app.utils.ColorUtils import java.util.* @@ -110,7 +111,7 @@ class ReplaceRuleAdapter(context: Context, var callBack: CallBack) : with(binding) { val bundle = payloads.getOrNull(0) as? Bundle if (bundle == null) { - root.setBackgroundColor(context.backgroundColor) + root.setBackgroundColor(ColorUtils.withAlpha(context.backgroundColor, 0.5f)) if (item.group.isNullOrEmpty()) { cbName.text = item.name } else { diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt index a0b8bdccf..3cc2db4bb 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt @@ -16,6 +16,7 @@ import io.legado.app.databinding.ItemRssSourceBinding import io.legado.app.lib.theme.backgroundColor import io.legado.app.ui.widget.recycler.DragSelectTouchHelper import io.legado.app.ui.widget.recycler.ItemTouchCallback +import io.legado.app.utils.ColorUtils class RssSourceAdapter(context: Context, val callBack: CallBack) : @@ -68,7 +69,7 @@ class RssSourceAdapter(context: Context, val callBack: CallBack) : with(binding) { val bundle = payloads.getOrNull(0) as? Bundle if (bundle == null) { - root.setBackgroundColor(context.backgroundColor) + root.setBackgroundColor(ColorUtils.withAlpha(context.backgroundColor, 0.5f)) if (item.sourceGroup.isNullOrEmpty()) { cbSource.text = item.sourceName } else { diff --git a/app/src/main/java/io/legado/app/ui/widget/prefs/PreferenceCategory.kt b/app/src/main/java/io/legado/app/ui/widget/prefs/PreferenceCategory.kt index c311e158c..9e168a4a0 100644 --- a/app/src/main/java/io/legado/app/ui/widget/prefs/PreferenceCategory.kt +++ b/app/src/main/java/io/legado/app/ui/widget/prefs/PreferenceCategory.kt @@ -33,9 +33,15 @@ class PreferenceCategory(context: Context, attrs: AttributeSet) : PreferenceCate val da = it.findViewById(R.id.preference_divider_above) val dividerColor = if (AppConfig.isNightTheme) { - ColorUtils.shiftColor(context.backgroundColor, 1.05f) + ColorUtils.withAlpha( + ColorUtils.shiftColor(context.backgroundColor, 1.05f), + 0.5f + ) } else { - ColorUtils.shiftColor(context.backgroundColor, 0.95f) + ColorUtils.withAlpha( + ColorUtils.shiftColor(context.backgroundColor, 0.95f), + 0.5f + ) } if (da is View) { da.setBackgroundColor(dividerColor)