更新界面

This commit is contained in:
HapeLee
2025-07-01 23:42:07 +08:00
parent cd4caed170
commit 3908ff7cf2
76 changed files with 1586 additions and 1393 deletions
+4 -2
View File
@@ -49,7 +49,7 @@ android {
defaultConfig {
applicationId "io.legato.kazusa"
minSdk 24
minSdk 26
targetSdk 35
versionCode 10000 + gitCommits
versionName version
@@ -81,7 +81,7 @@ android {
signingConfig signingConfigs.myConfig
}
//applicationIdSuffix '.release'
manifestPlaceholders.put("app_name", "@string/app_name_a")
manifestPlaceholders.put("app_name", "@string/app_name")
minifyEnabled true
shrinkResources true
@@ -104,6 +104,7 @@ android {
abi {
enable true
reset()
//noinspection ChromeOsAbiSupport
include 'armeabi-v7a', 'arm64-v8a'
universalApk true
}
@@ -306,4 +307,5 @@ dependencies {
//epubLib集成到应用内
implementation libs.androidx.datastore.preferences
implementation libs.androidx.palette
}
+2 -2
View File
@@ -114,7 +114,7 @@
android:name=".ui.main.MainActivity"
android:alwaysRetainTaskState="true"
android:enableOnBackInvokedCallback="true"
android:configChanges="locale|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
android:configChanges="locale|keyboardHidden|smallestScreenSize|screenLayout"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -125,7 +125,7 @@
<!-- 阅读界面 -->
<activity
android:name=".ui.book.read.ReadBookActivity"
android:configChanges="locale|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
android:configChanges="locale|keyboardHidden|smallestScreenSize|screenLayout"
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
@@ -69,6 +69,7 @@ class App : Application() {
override fun onCreate() {
super.onCreate()
DynamicColors.applyToActivitiesIfAvailable(this)
CrashHandler(this)
if (isDebuggable) {
ThreadUtils.setThreadAssertsDisabledForTesting(true)
@@ -14,6 +14,7 @@ import android.view.MotionEvent
import android.view.View
import android.widget.FrameLayout
import androidx.activity.addCallback
import androidx.activity.enableEdgeToEdge
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
@@ -78,7 +79,7 @@ abstract class BaseActivity<VB : ViewBinding>(
window.decorView.disableAutoFill()
AppContextWrapper.applyLocaleAndFont(this)
super.onCreate(savedInstanceState)
enableEdgeToEdge()
//setupSystemBar()
setContentView(binding.root)
upBackgroundImage()
@@ -90,9 +91,9 @@ abstract class BaseActivity<VB : ViewBinding>(
onActivityCreated(savedInstanceState)
}
@RequiresApi(Build.VERSION_CODES.O)
override fun onMultiWindowModeChanged(isInMultiWindowMode: Boolean, newConfig: Configuration) {
super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig)
// findViewById<TitleBar>(R.id.title_bar)
// ?.onMultiWindowModeChanged(isInMultiWindowMode, fullScreen)
//setupSystemBar()
@@ -37,10 +37,10 @@ abstract class BaseFragment(@LayoutRes layoutID: Int) : Fragment(layoutID) {
onMultiWindowModeChanged()
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
onMultiWindowModeChanged()
}
// override fun onConfigurationChanged(newConfig: Configuration) {
// super.onConfigurationChanged(newConfig)
// onMultiWindowModeChanged()
// }
private fun onMultiWindowModeChanged() {
// (activity as? BaseActivity<*>)?.let {
@@ -37,6 +37,8 @@ object PreferKey {
const val enableReview = "enableReview"
const val showRss = "showRss"
const val bookshelfLayout = "bookshelfLayout"
const val bookshelfLayoutPortrait = "bookshelfLayoutPortrait"
const val bookshelfLayoutLandscape = "bookshelf_layout_landscape"
const val bookshelfSort = "bookshelfSort"
const val bookExportFileName = "bookExportFileName"
const val bookImportFileName = "bookImportFileName"
@@ -159,12 +159,19 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
appCtx.putPrefInt(PreferKey.bookGroupStyle, value)
}
var bookshelfLayout: Int
get() = appCtx.getPrefInt(PreferKey.bookshelfLayout, 0)
var bookshelfLayoutPortrait: Int
get() = appCtx.getPrefInt(PreferKey.bookshelfLayoutPortrait, 3)
set(value) {
appCtx.putPrefInt(PreferKey.bookshelfLayout, value)
appCtx.putPrefInt(PreferKey.bookshelfLayoutPortrait, value)
}
var bookshelfLayoutLandscape: Int
get() = appCtx.getPrefInt(PreferKey.bookshelfLayoutLandscape, 5)
set(value) {
appCtx.putPrefInt(PreferKey.bookshelfLayoutLandscape, value)
}
var saveTabPosition: Int
get() = appCtx.getPrefInt(PreferKey.saveTabPosition, 0)
set(value) {
@@ -14,6 +14,7 @@ import io.legato.kazusa.utils.isContentScheme
import io.legato.kazusa.utils.isDataUrl
import io.legato.kazusa.utils.lifecycle
import java.io.File
import androidx.core.net.toUri
//https://bumptech.github.io/glide/doc/generatedapi.html
//Instead of GlideApp, use com.bumptech.Glide
@@ -28,7 +29,7 @@ object ImageLoader {
path.isNullOrEmpty() -> Glide.with(context).load(path)
path.isDataUrl() -> Glide.with(context).load(path)
path.isAbsUrl() -> Glide.with(context).load(path)
path.isContentScheme() -> Glide.with(context).load(Uri.parse(path))
path.isContentScheme() -> Glide.with(context).load(path.toUri())
else -> kotlin.runCatching {
Glide.with(context).load(File(path))
}.getOrElse {
@@ -12,6 +12,7 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import io.legato.kazusa.R
import io.legato.kazusa.constant.AppLog
import io.legato.kazusa.exception.NoStackTraceException
@@ -195,7 +196,7 @@ class PermissionActivity : AppCompatActivity() {
finish()
return
}
rationaleDialog = AlertDialog.Builder(this)
rationaleDialog = MaterialAlertDialogBuilder(this)
.setTitle(R.string.dialog_title)
.setMessage(rationale)
.setPositiveButton(R.string.dialog_setting) { _, _ ->
@@ -22,18 +22,6 @@ private constructor(private val mContext: Context) : ThemeStoreInterface {
private val mEditor = prefs(mContext).edit()
// override fun enableDynamicColors(context: Context, enable: Boolean): ThemeStore {
// mEditor.putBoolean(ThemeStorePrefKeys.KEY_DYNAMIC_COLORS_ENABLED, enable)
// if (enable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// // 使用系统动态颜色
// val dynamicColors = DynamicColorsOptions.Builder()
// .setThemeOverlay(R.style.Theme_App_Dynamic)
// .build()
// DynamicColors.applyToActivitiesIfAvailable(context.applicationContext, dynamicColors)
// }
// return this
// }
override fun primaryColor(@ColorInt color: Int): ThemeStore {
mEditor.putInt(ThemeStorePrefKeys.KEY_PRIMARY_COLOR, color)
if (autoGeneratePrimaryDark(mContext))
@@ -18,22 +18,6 @@ class ThemeBottomNavigationVIew(context: Context, attrs: AttributeSet) :
BottomNavigationView(context, attrs) {
init {
// val bgColor = context.bottomBackground
// setBackgroundColor(bgColor)
// val textIsDark = ColorUtils.isColorLight(bgColor)
// val textColor = context.getSecondaryTextColor(textIsDark)
//
// val colorStateList = Selector.colorBuild()
// .setDefaultColor(textColor)
// .setSelectedColor(ThemeStore.accentColor(context)).create()
// itemIconTintList = colorStateList
// itemTextColor = colorStateList
if (AppConfig.isEInkMode) {
isItemHorizontalTranslationEnabled = false
itemBackground = Color.TRANSPARENT.toDrawable()
}
ViewCompat.setOnApplyWindowInsetsListener(this, null)
}
@@ -78,6 +78,7 @@ object BookCover {
}.getOrDefault(appCtx.resources.getDrawable(R.drawable.image_cover_default, null))
}
/**
* 加载封面
*/
@@ -127,6 +128,8 @@ object BookCover {
.centerCrop()
}
/**
* 加载漫画图片
*/
@@ -63,7 +63,7 @@ class OpenUrlConfirmDialog() : BaseDialogFragment(R.layout.dialog_open_url_confi
private fun initMenu() {
binding.toolBar.setOnMenuItemClickListener(this)
binding.toolBar.inflateMenu(R.menu.open_url_confirm)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
}
private fun initView() {
@@ -79,7 +79,7 @@ class VerificationCodeDialog() : BaseDialogFragment(R.layout.dialog_verification
private fun initMenu() {
binding.toolBar.setOnMenuItemClickListener(this)
binding.toolBar.inflateMenu(R.menu.verification_code)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
}
@SuppressLint("CheckResult")
@@ -40,14 +40,14 @@ class BookmarkDialog() : BaseBottomSheetDialogFragment(R.layout.dialog_bookmark)
return
}
//@Suppress("DEPRECATION")
@Suppress("DEPRECATION")
val bookmark = arguments.getParcelable<Bookmark>("bookmark")
bookmark ?: let {
dismiss()
return
}
val editPos = arguments.getInt("editPos", -1)
binding.btnDelete.visible(editPos >= 0) // 替换 tvFooterLeft
binding.btnDelete.visible(editPos >= 0)
binding.run {
tvChapterName.text = bookmark.chapterName
@@ -59,7 +59,7 @@ class ChangeCoverDialog() : BaseDialogFragment(R.layout.dialog_change_cover),
private fun initMenu() {
binding.toolBar.inflateMenu(R.menu.change_cover)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener(this)
}
@@ -94,7 +94,7 @@ class ChangeCoverDialog() : BaseDialogFragment(R.layout.dialog_change_cover),
item.setTitle(R.string.refresh)
}
}
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
}
}
@@ -140,7 +140,7 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c
private fun initMenu() {
binding.toolBar.inflateMenu(R.menu.change_source)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener(this)
binding.toolBar.menu.findItem(R.id.menu_check_author)
?.isChecked = AppConfig.changeSourceCheckAuthor
@@ -86,7 +86,7 @@ class GroupManageDialog : BaseBottomSheetDialogFragment(R.layout.dialog_recycler
private fun initMenu() {
binding.toolBar.setOnMenuItemClickListener(this)
binding.toolBar.inflateMenu(R.menu.book_group_manage)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
}
override fun onMenuItemClick(item: MenuItem?): Boolean {
@@ -66,7 +66,7 @@ class GroupSelectDialog() : BaseBottomSheetDialogFragment(R.layout.dialog_book_g
private fun initView() {
binding.toolBar.title = getString(R.string.group_select)
binding.toolBar.inflateMenu(R.menu.book_group_manage)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener(this)
binding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
binding.recyclerView.addItemDecoration(VerticalDivider(requireContext()))
@@ -46,7 +46,7 @@ class ServerConfigDialog() : BaseDialogFragment(R.layout.dialog_webdav_server, t
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
//inding.toolBar.setBackgroundColor(primaryColor)
binding.toolBar.inflateMenu(R.menu.server_config)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener(this)
viewModel.init(arguments?.getLong("id")) {
upConfigView(viewModel.mServer)
@@ -2,19 +2,28 @@ package io.legato.kazusa.ui.book.info
import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.Color
import android.graphics.RenderEffect
import android.graphics.Shader
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.CheckBox
import android.widget.LinearLayout
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.core.content.ContextCompat
import androidx.lifecycle.lifecycleScope
import androidx.palette.graphics.Palette
import com.google.android.material.button.MaterialButton
import com.google.android.material.color.utilities.Hct
import com.google.android.material.color.utilities.SchemeTonalSpot
import io.legato.kazusa.R
import io.legato.kazusa.base.VMBaseActivity
import io.legato.kazusa.constant.BookType
@@ -75,6 +84,7 @@ import io.legato.kazusa.utils.startActivity
import io.legato.kazusa.utils.toastOnUi
import io.legato.kazusa.utils.viewbindingdelegate.viewBinding
import io.legato.kazusa.utils.visible
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@@ -161,12 +171,10 @@ class BookInfoActivity :
// binding.llInfo.setBackgroundColor(backgroundColor)
// binding.flAction.setBackgroundColor(bottomBackground)
//binding.flAction.applyNavigationBarPadding()
binding.btnShelf?.text = getString(R.string.remove_from_bookshelf)
binding.btnShelf.text = getString(R.string.remove_from_bookshelf)
binding.tvToc.text = getString(R.string.toc_s, getString(R.string.loading))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
binding.tvDetail?.let { it.revealOnFocusHint = false }
}
binding.tvDetail.revealOnFocusHint = false
viewModel.bookData.observe(this) { showBook(it) }
viewModel.chapterListData.observe(this) { upLoading(false, it) }
@@ -340,8 +348,8 @@ class BookInfoActivity :
tvAuthor.text = getString(R.string.author_show, book.getRealAuthor())
tvOrigin.text = getString(R.string.origin_show, book.originName)
tvLasted.text = getString(R.string.lasted_show, book.latestChapterTitle)
tvDetail?.let { it.text = book.getDisplayIntro() }
llToc?.visible(!book.isWebFile)
tvDetail.let { it.text = book.getDisplayIntro() }
llToc.visible(!book.isWebFile)
upTvBookshelf()
upKinds(book)
upGroup(book.group)
@@ -412,10 +420,10 @@ class BookInfoActivity :
}
private fun upTvBookshelf() {
binding.btnShelf?.apply {
binding.btnShelf.apply {
if (viewModel.inBookshelf) {
text = getString(R.string.remove_from_bookshelf)
icon = ContextCompat.getDrawable(context, R.drawable.ic_clear_all)
icon = ContextCompat.getDrawable(context, R.drawable.ic_star_fill)
} else {
text = getString(R.string.add_to_bookshelf)
icon = ContextCompat.getDrawable(context, R.drawable.ic_star)
@@ -427,13 +435,15 @@ class BookInfoActivity :
private fun upGroup(groupId: Long) {
viewModel.loadGroup(groupId) {
if (it.isNullOrEmpty()) {
binding.tvGroup.text = if (book?.isLocal == true) {
getString(R.string.group_s, getString(R.string.local_no_group))
binding.tvChangeGroup.text = if (book?.isLocal == true) {
getString(R.string.local_no_group)
} else {
getString(R.string.group_s, getString(R.string.no_group))
getString(R.string.no_group)
}
binding.tvChangeGroup.setIconResource(R.drawable.ic_groups)
} else {
binding.tvGroup.text = getString(R.string.group_s, it)
binding.tvChangeGroup.text = getString(R.string.group_s, it)
binding.tvChangeGroup.setIconResource(R.drawable.ic_groups_fill)
}
}
}
@@ -452,7 +462,7 @@ class BookInfoActivity :
}
true
}
btnRead?.setOnClickListener {
btnRead.setOnClickListener {
viewModel.getBook()?.let { book ->
if (book.isWebFile) {
showWebFileDownloadAlert {
@@ -463,7 +473,7 @@ class BookInfoActivity :
}
}
}
btnShelf?.setOnClickListener {
btnShelf.setOnClickListener {
viewModel.getBook()?.let { book ->
if (viewModel.inBookshelf) {
deleteBook()
@@ -490,7 +500,7 @@ class BookInfoActivity :
}
}
}
btnChangeSource?.setOnClickListener {
btnChangeSource.setOnClickListener {
viewModel.getBook()?.let { book ->
showDialogFragment(ChangeBookSourceDialog(book.name, book.author))
}
@@ -533,7 +543,7 @@ class BookInfoActivity :
}
}
}
refreshLayout?.setOnRefreshListener {
refreshLayout.setOnRefreshListener {
refreshLayout.isRefreshing = false
refreshBook()
}
@@ -784,4 +794,16 @@ class BookInfoActivity :
}
}
// 扩展函数:从Drawable中提取主色调
suspend fun Drawable.extractDominantColor(): Int = withContext(Dispatchers.Default) {
// 将Drawable转换为Bitmap
val bitmap = (this@extractDominantColor as? BitmapDrawable)?.bitmap ?: return@withContext Color.TRANSPARENT
// 生成Palette
val palette = Palette.from(bitmap).generate()
// 返回主色调,若未找到则使用默认值
palette.getDominantColor(Color.WHITE)
}
}
@@ -101,7 +101,7 @@ class SourcePickerDialog : BaseDialogFragment(R.layout.dialog_source_picker),
private fun initMenu() {
toolBar.setOnMenuItemClickListener(this)
toolBar.inflateMenu(R.menu.source_picker)
toolBar.menu.applyTint(requireContext())
//toolBar.menu.applyTint(requireContext())
}
override fun onMenuItemClick(item: MenuItem?): Boolean {
@@ -121,9 +121,9 @@ class ReadMangaActivity : VMBaseActivity<ActivityMangaBinding, ReadMangaViewMode
private val loadMoreView by lazy {
LoadMoreView(this).apply {
setBackgroundColor(getCompatColor(R.color.book_ant_10))
setLoadingColor(R.color.white)
setLoadingTextColor(R.color.white)
// setBackgroundColor(getCompatColor(R.color.book_ant_10))
// setLoadingColor(R.color.white)
// setLoadingTextColor(R.color.white)
}
}
@@ -78,7 +78,7 @@ class ContentEditDialog : BaseDialogFragment(R.layout.dialog_content_edit) {
private fun initMenu() {
binding.toolBar.inflateMenu(R.menu.content_edit)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener {
when (it.itemId) {
R.id.menu_save -> {
@@ -34,6 +34,7 @@ import io.legato.kazusa.data.entities.Book
import io.legato.kazusa.data.entities.BookChapter
import io.legato.kazusa.data.entities.BookProgress
import io.legato.kazusa.data.entities.BookSource
import io.legato.kazusa.data.entities.ReplaceRule
import io.legato.kazusa.exception.NoStackTraceException
import io.legato.kazusa.help.AppWebDav
import io.legato.kazusa.help.IntentData
@@ -508,6 +509,7 @@ class ReadBookActivity : BaseReadBookActivity(),
}
}
R.id.menu_setting_replace -> openReplaceRule()
R.id.menu_download -> showDownloadDialog()
R.id.menu_add_bookmark -> addBookmark()
R.id.menu_simulated_reading -> showSimulatedReading()
@@ -1203,19 +1205,23 @@ class ReadBookActivity : BaseReadBookActivity(),
/**
* 显示阅读样式配置
*/
override fun showReadStyle() {
// override fun showReadStyle() {
// showDialogFragment<ReadStyleDialog>()
// }
//
// /**
// * 显示更多设置
// */
// override fun showMoreSetting() {
// showDialogFragment<MoreConfigDialog>()
// }
//
override fun showSearchSetting() {
showDialogFragment<ReadStyleDialog>()
}
/**
* 显示更多设置
*/
override fun showMoreSetting() {
showDialogFragment<MoreConfigDialog>()
}
override fun showSearchSetting() {
showDialogFragment<MoreConfigDialog>()
override fun showReadStyle() {
showDialogFragment<ReadStyleDialog>()
}
/**
@@ -31,6 +31,7 @@ import io.legato.kazusa.lib.dialogs.alert
//import io.legado.app.lib.theme.primaryColor
//import io.legado.app.lib.theme.primaryTextColor
import io.legato.kazusa.model.ReadBook
import io.legato.kazusa.ui.book.read.config.MoreConfigDialog
import io.legato.kazusa.ui.browser.WebViewActivity
import io.legato.kazusa.ui.widget.seekbar.SeekBarChangeListener
import io.legato.kazusa.utils.ConstraintModify
@@ -44,6 +45,7 @@ import io.legato.kazusa.utils.loadAnimation
import io.legato.kazusa.utils.modifyBegin
import io.legato.kazusa.utils.openUrl
import io.legato.kazusa.utils.putPrefBoolean
import io.legato.kazusa.utils.showDialogFragment
import io.legato.kazusa.utils.startActivity
import io.legato.kazusa.utils.visible
import splitties.views.onClick
@@ -159,11 +161,11 @@ class ReadMenu @JvmOverloads constructor(
}
private fun initView(reset: Boolean = false) = binding.run {
if (AppConfig.isNightTheme) {
fabNightTheme.setImageResource(R.drawable.ic_daytime)
} else {
fabNightTheme.setImageResource(R.drawable.ic_brightness)
}
// if (AppConfig.isNightTheme) {
// fabNightTheme.setIconResource(R.drawable.ic_daytime)
// } else {
// fabNightTheme.setIconResource(R.drawable.ic_brightness)
// }
initAnimation()
if (immersiveMenu) {
// val lightTextColor = ColorUtils.withAlpha(ColorUtils.lightenColor(textColor), 0.75f)
@@ -223,7 +225,7 @@ class ReadMenu @JvmOverloads constructor(
/**
* 确保视图不被导航栏遮挡
*/
applyNavigationBarPadding()
binding.bottomView.applyNavigationBarPadding()
}
fun reset() {
@@ -361,8 +363,6 @@ class ReadMenu @JvmOverloads constructor(
}
tvChapterName.setOnClickListener(chapterViewClickListener)
tvChapterName.setOnLongClickListener(chapterViewLongClickListener)
tvChapterUrl.setOnClickListener(chapterViewClickListener)
tvChapterUrl.setOnLongClickListener(chapterViewLongClickListener)
//书源操作
tvSourceAction.onClick {
sourceMenu.menu.findItem(R.id.menu_login).isVisible =
@@ -446,13 +446,13 @@ class ReadMenu @JvmOverloads constructor(
}
//替换
fabReplaceRule.setOnClickListener { callBack.openReplaceRule() }
//fabReplaceRule.setOnClickListener { callBack.openReplaceRule() }
//夜间模式
fabNightTheme.setOnClickListener {
AppConfig.isNightTheme = !AppConfig.isNightTheme
ThemeConfig.applyDayNight(context)
}
// fabNightTheme.setOnClickListener {
// AppConfig.isNightTheme = !AppConfig.isNightTheme
// ThemeConfig.applyDayNight(context)
// }
//上一章
tvPre.setOnClickListener { ReadBook.moveToPrevChapter(upContent = true, toLast = false) }
@@ -461,37 +461,31 @@ class ReadMenu @JvmOverloads constructor(
tvNext.setOnClickListener { ReadBook.moveToNextChapter(true) }
//目录
llCatalog.setOnClickListener {
ivCatalog.setOnClickListener {
runMenuOut {
callBack.openChapterList()
}
}
//朗读
llReadAloud.setOnClickListener {
ivReadAloud.setOnClickListener {
runMenuOut {
callBack.onClickReadAloud()
}
}
llReadAloud.onLongClick {
ivReadAloud.onLongClick {
runMenuOut {
callBack.showReadAloudDialog()
}
}
//界面
llFont.setOnClickListener {
//设置
ivSetting.setOnClickListener {
runMenuOut {
callBack.showReadStyle()
}
}
//设置
llSetting.setOnClickListener {
runMenuOut {
callBack.showMoreSetting()
}
}
}
private fun initAnimation() {
@@ -500,13 +494,13 @@ class ReadMenu @JvmOverloads constructor(
}
fun upBookView() {
binding.titleBar.title = ReadBook.book?.name
binding.titleBar.title = " "
binding.tvBookName.text = ReadBook.book?.name
ReadBook.curTextChapter?.let {
binding.tvChapterName.text = it.title
binding.tvChapterName.visible()
if (!ReadBook.isLocalBook) {
binding.tvChapterUrl.text = it.chapter.getAbsoluteURL()
binding.tvChapterUrl.visible()
//binding.tvChapterUrl.visible()
} else {
binding.tvChapterUrl.gone()
}
@@ -514,7 +508,6 @@ class ReadMenu @JvmOverloads constructor(
binding.tvPre.isEnabled = ReadBook.durChapterIndex != 0
binding.tvNext.isEnabled = ReadBook.durChapterIndex != ReadBook.simulatedChapterSize - 1
} ?: let {
binding.tvChapterName.gone()
binding.tvChapterUrl.gone()
}
}
@@ -526,20 +519,16 @@ class ReadMenu @JvmOverloads constructor(
when (AppConfig.progressBarBehavior) {
"page" -> {
ReadBook.curTextChapter?.let { chapter ->
if (chapter.pageSize > 0 && ReadBook.durPageIndex > 0) {
if (chapter.pageSize >= 0 && ReadBook.durPageIndex >= 0) {
valueFrom = 1f
valueTo = chapter.pageSize.toFloat().coerceAtLeast(2f)
value = (ReadBook.durPageIndex).coerceIn(1, chapter.pageSize).toFloat()
stepSize = 1f
value = (ReadBook.durPageIndex).coerceIn(1, chapter.pageSize).toFloat()
} else {
valueFrom = 1f
valueTo = 2f
value = 1f
value = 0f
valueFrom = 0f
valueTo = 1000f
}
}?: run {
valueFrom = 1f
valueTo = 2f
value = 1f
}
}
@@ -548,12 +537,12 @@ class ReadMenu @JvmOverloads constructor(
{
valueFrom = 1f
valueTo = ReadBook.simulatedChapterSize.toFloat().coerceAtLeast(2f)
value = (ReadBook.durChapterIndex).coerceIn(1, ReadBook.simulatedChapterSize).toFloat()
stepSize = 1f
value = (ReadBook.durChapterIndex).coerceIn(1, ReadBook.simulatedChapterSize).toFloat()
} else {
valueFrom = 1f
valueTo = 2f
value = 1f
valueFrom = 0f
value = 0f
valueTo = 1000f
}
}
}
@@ -579,15 +568,15 @@ class ReadMenu @JvmOverloads constructor(
// }
fun setSeekPage(seek: Int) {
binding.seekReadPage.value = 1f
binding.seekReadPage.value = seek.toFloat() + 1
}
fun setAutoPage(autoPage: Boolean) = binding.run {
if (autoPage) {
fabAutoPage.setImageResource(R.drawable.ic_auto_page_stop)
fabAutoPage.setIconResource(R.drawable.ic_auto_page_stop)
fabAutoPage.contentDescription = context.getString(R.string.auto_next_page_stop)
} else {
fabAutoPage.setImageResource(R.drawable.ic_auto_page)
fabAutoPage.setIconResource(R.drawable.ic_auto_page)
fabAutoPage.contentDescription = context.getString(R.string.auto_next_page)
}
//fabAutoPage.setColorFilter(textColor)
@@ -615,7 +604,6 @@ class ReadMenu @JvmOverloads constructor(
fun openSourceEditActivity()
fun openBookInfoActivity()
fun showReadStyle()
fun showMoreSetting()
fun showReadAloudDialog()
fun upSystemUiVisibility()
fun onClickReadAloud()
@@ -71,7 +71,7 @@ class HttpTtsEditDialog() : BaseBottomSheetDialogFragment(R.layout.dialog_http_t
fun initMenu() {
binding.toolBar.inflateMenu(R.menu.speak_engine_edit)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener(this)
}
@@ -10,6 +10,7 @@ import android.view.ViewConfiguration
import android.view.ViewGroup
import android.widget.LinearLayout
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import io.legato.kazusa.R
import io.legato.kazusa.base.BasePrefDialogFragment
import io.legato.kazusa.constant.EventBus
@@ -31,20 +32,6 @@ import io.legato.kazusa.utils.removePref
class MoreConfigDialog : BasePrefDialogFragment() {
private val readPreferTag = "readPreferenceFragment"
override fun onStart() {
super.onStart()
// dialog?.window?.run {
// clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
// setBackgroundDrawableResource(R.color.background)
// decorView.setPadding(0, 0, 0, 0)
// val attr = attributes
// attr.dimAmount = 0.0f
// attr.gravity = Gravity.BOTTOM
// attributes = attr
// setLayout(ViewGroup.LayoutParams.MATCH_PARENT, 360.dpToPx())
// }
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@@ -67,12 +54,7 @@ class MoreConfigDialog : BasePrefDialogFragment() {
.commit()
}
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
(activity as ReadBookActivity).bottomDialog--
}
class ReadPreferenceFragment : PreferenceFragment(),
class ReadPreferenceFragment : PreferenceFragmentCompat(),
SharedPreferences.OnSharedPreferenceChangeListener {
private val slopSquare by lazy { ViewConfiguration.get(requireContext()).scaledTouchSlop }
@@ -198,6 +180,5 @@ class MoreConfigDialog : BasePrefDialogFragment() {
getString(R.string.page_touch_slop_summary, value)
}
}
}
}
@@ -29,6 +29,7 @@ import splitties.views.onLongClick
import androidx.core.graphics.drawable.toDrawable
import androidx.transition.TransitionManager
import com.google.android.material.bottomsheet.BottomSheetBehavior
import io.legato.kazusa.help.config.ThemeConfig
class ReadStyleDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_book_style),
FontSelectDialog.CallBack {
@@ -39,21 +40,6 @@ class ReadStyleDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_book_
private lateinit var allSliders: List<DetailSeekBar>
override fun onStart() {
super.onStart()
// dialog?.window?.run {
// clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
// setBackgroundDrawableResource(R.color.background)
// decorView.setPadding(0, 0, 0, 0)
// val attr = attributes
// attr.dimAmount = 0.0f
// attr.gravity = Gravity.BOTTOM
// attributes = attr
// setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
// }
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
(activity as ReadBookActivity).bottomDialog++
initView()
@@ -75,6 +61,11 @@ class ReadStyleDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_book_
// tvPageAnim.setTextColor(textColor)
// tvBgTs.setTextColor(textColor)
// tvShareLayout.setTextColor(textColor)
if (AppConfig.isNightTheme) {
tvDayNight.setIconResource(R.drawable.ic_daytime)
} else {
tvDayNight.setIconResource(R.drawable.ic_brightness)
}
dsbTextSize.valueFormat = {
(it + 5).toString()
}
@@ -133,6 +124,13 @@ class ReadStyleDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_book_
tvTip.setOnClickListener {
TipConfigDialog().show(childFragmentManager, "tipConfigDialog")
}
tvMore.setOnClickListener {
showDialogFragment<MoreConfigDialog>()
}
tvDayNight.setOnClickListener {
AppConfig.isNightTheme = !AppConfig.isNightTheme
ThemeConfig.applyDayNight(requireContext())
}
// rgPageAnim.setOnCheckedChangeListener { _, checkedId ->
// ReadBook.book?.setPageAnim(-1)
// ReadBookConfig.pageAnim = binding.rgPageAnim.getIndexById(checkedId)
@@ -299,6 +297,5 @@ class ReadStyleDialog : BaseBottomSheetDialogFragment(R.layout.dialog_read_book_
}
}
}
}
}
@@ -161,7 +161,7 @@ class SpeakEngineDialog() : BaseBottomSheetDialogFragment(R.layout.dialog_recycl
private fun initMenu() = binding.run {
toolBar.inflateMenu(R.menu.speak_engine)
toolBar.menu.applyTint(requireContext())
//toolBar.menu.applyTint(requireContext())
toolBar.setOnMenuItemClickListener(this@SpeakEngineDialog)
}
@@ -26,6 +26,7 @@ import io.legato.kazusa.utils.applyStatusBarPadding
import io.legato.kazusa.utils.dpToPx
import io.legato.kazusa.utils.gone
import io.legato.kazusa.utils.setTextIfNotEqual
import io.legato.kazusa.utils.statusBarHeight
import splitties.views.backgroundColor
import java.util.Date
@@ -59,11 +60,9 @@ class PageView(context: Context) : FrameLayout(context) {
}
init {
if (!isInEditMode) {
upStyle()
binding.vwStatusBar.applyStatusBarPadding()
binding.vwNavigationBar.applyNavigationBarPadding()
}
upStyle()
binding.vwStatusBar.applyStatusBarPadding()
binding.vwNavigationBar.applyNavigationBarPadding()
}
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
@@ -118,8 +117,8 @@ class PageView(context: Context) : FrameLayout(context) {
* 显示状态栏时隐藏header
*/
fun upStatusBar() = with(binding.vwStatusBar) {
// setPadding(paddingLeft, context.statusBarHeight, paddingRight, paddingBottom)
isGone = ReadBookConfig.hideStatusBar || readBookActivity?.isInMultiWindow == true
setPadding(paddingLeft, context.statusBarHeight, paddingRight, paddingBottom)
isGone = ReadBookConfig.hideStatusBar
}
fun upNavigationBar() {
@@ -60,7 +60,7 @@ class SearchScopeDialog : BaseDialogFragment(R.layout.dialog_search_scope) {
private fun initMenu() {
binding.toolBar.inflateMenu(R.menu.book_search_scope)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
}
private fun initSearchView() {
@@ -46,7 +46,7 @@ class GroupManageDialog : BaseDialogFragment(R.layout.dialog_recycler_view),
// binding.toolBar.setBackgroundColor(primaryColor)
binding.toolBar.title = getString(R.string.group_manage)
binding.toolBar.inflateMenu(R.menu.group_manage)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener(this)
binding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
binding.recyclerView.addItemDecoration(VerticalDivider(requireContext()))
@@ -90,7 +90,7 @@ class TxtTocRuleDialog() : BaseDialogFragment(R.layout.dialog_toc_regex),
durRegex = arguments?.getString("tocRegex")
binding.toolBar.setTitle(R.string.txt_toc_rule)
binding.toolBar.inflateMenu(R.menu.txt_toc_rule)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener(this)
initView()
initData()
@@ -51,7 +51,7 @@ class TxtTocRuleEditDialog() : BaseBottomSheetDialogFragment(R.layout.dialog_toc
private fun initMenu() {
binding.toolBar.inflateMenu(R.menu.txt_toc_rule_edit)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener(this)
}
@@ -38,7 +38,7 @@ class DictRuleEditDialog() : BaseBottomSheetDialogFragment(R.layout.dialog_dict_
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
//binding.toolBar.setBackgroundColor(primaryColor)
binding.toolBar.inflateMenu(R.menu.dict_rule_edit)
binding.toolBar.menu.applyTint(requireContext())
//binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener(this)
viewModel.initData(arguments?.getString("name")) {
upRuleView(viewModel.dictRule)
@@ -9,6 +9,7 @@ import androidx.documentfile.provider.DocumentFile
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import io.legato.kazusa.R
import io.legato.kazusa.base.BaseBottomSheetDialogFragment
import io.legato.kazusa.base.BaseDialogFragment
import io.legato.kazusa.constant.AppLog
import io.legato.kazusa.constant.PreferKey
@@ -36,11 +37,12 @@ import io.legato.kazusa.utils.toastOnUi
import io.legato.kazusa.utils.viewbindingdelegate.viewBinding
import kotlinx.coroutines.launch
import java.io.File
import androidx.core.net.toUri
/**
* 字体选择对话框
*/
class FontSelectDialog : BaseDialogFragment(R.layout.dialog_font_select),
class FontSelectDialog : BaseBottomSheetDialogFragment(R.layout.dialog_font_select),
Toolbar.OnMenuItemClickListener,
FontAdapter.CallBack {
private val fontRegex = Regex("(?i).*\\.[ot]tf")
@@ -70,11 +72,6 @@ class FontSelectDialog : BaseDialogFragment(R.layout.dialog_font_select),
}
}
override fun onStart() {
super.onStart()
setLayout(0.9f, 0.9f)
}
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
//binding.toolBar.setBackgroundColor(primaryColor)
binding.toolBar.setTitle(R.string.select_font)
@@ -89,7 +86,7 @@ class FontSelectDialog : BaseDialogFragment(R.layout.dialog_font_select),
openFolder()
} else {
if (fontPath.isContentScheme()) {
val doc = DocumentFile.fromTreeUri(requireContext(), Uri.parse(fontPath))
val doc = DocumentFile.fromTreeUri(requireContext(), fontPath.toUri())
if (doc?.canRead() == true) {
loadFontFiles(FileDoc.fromDocumentFile(doc))
} else {
@@ -2,12 +2,14 @@
package io.legato.kazusa.ui.main
import android.content.res.Configuration
import android.os.Bundle
import android.text.format.DateUtils
import android.view.MenuItem
import android.view.MotionEvent
import android.view.ViewGroup
import androidx.activity.addCallback
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.core.view.postDelayed
import androidx.fragment.app.Fragment
@@ -57,7 +59,10 @@ import splitties.views.bottomPadding
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
import androidx.core.view.get
import com.google.android.material.navigation.NavigationBarView
import io.legato.kazusa.ui.welcome.WelcomeActivity
import io.legato.kazusa.utils.applyNavigationBarPadding
import io.legato.kazusa.utils.applyStatusBarPadding
/**
* 主界面
@@ -84,10 +89,12 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
private val adapter by lazy {
TabFragmentPageAdapter(supportFragmentManager)
}
private val onUpBooksBadgeView by lazy {
binding.bottomNavigationView.addBadgeView(0)
private val badge by lazy {
getNavigationBarView().getOrCreateBadge(R.id.menu_bookshelf)
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
upBottomMenu()
initView()
@@ -197,13 +204,18 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
viewPagerMain.adapter = adapter
viewPagerMain.addOnPageChangeListener(PageChangeCallback())
//bottomNavigationView.elevation = elevation
bottomNavigationView.setOnNavigationItemSelectedListener(this@MainActivity)
bottomNavigationView.setOnNavigationItemReselectedListener(this@MainActivity)
bottomNavigationView.setOnApplyWindowInsetsListenerCompat { view, windowInsets ->
val height = windowInsets.navigationBarHeight
view.bottomPadding = height
windowInsets.inset(0, 0, 0, height)
getNavigationBarView().apply {
setOnItemSelectedListener { onNavigationItemSelected(it) }
setOnItemReselectedListener { onNavigationItemReselected(it) }
}
//getNavigationBarView().applyNavigationBarPadding()
// bottomNavigationView.setOnApplyWindowInsetsListenerCompat { view, windowInsets ->
// val height = windowInsets.navigationBarHeight
// view.bottomPadding = height
// windowInsets.inset(0, 0, 0, height)
// }
}
/**
@@ -344,8 +356,10 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
override fun observeLiveBus() {
super.observeLiveBus()
viewModel.onUpBooksLiveData.observe(this) {
onUpBooksBadgeView.setBadgeCount(it)
badge.isVisible = it > 0
badge.number = it
}
observeEvent<Boolean>(EventBus.NOTIFY_MAIN) {
binding.apply {
upBottomMenu()
@@ -359,13 +373,24 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
}
}
private fun getNavigationBarView(): NavigationBarView {
return findViewById(
if (resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT)
R.id.bottom_navigation_view
else
R.id.navigation_rail_view
)
}
private fun upBottomMenu() {
val showDiscovery = AppConfig.showDiscovery
val showRss = AppConfig.showRSS
binding.bottomNavigationView.menu.let { menu ->
menu.findItem(R.id.menu_discovery).isVisible = showDiscovery
menu.findItem(R.id.menu_rss).isVisible = showRss
}
val menu = getNavigationBarView().menu
menu.findItem(R.id.menu_discovery).isVisible = showDiscovery
menu.findItem(R.id.menu_rss).isVisible = showRss
var index = 0
if (showDiscovery) {
index++
@@ -408,8 +433,9 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
override fun onPageSelected(position: Int) {
pagePosition = position
binding.bottomNavigationView.menu[realPositions[position]].isChecked = true
getNavigationBarView().menu[realPositions[position]].isChecked = true
}
}
@@ -1,8 +1,10 @@
package io.legato.kazusa.ui.main.bookshelf
import android.annotation.SuppressLint
import android.content.res.Configuration
import android.view.Menu
import android.view.MenuItem
import androidx.core.view.isVisible
import androidx.fragment.app.activityViewModels
import androidx.fragment.app.viewModels
import androidx.lifecycle.LiveData
@@ -28,6 +30,7 @@ import io.legato.kazusa.ui.file.HandleFileContract
import io.legato.kazusa.ui.main.MainFragmentInterface
import io.legato.kazusa.ui.main.MainViewModel
import io.legato.kazusa.ui.widget.dialog.WaitDialog
import io.legato.kazusa.utils.bookshelfLayout
import io.legato.kazusa.utils.checkByIndex
import io.legato.kazusa.utils.getCheckedIndex
import io.legato.kazusa.utils.isAbsUrl
@@ -164,7 +167,17 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
@SuppressLint("InflateParams")
fun configBookshelf() {
alert(titleResource = R.string.bookshelf_layout) {
val bookshelfLayout = AppConfig.bookshelfLayout
val orientation = requireContext().resources.configuration.orientation
val bookshelfLayout = if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
AppConfig.bookshelfLayoutLandscape
} else {
AppConfig.bookshelfLayoutPortrait
}
val isGrid = bookshelfLayout > 0
val columnCount = (bookshelfLayout.takeIf { it > 0 } ?: 1)
val bookshelfSort = AppConfig.bookshelfSort
val alertBinding =
DialogBookshelfConfigBinding.inflate(layoutInflater)
@@ -174,10 +187,20 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
swShowLastUpdateTime.isChecked = AppConfig.showLastUpdateTime
swShowWaitUpBooks.isChecked = AppConfig.showWaitUpCount
swShowBookshelfFastScroller.isChecked = AppConfig.showBookshelfFastScroller
rgLayout.checkByIndex(bookshelfLayout)
rgSort.checkByIndex(bookshelfSort)
chipList.isChecked = !isGrid
chipGrid.isChecked = isGrid
llGridSlider.isVisible = isGrid
sliderGridCount.value = columnCount.toFloat()
chipGroupLayout.setOnCheckedChangeListener { _, checkedId ->
llGridSlider.isVisible = checkedId == R.id.chip_grid
}
}
customView { alertBinding.root }
okButton {
alertBinding.apply {
var notifyMain = false
@@ -206,15 +229,30 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
AppConfig.bookshelfSort = rgSort.getCheckedIndex()
upSort()
}
if (bookshelfLayout != rgLayout.getCheckedIndex()) {
AppConfig.bookshelfLayout = rgLayout.getCheckedIndex()
if (AppConfig.bookshelfLayout == 0) {
activityViewModel.booksGridRecycledViewPool.clear()
val isNowGrid = alertBinding.chipGrid.isChecked
val selectedColumn = alertBinding.sliderGridCount.value.toInt()
val newLayout = if (isNowGrid) selectedColumn else 0
if (bookshelfLayout != newLayout) {
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
AppConfig.bookshelfLayoutLandscape = newLayout
if (newLayout == 0) {
activityViewModel.booksGridRecycledViewPool.clear()
} else {
activityViewModel.booksListRecycledViewPool.clear()
}
} else {
activityViewModel.booksListRecycledViewPool.clear()
AppConfig.bookshelfLayoutPortrait = newLayout
if (newLayout == 0) {
activityViewModel.booksGridRecycledViewPool.clear()
} else {
activityViewModel.booksListRecycledViewPool.clear()
}
}
recreate = true
}
if (recreate) {
postEvent(EventBus.RECREATE, "")
} else if (notifyMain) {
@@ -1,6 +1,7 @@
package io.legato.kazusa.ui.main.bookshelf.style1.books
import android.annotation.SuppressLint
import android.content.res.Configuration
import android.os.Bundle
import android.view.View
import android.view.ViewConfiguration
@@ -27,6 +28,7 @@ import io.legato.kazusa.help.config.AppConfig
//import io.legado.app.lib.theme.primaryColor
import io.legato.kazusa.ui.book.info.BookInfoActivity
import io.legato.kazusa.ui.main.MainViewModel
import io.legato.kazusa.utils.bookshelfLayout
import io.legato.kazusa.utils.cnCompare
import io.legato.kazusa.utils.flowWithLifecycleAndDatabaseChangeFirst
import io.legato.kazusa.utils.observeEvent
@@ -61,7 +63,10 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
private val binding by viewBinding(FragmentBooksBinding::bind)
private val activityViewModel by activityViewModels<MainViewModel>()
private val bookshelfLayout by lazy { AppConfig.bookshelfLayout }
private val bookshelfLayout by lazy { requireContext().bookshelfLayout }
private val booksAdapter: BaseBooksAdapter<*> by lazy {
if (bookshelfLayout == 0) {
BooksAdapterList(requireContext(), this, this, viewLifecycleOwner.lifecycle)
@@ -102,7 +107,7 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
if (bookshelfLayout == 0) {
binding.rvBookshelf.layoutManager = LinearLayoutManager(context)
} else {
binding.rvBookshelf.layoutManager = GridLayoutManager(context, bookshelfLayout + 2)
binding.rvBookshelf.layoutManager = GridLayoutManager(context, bookshelfLayout)
}
if (bookshelfLayout == 0) {
binding.rvBookshelf.setRecycledViewPool(activityViewModel.booksListRecycledViewPool)
@@ -25,6 +25,7 @@ import io.legato.kazusa.ui.book.group.GroupEditDialog
import io.legato.kazusa.ui.book.info.BookInfoActivity
import io.legato.kazusa.ui.book.search.SearchActivity
import io.legato.kazusa.ui.main.bookshelf.BaseBookshelfFragment
import io.legato.kazusa.utils.bookshelfLayout
import io.legato.kazusa.utils.cnCompare
import io.legato.kazusa.utils.flowWithLifecycleAndDatabaseChangeFirst
import io.legato.kazusa.utils.observeEvent
@@ -56,7 +57,9 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
}
private val binding by viewBinding(FragmentBookshelf2Binding::bind)
private val bookshelfLayout by lazy { AppConfig.bookshelfLayout }
private val bookshelfLayout by lazy { requireContext().bookshelfLayout }
private val booksAdapter: BaseBooksAdapter<*> by lazy {
if (bookshelfLayout == 0) {
BooksAdapterList(requireContext(), this)
@@ -87,7 +90,7 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
if (bookshelfLayout == 0) {
binding.rvBookshelf.layoutManager = LinearLayoutManager(context)
} else {
binding.rvBookshelf.layoutManager = GridLayoutManager(context, bookshelfLayout + 2)
binding.rvBookshelf.layoutManager = GridLayoutManager(context, bookshelfLayout)
}
binding.rvBookshelf.itemAnimator = null
binding.rvBookshelf.adapter = booksAdapter
@@ -8,6 +8,7 @@ import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.core.view.children
import com.google.android.flexbox.FlexboxLayout
import com.google.android.material.card.MaterialCardView
import io.legato.kazusa.R
import io.legato.kazusa.base.adapter.ItemViewHolder
import io.legato.kazusa.base.adapter.RecyclerAdapter
@@ -85,14 +86,17 @@ class ExploreAdapter(context: Context, val callBack: CallBack) :
recyclerFlexbox(flexbox)
flexbox.visible()
kinds.forEach { kind ->
val tv = getFlexboxChild(flexbox)
flexbox.addView(tv)
tv.text = kind.title
kind.style().apply(tv)
val cardView = getFlexboxChild(flexbox)
val textView = cardView.findViewById<TextView>(R.id.text_view)
flexbox.addView(cardView)
textView.text = kind.title
//kind.style().apply(textView)
if (kind.url.isNullOrBlank()) {
tv.setOnClickListener(null)
cardView.setOnClickListener(null)
} else {
tv.setOnClickListener {
cardView.setOnClickListener {
if (kind.title.startsWith("ERROR:")) {
it.activity?.showDialogFragment(TextDialog("ERROR", kind.url))
} else {
@@ -104,12 +108,13 @@ class ExploreAdapter(context: Context, val callBack: CallBack) :
}
}
@Synchronized
private fun getFlexboxChild(flexbox: FlexboxLayout): TextView {
private fun getFlexboxChild(flexbox: FlexboxLayout): MaterialCardView {
return if (recycler.isEmpty()) {
ItemFilletTextBinding.inflate(inflater, flexbox, false).root
} else {
recycler.removeLastElement() as TextView
recycler.removeLastElement() as MaterialCardView
}
}
@@ -47,7 +47,7 @@ class GroupManageDialog : BaseBottomSheetDialogFragment(R.layout.dialog_recycler
//toolBar.setBackgroundColor(primaryColor)
toolBar.title = getString(R.string.group_manage)
toolBar.inflateMenu(R.menu.group_manage)
toolBar.menu.applyTint(requireContext())
//toolBar.menu.applyTint(requireContext())
toolBar.setOnMenuItemClickListener(this@GroupManageDialog)
recyclerView.layoutManager = LinearLayoutManager(requireContext())
recyclerView.addItemDecoration(VerticalDivider(requireContext()))
@@ -167,12 +167,6 @@ class TitleBar @JvmOverloads constructor(
}
}
if (AppConfig.isEInkMode) {
setBackgroundResource(R.drawable.bg_eink_border_bottom)
} else {
//setBackgroundColor(context.primaryColor)
}
stateListAnimator = null
//elevation = context.elevation
}
@@ -6,6 +6,8 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.FrameLayout
import androidx.annotation.ColorRes
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import io.legato.kazusa.R
import io.legato.kazusa.databinding.ViewLoadMoreBinding
import io.legato.kazusa.lib.dialogs.alert
@@ -51,7 +53,7 @@ class LoadMoreView(context: Context, attrs: AttributeSet? = null) : FrameLayout(
fun stopLoad() {
isLoading = false
binding.rotateLoading.inVisible()
binding.rotateLoading.invisible()
}
fun hasMore() {
@@ -81,14 +83,6 @@ class LoadMoreView(context: Context, attrs: AttributeSet? = null) : FrameLayout(
binding.tvText.visible()
}
fun setLoadingColor(@ColorRes color: Int) {
binding.rotateLoading.loadingColor = context.getCompatColor(color)
}
fun setLoadingTextColor(@ColorRes color: Int) {
binding.tvText.setTextColor(context.getCompatColor(color))
}
private fun showErrorDialog(): Boolean {
if (errorMsg.isBlank()) {
return false
@@ -290,7 +290,7 @@ class FastScroller : LinearLayout {
override fun onTouchEvent(event: MotionEvent): Boolean {
when (event.action) {
MotionEvent.ACTION_DOWN -> {
if (event.x < mHandleView.x - ViewCompat.getPaddingStart(mHandleView)) {
if (event.x < mHandleView.x - mHandleView.paddingStart) {
return false
}
if (!mScrollbar.isVisible) {
@@ -418,6 +418,13 @@ val Context.isDebuggable: Boolean
val Context.dataStore by preferencesDataStore(name = "settings")
val Context.bookshelfLayout: Int
get() = if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
AppConfig.bookshelfLayoutLandscape
} else {
AppConfig.bookshelfLayoutPortrait
}
fun Context.themeColor(attr: Int): Int {
val typedValue = TypedValue()
theme.resolveAttribute(attr, typedValue, true)
@@ -24,6 +24,7 @@ object DataStoreUtil {
}
}
@Suppress("UNCHECKED_CAST")
suspend fun <T> read(context: Context, key: String, defaultValue: T): T {
return context.dataStore.data.map { preferences ->
when (defaultValue) {
@@ -26,7 +26,7 @@ import io.legato.kazusa.ui.widget.dialog.TextDialog
inline fun <reified T : DialogFragment> Fragment.showDialogFragment(
arguments: Bundle.() -> Unit = {}
) {
val dialog = T::class.java.newInstance()
val dialog = T::class.java.getDeclaredConstructor().newInstance()
val bundle = Bundle()
bundle.apply(arguments)
dialog.arguments = bundle
@@ -69,9 +69,7 @@ fun EditText.showSoftInput() = run {
}
fun View.disableAutoFill() = run {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
this.importantForAutofill = IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS
}
this.importantForAutofill = IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS
}
fun View.applyTint(
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="150">
android:duration="320"
android:interpolator="@android:interpolator/decelerate_cubic">
<translate
android:fromYDelta="100%"
android:toYDelta="0" />
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200">
android:duration="320"
android:interpolator="@android:interpolator/decelerate_cubic">
<translate
android:fromYDelta="0%"
android:toYDelta="100%" />
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200">
android:duration="320"
android:interpolator="@android:interpolator/decelerate_cubic">
<translate
android:fromYDelta="-100%"
android:toYDelta="0" />
</set>
</set>
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200">
android:duration="320"
android:interpolator="@android:interpolator/decelerate_cubic">
<translate
android:fromYDelta="0"
android:toYDelta="-100%" />
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="960" android:viewportHeight="960" android:tint="?attr/colorControlNormal">
<path android:fillColor="@android:color/white" android:pathData="M856,570L570,856Q558,868 543,874Q528,880 513,880Q498,880 483,874Q468,868 456,856L103,503Q92,492 86,477.5Q80,463 80,447L80,160Q80,127 103.5,103.5Q127,80 160,80L447,80Q463,80 478,86.5Q493,93 504,104L856,457Q868,469 873.5,484Q879,499 879,514Q879,529 873.5,543.5Q868,558 856,570ZM260,320Q285,320 302.5,302.5Q320,285 320,260Q320,235 302.5,217.5Q285,200 260,200Q235,200 217.5,217.5Q200,235 200,260Q200,285 217.5,302.5Q235,320 260,320Z"/>
</vector>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="960" android:viewportHeight="960" android:tint="?attr/colorControlNormal">
<path android:fillColor="@android:color/white" android:pathData="M480,840L422,788Q321,697 255,631Q189,565 150,512.5Q111,460 95.5,416Q80,372 80,326Q80,232 143,169Q206,106 300,106Q352,106 399,128Q446,150 480,190Q514,150 561,128Q608,106 660,106Q754,106 817,169Q880,232 880,326Q880,372 864.5,416Q849,460 810,512.5Q771,565 705,631Q639,697 538,788L480,840Z"/>
</vector>
@@ -1,409 +1,389 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<ImageView
android:id="@+id/bg_book"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/bg_image"
android:scaleType="centerCrop"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ImageContrastCheck" />
android:foreground="@drawable/bg_book_mask"
android:scaleType="centerCrop" />
<View
android:id="@+id/vw_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#50000000" />
<io.legato.kazusa.ui.widget.TitleBar
android:id="@+id/title_bar"
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:title="@string/book_info"
app:themeMode="dark" />
android:background="@android:color/transparent"
android:fitsSystemWindows="true">
<LinearLayout
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutLargeSize"
style="?attr/collapsingToolbarLayoutLargeSize"
app:collapsedTitleTextAppearance="?attr/textAppearanceTitleLarge"
app:expandedTitleTextAppearance="?attr/textAppearanceHeadlineLarge"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_arrow_back"
app:title=" "
app:layout_collapseMode="pin" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/refresh_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/title_bar"
app:layout_constraintBottom_toBottomOf="parent"
tools:ignore="DisableBaselineAlignment">
android:layout_height="match_parent"
android:background="@drawable/bg_gradient_mask"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<io.legato.kazusa.ui.widget.image.ArcView
android:id="@+id/arc_view"
android:layout_width="match_parent"
android:layout_height="78dp"
android:layout_marginTop="128dp"
app:arcDirectionTop="true"
app:arcHeight="36dp"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingHorizontal="32dp"
tools:ignore="RtlSymmetry">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="3dp"
app:cardCornerRadius="5dp"
app:cardElevation="8dp">
android:layout_marginEnd="96dp"
android:layout_marginStart="16dp"
app:cardCornerRadius="16dp">
<io.legato.kazusa.ui.widget.image.CoverImageView
android:id="@+id/iv_cover"
android:layout_width="130dp"
android:layout_height="200dp"
android:layout_width="150dp"
android:layout_height="210dp"
android:contentDescription="@string/img_cover"
android:scaleType="centerCrop"
android:src="@drawable/image_cover_default"
tools:ignore="ImageContrastCheck" />
android:src="@drawable/image_cover_default" />
</androidx.cardview.widget.CardView>
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingTop="8dp"
android:paddingRight="16dp"
android:paddingBottom="3dp"
tools:ignore="RtlHardcoded">
<TextView
android:id="@+id/tv_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:gravity="center"
android:includeFontPadding="false"
android:singleLine="true"
android:text="@string/book_name"
android:textSize="18sp"
tools:ignore="RtlHardcoded" />
<io.legato.kazusa.ui.widget.LabelsBar
android:id="@+id/lb_kind"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="6dp"
android:gravity="center"
android:visibility="gone" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:paddingTop="3dp"
android:paddingBottom="3dp"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="18sp"
android:layout_height="18sp"
android:contentDescription="@string/origin_format"
android:paddingRight="4dp"
android:src="@drawable/ic_author"
app:tint="@color/tv_text_summary"
tools:ignore="RtlHardcoded,RtlSymmetry" />
android:orientation="vertical"
android:padding="12dp">
<TextView
android:id="@+id/tv_author"
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:includeFontPadding="false"
android:singleLine="true"
android:text="@string/author"
android:textSize="13sp"
tools:ignore="NestedWeights,TextContrastCheck" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_weight="1.0"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true"
android:fitsSystemWindows="true"
android:focusable="true"
android:padding="0dp"
android:scrollbarStyle="outsideInset"
android:scrollbars="vertical"
tools:ignore="NestedWeights">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="16dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingBottom="8dp">
android:maxLines="2"
android:text="@string/book_name"
style="@style/TextAppearance.Material3.ActionBar.Title"
tools:ignore="RtlHardcoded" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingBottom="8dp">
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="6dp"
android:paddingBottom="2dp"
tools:ignore="UseCompoundDrawables">
<LinearLayout
android:layout_width="match_parent"
<ImageView
android:layout_width="18sp"
android:layout_height="18sp"
android:contentDescription="@string/author"
android:src="@drawable/ic_author"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/tv_author"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="3dp"
android:paddingBottom="3dp">
<ImageView
android:id="@+id/iv_web"
android:layout_width="18sp"
android:layout_height="18sp"
android:contentDescription="@string/origin_format"
android:paddingRight="2dp"
android:src="@drawable/ic_web_outline"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/tv_origin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:includeFontPadding="false"
android:paddingRight="6dp"
android:singleLine="true"
android:textSize="13sp"
tools:ignore="NestedWeights,RtlHardcoded,RtlSymmetry,TextContrastCheck"
tools:text="@string/origin_format" />
<io.legato.kazusa.ui.widget.text.AccentBgTextView
android:id="@+id/tv_change_source"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="@string/change_origin"
android:textSize="13sp"
app:radius="2dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="3dp"
android:paddingBottom="3dp"
tools:ignore="UseCompoundDrawables">
<ImageView
android:id="@+id/ic_book_last"
android:layout_width="18sp"
android:layout_height="18sp"
android:contentDescription="@string/read_dur_progress"
android:paddingRight="2dp"
android:src="@drawable/ic_book_last"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/tv_lasted"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:includeFontPadding="false"
android:paddingRight="6dp"
android:singleLine="true"
android:textSize="13sp"
tools:ignore="NestedWeights,RtlHardcoded,RtlSymmetry,TextContrastCheck"
tools:text="@string/read_dur_progress" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="3dp"
android:paddingBottom="3dp">
<ImageView
android:layout_width="18sp"
android:layout_height="18sp"
android:contentDescription="@string/read_dur_progress"
android:paddingRight="2dp"
android:src="@drawable/ic_groups"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/tv_group"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:includeFontPadding="false"
android:paddingRight="6dp"
android:singleLine="true"
android:textSize="13sp"
tools:ignore="NestedWeights,RtlHardcoded,RtlSymmetry,TextContrastCheck"
tools:text="@string/group_s" />
<io.legato.kazusa.ui.widget.text.AccentBgTextView
android:id="@+id/tv_change_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="@string/change_group"
android:textSize="13sp"
app:radius="2dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="3dp"
android:paddingBottom="3dp">
<ImageView
android:layout_width="18sp"
android:layout_height="18sp"
android:contentDescription="@string/read_dur_progress"
android:paddingRight="2dp"
android:src="@drawable/ic_folder_open"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/tv_toc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:includeFontPadding="false"
android:paddingRight="6dp"
android:singleLine="true"
android:textSize="13sp"
tools:ignore="NestedWeights,RtlHardcoded,RtlSymmetry,TextContrastCheck"
tools:text="@string/toc_s" />
<io.legato.kazusa.ui.widget.text.AccentBgTextView
android:id="@+id/tv_toc_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="@string/view_toc"
android:textSize="13sp"
app:radius="2dp" />
</LinearLayout>
android:layout_weight="1"
android:layout_marginStart="2dp"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/author"
android:textSize="14sp"
tools:ignore="NestedWeights,RtlHardcoded,RtlSymmetry" />
</LinearLayout>
<io.legato.kazusa.ui.widget.text.ScrollTextView
android:id="@+id/tv_intro"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:clickable="true"
android:focusable="true"
android:minHeight="48dp"
android:paddingLeft="8dp"
android:paddingBottom="8dp"
android:text="@string/book_intro"
android:textIsSelectable="true"
android:textSize="14sp"
android:visibility="visible"
tools:ignore="RtlHardcoded,RtlSymmetry" />
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_web"
android:layout_width="18sp"
android:layout_height="18sp"
android:contentDescription="@string/origin_format"
android:src="@drawable/ic_web_outline"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/tv_origin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="2dp"
android:ellipsize="end"
android:paddingRight="6dp"
android:singleLine="true"
android:textSize="14sp"
tools:ignore="NestedWeights,RtlHardcoded,RtlSymmetry"
tools:text="@string/origin_format" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<LinearLayout
android:id="@+id/fl_action"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/tv_shelf"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/remove_from_bookshelf"
android:textSize="15sp" />
<io.legato.kazusa.ui.widget.text.AccentBgTextView
android:id="@+id/tv_read"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/reading"
android:textSize="15sp" />
</LinearLayout>
<io.legato.kazusa.ui.widget.NoChildScrollNestedScrollView
android:id="@+id/scroll_view"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:fillViewport="true"
android:fitsSystemWindows="false"
android:focusable="true"
android:padding="0dp"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical">
<LinearLayout
android:id="@+id/ll_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:scrollbars="none">
<io.legato.kazusa.ui.widget.LabelsBar
android:id="@+id/lb_kind"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</HorizontalScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="8dp"
android:paddingBottom="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="4"
android:gravity="center_vertical">
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_shelf"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="6dp"
android:padding="8dp"
android:text="@string/remove_from_bookshelf"
android:textSize="13sp"
app:icon="@drawable/ic_clear_all"
app:iconGravity="top"
app:iconPadding="4dp"
app:iconSize="20dp" />
<!-- 查看目录按钮 -->
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_toc_view"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="8dp"
android:padding="8dp"
android:text="@string/view_toc"
android:textSize="13sp"
app:icon="@drawable/ic_toc"
app:iconGravity="top"
app:iconPadding="4dp"
app:iconSize="20dp" />
<!-- 更换分组按钮 -->
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_change_group"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="8dp"
android:padding="8dp"
android:text="@string/change_group"
android:textSize="13sp"
app:icon="@drawable/ic_groups"
app:iconGravity="top"
app:iconPadding="4dp"
app:iconSize="20dp" />
<!-- 更换来源按钮(保持原样) -->
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_change_source"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="8dp"
android:text="@string/book_source"
android:padding="8dp"
app:icon="@drawable/ic_change_source"
android:textSize="13sp"
app:iconGravity="top"
app:iconPadding="4dp"
app:iconSize="20dp"
tools:contentDescription="@string/change_origin" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_toc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="4dp"
android:paddingBottom="4dp">
<ImageView
android:layout_width="18sp"
android:layout_height="18sp"
android:contentDescription="@string/read_dur_progress"
android:paddingRight="2dp"
android:src="@drawable/ic_chapter"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/tv_toc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:includeFontPadding="false"
android:paddingRight="6dp"
android:textSize="14sp"
tools:ignore="NestedWeights,RtlHardcoded,RtlSymmetry"
tools:text="@string/toc_s" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="3dp"
android:paddingBottom="3dp"
tools:ignore="UseCompoundDrawables">
<ImageView
android:id="@+id/ic_book_last"
android:layout_width="18sp"
android:layout_height="18sp"
android:contentDescription="@string/read_dur_progress"
android:paddingRight="2dp"
android:src="@drawable/ic_book_last"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/tv_lasted"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:includeFontPadding="false"
android:paddingRight="6dp"
android:singleLine="true"
android:textSize="14sp"
tools:ignore="NestedWeights,RtlHardcoded,RtlSymmetry"
tools:text="@string/read_dur_progress" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="3dp"
android:paddingBottom="3dp"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="18sp"
android:layout_height="18sp"
android:contentDescription="@string/read_dur_progress"
android:paddingRight="2dp"
android:src="@drawable/ic_groups"
tools:ignore="RtlHardcoded,RtlSymmetry" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/tv_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:clickable="true"
android:focusable="true"
android:minHeight="48dp"
android:paddingHorizontal="8dp"
android:paddingBottom="80dp"
android:lineSpacingExtra="4dp"
android:text="@string/book_intro"
android:textIsSelectable="true"
android:textSize="14sp"
android:visibility="visible"
tools:ignore="RtlHardcoded,RtlSymmetry" />
</LinearLayout>
</io.legato.kazusa.ui.widget.NoChildScrollNestedScrollView>
</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/btn_read"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="16dp"
android:layout_marginBottom="24dp"
android:text="@string/reading"
android:textColor="?attr/colorOnPrimary"
android:contentDescription="@string/reading"
app:iconGravity="textStart"
app:icon="@drawable/ic_bottom_books"
app:backgroundTint="?attr/colorSecondary"
app:iconTint="?attr/colorOnPrimary"
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.navigationrail.NavigationRailView
android:id="@+id/navigation_rail_view"
android:layout_width="wrap_content"
android:layout_height="0dp"
app:menuGravity="center"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/main_bnv" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager_main"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/navigation_rail_view"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,264 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/vw_menu_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:id="@+id/vw_menu_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/content"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp" />
<io.legato.kazusa.ui.widget.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurfaceContainer"
android:alpha="0.92"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="32dp">
<TextView
android:id="@+id/tv_book_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/TextAppearance.Material3.TitleLarge"
android:singleLine="true" />
<LinearLayout
android:id="@+id/title_bar_addition"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_chapter_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_weight="1"
android:singleLine="true" />
<TextView
android:id="@+id/tv_chapter_url"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:visibility="gone" />
<TextView
android:id="@+id/tv_source_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="8dp"
android:text="@string/book_source" />
</LinearLayout>
</LinearLayout>
</io.legato.kazusa.ui.widget.TitleBar>
<LinearLayout
android:id="@+id/ll_brightness"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="16dp"
android:gravity="center_horizontal"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/bottom_menu"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title_bar"
tools:ignore="RtlHardcoded">
<ImageView
android:id="@+id/iv_brightness_auto"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="8dp"
android:contentDescription="@string/brightness_auto"
android:src="@drawable/ic_brightness_auto"
tools:ignore="ImageContrastCheck" />
<io.legato.kazusa.ui.widget.seekbar.VerticalSeekBarWrapper
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1">
<io.legato.kazusa.ui.widget.seekbar.VerticalSeekBar
android:id="@+id/seek_brightness"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:max="255"
app:seekBarRotation="CW270" />
</io.legato.kazusa.ui.widget.seekbar.VerticalSeekBarWrapper>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/vw_brightness_pos_adjust"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="8dp"
android:contentDescription="@string/adjust_pos"
android:src="@drawable/ic_swap_horiz"/>
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.92"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
<LinearLayout
android:id="@+id/ll_bottom_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:importantForAccessibility="no"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<!--章节设置-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginVertical="8dp"
android:layout_marginHorizontal="16dp"
android:importantForAccessibility="no"
android:gravity="center"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_pre"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:enabled="false"
android:focusable="true"
app:icon="@drawable/ic_previous"
android:contentDescription="@string/previous_chapter"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.card.MaterialCardView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:cardCornerRadius="32dp"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
app:strokeWidth="0dp">
<com.google.android.material.slider.Slider
android:id="@+id/seek_read_page"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"/>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_next"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:enabled="false"
android:focusable="true"
app:icon="@drawable/ic_next"
android:contentDescription="@string/next_chapter"
tools:ignore="TouchTargetSizeCheck"/>
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:importantForAccessibility="no"
android:paddingVertical="8dp"
android:paddingHorizontal="16dp"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/fabSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:contentDescription="@string/search_content"
android:tooltipText="@string/search_content"
app:icon="@drawable/ic_search"
app:iconGravity="textStart"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/iv_read_aloud"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:contentDescription="@string/read_aloud"
android:maxHeight="24dp"
app:icon="@drawable/ic_read_aloud"
app:iconGravity="textStart"
tools:ignore="NestedWeights" />
<com.google.android.material.button.MaterialButton
android:id="@+id/iv_catalog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:contentDescription="@string/chapter_list"
android:tooltipText="@string/chapter_list"
android:maxHeight="24dp"
app:icon="@drawable/ic_toc"
app:iconGravity="textStart"
tools:ignore="NestedWeights" />
<com.google.android.material.button.MaterialButton
android:id="@+id/fabAutoPage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:contentDescription="@string/auto_next_page"
android:tooltipText="@string/auto_next_page"
app:icon="@drawable/ic_auto_page"
app:iconGravity="textStart"
tools:ignore="UnusedAttribute" />
<com.google.android.material.button.MaterialButton
android:id="@+id/iv_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:contentDescription="@string/setting"
android:tooltipText="@string/setting"
android:maxHeight="24dp"
app:icon="@drawable/ic_settings"
app:iconGravity="textStart"
tools:ignore="NestedWeights" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
+3 -19
View File
@@ -66,12 +66,9 @@
android:layout_height="wrap_content"
android:background="@drawable/bg_gradient_mask"
android:paddingHorizontal="16dp"
android:paddingTop="8dp">
android:paddingVertical="8dp">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp">
<io.legato.kazusa.ui.widget.image.CoverImageView
android:id="@+id/iv_cover"
@@ -81,7 +78,7 @@
android:scaleType="centerCrop"
android:src="@drawable/image_cover_default" />
</androidx.cardview.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
@@ -341,19 +338,6 @@
android:src="@drawable/ic_groups"
tools:ignore="RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/tv_group"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:includeFontPadding="false"
android:paddingRight="6dp"
android:singleLine="true"
android:textSize="14sp"
tools:ignore="NestedWeights,RtlHardcoded,RtlSymmetry"
tools:text="@string/group_s" />
</LinearLayout>
</LinearLayout>
+12 -9
View File
@@ -1,25 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/bottom_navigation_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="SpeakableTextPresentCheck" />
<!-- 底部导航栏 -->
<io.legato.kazusa.lib.theme.view.ThemeBottomNavigationVIew
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:menu="@menu/main_bnv"
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior" />
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/main_bnv" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,185 +1,184 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fillViewport="true">
<LinearLayout
android:id="@+id/ll_group_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent">
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="0dp"
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/sw_show_unread"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="6dp"
android:text="@string/group_style" />
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/sp_group_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/group_style"
android:padding="8dp"
android:text="@string/show_unread"
tools:ignore="TouchTargetSizeCheck" />
</LinearLayout>
<io.legato.kazusa.lib.theme.view.ThemeSwitch
android:id="@+id/sw_show_unread"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/show_unread"
app:layout_constraintTop_toBottomOf="@+id/ll_group_style"
tools:ignore="TouchTargetSizeCheck" />
<io.legato.kazusa.lib.theme.view.ThemeSwitch
android:id="@+id/sw_show_last_update_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/show_last_update_time"
app:layout_constraintTop_toBottomOf="@+id/sw_show_unread"
tools:ignore="TouchTargetSizeCheck" />
<io.legato.kazusa.lib.theme.view.ThemeSwitch
android:id="@+id/sw_show_wait_up_books"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/show_wait_up_count"
app:layout_constraintTop_toBottomOf="@+id/sw_show_last_update_time"
tools:ignore="TouchTargetSizeCheck" />
<io.legato.kazusa.lib.theme.view.ThemeSwitch
android:id="@+id/sw_show_bookshelf_fast_scroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/show_bookshelf_fast_scroller"
app:layout_constraintTop_toBottomOf="@+id/sw_show_wait_up_books"
tools:ignore="TouchTargetSizeCheck" />
<LinearLayout
android:id="@+id/ll_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintRight_toLeftOf="@+id/ll_sort"
app:layout_constraintTop_toBottomOf="@+id/sw_show_bookshelf_fast_scroller"
app:layout_constraintLeft_toLeftOf="parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="6dp"
android:text="@string/view"
android:textSize="16sp" />
<RadioGroup
android:id="@+id/rg_layout"
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/sw_show_last_update_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:padding="8dp"
android:text="@string/show_last_update_time"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/layout_list"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/layout_grid3"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/layout_grid4"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/layout_grid5"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/layout_grid6"
tools:ignore="TouchTargetSizeCheck" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_sort"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintLeft_toRightOf="@+id/ll_layout"
app:layout_constraintTop_toBottomOf="@id/sw_show_bookshelf_fast_scroller"
app:layout_constraintRight_toRightOf="parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="6dp"
android:text="@string/sort"
android:textSize="16sp" />
<RadioGroup
android:id="@+id/rg_sort"
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/sw_show_wait_up_books"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:padding="8dp"
android:text="@string/show_wait_up_count"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/sw_show_bookshelf_fast_scroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="@string/show_bookshelf_fast_scroller"
tools:ignore="TouchTargetSizeCheck" />
<LinearLayout
android:id="@+id/ll_group_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingHorizontal="6dp"
android:paddingVertical="16dp"
android:text="@string/group_style" />
<Spinner
android:id="@+id/sp_group_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/group_style"
tools:ignore="TouchTargetSizeCheck" />
</LinearLayout>
<com.google.android.material.chip.ChipGroup
android:id="@+id/chip_group_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:singleSelection="true"
app:selectionRequired="true"
android:paddingVertical="8dp"
android:paddingHorizontal="4dp">
<com.google.android.material.chip.Chip
android:id="@+id/chip_list"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="列表" />
<com.google.android.material.chip.Chip
android:id="@+id/chip_grid"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="网格" />
</com.google.android.material.chip.ChipGroup>
<LinearLayout
android:id="@+id/ll_grid_slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="每行列数:"
android:textSize="14sp"
android:paddingVertical="8dp"
android:paddingHorizontal="4dp"/>
<com.google.android.material.slider.Slider
android:id="@+id/slider_grid_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_0"
tools:ignore="TouchTargetSizeCheck" />
android:paddingVertical="8dp"
android:valueFrom="1"
android:valueTo="9"
android:stepSize="1"
android:value="3" />
</LinearLayout>
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/ll_sort"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_1"
tools:ignore="TouchTargetSizeCheck" />
android:layout_weight="1"
android:orientation="vertical">
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_2"
tools:ignore="TouchTargetSizeCheck" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/sort"
android:textSize="16sp" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_3"
tools:ignore="TouchTargetSizeCheck" />
<RadioGroup
android:id="@+id/rg_sort"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_4"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_0"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_5"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_1"
tools:ignore="TouchTargetSizeCheck" />
</RadioGroup>
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_2"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_3"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_4"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.radiobutton.MaterialRadioButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bookshelf_px_5"
tools:ignore="TouchTargetSizeCheck" />
</RadioGroup>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
+268 -254
View File
@@ -1,298 +1,312 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tool="http://schemas.android.com/tools"
android:id="@+id/root_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:paddingVertical="16dp"
android:paddingHorizontal="16dp">
<View
android:layout_width="36dp"
android:layout_height="4dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/bg_bottom_sheet_handle"
android:layout_marginBottom="16dp" />
<TextView
android:id="@+id/bottom_sheet_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="界面设置"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/set_bar"
android:id="@+id/root_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_marginHorizontal="12dp" >
<io.legato.kazusa.ui.book.read.config.TextFontWeightConverter
android:id="@+id/text_font_weight_converter"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="72dp"
android:layout_height="72dp"
app:icon="@drawable/font_bold"
app:iconGravity="textTop"
android:text="@string/font_weight_text" />
android:orientation="vertical"
android:gravity="center"
android:paddingVertical="16dp"
android:paddingHorizontal="16dp">
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
android:layout_width="36dp"
android:layout_height="4dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/bg_bottom_sheet_handle"
android:layout_marginBottom="16dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_text_font"
android:layout_width="72dp"
android:layout_height="72dp"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
app:icon="@drawable/font_style"
app:iconGravity="textTop"
android:text="@string/text_font" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_text_indent"
android:layout_width="72dp"
android:layout_height="72dp"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
app:icon="@drawable/ic_segment"
app:iconGravity="textTop"
android:text="@string/text_indent" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_padding"
android:layout_width="72dp"
android:layout_height="72dp"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
app:icon="@drawable/ic_padding"
app:iconGravity="textTop"
android:text="@string/padding" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<TextView
android:id="@+id/bottom_sheet_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="界面设置"
android:textSize="18sp"
android:textStyle="bold" />
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_day_night"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_marginStart="8dp"
app:icon="@drawable/ic_brightness"
app:iconGravity="textStart" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/set_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_marginHorizontal="12dp" >
<io.legato.kazusa.ui.book.read.config.TextFontWeightConverter
android:id="@+id/text_font_weight_converter"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="64dp"
android:layout_height="64dp"
app:icon="@drawable/font_bold"
app:iconGravity="textTop"
android:text="@string/font_weight_text" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_text_font"
android:layout_width="64dp"
android:layout_height="64dp"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
app:icon="@drawable/font_style"
app:iconGravity="textTop"
android:text="@string/text_font" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_text_indent"
android:layout_width="64dp"
android:layout_height="64dp"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
app:icon="@drawable/ic_segment"
app:iconGravity="textTop"
android:text="@string/text_indent" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_padding"
android:layout_width="64dp"
android:layout_height="64dp"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
app:icon="@drawable/ic_padding"
app:iconGravity="textTop"
android:text="@string/padding" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_marginHorizontal="12dp" >
<io.legato.kazusa.ui.book.read.config.ChineseConverter
android:id="@+id/chinese_converter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/Widget.Material3.Button.IconButton.Outlined" />
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/Widget.Material3.Button.IconButton.Outlined"
android:text="@string/information" />
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/Widget.Material3.Button.IconButton.Outlined"
android:text="@string/more_setting" />
</LinearLayout>
</LinearLayout>
<io.legato.kazusa.ui.widget.DetailSeekBar
android:id="@+id/dsb_text_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_marginHorizontal="12dp" >
app:isBottomBackground="true"
app:max="45"
app:title="@string/text_size" />
<io.legato.kazusa.ui.book.read.config.ChineseConverter
android:id="@+id/chinese_converter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/Widget.Material3.Button.IconButton.Outlined" />
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/Widget.Material3.Button.IconButton.Outlined"
android:text="@string/information" />
</LinearLayout>
</LinearLayout>
<io.legato.kazusa.ui.widget.DetailSeekBar
android:id="@+id/dsb_text_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp"
app:isBottomBackground="true"
app:max="45"
app:title="@string/text_size" />
<io.legato.kazusa.ui.widget.DetailSeekBar
android:id="@+id/dsb_text_letter_spacing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
app:isBottomBackground="true"
app:max="100"
app:title="@string/text_letter_spacing" />
<io.legato.kazusa.ui.widget.DetailSeekBar
android:id="@+id/dsb_line_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
app:isBottomBackground="true"
app:max="20"
app:title="@string/line_size" />
<io.legato.kazusa.ui.widget.DetailSeekBar
android:id="@+id/dsb_paragraph_spacing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
app:isBottomBackground="true"
app:max="20"
app:title="@string/paragraph_size" />
<View
android:id="@+id/vw_bg_fg"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginHorizontal="16dp"
android:layout_marginVertical="8dp"
android:background="@color/btn_bg_press" />
<LinearLayout
android:id="@+id/set_bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_page_anim"
<io.legato.kazusa.ui.widget.DetailSeekBar
android:id="@+id/dsb_text_letter_spacing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="4dp"
android:text="@string/page_anim"
android:textSize="12sp" />
app:isBottomBackground="true"
app:max="100"
app:title="@string/text_letter_spacing" />
<HorizontalScrollView
<io.legato.kazusa.ui.widget.DetailSeekBar
android:id="@+id/dsb_line_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<com.google.android.material.chip.ChipGroup
android:id="@+id/rg_page_anim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
app:singleLine="true"
app:singleSelection="true"
app:selectionRequired="true">
<com.google.android.material.chip.Chip
android:id="@+id/rb_anim0"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/page_anim_cover"
/>
<!-- 滑动动画 Chip -->
<com.google.android.material.chip.Chip
android:id="@+id/rb_anim1"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:text="@string/page_anim_slide"
app:chipStrokeWidth="1dp" />
<!-- 仿真翻页 Chip -->
<com.google.android.material.chip.Chip
android:id="@+id/rb_simulation_anim"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:text="@string/page_anim_simulation"
app:chipStrokeWidth="1dp" />
<!-- 滚动动画 Chip -->
<com.google.android.material.chip.Chip
android:id="@+id/rb_scroll_anim"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:text="@string/page_anim_scroll"
app:chipStrokeWidth="1dp" />
<!-- 无动画 Chip -->
<com.google.android.material.chip.Chip
android:id="@+id/rb_no_anim"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:text="@string/page_anim_none"
app:chipStrokeWidth="1dp" />
</com.google.android.material.chip.ChipGroup>
</HorizontalScrollView>
<View
android:id="@+id/vw_bg_fg1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginHorizontal="16dp"
android:layout_marginVertical="8dp" />
app:isBottomBackground="true"
app:max="20"
app:title="@string/line_size" />
<io.legato.kazusa.ui.widget.DetailSeekBar
android:id="@+id/dsb_paragraph_spacing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
app:isBottomBackground="true"
app:max="20"
app:title="@string/paragraph_size" />
<LinearLayout
android:id="@+id/set_bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
android:orientation="vertical">
<TextView
android:id="@+id/tv_bg_ts"
android:layout_width="0dp"
android:id="@+id/tv_page_anim"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:alpha="0.75"
android:text="@string/text_bg_style"
android:layout_marginHorizontal="16dp"
android:layout_marginBottom="4dp"
android:text="@string/page_anim"
android:textSize="12sp" />
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<com.google.android.material.chip.ChipGroup
android:id="@+id/rg_page_anim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
app:singleLine="true"
app:singleSelection="true"
app:selectionRequired="true">
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/cb_share_layout"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:text="@string/share_layout"
android:layout_marginStart="6dp"
android:layout_marginEnd="16dp" />
<com.google.android.material.chip.Chip
android:id="@+id/rb_anim0"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/page_anim_cover"
/>
<!-- 滑动动画 Chip -->
<com.google.android.material.chip.Chip
android:id="@+id/rb_anim1"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:text="@string/page_anim_slide"
app:chipStrokeWidth="1dp" />
<!-- 仿真翻页 Chip -->
<com.google.android.material.chip.Chip
android:id="@+id/rb_simulation_anim"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:text="@string/page_anim_simulation"
app:chipStrokeWidth="1dp" />
<!-- 滚动动画 Chip -->
<com.google.android.material.chip.Chip
android:id="@+id/rb_scroll_anim"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:text="@string/page_anim_scroll"
app:chipStrokeWidth="1dp" />
<!-- 无动画 Chip -->
<com.google.android.material.chip.Chip
android:id="@+id/rb_no_anim"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:text="@string/page_anim_none"
app:chipStrokeWidth="1dp" />
</com.google.android.material.chip.ChipGroup>
</HorizontalScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_bg_ts"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:alpha="0.75"
android:text="@string/text_bg_style"
android:textSize="12sp" />
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/cb_share_layout"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:text="@string/share_layout"
android:layout_marginStart="6dp"
android:layout_marginEnd="16dp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingHorizontal="12dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tool:listitem="@layout/item_read_style" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingHorizontal="12dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tool:listitem="@layout/item_read_style" />
</LinearLayout>
</LinearLayout>
</ScrollView>
+3 -3
View File
@@ -3,10 +3,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="20dp"
android:padding="16dp"
android:orientation="horizontal">
<ProgressBar
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/pb"
android:layout_width="30dp"
android:layout_height="30dp"
@@ -17,7 +17,7 @@
android:id="@+id/tv_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dp"
android:padding="8dp"
android:gravity="center"
android:text="@string/loading" />
</LinearLayout>
+21 -14
View File
@@ -1,17 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/text_view"
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/selector_fillet_btn_bg"
android:ellipsize="end"
android:gravity="center"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:maxLines="1"
android:textSize="14sp"
android:textColor="?attr/colorPrimary"
tools:ignore="UnusedAttribute" />
android:clickable="true"
android:focusable="true">
<TextView
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:maxLines="1"
android:textSize="14sp"
android:textColor="?attr/colorPrimary"
tools:ignore="UnusedAttribute" />
</com.google.android.material.card.MaterialCardView>
@@ -28,8 +28,8 @@
android:name="@string/enable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@id/iv_edit"
app:layout_constraintTop_toTopOf="parent"
@@ -37,12 +37,12 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_edit"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/edit"
android:padding="6dp"
android:layout_marginEnd="8dp"
android:src="@drawable/ic_edit"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@id/iv_menu_more"
@@ -50,11 +50,11 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_menu_more"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/more_menu"
android:padding="6dp"
android:src="@drawable/ic_more_vert"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
+12 -11
View File
@@ -7,9 +7,10 @@
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:padding="16dp">
android:paddingHorizontal="16dp"
android:paddingVertical="8dp">
<io.legato.kazusa.lib.theme.view.ThemeCheckBox
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/cb_source"
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -21,13 +22,13 @@
app:layout_constraintTop_toTopOf="parent"
tools:ignore="TouchTargetSizeCheck,DuplicateSpeakableTextCheck" />
<io.legato.kazusa.lib.theme.view.ThemeSwitch
<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/swt_enabled"
android:name="@string/enable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toTopOf="@id/title_example"
app:layout_constraintRight_toLeftOf="@id/iv_edit"
app:layout_constraintTop_toTopOf="parent"
@@ -35,12 +36,12 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_edit"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/edit"
android:padding="6dp"
android:layout_marginEnd="8dp"
android:src="@drawable/ic_edit"
app:layout_constraintBottom_toTopOf="@id/title_example"
app:layout_constraintRight_toLeftOf="@id/iv_menu_more"
@@ -48,11 +49,11 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_menu_more"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/more_menu"
android:padding="6dp"
android:layout_marginEnd="8dp"
android:src="@drawable/ic_more_vert"
app:layout_constraintBottom_toTopOf="@id/title_example"
app:layout_constraintRight_toRightOf="parent"
+2 -3
View File
@@ -5,14 +5,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<io.legato.kazusa.ui.widget.anima.RotateLoading
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/rotate_loading"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_margin="6dp"
android:layout_gravity="center"
android:visibility="invisible"
app:loading_width="2dp" />
android:indeterminate="true" />
<TextView
android:id="@+id/tv_text"
@@ -21,7 +21,6 @@
android:padding="10dp"
android:layout_gravity="center"
android:gravity="center"
android:textColor="?android:attr/textColorSecondary"
android:textSize="14sp"
android:background="?attr/selectableItemBackground"
android:visibility="invisible"
+6 -11
View File
@@ -5,10 +5,8 @@
android:background="?attr/selectableItemBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingTop="16dp"
android:paddingRight="16dp"
android:paddingBottom="16dp"
android:paddingHorizontal="16dp"
android:paddingVertical="16dp"
android:minHeight="60dp"
android:clickable="true"
android:orientation="horizontal"
@@ -20,9 +18,8 @@
android:layout_marginRight="16dp"
android:scaleType="fitCenter"
android:visibility="visible"
android:paddingTop="1dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="28dp"
android:layout_height="28dp"
app:tint="?attr/colorPrimary"
tools:ignore="ContentDescription,RtlHardcoded" />
@@ -53,10 +50,8 @@
<FrameLayout
android:id="@+id/preference_widget"
android:orientation="vertical"
android:layout_gravity="center"
android:layout_marginStart="12dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:visibility="gone"
android:gravity="right|center_vertical"
android:layout_width="wrap_content"
+134 -295
View File
@@ -19,53 +19,55 @@
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurfaceContainer"
android:alpha="0.92"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/title_bar_addition"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="16dp">
<TextView
android:id="@+id/tv_chapter_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tv_source_action"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_chapter_url"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:singleLine="true"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tv_source_action"
app:layout_constraintTop_toBottomOf="@+id/tv_chapter_name" />
<io.legato.kazusa.ui.widget.text.AccentBgTextView
android:id="@+id/tv_source_action"
android:id="@+id/tv_book_name"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_margin="1dp"
android:gravity="center"
android:maxWidth="120dp"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:text="@string/book_source"
app:layout_constraintBottom_toBottomOf="@+id/tv_chapter_url"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:radius="2dp" />
android:layout_height="wrap_content"
style="@style/TextAppearance.Material3.TitleLarge"
android:singleLine="true" />
<LinearLayout
android:id="@+id/title_bar_addition"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_chapter_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_weight="1"
android:singleLine="true" />
<TextView
android:id="@+id/tv_chapter_url"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:visibility="gone" />
<TextView
android:id="@+id/tv_source_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="8dp"
android:text="@string/book_source" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</io.legato.kazusa.ui.widget.TitleBar>
@@ -119,113 +121,32 @@
android:id="@+id/bottom_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.92"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent">
<LinearLayout
android:id="@+id/ll_floating_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="12dp"
android:paddingEnd="12dp">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:contentDescription="@string/search_content"
android:src="@drawable/ic_search"
android:tooltipText="@string/search_content"
app:elevation="2dp"
app:fabSize="mini"
tools:ignore="UnusedAttribute" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabAutoPage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:contentDescription="@string/auto_next_page"
android:src="@drawable/ic_auto_page"
android:tooltipText="@string/auto_next_page"
app:elevation="2dp"
app:fabSize="mini"
tools:ignore="UnusedAttribute" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabReplaceRule"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:contentDescription="@string/replace_rule_title"
android:src="@drawable/ic_find_replace"
android:tooltipText="@string/replace_rule_title"
app:elevation="2dp"
app:fabSize="mini"
tools:ignore="UnusedAttribute" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabNightTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:contentDescription="@string/dark_theme"
android:src="@drawable/ic_brightness"
android:tooltipText="@string/dark_theme"
app:elevation="2dp"
app:fabSize="mini"
tools:ignore="UnusedAttribute" />
</LinearLayout>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:strokeWidth="0dp"
android:layout_margin="8dp">
<LinearLayout
android:id="@+id/ll_bottom_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurface"
android:background="@android:color/transparent"
android:importantForAccessibility="no"
android:orientation="vertical">
<!--章节设置-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="5dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="5dp"
android:layout_marginVertical="8dp"
android:layout_marginHorizontal="16dp"
android:importantForAccessibility="no"
android:gravity="center"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_pre"
style="@style/Widget.Material3.Button.IconButton.Outlined"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:clickable="true"
android:enabled="false"
android:focusable="true"
@@ -233,22 +154,27 @@
android:contentDescription="@string/previous_chapter"
tools:ignore="TouchTargetSizeCheck" />
<com.google.android.material.slider.Slider
android:id="@+id/seek_read_page"
<com.google.android.material.card.MaterialCardView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:valueTo="2.0"
android:valueFrom="1.0"
android:value="1.0"/>
app:cardCornerRadius="32dp"
app:cardBackgroundColor="?attr/colorSurfaceContainer"
app:strokeWidth="0dp">
<com.google.android.material.slider.Slider
android:id="@+id/seek_read_page"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"/>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.button.MaterialButton
android:id="@+id/tv_next"
style="@style/Widget.Material3.Button.IconButton.Outlined"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:clickable="true"
android:enabled="false"
android:focusable="true"
@@ -258,179 +184,43 @@
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:importantForAccessibility="no"
android:paddingVertical="8dp"
android:paddingHorizontal="16dp"
android:background="?attr/colorSurfaceContainer"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/fabSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:backgroundTint="@android:color/transparent"
android:contentDescription="@string/search_content"
android:tooltipText="@string/search_content"
app:icon="@drawable/ic_search"
app:iconGravity="textStart"/>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:importantForAccessibility="no" />
<!--目录按钮-->
<LinearLayout
android:id="@+id/ll_catalog"
android:layout_width="56dp"
<com.google.android.material.button.MaterialButton
android:id="@+id/iv_read_aloud"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:contentDescription="@string/chapter_list"
android:focusable="true"
android:orientation="vertical"
android:gravity="center"
android:paddingBottom="4dp"
tools:ignore="VisualLintBounds">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_catalog"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/chapter_list"
android:maxHeight="24dp"
android:src="@drawable/ic_toc"
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/tv_catalog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:ellipsize="middle"
android:singleLine="true"
android:text="@string/chapter_list"
android:textSize="12sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:importantForAccessibility="no" />
<!--调节按钮-->
<LinearLayout
android:id="@+id/ll_read_aloud"
android:layout_width="56dp"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:clickable="true"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:backgroundTint="@android:color/transparent"
android:contentDescription="@string/read_aloud"
android:focusable="true"
android:orientation="vertical"
android:gravity="center"
android:paddingBottom="4dp"
tools:ignore="VisualLintBounds">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_read_aloud"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/read_aloud"
android:maxHeight="24dp"
android:src="@drawable/ic_read_aloud"
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/tv_read_aloud"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:ellipsize="middle"
android:singleLine="true"
android:text="@string/read_aloud"
android:textSize="12sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:importantForAccessibility="no" />
<!--界面按钮-->
<LinearLayout
android:id="@+id/ll_font"
android:layout_width="56dp"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:contentDescription="@string/interface_setting"
android:focusable="true"
android:orientation="vertical"
android:gravity="center"
android:paddingBottom="4dp"
tools:ignore="VisualLintBounds">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_font"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/interface_setting"
android:maxHeight="24dp"
android:src="@drawable/ic_interface_setting"
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/tv_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:ellipsize="middle"
android:singleLine="true"
android:text="@string/interface_setting"
android:textSize="12sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:importantForAccessibility="no" />
<!--设置按钮-->
<LinearLayout
android:id="@+id/ll_setting"
android:layout_width="56dp"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:contentDescription="@string/setting"
android:focusable="true"
android:orientation="vertical"
android:gravity="center"
android:paddingBottom="4dp"
tools:ignore="VisualLintBounds">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_setting"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/setting"
android:maxHeight="24dp"
android:src="@drawable/ic_settings"
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/tv_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:ellipsize="middle"
android:singleLine="true"
android:text="@string/setting"
android:textSize="12sp" />
</LinearLayout>
android:maxHeight="24dp"
app:icon="@drawable/ic_read_aloud"
app:iconGravity="textStart"
tools:ignore="NestedWeights" />
<View
android:layout_width="0dp"
@@ -438,9 +228,58 @@
android:layout_weight="1"
android:importantForAccessibility="no" />
<com.google.android.material.button.MaterialButton
android:id="@+id/iv_catalog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:backgroundTint="@android:color/transparent"
android:contentDescription="@string/chapter_list"
android:tooltipText="@string/chapter_list"
android:maxHeight="24dp"
app:icon="@drawable/ic_toc"
app:iconGravity="textStart"
tools:ignore="NestedWeights" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:importantForAccessibility="no" />
<com.google.android.material.button.MaterialButton
android:id="@+id/fabAutoPage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:backgroundTint="@android:color/transparent"
android:contentDescription="@string/auto_next_page"
android:tooltipText="@string/auto_next_page"
app:icon="@drawable/ic_auto_page"
app:iconGravity="textStart"
tools:ignore="UnusedAttribute" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:importantForAccessibility="no" />
<com.google.android.material.button.MaterialButton
android:id="@+id/iv_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
android:backgroundTint="@android:color/transparent"
android:contentDescription="@string/setting"
android:tooltipText="@string/setting"
android:maxHeight="24dp"
app:icon="@drawable/ic_settings"
app:iconGravity="textStart"
tools:ignore="NestedWeights" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
+10 -5
View File
@@ -88,6 +88,16 @@
android:title="@string/replace_rule_title"
app:showAsAction="never" />
<item
android:id="@+id/menu_setting_replace"
android:title="@string/replace_rule_title_setting"
app:showAsAction="never" />
<item
android:id="@+id/menu_effective_replaces"
android:title="@string/effective_replaces"
app:showAsAction="never" />
<item
android:id="@+id/menu_same_title_removed"
android:checkable="true"
@@ -137,11 +147,6 @@
android:title="@string/update_toc"
app:showAsAction="never" />
<item
android:id="@+id/menu_effective_replaces"
android:title="@string/effective_replaces"
app:showAsAction="never" />
<item
android:id="@+id/menu_log"
android:title="@string/log"
+2 -2
View File
@@ -229,7 +229,7 @@
<string name="import_select_book">导入选择书籍</string>
<string name="threads_num_title">更新和搜索线程数(太多会卡顿)</string>
<string name="change_icon">切换图标</string>
<string name="remove_from_bookshelf">删除书籍</string>
<string name="remove_from_bookshelf">已在书架</string>
<string name="start_read">开始阅读</string>
<string name="data_loading">加载数据中…</string>
<string name="load_error_retry">加载失败,点击重试</string>
@@ -589,7 +589,7 @@
<string name="remove_group">移除分组</string>
<string name="add_replace_rule">新建替换</string>
<string name="group">分组</string>
<string name="group_s">分组:%s</string>
<string name="group_s">%s</string>
<string name="toc_s">已读:%s</string>
<string name="enable_explore">启用发现</string>
<string name="disable_explore">禁用发现</string>
+2
View File
@@ -1221,4 +1221,6 @@
<string name="ungroup">未分组</string>
<string name="dynamic_colors">动态取色</string>
<string name="change_icon_success">图标已修改</string>
<string name="replace_rule_title_setting">配置替换规则</string>
<string name="more_setting">更多设置</string>
</resources>
@@ -2,6 +2,14 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<io.legato.kazusa.lib.prefs.ThemeModePreference
android:defaultValue="0"
android:entries="@array/theme_mode"
android:entryValues="@array/theme_mode_v"
android:key="themeMode"
android:title="@string/theme_mode"
android:summary="切换浅色/深色/跟随系统" />
<io.legato.kazusa.lib.prefs.NameListPreference
android:defaultValue="0"
android:entries="@array/screen_direction_title"
+3 -3
View File
@@ -22,7 +22,7 @@
<io.legato.kazusa.lib.prefs.PreferenceCategory
android:title="@string/setting"
app:allowDividerAbove="true"
app:allowDividerAbove="false"
app:allowDividerBelow="false"
app:iconSpaceReserved="false"
app:layout="@layout/view_preference_category">
@@ -53,7 +53,7 @@
<io.legato.kazusa.lib.prefs.PreferenceCategory
android:title="规则"
app:allowDividerAbove="true"
app:allowDividerAbove="false"
app:allowDividerBelow="false"
app:iconSpaceReserved="false"
app:layout="@layout/view_preference_category">
@@ -84,7 +84,7 @@
<io.legato.kazusa.lib.prefs.PreferenceCategory
android:key="aboutCategory"
android:title="@string/other"
app:allowDividerAbove="true"
app:allowDividerAbove="false"
app:allowDividerBelow="false"
app:iconSpaceReserved="false"
app:layout="@layout/view_preference_category">
+2
View File
@@ -33,6 +33,7 @@ media = "1.7.0"
media3 = "1.6.1"
nanoHttpd = "2.3.1"
okhttp = "4.12.0"
palette = "1.0.0"
preference = "1.2.1"
protobufJavalite = "4.26.1"
quickChineseTransfer = "0.2.16"
@@ -65,6 +66,7 @@ androidx-annotation = { group = "androidx.annotation", name = "annotation", vers
androidx-collection = { module = "androidx.collection:collection", version.ref = "collection" }
androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" }
androidx-palette = { module = "androidx.palette:palette", version.ref = "palette" }
appcompat-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }