pull/60/head
kunfei 5 years ago
parent f1bca15552
commit 216398e98c
  1. 2
      app/src/main/java/io/legado/app/ui/about/DonateActivity.kt
  2. 2
      app/src/main/java/io/legado/app/ui/audio/AudioPlayActivity.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  4. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt
  5. 2
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
  6. 2
      app/src/main/java/io/legado/app/ui/chapterlist/ChapterListActivity.kt
  7. 2
      app/src/main/java/io/legado/app/ui/config/ConfigActivity.kt
  8. 2
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt
  9. 17
      app/src/main/java/io/legado/app/ui/widget/TitleBar.kt

@ -13,7 +13,6 @@ import io.legado.app.base.BaseActivity
import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ATH
import io.legado.app.utils.ACache import io.legado.app.utils.ACache
import kotlinx.android.synthetic.main.activity_donate.* import kotlinx.android.synthetic.main.activity_donate.*
import kotlinx.android.synthetic.main.view_title_bar.*
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
import java.net.URLEncoder import java.net.URLEncoder
@ -25,7 +24,6 @@ import java.net.URLEncoder
class DonateActivity : BaseActivity(R.layout.activity_donate) { class DonateActivity : BaseActivity(R.layout.activity_donate) {
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
setSupportActionBar(toolbar)
ATH.applyEdgeEffectColor(scroll_view) ATH.applyEdgeEffectColor(scroll_view)
vw_zfb_tz.setOnClickListener { aliDonate(this) } vw_zfb_tz.setOnClickListener { aliDonate(this) }
cv_wx_gzh.setOnClickListener { cv_wx_gzh.setOnClickListener {

@ -26,7 +26,6 @@ import io.legado.app.ui.changesource.ChangeSourceDialog
import io.legado.app.ui.chapterlist.ChapterListActivity import io.legado.app.ui.chapterlist.ChapterListActivity
import io.legado.app.utils.* import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_audio_play.* import kotlinx.android.synthetic.main.activity_audio_play.*
import kotlinx.android.synthetic.main.view_title_bar.*
import org.apache.commons.lang3.time.DateFormatUtils import org.apache.commons.lang3.time.DateFormatUtils
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.sdk27.listeners.onLongClick import org.jetbrains.anko.sdk27.listeners.onLongClick
@ -43,7 +42,6 @@ class AudioPlayActivity : VMBaseActivity<AudioPlayViewModel>(R.layout.activity_a
private var adjustProgress = false private var adjustProgress = false
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
setSupportActionBar(toolbar)
AudioPlay.titleData.observe(this, Observer { title_bar.title = it }) AudioPlay.titleData.observe(this, Observer { title_bar.title = it })
AudioPlay.coverData.observe(this, Observer { upCover(it) }) AudioPlay.coverData.observe(this, Observer { upCover(it) })
viewModel.initData(intent) viewModel.initData(intent)

@ -30,7 +30,6 @@ import io.legado.app.utils.getViewModel
import io.legado.app.utils.gone import io.legado.app.utils.gone
import io.legado.app.utils.visible import io.legado.app.utils.visible
import kotlinx.android.synthetic.main.activity_book_info.* import kotlinx.android.synthetic.main.activity_book_info.*
import kotlinx.android.synthetic.main.view_title_bar.*
import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onClick
import org.jetbrains.anko.startActivity import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
@ -46,7 +45,6 @@ class BookInfoActivity :
get() = getViewModel(BookInfoViewModel::class.java) get() = getViewModel(BookInfoViewModel::class.java)
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
setSupportActionBar(toolbar)
title_bar.background.alpha = 0 title_bar.background.alpha = 0
viewModel.bookData.observe(this, Observer { showBook(it) }) viewModel.bookData.observe(this, Observer { showBook(it) })
viewModel.isLoadingData.observe(this, Observer { upLoading(it) }) viewModel.isLoadingData.observe(this, Observer { upLoading(it) })

@ -40,7 +40,6 @@ import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_book_read.* import kotlinx.android.synthetic.main.activity_book_read.*
import kotlinx.android.synthetic.main.view_book_page.* import kotlinx.android.synthetic.main.view_book_page.*
import kotlinx.android.synthetic.main.view_read_menu.* import kotlinx.android.synthetic.main.view_read_menu.*
import kotlinx.android.synthetic.main.view_title_bar.*
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -66,7 +65,6 @@ class ReadBookActivity : VMBaseActivity<ReadBookViewModel>(R.layout.activity_boo
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
Help.upLayoutInDisplayCutoutMode(window) Help.upLayoutInDisplayCutoutMode(window)
setSupportActionBar(toolbar)
initView() initView()
ReadBook.callBack = this ReadBook.callBack = this
ReadBook.titleDate.observe(this, Observer { title_bar.title = it }) ReadBook.titleDate.observe(this, Observer { title_bar.title = it })

@ -36,7 +36,6 @@ import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_book_source.* import kotlinx.android.synthetic.main.activity_book_source.*
import kotlinx.android.synthetic.main.dialog_edit_text.view.* import kotlinx.android.synthetic.main.dialog_edit_text.view.*
import kotlinx.android.synthetic.main.view_search.* import kotlinx.android.synthetic.main.view_search.*
import kotlinx.android.synthetic.main.view_title_bar.*
import org.jetbrains.anko.startActivity import org.jetbrains.anko.startActivity
import org.jetbrains.anko.startActivityForResult import org.jetbrains.anko.startActivityForResult
import org.jetbrains.anko.startService import org.jetbrains.anko.startService
@ -57,7 +56,6 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
private var groupMenu: SubMenu? = null private var groupMenu: SubMenu? = null
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
setSupportActionBar(toolbar)
initUriScheme() initUriScheme()
initRecyclerView() initRecyclerView()
initSearchView() initSearchView()

@ -17,7 +17,6 @@ import io.legado.app.utils.gone
import io.legado.app.utils.visible import io.legado.app.utils.visible
import kotlinx.android.synthetic.main.activity_chapter_list.* import kotlinx.android.synthetic.main.activity_chapter_list.*
import kotlinx.android.synthetic.main.view_tab_layout.* import kotlinx.android.synthetic.main.view_tab_layout.*
import kotlinx.android.synthetic.main.view_title_bar.*
class ChapterListActivity : VMBaseActivity<ChapterListViewModel>(R.layout.activity_chapter_list) { class ChapterListActivity : VMBaseActivity<ChapterListViewModel>(R.layout.activity_chapter_list) {
override val viewModel: ChapterListViewModel override val viewModel: ChapterListViewModel
@ -26,7 +25,6 @@ class ChapterListActivity : VMBaseActivity<ChapterListViewModel>(R.layout.activi
private var searchView: SearchView? = null private var searchView: SearchView? = null
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
setSupportActionBar(toolbar)
tab_layout.setSelectedTabIndicatorColor(accentColor) tab_layout.setSelectedTabIndicatorColor(accentColor)
viewModel.bookUrl = intent.getStringExtra("bookUrl") viewModel.bookUrl = intent.getStringExtra("bookUrl")
viewModel.loadBook { viewModel.loadBook {

@ -5,7 +5,6 @@ import io.legado.app.R
import io.legado.app.base.VMBaseActivity import io.legado.app.base.VMBaseActivity
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_config.* import kotlinx.android.synthetic.main.activity_config.*
import kotlinx.android.synthetic.main.view_title_bar.*
class ConfigActivity : VMBaseActivity<ConfigViewModel>(R.layout.activity_config) { class ConfigActivity : VMBaseActivity<ConfigViewModel>(R.layout.activity_config) {
override val viewModel: ConfigViewModel override val viewModel: ConfigViewModel
@ -15,7 +14,6 @@ class ConfigActivity : VMBaseActivity<ConfigViewModel>(R.layout.activity_config)
intent.getIntExtra("configType", -1).let { intent.getIntExtra("configType", -1).let {
if (it != -1) viewModel.configType = it if (it != -1) viewModel.configType = it
} }
this.setSupportActionBar(toolbar)
when (viewModel.configType) { when (viewModel.configType) {
ConfigViewModel.TYPE_CONFIG -> { ConfigViewModel.TYPE_CONFIG -> {

@ -35,7 +35,6 @@ import io.legado.app.utils.*
import kotlinx.android.synthetic.main.activity_rss_source.* import kotlinx.android.synthetic.main.activity_rss_source.*
import kotlinx.android.synthetic.main.dialog_edit_text.view.* import kotlinx.android.synthetic.main.dialog_edit_text.view.*
import kotlinx.android.synthetic.main.view_search.* import kotlinx.android.synthetic.main.view_search.*
import kotlinx.android.synthetic.main.view_title_bar.*
import org.jetbrains.anko.startActivity import org.jetbrains.anko.startActivity
import org.jetbrains.anko.startActivityForResult import org.jetbrains.anko.startActivityForResult
@ -55,7 +54,6 @@ class RssSourceActivity : VMBaseActivity<RssSourceViewModel>(R.layout.activity_r
private var groupMenu: SubMenu? = null private var groupMenu: SubMenu? = null
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
setSupportActionBar(toolbar)
initRecyclerView() initRecyclerView()
initSearchView() initSearchView()
initLiveDataGroup() initLiveDataGroup()

@ -2,7 +2,6 @@ package io.legado.app.ui.widget
import android.content.Context import android.content.Context
import android.content.res.ColorStateList import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.PorterDuff import android.graphics.PorterDuff
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.util.AttributeSet import android.util.AttributeSet
@ -14,9 +13,7 @@ import androidx.appcompat.widget.Toolbar
import androidx.core.graphics.drawable.DrawableCompat import androidx.core.graphics.drawable.DrawableCompat
import com.google.android.material.appbar.AppBarLayout import com.google.android.material.appbar.AppBarLayout
import io.legado.app.R import io.legado.app.R
import io.legado.app.lib.theme.DrawableUtils
import io.legado.app.lib.theme.primaryColor import io.legado.app.lib.theme.primaryColor
import io.legado.app.lib.theme.primaryTextColor
import io.legado.app.utils.activity import io.legado.app.utils.activity
import io.legado.app.utils.getNavigationBarHeight import io.legado.app.utils.getNavigationBarHeight
import io.legado.app.utils.getStatusBarHeight import io.legado.app.utils.getStatusBarHeight
@ -190,20 +187,6 @@ class TitleBar(context: Context, attrs: AttributeSet?) : AppBarLayout(context, a
it.supportActionBar?.setDisplayHomeAsUpEnabled(displayHomeAsUp) it.supportActionBar?.setDisplayHomeAsUpEnabled(displayHomeAsUp)
} }
} }
val primaryTextColor = if (isInEditMode) Color.BLACK else context.primaryTextColor
DrawableUtils.setTint(toolbar.overflowIcon, primaryTextColor)
toolbar.setTitleTextColor(primaryTextColor)
if (navigationIconTint != null) {
wrapDrawableTint(toolbar.navigationIcon, navigationIconTint, navigationIconTintMode)
} else {
wrapDrawableTint(
toolbar.navigationIcon,
ColorStateList.valueOf(primaryTextColor),
navigationIconTintMode
)
}
} }
private fun wrapDrawableTint(drawable: Drawable?, tintList: ColorStateList?, tintMode: Int) { private fun wrapDrawableTint(drawable: Drawable?, tintList: ColorStateList?, tintMode: Int) {

Loading…
Cancel
Save