mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Fix #242. Minor changes
This commit is contained in:
		@@ -4,7 +4,6 @@ import android.graphics.Color
 | 
			
		||||
import android.support.design.widget.Snackbar
 | 
			
		||||
import android.support.v7.app.AppCompatActivity
 | 
			
		||||
import android.support.v7.widget.Toolbar
 | 
			
		||||
import android.view.MenuItem
 | 
			
		||||
import android.view.View
 | 
			
		||||
import android.widget.TextView
 | 
			
		||||
import eu.kanade.tachiyomi.App
 | 
			
		||||
@@ -12,9 +11,12 @@ import eu.kanade.tachiyomi.R
 | 
			
		||||
 | 
			
		||||
open class BaseActivity : AppCompatActivity() {
 | 
			
		||||
 | 
			
		||||
    protected fun setupToolbar(toolbar: Toolbar) {
 | 
			
		||||
    protected fun setupToolbar(toolbar: Toolbar, backNavigation: Boolean = true) {
 | 
			
		||||
        setSupportActionBar(toolbar)
 | 
			
		||||
        supportActionBar?.setDisplayHomeAsUpEnabled(true)
 | 
			
		||||
        if (backNavigation) {
 | 
			
		||||
            toolbar.setNavigationOnClickListener { onBackPressed() }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun setAppTheme() {
 | 
			
		||||
@@ -40,16 +42,6 @@ open class BaseActivity : AppCompatActivity() {
 | 
			
		||||
        supportActionBar?.subtitle = getString(titleResource)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    override fun onOptionsItemSelected(item: MenuItem): Boolean {
 | 
			
		||||
        when (item.itemId) {
 | 
			
		||||
            android.R.id.home -> {
 | 
			
		||||
                onBackPressed()
 | 
			
		||||
                return true
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return super.onOptionsItemSelected(item)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun snack(text: String?, duration: Int = Snackbar.LENGTH_LONG) {
 | 
			
		||||
        val snack = Snackbar.make(findViewById(android.R.id.content)!!, text ?: getString(R.string.unknown_error), duration)
 | 
			
		||||
        val textView = snack.view.findViewById(android.support.design.R.id.snackbar_text) as TextView
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ class MainActivity : BaseActivity() {
 | 
			
		||||
        setContentView(R.layout.activity_main)
 | 
			
		||||
 | 
			
		||||
        // Handle Toolbar
 | 
			
		||||
        setupToolbar(toolbar)
 | 
			
		||||
        setupToolbar(toolbar, backNavigation = false)
 | 
			
		||||
        supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp)
 | 
			
		||||
 | 
			
		||||
        drawer.addDrawerListener(object : DrawerLayout.SimpleDrawerListener() {
 | 
			
		||||
 
 | 
			
		||||
@@ -143,8 +143,6 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    override fun onBackPressed() {
 | 
			
		||||
        if (isFinishing) return
 | 
			
		||||
 | 
			
		||||
        presenter.onChapterLeft()
 | 
			
		||||
 | 
			
		||||
        val chapterToUpdate = presenter.getMangaSyncChapterToUpdate()
 | 
			
		||||
 
 | 
			
		||||
@@ -99,7 +99,7 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
 | 
			
		||||
 | 
			
		||||
        restartableLatestCache(GET_PAGE_LIST,
 | 
			
		||||
                { getPageListObservable(chapter) },
 | 
			
		||||
                { view, chapter -> view.onChapterReady(manga, chapter, currentPage) },
 | 
			
		||||
                { view, chapter -> view.onChapterReady(manga, this.chapter, currentPage) },
 | 
			
		||||
                { view, error -> view.onChapterError(error) })
 | 
			
		||||
 | 
			
		||||
        if (savedState == null) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user