feat: 优化代码

pull/97/head
kunfei 5 years ago
parent c99314a838
commit 382b2b1811
  1. 5
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt
  2. 7
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt

@ -48,6 +48,11 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main),
bottom_navigation_view.setOnNavigationItemSelectedListener(this)
bottom_navigation_view.menu.findItem(R.id.menu_rss).isVisible = AppConfig.isShowRSS
upVersion()
if (AppConfig.autoRefreshBook) {
view_pager_main.postDelayed({
viewModel.upChapterList()
}, 1000)
}
}
override fun onNavigationItemSelected(item: MenuItem): Boolean {

@ -17,7 +17,6 @@ import io.legado.app.constant.AppConst
import io.legado.app.constant.EventBus
import io.legado.app.constant.PreferKey
import io.legado.app.data.entities.BookGroup
import io.legado.app.help.AppConfig
import io.legado.app.lib.dialogs.*
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.accentColor
@ -27,7 +26,6 @@ import io.legado.app.ui.book.group.GroupManageDialog
import io.legado.app.ui.book.search.SearchActivity
import io.legado.app.ui.download.DownloadActivity
import io.legado.app.ui.importbook.ImportBookActivity
import io.legado.app.ui.main.MainViewModel
import io.legado.app.utils.*
import kotlinx.android.synthetic.main.dialog_edit_text.view.*
import kotlinx.android.synthetic.main.fragment_bookshelf.*
@ -53,11 +51,6 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
setSupportToolbar(toolbar)
initView()
initBookGroupData()
if (AppConfig.autoRefreshBook) {
tab_layout.postDelayed({
getViewModelOfActivity(MainViewModel::class.java).upChapterList()
}, 1000)
}
}
override fun onCompatCreateOptionsMenu(menu: Menu) {

Loading…
Cancel
Save