更新主题

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.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 {

@ -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<Any>
) {
) = 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)
}
}

@ -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<Any>
) {
) = 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)
}
}

@ -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 {

@ -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 {

@ -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)

Loading…
Cancel
Save