更新主题

pull/854/head
gedoor 4 years ago
parent ab0d982997
commit 9cbb06995b
  1. 3
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceAdapter.kt
  2. 15
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt
  3. 27
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterList.kt
  4. 3
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleAdapter.kt
  5. 3
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceAdapter.kt
  6. 10
      app/src/main/java/io/legado/app/ui/widget/prefs/PreferenceCategory.kt

@ -18,6 +18,7 @@ import io.legado.app.databinding.ItemBookSourceBinding
import io.legado.app.lib.theme.backgroundColor import io.legado.app.lib.theme.backgroundColor
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper import io.legado.app.ui.widget.recycler.DragSelectTouchHelper
import io.legado.app.ui.widget.recycler.ItemTouchCallback.Callback 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.invisible
import io.legado.app.utils.visible import io.legado.app.utils.visible
@ -86,7 +87,7 @@ class BookSourceAdapter(context: Context, val callBack: CallBack) :
with(binding) { with(binding) {
val payload = payloads.getOrNull(0) as? Bundle val payload = payloads.getOrNull(0) as? Bundle
if (payload == null) { if (payload == null) {
root.setBackgroundColor(context.backgroundColor) root.setBackgroundColor(ColorUtils.withAlpha(context.backgroundColor, 0.5f))
if (item.bookSourceGroup.isNullOrEmpty()) { if (item.bookSourceGroup.isNullOrEmpty()) {
cbBookSource.text = item.bookSourceName cbBookSource.text = item.bookSourceName
} else { } else {

@ -7,7 +7,8 @@ import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.constant.BookType import io.legado.app.constant.BookType
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.databinding.ItemBookshelfGridBinding 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 io.legado.app.utils.invisible
import splitties.views.onLongClick import splitties.views.onLongClick
@ -23,18 +24,18 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
binding: ItemBookshelfGridBinding, binding: ItemBookshelfGridBinding,
item: Book, item: Book,
payloads: MutableList<Any> payloads: MutableList<Any>
) { ) = with(binding) {
val bundle = payloads.getOrNull(0) as? Bundle val bundle = payloads.getOrNull(0) as? Bundle
if (bundle == null) { if (bundle == null) {
ATH.applyBackgroundTint(binding.root) root.setBackgroundColor(ColorUtils.withAlpha(context.backgroundColor, 0.5f))
binding.tvName.text = item.name tvName.text = item.name
binding.ivCover.load(item.getDisplayCover(), item.name, item.author) ivCover.load(item.getDisplayCover(), item.name, item.author)
upRefresh(binding, item) upRefresh(binding, item)
} else { } else {
bundle.keySet().forEach { bundle.keySet().forEach {
when (it) { when (it) {
"name" -> binding.tvName.text = item.name "name" -> tvName.text = item.name
"cover" -> binding.ivCover.load(item.getDisplayCover(), item.name, item.author) "cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author)
"refresh" -> upRefresh(binding, item) "refresh" -> upRefresh(binding, item)
} }
} }

@ -7,7 +7,8 @@ import io.legado.app.base.adapter.ItemViewHolder
import io.legado.app.constant.BookType import io.legado.app.constant.BookType
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.databinding.ItemBookshelfListBinding 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 io.legado.app.utils.invisible
import splitties.views.onLongClick import splitties.views.onLongClick
@ -23,24 +24,24 @@ class BooksAdapterList(context: Context, private val callBack: CallBack) :
binding: ItemBookshelfListBinding, binding: ItemBookshelfListBinding,
item: Book, item: Book,
payloads: MutableList<Any> payloads: MutableList<Any>
) { ) = with(binding) {
val bundle = payloads.getOrNull(0) as? Bundle val bundle = payloads.getOrNull(0) as? Bundle
if (bundle == null) { if (bundle == null) {
ATH.applyBackgroundTint(binding.root) root.setBackgroundColor(ColorUtils.withAlpha(context.backgroundColor, 0.5f))
binding.tvName.text = item.name tvName.text = item.name
binding.tvAuthor.text = item.author tvAuthor.text = item.author
binding.tvRead.text = item.durChapterTitle tvRead.text = item.durChapterTitle
binding.tvLast.text = item.latestChapterTitle tvLast.text = item.latestChapterTitle
binding.ivCover.load(item.getDisplayCover(), item.name, item.author) ivCover.load(item.getDisplayCover(), item.name, item.author)
upRefresh(binding, item) upRefresh(binding, item)
} else { } else {
binding.tvRead.text = item.durChapterTitle tvRead.text = item.durChapterTitle
binding.tvLast.text = item.latestChapterTitle tvLast.text = item.latestChapterTitle
bundle.keySet().forEach { bundle.keySet().forEach {
when (it) { when (it) {
"name" -> binding.tvName.text = item.name "name" -> tvName.text = item.name
"author" -> binding.tvAuthor.text = item.author "author" -> tvAuthor.text = item.author
"cover" -> binding.ivCover.load(item.getDisplayCover(), item.name, item.author) "cover" -> ivCover.load(item.getDisplayCover(), item.name, item.author)
"refresh" -> upRefresh(binding, item) "refresh" -> upRefresh(binding, item)
} }
} }

@ -16,6 +16,7 @@ import io.legado.app.databinding.ItemReplaceRuleBinding
import io.legado.app.lib.theme.backgroundColor import io.legado.app.lib.theme.backgroundColor
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper import io.legado.app.ui.widget.recycler.DragSelectTouchHelper
import io.legado.app.ui.widget.recycler.ItemTouchCallback import io.legado.app.ui.widget.recycler.ItemTouchCallback
import io.legado.app.utils.ColorUtils
import java.util.* import java.util.*
@ -110,7 +111,7 @@ class ReplaceRuleAdapter(context: Context, var callBack: CallBack) :
with(binding) { with(binding) {
val bundle = payloads.getOrNull(0) as? Bundle val bundle = payloads.getOrNull(0) as? Bundle
if (bundle == null) { if (bundle == null) {
root.setBackgroundColor(context.backgroundColor) root.setBackgroundColor(ColorUtils.withAlpha(context.backgroundColor, 0.5f))
if (item.group.isNullOrEmpty()) { if (item.group.isNullOrEmpty()) {
cbName.text = item.name cbName.text = item.name
} else { } else {

@ -16,6 +16,7 @@ import io.legado.app.databinding.ItemRssSourceBinding
import io.legado.app.lib.theme.backgroundColor import io.legado.app.lib.theme.backgroundColor
import io.legado.app.ui.widget.recycler.DragSelectTouchHelper import io.legado.app.ui.widget.recycler.DragSelectTouchHelper
import io.legado.app.ui.widget.recycler.ItemTouchCallback import io.legado.app.ui.widget.recycler.ItemTouchCallback
import io.legado.app.utils.ColorUtils
class RssSourceAdapter(context: Context, val callBack: CallBack) : class RssSourceAdapter(context: Context, val callBack: CallBack) :
@ -68,7 +69,7 @@ class RssSourceAdapter(context: Context, val callBack: CallBack) :
with(binding) { with(binding) {
val bundle = payloads.getOrNull(0) as? Bundle val bundle = payloads.getOrNull(0) as? Bundle
if (bundle == null) { if (bundle == null) {
root.setBackgroundColor(context.backgroundColor) root.setBackgroundColor(ColorUtils.withAlpha(context.backgroundColor, 0.5f))
if (item.sourceGroup.isNullOrEmpty()) { if (item.sourceGroup.isNullOrEmpty()) {
cbSource.text = item.sourceName cbSource.text = item.sourceName
} else { } else {

@ -33,9 +33,15 @@ class PreferenceCategory(context: Context, attrs: AttributeSet) : PreferenceCate
val da = it.findViewById(R.id.preference_divider_above) val da = it.findViewById(R.id.preference_divider_above)
val dividerColor = if (AppConfig.isNightTheme) { val dividerColor = if (AppConfig.isNightTheme) {
ColorUtils.shiftColor(context.backgroundColor, 1.05f) ColorUtils.withAlpha(
ColorUtils.shiftColor(context.backgroundColor, 1.05f),
0.5f
)
} else { } else {
ColorUtils.shiftColor(context.backgroundColor, 0.95f) ColorUtils.withAlpha(
ColorUtils.shiftColor(context.backgroundColor, 0.95f),
0.5f
)
} }
if (da is View) { if (da is View) {
da.setBackgroundColor(dividerColor) da.setBackgroundColor(dividerColor)

Loading…
Cancel
Save