更新界面
This commit is contained in:
@@ -3,36 +3,26 @@ package io.legato.kazusa.base
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
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
|
||||
import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import io.legato.kazusa.R
|
||||
import io.legato.kazusa.constant.AppConst
|
||||
import io.legato.kazusa.constant.AppLog
|
||||
import io.legato.kazusa.constant.EventBus
|
||||
import io.legato.kazusa.constant.PreferKey
|
||||
import io.legato.kazusa.constant.Theme
|
||||
import io.legato.kazusa.help.config.ThemeConfig
|
||||
//import io.legado.app.lib.theme.backgroundColor
|
||||
//import io.legado.app.lib.theme.primaryColor
|
||||
import io.legato.kazusa.utils.applyOpenTint
|
||||
import io.legato.kazusa.utils.applyTint
|
||||
import io.legato.kazusa.utils.disableAutoFill
|
||||
import io.legato.kazusa.utils.getPrefBoolean
|
||||
import io.legato.kazusa.utils.getPrefString
|
||||
import io.legato.kazusa.utils.hideSoftInput
|
||||
import io.legato.kazusa.utils.observeEvent
|
||||
@@ -88,7 +78,7 @@ abstract class BaseActivity<VB : ViewBinding>(
|
||||
|
||||
|
||||
observeLiveBus()
|
||||
onActivityCreated(savedInstanceState)
|
||||
//onActivityCreated(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onMultiWindowModeChanged(isInMultiWindowMode: Boolean, newConfig: Configuration) {
|
||||
@@ -107,7 +97,7 @@ abstract class BaseActivity<VB : ViewBinding>(
|
||||
// //setupSystemBar()
|
||||
// }
|
||||
|
||||
abstract fun onActivityCreated(savedInstanceState: Bundle?)
|
||||
|
||||
|
||||
final override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
val bool = onCompatCreateOptionsMenu(menu)
|
||||
|
||||
@@ -183,4 +183,5 @@ object PreferKey {
|
||||
const val contentSelectSpeakMod = "contentReadAloudMod"
|
||||
|
||||
const val themePref = "themePref"
|
||||
const val bookshelfSortOrder = "bookshelfSortOrder"
|
||||
}
|
||||
|
||||
@@ -539,6 +539,12 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
appCtx.putPrefInt(PreferKey.bookshelfSort, value)
|
||||
}
|
||||
|
||||
var bookshelfSortOrder: Int
|
||||
get() = appCtx.getPrefInt(PreferKey.bookshelfSortOrder, 0)
|
||||
set(value) {
|
||||
appCtx.putPrefInt(PreferKey.bookshelfSortOrder, value)
|
||||
}
|
||||
|
||||
fun getBookSortByGroupId(groupId: Long): Int {
|
||||
return appDb.bookGroupDao.getByID(groupId)?.getRealBookSort()
|
||||
?: bookshelfSort
|
||||
|
||||
@@ -20,8 +20,9 @@ class AboutActivity : BaseActivity<ActivityAboutBinding>() {
|
||||
|
||||
override val binding by viewBinding(ActivityAboutBinding::inflate)
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
//binding.llAbout.background = filletBackground
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val fTag = "aboutFragment"
|
||||
var aboutFragment = supportFragmentManager.findFragmentByTag(fTag)
|
||||
if (aboutFragment == null) aboutFragment = AboutFragment()
|
||||
|
||||
@@ -46,7 +46,8 @@ class ReadRecordActivity : BaseActivity<ActivityReadRecordBinding>() {
|
||||
|
||||
override val binding by viewBinding(ActivityReadRecordBinding::inflate)
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initView()
|
||||
initAllTime()
|
||||
initData()
|
||||
|
||||
@@ -59,7 +59,8 @@ class FileAssociationActivity :
|
||||
buildMainHandler()
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding.rotateLoading.visible()
|
||||
viewModel.importBookLiveData.observe(this) { uri ->
|
||||
importBook(uri)
|
||||
|
||||
@@ -19,7 +19,8 @@ class OnLineImportActivity :
|
||||
override val binding by viewBinding(ActivityTranslucenceBinding::inflate)
|
||||
override val viewModel by viewModels<OnLineImportViewModel>()
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
viewModel.successLive.observe(this) {
|
||||
when (it.first) {
|
||||
"bookSource" -> showDialogFragment(
|
||||
|
||||
@@ -12,7 +12,8 @@ class OpenUrlConfirmActivity :
|
||||
|
||||
override val binding by viewBinding(ActivityTranslucenceBinding::inflate)
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
intent.getStringExtra("uri")?.let {
|
||||
val mimeType = intent.getStringExtra("mimeType")
|
||||
val sourceOrigin = intent.getStringExtra("sourceOrigin")
|
||||
|
||||
@@ -15,7 +15,8 @@ class VerificationCodeActivity :
|
||||
|
||||
override val binding by viewBinding(ActivityTranslucenceBinding::inflate)
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
intent.getStringExtra("imageUrl")?.let {
|
||||
val sourceOrigin = intent.getStringExtra("sourceOrigin")
|
||||
val sourceName = intent.getStringExtra("sourceName")
|
||||
|
||||
@@ -88,7 +88,8 @@ class AudioPlayActivity :
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding.titleBar.setBackgroundResource(R.color.transparent)
|
||||
AudioPlay.register(this)
|
||||
viewModel.titleData.observe(this) {
|
||||
|
||||
@@ -40,7 +40,8 @@ class AllBookmarkActivity : VMBaseActivity<ActivityAllBookmarkBinding, AllBookma
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initView()
|
||||
lifecycleScope.launch {
|
||||
appDb.bookmarkDao.flowAll().catch {
|
||||
|
||||
@@ -109,7 +109,8 @@ class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
groupId = intent.getLongExtra("groupId", -1)
|
||||
lifecycleScope.launch {
|
||||
binding.titleBar.subtitle = withContext(IO) {
|
||||
|
||||
@@ -28,7 +28,8 @@ class ExploreShowActivity : VMBaseActivity<ActivityExploreShowBinding, ExploreSh
|
||||
private val adapter by lazy { ExploreShowAdapter(this, this) }
|
||||
private val loadMoreView by lazy { LoadMoreView(this) }
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding.titleBar.title = intent.getStringExtra("exploreName")
|
||||
initRecyclerView()
|
||||
viewModel.booksData.observe(this) { upData(it) }
|
||||
|
||||
@@ -38,6 +38,7 @@ import kotlinx.coroutines.flow.conflate
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.File
|
||||
import androidx.core.net.toUri
|
||||
|
||||
/**
|
||||
* 导入本地书籍界面
|
||||
@@ -58,7 +59,8 @@ class ImportBookActivity : BaseImportBookActivity<ImportBookViewModel>(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
searchView.queryHint = getString(R.string.screen) + " • " + getString(R.string.local_book)
|
||||
onBackPressedDispatcher.addCallback(this) {
|
||||
if (!goBackDir()) {
|
||||
@@ -166,7 +168,7 @@ class ImportBookActivity : BaseImportBookActivity<ImportBookViewModel>(),
|
||||
selectFolder.launch()
|
||||
} else {
|
||||
val rootUri = if (lastPath.isUri()) {
|
||||
Uri.parse(lastPath)
|
||||
lastPath.toUri()
|
||||
} else {
|
||||
Uri.fromFile(File(lastPath))
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import io.legato.kazusa.data.appDb
|
||||
import io.legato.kazusa.help.config.AppConfig
|
||||
import io.legato.kazusa.help.config.LocalConfig
|
||||
import io.legato.kazusa.lib.dialogs.alert
|
||||
//import io.legado.app.lib.theme.backgroundColor
|
||||
import io.legato.kazusa.model.remote.RemoteBook
|
||||
import io.legato.kazusa.ui.about.AppLogDialog
|
||||
import io.legato.kazusa.ui.book.import.BaseImportBookActivity
|
||||
@@ -43,7 +42,8 @@ class RemoteBookActivity : BaseImportBookActivity<RemoteBookViewModel>(),
|
||||
private val adapter by lazy { RemoteBookAdapter(this, this) }
|
||||
private var groupMenu: SubMenu? = null
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
searchView.queryHint = getString(R.string.screen) + " • " + getString(R.string.remote_book)
|
||||
onBackPressedDispatcher.addCallback(this) {
|
||||
if (!goBackDir()) {
|
||||
|
||||
@@ -154,7 +154,8 @@ class BookInfoActivity :
|
||||
override val viewModel by viewModels<BookInfoViewModel>()
|
||||
|
||||
@SuppressLint("PrivateResource")
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setSupportActionBar(binding.topBar)
|
||||
|
||||
|
||||
@@ -46,7 +46,8 @@ class BookInfoEditActivity :
|
||||
override val binding by viewBinding(ActivityBookInfoEditBinding::inflate)
|
||||
override val viewModel by viewModels<BookInfoEditViewModel>()
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
viewModel.bookData.observe(this) { upView(it) }
|
||||
if (viewModel.bookData.value == null) {
|
||||
intent.getStringExtra("bookUrl")?.let {
|
||||
|
||||
@@ -101,7 +101,8 @@ class BookshelfManageActivity :
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
viewModel.groupId = intent.getLongExtra("groupId", -1)
|
||||
lifecycleScope.launch {
|
||||
viewModel.groupName = withContext(IO) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Looper
|
||||
import android.os.PersistableBundle
|
||||
import android.view.KeyEvent
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
@@ -152,9 +153,7 @@ class ReadMangaActivity : VMBaseActivity<ActivityMangaBinding, ReadMangaViewMode
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
upLayoutInDisplayCutoutMode()
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
ReadManga.register(this)
|
||||
upSystemUiVisibility(false)
|
||||
initRecyclerView()
|
||||
|
||||
@@ -90,10 +90,7 @@ abstract class BaseReadBookActivity :
|
||||
}
|
||||
windowInsets
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
//binding.navigationBar.setBackgroundColor(bottomBackground)
|
||||
viewModel.permissionDenialLiveData.observe(this) {
|
||||
selectBookFolderResult.launch {
|
||||
mode = HandleFileContract.DIR_SYS
|
||||
|
||||
@@ -257,8 +257,8 @@ class ReadBookActivity : BaseReadBookActivity(),
|
||||
private var syncDialog: AlertDialog? = null
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
//binding.cursorLeft.setColorFilter(accentColor)
|
||||
//binding.cursorRight.setColorFilter(accentColor)
|
||||
binding.cursorLeft.setOnTouchListener(this)
|
||||
|
||||
@@ -83,7 +83,8 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
|
||||
private var precisionSearchMenuItem: MenuItem? = null
|
||||
private var isManualStopSearch = false
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
//binding.llInputHelp.setBackgroundColor(backgroundColor)
|
||||
initRecyclerView()
|
||||
initSearchView()
|
||||
|
||||
@@ -58,7 +58,8 @@ class SearchContentActivity :
|
||||
private var searchJob: Job? = null
|
||||
private var initJob: Job? = null
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
// val bbg = bottomBackground
|
||||
// val btc = getPrimaryTextColor(ColorUtils.isColorLight(bbg))
|
||||
// binding.llSearchBaseInfo.setBackgroundColor(bbg)
|
||||
|
||||
@@ -43,7 +43,8 @@ class BookSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, BookS
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initRecyclerView()
|
||||
initSearchView()
|
||||
viewModel.init(intent.getStringExtra("key")) {
|
||||
|
||||
@@ -93,7 +93,8 @@ class BookSourceEditActivity :
|
||||
KeyboardToolPop(this, lifecycleScope, binding.root, this)
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
softKeyboardTool.attachToWindow(window)
|
||||
initView()
|
||||
viewModel.initData(intent) {
|
||||
|
||||
@@ -145,7 +145,8 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
|
||||
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initRecyclerView()
|
||||
initSearchView()
|
||||
upBookSource()
|
||||
|
||||
@@ -54,7 +54,8 @@ class TocActivity : VMBaseActivity<ActivityChapterListBinding, TocViewModel>(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
tabLayout = binding.titleBar.findViewById(R.id.tab_layout)
|
||||
//tabLayout.isTabIndicatorFullWidth = false
|
||||
//tabLayout.setSelectedTabIndicatorColor(accentColor)
|
||||
|
||||
@@ -85,7 +85,8 @@ class TxtTocRuleActivity : VMBaseActivity<ActivityTxtTocRuleBinding, TxtTocRuleV
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initView()
|
||||
initBottomActionBar()
|
||||
initData()
|
||||
|
||||
@@ -63,7 +63,8 @@ class WebViewActivity : VMBaseActivity<ActivityWebViewBinding, WebViewModel>() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding.titleBar.title = intent.getStringExtra("title") ?: getString(R.string.loading)
|
||||
binding.titleBar.subtitle = intent.getStringExtra("sourceName")
|
||||
viewModel.initData(intent) {
|
||||
|
||||
@@ -15,7 +15,8 @@ class ConfigActivity : VMBaseActivity<ActivityConfigBinding, ConfigViewModel>()
|
||||
override val binding by viewBinding(ActivityConfigBinding::inflate)
|
||||
override val viewModel by viewModels<ConfigViewModel>()
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
when (val configTag = intent.getStringExtra("configTag")) {
|
||||
ConfigTag.OTHER_CONFIG -> replaceFragment<OtherConfigFragment>(configTag)
|
||||
ConfigTag.THEME_CONFIG -> replaceFragment<ThemeConfigFragment>(configTag)
|
||||
|
||||
@@ -86,7 +86,8 @@ class DictRuleActivity : VMBaseActivity<ActivityDictRuleBinding, DictRuleViewMod
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initRecyclerView()
|
||||
initSelectActionView()
|
||||
observeDictRuleData()
|
||||
|
||||
@@ -44,7 +44,8 @@ class FileManageActivity : VMBaseActivity<ActivityFileManageBinding, FileManageV
|
||||
}
|
||||
private val currentFiles = arrayListOf<File>()
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initView()
|
||||
initSearchView()
|
||||
viewModel.upFiles(viewModel.rootDoc)
|
||||
|
||||
@@ -59,7 +59,8 @@ class HandleFileActivity :
|
||||
} ?: finish()
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mode = intent.getIntExtra("mode", 0)
|
||||
viewModel.errorLiveData.observe(this) {
|
||||
toastOnUi(it)
|
||||
|
||||
@@ -15,7 +15,8 @@ class SourceLoginActivity : VMBaseActivity<ActivitySourceLoginBinding, SourceLog
|
||||
override val binding by viewBinding(ActivitySourceLoginBinding::inflate)
|
||||
override val viewModel by viewModels<SourceLoginViewModel>()
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
viewModel.initData(intent) { source ->
|
||||
initView(source)
|
||||
}
|
||||
|
||||
@@ -89,20 +89,20 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
||||
}
|
||||
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
upBottomMenu()
|
||||
initView()
|
||||
upHomePage()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// 绑定返回键逻辑
|
||||
onBackPressedDispatcher.addCallback(this) {
|
||||
if (pagePosition != 0) {
|
||||
binding.viewPagerMain.currentItem = 0
|
||||
return@addCallback
|
||||
}
|
||||
|
||||
(fragmentMap[getFragmentId(0)] as? BookshelfFragment2)?.let {
|
||||
if (it.back()) {
|
||||
return@addCallback
|
||||
}
|
||||
if (it.back()) return@addCallback
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - exitTime > 2000) {
|
||||
toastOnUi(R.string.double_click_exit)
|
||||
exitTime = System.currentTimeMillis()
|
||||
@@ -114,6 +114,11 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 其他初始化逻辑
|
||||
upBottomMenu()
|
||||
initView()
|
||||
upHomePage()
|
||||
}
|
||||
|
||||
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
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 android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.LiveData
|
||||
import com.google.android.material.chip.Chip
|
||||
import io.legato.kazusa.R
|
||||
import io.legato.kazusa.base.VMBaseFragment
|
||||
import io.legato.kazusa.constant.EventBus
|
||||
import io.legato.kazusa.data.appDb
|
||||
import io.legato.kazusa.data.entities.Book
|
||||
import io.legato.kazusa.data.entities.BookGroup
|
||||
import io.legato.kazusa.databinding.DialogBookshelfConfigBinding
|
||||
import io.legato.kazusa.databinding.DialogEditTextBinding
|
||||
import io.legato.kazusa.help.DirectLinkUpload
|
||||
import io.legato.kazusa.help.config.AppConfig
|
||||
import io.legato.kazusa.lib.dialogs.alert
|
||||
import io.legato.kazusa.ui.about.AppLogDialog
|
||||
import io.legato.kazusa.ui.book.cache.CacheActivity
|
||||
@@ -33,7 +26,6 @@ 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.isAbsUrl
|
||||
import io.legato.kazusa.utils.postEvent
|
||||
import io.legato.kazusa.utils.readText
|
||||
import io.legato.kazusa.utils.sendToClip
|
||||
import io.legato.kazusa.utils.showDialogFragment
|
||||
@@ -97,7 +89,7 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
|
||||
R.id.menu_remote -> startActivity<RemoteBookActivity>()
|
||||
R.id.menu_search -> startActivity<SearchActivity>()
|
||||
R.id.menu_update_toc -> activityViewModel.upToc(books)
|
||||
R.id.menu_bookshelf_layout -> configBookshelf()
|
||||
R.id.menu_bookshelf_layout -> showDialogFragment<BookshelfConfigBottomSheet>()
|
||||
R.id.menu_group_manage -> showDialogFragment<GroupManageDialog>()
|
||||
R.id.menu_add_local -> startActivity<ImportBookActivity>()
|
||||
R.id.menu_add_url -> showAddBookByUrlAlert()
|
||||
@@ -163,142 +155,6 @@ abstract class BaseBookshelfFragment(layoutId: Int) : VMBaseFragment<BookshelfVi
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
fun configBookshelf() {
|
||||
alert {
|
||||
|
||||
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)
|
||||
.apply {
|
||||
|
||||
val groupStyleArray = resources.getStringArray(R.array.group_style)
|
||||
val chipGroupStyle = chipGroupStyle
|
||||
|
||||
groupStyleArray.forEachIndexed { index, label ->
|
||||
val chip = Chip(context).apply {
|
||||
text = label
|
||||
isCheckable = true
|
||||
isClickable = true
|
||||
id = View.generateViewId()
|
||||
}
|
||||
chipGroupStyle.addView(chip)
|
||||
if (index == AppConfig.bookGroupStyle) {
|
||||
chipGroupStyle.check(chip.id)
|
||||
}
|
||||
}
|
||||
|
||||
val sortArray = resources.getStringArray(R.array.bookshelf_px_array)
|
||||
val chipGroupSort = chipGroupSort
|
||||
|
||||
sortArray.forEachIndexed { index, label ->
|
||||
val chip = Chip(context).apply {
|
||||
text = label
|
||||
isCheckable = true
|
||||
isClickable = true
|
||||
id = View.generateViewId()
|
||||
}
|
||||
chipGroupSort.addView(chip)
|
||||
if (index == AppConfig.bookshelfSort) {
|
||||
chipGroupSort.check(chip.id)
|
||||
}
|
||||
}
|
||||
|
||||
swShowUnread.isChecked = AppConfig.showUnread
|
||||
swShowLastUpdateTime.isChecked = AppConfig.showLastUpdateTime
|
||||
swShowWaitUpBooks.isChecked = AppConfig.showWaitUpCount
|
||||
swShowBookshelfFastScroller.isChecked = AppConfig.showBookshelfFastScroller
|
||||
|
||||
chipList.isChecked = !isGrid
|
||||
chipGrid.isChecked = isGrid
|
||||
sliderText.isVisible = isGrid
|
||||
sliderGridCount.isVisible = isGrid
|
||||
sliderGridCount.value = columnCount.toFloat()
|
||||
|
||||
chipGroupLayout.setOnCheckedStateChangeListener { group, checkedIds ->
|
||||
sliderText.isVisible = checkedIds.firstOrNull() == R.id.chip_grid
|
||||
sliderGridCount.isVisible = checkedIds.firstOrNull() == R.id.chip_grid
|
||||
}
|
||||
|
||||
}
|
||||
customView { alertBinding.root }
|
||||
|
||||
okButton {
|
||||
alertBinding.apply {
|
||||
var notifyMain = false
|
||||
var recreate = false
|
||||
|
||||
if (AppConfig.bookGroupStyle != chipGroupStyle.checkedChipId) {
|
||||
AppConfig.bookGroupStyle = chipGroupStyle.indexOfChild(chipGroupStyle.findViewById(chipGroupStyle.checkedChipId))
|
||||
notifyMain = true
|
||||
}
|
||||
|
||||
if (AppConfig.showUnread != swShowUnread.isChecked) {
|
||||
AppConfig.showUnread = swShowUnread.isChecked
|
||||
postEvent(EventBus.BOOKSHELF_REFRESH, "")
|
||||
}
|
||||
if (AppConfig.showLastUpdateTime != swShowLastUpdateTime.isChecked) {
|
||||
AppConfig.showLastUpdateTime = swShowLastUpdateTime.isChecked
|
||||
postEvent(EventBus.BOOKSHELF_REFRESH, "")
|
||||
}
|
||||
if (AppConfig.showWaitUpCount != swShowWaitUpBooks.isChecked) {
|
||||
AppConfig.showWaitUpCount = swShowWaitUpBooks.isChecked
|
||||
activityViewModel.postUpBooksLiveData(true)
|
||||
}
|
||||
if (AppConfig.showBookshelfFastScroller != swShowBookshelfFastScroller.isChecked) {
|
||||
AppConfig.showBookshelfFastScroller = swShowBookshelfFastScroller.isChecked
|
||||
postEvent(EventBus.BOOKSHELF_REFRESH, "")
|
||||
}
|
||||
if (bookshelfSort != chipGroupSort.indexOfChild(chipGroupSort.findViewById(chipGroupSort.checkedChipId))) {
|
||||
AppConfig.bookshelfSort = chipGroupSort.indexOfChild(chipGroupSort.findViewById(chipGroupSort.checkedChipId))
|
||||
upSort()
|
||||
}
|
||||
|
||||
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 {
|
||||
AppConfig.bookshelfLayoutPortrait = newLayout
|
||||
if (newLayout == 0) {
|
||||
activityViewModel.booksGridRecycledViewPool.clear()
|
||||
} else {
|
||||
activityViewModel.booksListRecycledViewPool.clear()
|
||||
}
|
||||
}
|
||||
recreate = true
|
||||
}
|
||||
|
||||
if (recreate) {
|
||||
postEvent(EventBus.RECREATE, "")
|
||||
} else if (notifyMain) {
|
||||
postEvent(EventBus.NOTIFY_MAIN, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
cancelButton()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun importBookshelfAlert(groupId: Long) {
|
||||
alert(titleResource = R.string.import_bookshelf) {
|
||||
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply {
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
package io.legato.kazusa.ui.main.bookshelf
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.transition.TransitionManager
|
||||
import com.google.android.material.chip.Chip
|
||||
import io.legato.kazusa.R
|
||||
import io.legato.kazusa.base.BaseBottomSheetDialogFragment
|
||||
import io.legato.kazusa.constant.EventBus
|
||||
import io.legato.kazusa.databinding.DialogBookshelfConfigBinding
|
||||
import io.legato.kazusa.help.config.AppConfig
|
||||
import io.legato.kazusa.ui.main.MainViewModel
|
||||
import io.legato.kazusa.utils.postEvent
|
||||
import io.legato.kazusa.utils.viewbindingdelegate.viewBinding
|
||||
|
||||
class BookshelfConfigBottomSheet : BaseBottomSheetDialogFragment(R.layout.dialog_bookshelf_config) {
|
||||
|
||||
private val binding by viewBinding(DialogBookshelfConfigBinding::bind)
|
||||
private val activityViewModel by activityViewModels<MainViewModel>()
|
||||
|
||||
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
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
|
||||
|
||||
binding.apply {
|
||||
|
||||
resources.getStringArray(R.array.group_style).forEachIndexed { index, label ->
|
||||
val chip = Chip(context).apply {
|
||||
text = label
|
||||
isCheckable = true
|
||||
isClickable = true
|
||||
id = View.generateViewId()
|
||||
}
|
||||
chipGroupStyle.addView(chip)
|
||||
if (index == AppConfig.bookGroupStyle) {
|
||||
chipGroupStyle.check(chip.id)
|
||||
}
|
||||
}
|
||||
|
||||
resources.getStringArray(R.array.bookshelf_px_array).forEachIndexed { index, label ->
|
||||
val chip = Chip(context).apply {
|
||||
text = label
|
||||
isCheckable = true
|
||||
isClickable = true
|
||||
id = View.generateViewId()
|
||||
}
|
||||
chipGroupSort.addView(chip)
|
||||
if (index == AppConfig.bookshelfSort) {
|
||||
chipGroupSort.check(chip.id)
|
||||
}
|
||||
}
|
||||
|
||||
swShowUnread.isChecked = AppConfig.showUnread
|
||||
swShowLastUpdateTime.isChecked = AppConfig.showLastUpdateTime
|
||||
swShowWaitUpBooks.isChecked = AppConfig.showWaitUpCount
|
||||
swShowBookshelfFastScroller.isChecked = AppConfig.showBookshelfFastScroller
|
||||
|
||||
chipList.isChecked = !isGrid
|
||||
chipGrid.isChecked = isGrid
|
||||
sliderText.isVisible = isGrid
|
||||
sliderGridCount.isVisible = isGrid
|
||||
sliderGridCount.value = columnCount.toFloat()
|
||||
|
||||
when (AppConfig.bookshelfSortOrder) {
|
||||
0 -> binding.chipGroupOrder.check(binding.chipAsc.id)
|
||||
1 -> binding.chipGroupOrder.check(binding.chipDesc.id)
|
||||
}
|
||||
|
||||
chipGroupLayout.setOnCheckedStateChangeListener { group, checkedIds ->
|
||||
sliderText.isVisible = checkedIds.firstOrNull() == R.id.chip_grid
|
||||
TransitionManager.beginDelayedTransition(root)
|
||||
sliderGridCount.isVisible = checkedIds.firstOrNull() == R.id.chip_grid
|
||||
}
|
||||
|
||||
btnOk.setOnClickListener {
|
||||
var notifyMain = false
|
||||
var recreate = false
|
||||
|
||||
if (AppConfig.bookGroupStyle != chipGroupStyle.checkedChipId) {
|
||||
AppConfig.bookGroupStyle = chipGroupStyle.indexOfChild(chipGroupStyle.findViewById(chipGroupStyle.checkedChipId))
|
||||
notifyMain = true
|
||||
}
|
||||
|
||||
if (AppConfig.showUnread != swShowUnread.isChecked) {
|
||||
AppConfig.showUnread = swShowUnread.isChecked
|
||||
postEvent(EventBus.BOOKSHELF_REFRESH, "")
|
||||
}
|
||||
if (AppConfig.showLastUpdateTime != swShowLastUpdateTime.isChecked) {
|
||||
AppConfig.showLastUpdateTime = swShowLastUpdateTime.isChecked
|
||||
postEvent(EventBus.BOOKSHELF_REFRESH, "")
|
||||
}
|
||||
if (AppConfig.showWaitUpCount != swShowWaitUpBooks.isChecked) {
|
||||
AppConfig.showWaitUpCount = swShowWaitUpBooks.isChecked
|
||||
activityViewModel.postUpBooksLiveData(true)
|
||||
}
|
||||
|
||||
if (AppConfig.showBookshelfFastScroller != swShowBookshelfFastScroller.isChecked) {
|
||||
AppConfig.showBookshelfFastScroller = swShowBookshelfFastScroller.isChecked
|
||||
postEvent(EventBus.BOOKSHELF_REFRESH, "")
|
||||
}
|
||||
|
||||
if (bookshelfSort != chipGroupSort.indexOfChild(chipGroupSort.findViewById(chipGroupSort.checkedChipId))) {
|
||||
AppConfig.bookshelfSort = chipGroupSort.indexOfChild(chipGroupSort.findViewById(chipGroupSort.checkedChipId))
|
||||
(requireParentFragment() as? BaseBookshelfFragment)?.upSort()
|
||||
}
|
||||
|
||||
val isNowGrid = chipGrid.isChecked
|
||||
val selectedColumn = 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 {
|
||||
AppConfig.bookshelfLayoutPortrait = newLayout
|
||||
if (newLayout == 0) {
|
||||
activityViewModel.booksGridRecycledViewPool.clear()
|
||||
} else {
|
||||
activityViewModel.booksListRecycledViewPool.clear()
|
||||
}
|
||||
}
|
||||
recreate = true
|
||||
}
|
||||
|
||||
val newOrder = when (binding.chipGroupOrder.checkedChipId) {
|
||||
binding.chipAsc.id -> 0
|
||||
binding.chipDesc.id -> 1
|
||||
else -> 1
|
||||
}
|
||||
|
||||
if (AppConfig.bookshelfSortOrder != newOrder) {
|
||||
AppConfig.bookshelfSortOrder = newOrder
|
||||
(requireParentFragment() as? BaseBookshelfFragment)?.upSort()
|
||||
}
|
||||
|
||||
if (recreate) {
|
||||
dismiss()
|
||||
postEvent(EventBus.RECREATE, "")
|
||||
} else if (notifyMain) {
|
||||
dismiss()
|
||||
postEvent(EventBus.NOTIFY_MAIN, false)
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
|
||||
btnCancel.setOnClickListener {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ import kotlinx.coroutines.flow.conflate
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.Locale
|
||||
import kotlin.math.max
|
||||
|
||||
/**
|
||||
@@ -176,27 +177,25 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
|
||||
appDb.bookDao.flowByGroup(groupId).map { list ->
|
||||
|
||||
//排序
|
||||
val isDescending = AppConfig.bookshelfSortOrder == 1
|
||||
|
||||
when (AppConfig.getBookSortByGroupId(groupId)) {
|
||||
1 -> list.sortedByDescending {
|
||||
it.latestChapterTime
|
||||
}
|
||||
1 -> if (isDescending) list.sortedByDescending { it.latestChapterTime }
|
||||
else list.sortedBy { it.latestChapterTime }
|
||||
|
||||
2 -> list.sortedWith { o1, o2 ->
|
||||
o1.name.cnCompare(o2.name)
|
||||
}
|
||||
2 -> if (isDescending) list.sortedWith(compareByDescending { it.name.cnCompareKey() })
|
||||
else list.sortedWith(compareBy { it.name.cnCompareKey() })
|
||||
|
||||
3 -> list.sortedBy {
|
||||
it.order
|
||||
}
|
||||
3 -> if (isDescending) list.sortedByDescending { it.order }
|
||||
else list.sortedBy { it.order }
|
||||
|
||||
4 -> list.sortedByDescending {
|
||||
max(it.latestChapterTime, it.durChapterTime)
|
||||
}
|
||||
4 -> if (isDescending) list.sortedByDescending { max(it.latestChapterTime, it.durChapterTime) }
|
||||
else list.sortedBy { max(it.latestChapterTime, it.durChapterTime) }
|
||||
|
||||
else -> list.sortedByDescending {
|
||||
it.durChapterTime
|
||||
}
|
||||
else -> if (isDescending) list.sortedByDescending { it.durChapterTime }
|
||||
else list.sortedBy { it.durChapterTime }
|
||||
}
|
||||
|
||||
}.flowWithLifecycleAndDatabaseChangeFirst(
|
||||
viewLifecycleOwner.lifecycle,
|
||||
Lifecycle.State.RESUMED,
|
||||
@@ -212,6 +211,10 @@ class BookshelfFragment2() : BaseBookshelfFragment(R.layout.fragment_bookshelf2)
|
||||
}
|
||||
}
|
||||
|
||||
fun String.cnCompareKey(): String {
|
||||
return this.trim().lowercase(Locale.getDefault())
|
||||
}
|
||||
|
||||
fun back(): Boolean {
|
||||
if (groupId != BookGroup.IdRoot) {
|
||||
groupId = BookGroup.IdRoot
|
||||
|
||||
@@ -26,7 +26,8 @@ class QrCodeActivity : BaseActivity<ActivityQrcodeCaptureBinding>(), ScanResultC
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val fTag = "qrCodeFragment"
|
||||
val qrCodeFragment = QrCodeFragment()
|
||||
supportFragmentManager.beginTransaction()
|
||||
|
||||
@@ -117,7 +117,8 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initRecyclerView()
|
||||
initSearchView()
|
||||
initSelectActionView()
|
||||
|
||||
@@ -54,7 +54,8 @@ class ReplaceEditActivity :
|
||||
KeyboardToolPop(this, lifecycleScope, binding.root, this)
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
softKeyboardTool.attachToWindow(window)
|
||||
initView()
|
||||
viewModel.initData(intent) {
|
||||
|
||||
@@ -5,11 +5,9 @@ package io.legato.kazusa.ui.rss.article
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.ViewGroup
|
||||
import androidx.activity.viewModels
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
@@ -17,7 +15,6 @@ import io.legato.kazusa.R
|
||||
import io.legato.kazusa.base.VMBaseActivity
|
||||
import io.legato.kazusa.databinding.ActivityRssArtivlesBinding
|
||||
import io.legato.kazusa.help.source.sortUrls
|
||||
//import io.legado.app.lib.theme.accentColor
|
||||
import io.legato.kazusa.ui.login.SourceLoginActivity
|
||||
import io.legato.kazusa.ui.rss.source.edit.RssSourceEditActivity
|
||||
import io.legato.kazusa.ui.widget.dialog.VariableDialog
|
||||
@@ -45,7 +42,8 @@ class RssSortActivity : VMBaseActivity<ActivityRssArtivlesBinding, RssSortViewMo
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setSupportActionBar(binding.topBar)
|
||||
|
||||
viewModel.titleLiveData.observe(this) {
|
||||
|
||||
@@ -38,7 +38,8 @@ class RssFavoritesActivity : BaseActivity<ActivityRssFavoritesBinding>() {
|
||||
private var groupsMenu: SubMenu? = null
|
||||
private var currentGroup = ""
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initView()
|
||||
upFragments()
|
||||
}
|
||||
|
||||
@@ -95,7 +95,8 @@ class ReadRssActivity : VMBaseActivity<ActivityRssReadBinding, ReadRssViewModel>
|
||||
return viewModel.rssSource
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
viewModel.upStarMenuData.observe(this) { upStarMenu() }
|
||||
viewModel.upTtsMenuData.observe(this) { upTtsMenu(it) }
|
||||
binding.titleBar.title = intent.getStringExtra("title")
|
||||
|
||||
@@ -27,7 +27,8 @@ class RssSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, RssSou
|
||||
|
||||
private val adapter by lazy { RssSourceDebugAdapter(this) }
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initRecyclerView()
|
||||
initSearchView()
|
||||
viewModel.observe { state, msg ->
|
||||
|
||||
@@ -76,7 +76,8 @@ class RssSourceEditActivity :
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
softKeyboardTool.attachToWindow(window)
|
||||
initView()
|
||||
viewModel.initData(intent) {
|
||||
|
||||
@@ -107,7 +107,8 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initRecyclerView()
|
||||
initSearchView()
|
||||
initGroupFlow()
|
||||
|
||||
@@ -38,7 +38,8 @@ class RuleSubActivity : BaseActivity<ActivityRuleSubBinding>(),
|
||||
override val binding by viewBinding(ActivityRuleSubBinding::inflate)
|
||||
private val adapter by lazy { RuleSubAdapter(this, this) }
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
initView()
|
||||
initData()
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ open class WelcomeActivity : BaseActivity<ActivityWelcomeBinding>() {
|
||||
|
||||
override val binding by viewBinding(ActivityWelcomeBinding::inflate)
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
// binding.ivBook.setColorFilter(accentColor)
|
||||
// binding.vwTitleLine.setBackgroundColor(accentColor)
|
||||
// 避免从桌面启动程序后,会重新实例化入口类的activity
|
||||
|
||||
Reference in New Issue
Block a user