更新界面
This commit is contained in:
1 parent
e9248cab14
commit
7e67246841
3 files changed
+41
-22
No files matched your search
@@ -4,7 +4,6 @@ import android.content.Context
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.core.view.marginEnd
|
|
||||||
import androidx.recyclerview.widget.DiffUtil
|
import androidx.recyclerview.widget.DiffUtil
|
||||||
import io.legato.kazusa.R
|
import io.legato.kazusa.R
|
||||||
import io.legato.kazusa.base.adapter.DiffRecyclerAdapter
|
import io.legato.kazusa.base.adapter.DiffRecyclerAdapter
|
||||||
@@ -12,7 +11,6 @@ import io.legato.kazusa.base.adapter.ItemViewHolder
|
|||||||
import io.legato.kazusa.data.entities.SearchBook
|
import io.legato.kazusa.data.entities.SearchBook
|
||||||
import io.legato.kazusa.databinding.ItemSearchBinding
|
import io.legato.kazusa.databinding.ItemSearchBinding
|
||||||
import io.legato.kazusa.help.config.AppConfig
|
import io.legato.kazusa.help.config.AppConfig
|
||||||
import io.legato.kazusa.utils.dpToPx
|
|
||||||
import io.legato.kazusa.utils.gone
|
import io.legato.kazusa.utils.gone
|
||||||
import io.legato.kazusa.utils.visible
|
import io.legato.kazusa.utils.visible
|
||||||
|
|
||||||
@@ -87,7 +85,7 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
|
|||||||
tvAuthor.text = context.getString(R.string.author_show, searchBook.author)
|
tvAuthor.text = context.getString(R.string.author_show, searchBook.author)
|
||||||
ivInBookshelf.isVisible =
|
ivInBookshelf.isVisible =
|
||||||
callBack.isInBookshelf(searchBook.name, searchBook.author)
|
callBack.isInBookshelf(searchBook.name, searchBook.author)
|
||||||
bvOriginCount.setBadgeCount(searchBook.origins.size)
|
bvOriginCount.text = searchBook.origins.size.toString()
|
||||||
upLasted(binding, searchBook.latestChapterTitle)
|
upLasted(binding, searchBook.latestChapterTitle)
|
||||||
tvIntroduce.text = searchBook.trimIntro(context)
|
tvIntroduce.text = searchBook.trimIntro(context)
|
||||||
upKind(binding, searchBook.getKindList())
|
upKind(binding, searchBook.getKindList())
|
||||||
@@ -105,7 +103,7 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
|
|||||||
binding.run {
|
binding.run {
|
||||||
bundle.keySet().forEach {
|
bundle.keySet().forEach {
|
||||||
when (it) {
|
when (it) {
|
||||||
"origins" -> bvOriginCount.setBadgeCount(searchBook.origins.size)
|
"origins" -> bvOriginCount.text = searchBook.origins.size.toString()
|
||||||
"last" -> upLasted(binding, searchBook.latestChapterTitle)
|
"last" -> upLasted(binding, searchBook.latestChapterTitle)
|
||||||
"intro" -> tvIntroduce.text = searchBook.trimIntro(context)
|
"intro" -> tvIntroduce.text = searchBook.trimIntro(context)
|
||||||
"kind" -> upKind(binding, searchBook.getKindList())
|
"kind" -> upKind(binding, searchBook.getKindList())
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package io.legato.kazusa.ui.book.toc
|
package io.legato.kazusa.ui.book.toc
|
||||||
|
|
||||||
|
//import io.legado.app.lib.theme.accentColor
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.DiffUtil
|
import androidx.recyclerview.widget.DiffUtil
|
||||||
import com.google.android.material.color.MaterialColors
|
|
||||||
import io.legato.kazusa.R
|
import io.legato.kazusa.R
|
||||||
import io.legato.kazusa.base.adapter.DiffRecyclerAdapter
|
import io.legato.kazusa.base.adapter.DiffRecyclerAdapter
|
||||||
import io.legato.kazusa.base.adapter.ItemViewHolder
|
import io.legato.kazusa.base.adapter.ItemViewHolder
|
||||||
@@ -16,9 +16,9 @@ import io.legato.kazusa.help.book.ContentProcessor
|
|||||||
import io.legato.kazusa.help.config.AppConfig
|
import io.legato.kazusa.help.config.AppConfig
|
||||||
import io.legato.kazusa.help.coroutine.Coroutine
|
import io.legato.kazusa.help.coroutine.Coroutine
|
||||||
import io.legato.kazusa.lib.theme.ThemeUtils
|
import io.legato.kazusa.lib.theme.ThemeUtils
|
||||||
//import io.legado.app.lib.theme.accentColor
|
|
||||||
import io.legato.kazusa.utils.gone
|
import io.legato.kazusa.utils.gone
|
||||||
import io.legato.kazusa.utils.longToastOnUi
|
import io.legato.kazusa.utils.longToastOnUi
|
||||||
|
import io.legato.kazusa.utils.themeColor
|
||||||
import io.legato.kazusa.utils.visible
|
import io.legato.kazusa.utils.visible
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.ensureActive
|
import kotlinx.coroutines.ensureActive
|
||||||
@@ -129,16 +129,16 @@ class ChapterListAdapter(context: Context, val callback: Callback) :
|
|||||||
|| cacheFileNames.contains(item.getFileName())
|
|| cacheFileNames.contains(item.getFileName())
|
||||||
if (payloads.isEmpty()) {
|
if (payloads.isEmpty()) {
|
||||||
if (isDur) {
|
if (isDur) {
|
||||||
tvChapterName.setTextColor(MaterialColors.getColor(tvChapterName, com.google.android.material.R.attr.colorSecondary))
|
tvChapterName.setTextColor(context.themeColor(androidx.appcompat.R.attr.colorPrimary))
|
||||||
|
tvChapterItem.setBackgroundColor(context.themeColor(com.google.android.material.R.attr.colorSurfaceContainer))
|
||||||
} else {
|
} else {
|
||||||
tvChapterName.setTextColor(MaterialColors.getColor(tvChapterName, com.google.android.material.R.attr.colorOnSurface))
|
tvChapterName.setTextColor(context.themeColor(com.google.android.material.R.attr.colorOnSurface))
|
||||||
}
|
}
|
||||||
tvChapterName.text = getDisplayTitle(item)
|
tvChapterName.text = getDisplayTitle(item)
|
||||||
if (item.isVolume) {
|
if (item.isVolume) {
|
||||||
tvChapterItem.setBackgroundColor(MaterialColors.getColor(tvChapterItem, com.google.android.material.R.attr.colorSurfaceVariant))
|
tvChapterItem.setBackgroundColor(context.themeColor(com.google.android.material.R.attr.colorSecondaryContainer))
|
||||||
} else {
|
} else {
|
||||||
//普通章节 保持不变
|
tvChapterItem.foreground =
|
||||||
tvChapterItem.background =
|
|
||||||
ThemeUtils.resolveDrawable(context, android.R.attr.selectableItemBackground)
|
ThemeUtils.resolveDrawable(context, android.R.attr.selectableItemBackground)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
tools:ignore="SmallSp" />
|
tools:ignore="SmallSp" />
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
@@ -66,29 +67,49 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<!-- 标题行 -->
|
<!-- 标题行 -->
|
||||||
<RelativeLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<!-- 书名 -->
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_name"
|
android:id="@+id/tv_name"
|
||||||
android:layout_width="match_parent"
|
style="@style/ChapterNameText"
|
||||||
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_toStartOf="@id/bv_originCount"
|
android:layout_marginEnd="4dp"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="@string/app_name"
|
android:text="@string/app_name"
|
||||||
style="@style/ChapterNameText" />
|
app:layout_constraintEnd_toStartOf="@id/cd_count"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<!-- 来源计数 -->
|
<com.google.android.material.card.MaterialCardView
|
||||||
<io.legato.kazusa.ui.widget.text.BadgeView
|
android:id="@+id/cd_count"
|
||||||
android:id="@+id/bv_originCount"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_marginVertical="4dp"
|
||||||
android:layout_centerVertical="true"/>
|
app:cardBackgroundColor="?attr/colorSurfaceContainer"
|
||||||
|
app:cardCornerRadius="4dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/tv_name"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/tv_name"
|
||||||
|
app:strokeWidth="0dp">
|
||||||
|
|
||||||
</RelativeLayout>
|
<TextView
|
||||||
|
android:id="@+id/bv_originCount"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingHorizontal="4dp"
|
||||||
|
android:paddingVertical="2dp"
|
||||||
|
android:text="@string/text"
|
||||||
|
android:textColor="?attr/colorPrimary"
|
||||||
|
android:textSize="10sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:ignore="SmallSp" />
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<!-- 作者 -->
|
<!-- 作者 -->
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
Reference in new issue
Block a user