1.整理设置界面,将有关主页面外观的设置移至[外观]设置中
2.将部分控件更换为M3E样式 3.增加导航栏标签显示自定义设置 4.现在轨道导航可以记住上次的扩展位置 5.优化共享动画 6.更新一些颜文字 7.清理代码
This commit is contained in:
@@ -103,7 +103,6 @@ object PreferKey {
|
||||
const val mangaColorFilter = "mangaColorFilter"
|
||||
const val enableMangaEInk = "enableMangaEInk"
|
||||
const val mangaEInkThreshold = "mangaEInkThreshold"
|
||||
const val disableHorizontalAnimator = "disableHorizontalAnimator"
|
||||
const val enableMangaGray = "enableMangaGray"
|
||||
|
||||
const val autoRefresh = "auto_refresh"
|
||||
@@ -204,4 +203,5 @@ object PreferKey {
|
||||
const val bookshelfLayoutGridPortrait = "bookshelfLayoutGridPortrait"
|
||||
const val tabletInterface = "tabletInterface"
|
||||
const val pureBlack = "pure_black"
|
||||
const val labelVisibilityMode = "labelVisibilityMode"
|
||||
}
|
||||
|
||||
@@ -814,5 +814,11 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
set(value) {
|
||||
appCtx.getPrefBoolean(PreferKey.pureBlack, value)
|
||||
}
|
||||
|
||||
var labelVisibilityMode
|
||||
get() = appCtx.getPrefString(PreferKey.labelVisibilityMode, "auto")
|
||||
set(value) {
|
||||
appCtx.putPrefString(PreferKey.labelVisibilityMode, value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,12 @@ by appCtx.getSharedPreferences("local", Context.MODE_PRIVATE) {
|
||||
putBoolean("privacyPolicyOk", value)
|
||||
}
|
||||
|
||||
var navExtended: Boolean
|
||||
get() = getBoolean("navExtended")
|
||||
set(value) {
|
||||
putBoolean("navExtended", value)
|
||||
}
|
||||
|
||||
val readHelpVersionIsLast: Boolean
|
||||
get() = isLastVersion(1, "readHelpVersion", "firstRead")
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
import com.jeremyliao.liveeventbus.LiveEventBus
|
||||
import io.legato.kazusa.R
|
||||
import io.legato.kazusa.constant.EventBus
|
||||
import io.legato.kazusa.constant.PreferKey
|
||||
import io.legato.kazusa.databinding.DialogEditTextBinding
|
||||
import io.legato.kazusa.help.AppFreezeMonitor
|
||||
@@ -205,7 +204,6 @@ class OtherConfigFragment : PreferenceFragment(),
|
||||
setProcessTextEnable(it.getBoolean(key, true))
|
||||
}
|
||||
|
||||
PreferKey.showDiscovery, PreferKey.showRss, PreferKey.showBottomView -> postEvent(EventBus.NOTIFY_MAIN, true)
|
||||
PreferKey.language -> listView.postDelayed(1000) {
|
||||
appCtx.restart()
|
||||
}
|
||||
|
||||
@@ -205,9 +205,9 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
|
||||
upPreferenceSummary(key, getPrefString(key))
|
||||
}
|
||||
|
||||
PreferKey.tabletInterface -> {
|
||||
recreateActivities()
|
||||
}
|
||||
PreferKey.showDiscovery, PreferKey.showRss,
|
||||
PreferKey.showBottomView, PreferKey.tabletInterface,
|
||||
PreferKey.labelVisibilityMode -> postEvent(EventBus.NOTIFY_MAIN, true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import androidx.lifecycle.lifecycleScope
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import com.google.android.material.bottomnavigation.LabelVisibilityMode
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
import com.google.android.material.navigation.NavigationBarView
|
||||
import com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback
|
||||
@@ -48,7 +49,6 @@ import io.legato.kazusa.ui.main.explore.ExploreFragment
|
||||
import io.legato.kazusa.ui.main.my.MyFragment
|
||||
import io.legato.kazusa.ui.main.rss.RssFragment
|
||||
import io.legato.kazusa.ui.widget.dialog.TextDialog
|
||||
import io.legato.kazusa.utils.dpToPx
|
||||
import io.legato.kazusa.utils.gone
|
||||
import io.legato.kazusa.utils.hideSoftInput
|
||||
import io.legato.kazusa.utils.observeEvent
|
||||
@@ -371,42 +371,67 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
||||
} else {
|
||||
binding.bottomNavigationView.gone()
|
||||
}
|
||||
|
||||
navView.labelVisibilityMode = when (AppConfig.labelVisibilityMode) {
|
||||
"auto" -> LabelVisibilityMode.LABEL_VISIBILITY_AUTO
|
||||
"selected" -> LabelVisibilityMode.LABEL_VISIBILITY_SELECTED
|
||||
"labeled" -> LabelVisibilityMode.LABEL_VISIBILITY_LABELED
|
||||
"unlabeled" -> LabelVisibilityMode.LABEL_VISIBILITY_UNLABELED
|
||||
else -> LabelVisibilityMode.LABEL_VISIBILITY_AUTO
|
||||
}
|
||||
|
||||
} else {
|
||||
binding.bottomNavigationView.gone()
|
||||
binding.navigationRailView.gone()
|
||||
}
|
||||
|
||||
val efab =
|
||||
binding.navigationRailView.headerView?.findViewById<ExtendedFloatingActionButton>(R.id.nav_fab)
|
||||
efab?.let { it.isExtended = false }
|
||||
|
||||
val lp =
|
||||
binding.navigationRailView.headerView?.let { it.layoutParams as FrameLayout.LayoutParams }
|
||||
lp!!.gravity = Gravity.START
|
||||
binding.navigationRailView.headerView!!.layoutParams as FrameLayout.LayoutParams
|
||||
lp.gravity = Gravity.START
|
||||
|
||||
binding.navigationRailView.headerView?.setPadding(
|
||||
12.dpToPx(),
|
||||
12.dpToPx(),
|
||||
12.dpToPx(),
|
||||
12.dpToPx()
|
||||
)
|
||||
binding.navigationRailView.headerView!!
|
||||
.setPadding(
|
||||
binding.navigationRailView.itemActiveIndicatorExpandedMarginHorizontal,
|
||||
0,
|
||||
binding.navigationRailView.itemActiveIndicatorExpandedMarginHorizontal,
|
||||
0)
|
||||
|
||||
binding.navigationRailView.headerView?.findViewById<ExtendedFloatingActionButton>(R.id.nav_fab)
|
||||
?.setOnClickListener {
|
||||
val efab =
|
||||
binding.navigationRailView.headerView!!.findViewById<ExtendedFloatingActionButton>(R.id.nav_fab)
|
||||
val button =
|
||||
binding.navigationRailView.headerView!!.findViewById<ImageView>(R.id.nav_botton)
|
||||
|
||||
efab.let {
|
||||
if (LocalConfig.navExtended) {
|
||||
it.isExtended = true
|
||||
binding.navigationRailView.expand()
|
||||
button.setImageResource(R.drawable.ic_menu_open)
|
||||
} else {
|
||||
it.isExtended = false
|
||||
binding.navigationRailView.collapse()
|
||||
button.setImageResource(R.drawable.ic_menu)
|
||||
}
|
||||
}
|
||||
|
||||
efab.setOnClickListener {
|
||||
startActivity<SearchActivity>()
|
||||
}
|
||||
binding.navigationRailView.headerView?.findViewById<ImageView>(R.id.nav_botton)
|
||||
?.setOnClickListener {
|
||||
efab?.let { it1 ->
|
||||
if (it1.isExtended) {
|
||||
efab.isExtended = false
|
||||
binding.navigationRailView.collapse()
|
||||
} else {
|
||||
efab.isExtended = true
|
||||
binding.navigationRailView.expand()
|
||||
}
|
||||
|
||||
button.setOnClickListener {
|
||||
efab.let { it1 ->
|
||||
if (it1.isExtended) {
|
||||
efab.isExtended = false
|
||||
binding.navigationRailView.collapse()
|
||||
button.setImageResource(R.drawable.ic_menu)
|
||||
} else {
|
||||
efab.isExtended = true
|
||||
binding.navigationRailView.expand()
|
||||
button.setImageResource(R.drawable.ic_menu_open)
|
||||
}
|
||||
LocalConfig.navExtended = it1.isExtended
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun bindNavigationListener() {
|
||||
@@ -419,14 +444,6 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNavigationRailFab(position: Int) {
|
||||
binding.navigationRailView.headerView?.gone()
|
||||
val fragmentId = getFragmentId(position)
|
||||
if (fragmentId == idBookshelf1 || fragmentId == idBookshelf2 || fragmentId == idBookshelf3) {
|
||||
binding.navigationRailView.headerView?.visible()
|
||||
}
|
||||
}
|
||||
|
||||
private fun upHomePage() {
|
||||
when (AppConfig.defaultHomePage) {
|
||||
"bookshelf" -> {}
|
||||
@@ -467,7 +484,6 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
||||
idMy -> R.id.menu_my_config
|
||||
else -> R.id.menu_bookshelf
|
||||
}
|
||||
updateNavigationRailFab(position)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -31,7 +31,7 @@ class BooksAdapterList(
|
||||
item: Book,
|
||||
payloads: MutableList<Any>
|
||||
) = binding.run {
|
||||
binding.ivCover.transitionName = "book_${item.bookUrl}"
|
||||
binding.cdCover.transitionName = "book_${item.bookUrl}"
|
||||
if (payloads.isEmpty()) {
|
||||
tvName.text = item.name
|
||||
tvAuthor.text = item.author
|
||||
@@ -98,13 +98,13 @@ class BooksAdapterList(
|
||||
holder.itemView.apply {
|
||||
binding.cvContent.setOnClickListener {
|
||||
getItem(holder.layoutPosition)?.let {
|
||||
callBack.open(it, binding.ivCover)
|
||||
callBack.open(it, binding.cdCover)
|
||||
}
|
||||
}
|
||||
|
||||
binding.cvContent.onLongClick {
|
||||
getItem(holder.layoutPosition)?.let {
|
||||
callBack.openBookInfo(it, binding.ivCover)
|
||||
callBack.openBookInfo(it, binding.cdCover)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -113,10 +113,10 @@ class BooksAdapterList(context: Context, callBack: CallBack) :
|
||||
|
||||
fun registerListener(item: Any) {
|
||||
binding.cvContent.setOnClickListener {
|
||||
callBack.onItemClick(item, binding.ivCover)
|
||||
callBack.onItemClick(item, binding.cdCover)
|
||||
}
|
||||
binding.cvContent.onLongClick {
|
||||
callBack.onItemLongClick(item, binding.ivCover)
|
||||
callBack.onItemLongClick(item, binding.cdCover)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class EmptyMessageView @JvmOverloads constructor(
|
||||
private val messageTextView: TextView
|
||||
|
||||
private val faces = listOf(
|
||||
"(๑`^´๑)", "(´・ᴗ・`)", "(•̀ᴗ•́)و", "(ᵔᴥᵔ)", "(¬‿¬)", "(ಥ﹏ಥ)", "(。•́︿•̀。)"
|
||||
"(;′⌒`)", "(つ﹏⊂)", "(•̀ᴗ•́)و", "(๑•́ ₃ •̀๑)", "(눈‸눈)", "(ಥ﹏ಥ)", "(。•́︿•̀。)"
|
||||
)
|
||||
|
||||
init {
|
||||
@@ -70,9 +70,4 @@ class EmptyMessageView @JvmOverloads constructor(
|
||||
messageTextView.text = msg
|
||||
}
|
||||
|
||||
|
||||
/** 可选:手动刷新随机颜文字 */
|
||||
fun refreshFace() {
|
||||
faceTextView.text = faces.random()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user