mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 03:41:50 +01:00
Fix recent crashes
This commit is contained in:
parent
47bc1f7a9f
commit
49628e9cf5
@ -10,6 +10,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.ui.base.activity.ActivityMixin
|
||||
import eu.kanade.tachiyomi.ui.base.fragment.BaseRxFragment
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
import kotlinx.android.synthetic.main.fragment_backup.*
|
||||
@ -40,7 +41,7 @@ class BackupFragment : BaseRxFragment<BackupPresenter>() {
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedState: Bundle?) {
|
||||
baseActivity.requestPermissionsOnMarshmallow()
|
||||
(activity as ActivityMixin).requestPermissionsOnMarshmallow()
|
||||
subscriptions = SubscriptionList()
|
||||
|
||||
backup_button.setOnClickListener {
|
||||
|
@ -1,22 +1,19 @@
|
||||
package eu.kanade.tachiyomi.ui.base.fragment
|
||||
|
||||
import android.support.v4.app.FragmentActivity
|
||||
import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import eu.kanade.tachiyomi.ui.base.activity.ActivityMixin
|
||||
|
||||
interface FragmentMixin {
|
||||
|
||||
fun setToolbarTitle(title: String) {
|
||||
baseActivity.setToolbarTitle(title)
|
||||
(getActivity() as ActivityMixin).setToolbarTitle(title)
|
||||
}
|
||||
|
||||
fun setToolbarTitle(resourceId: Int) {
|
||||
baseActivity.setToolbarTitle(getString(resourceId))
|
||||
(getActivity() as ActivityMixin).setToolbarTitle(getString(resourceId))
|
||||
}
|
||||
|
||||
val baseActivity: BaseActivity
|
||||
get() = getActivity() as BaseActivity
|
||||
|
||||
fun getActivity(): FragmentActivity
|
||||
fun getActivity(): AppCompatActivity
|
||||
|
||||
fun getString(resource: Int): String
|
||||
}
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.catalogue
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.support.v7.widget.GridLayoutManager
|
||||
import android.support.v7.widget.SearchView
|
||||
import android.support.v7.widget.Toolbar
|
||||
@ -161,7 +162,7 @@ class CatalogueFragment : BaseRxFragment<CataloguePresenter>(), FlexibleViewHold
|
||||
switcher.outAnimation = AnimationUtils.loadAnimation(activity, android.R.anim.fade_out)
|
||||
|
||||
// Create toolbar spinner
|
||||
val themedContext = baseActivity.supportActionBar?.themedContext ?: activity
|
||||
val themedContext = activity.supportActionBar?.themedContext ?: activity
|
||||
|
||||
val spinnerAdapter = ArrayAdapter(themedContext,
|
||||
android.R.layout.simple_spinner_item, presenter.sources)
|
||||
|
@ -413,7 +413,7 @@ class LibraryFragment : BaseRxFragment<LibraryPresenter>(), ActionMode.Callback
|
||||
*/
|
||||
fun createActionModeIfNeeded() {
|
||||
if (actionMode == null) {
|
||||
actionMode = baseActivity.startSupportActionMode(this)
|
||||
actionMode = activity.startSupportActionMode(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ class ChaptersFragment : BaseRxFragment<ChaptersPresenter>(), ActionMode.Callbac
|
||||
|
||||
override fun onListItemLongClick(position: Int) {
|
||||
if (actionMode == null)
|
||||
actionMode = baseActivity.startSupportActionMode(this)
|
||||
actionMode = activity.startSupportActionMode(this)
|
||||
|
||||
toggleSelection(position)
|
||||
}
|
||||
@ -391,10 +391,10 @@ class ChaptersFragment : BaseRxFragment<ChaptersPresenter>(), ActionMode.Callbac
|
||||
}
|
||||
|
||||
fun setReadFilter() {
|
||||
this.activity.supportInvalidateOptionsMenu()
|
||||
activity.supportInvalidateOptionsMenu()
|
||||
}
|
||||
|
||||
fun setDownloadedFilter() {
|
||||
this.activity.supportInvalidateOptionsMenu()
|
||||
activity.supportInvalidateOptionsMenu()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user