More crash fixes

pull/7308/head
Jays2Kings 3 years ago
parent 56d7331aae
commit 1f93f82752

@ -15,6 +15,7 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
val preferences: PreferencesHelper by injectLazy() val preferences: PreferencesHelper by injectLazy()
lateinit var binding: VB lateinit var binding: VB
val isBindingInitialized get() = this::binding.isInitialized
init { init {
@Suppress("LeakingThis") @Suppress("LeakingThis")

@ -18,6 +18,7 @@ abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) :
lateinit var binding: VB lateinit var binding: VB
val isBindingInitialized get() = this::binding.isInitialized
init { init {
addLifecycleListener( addLifecycleListener(
object : LifecycleListener() { object : LifecycleListener() {

@ -805,7 +805,7 @@ class LibraryController(
override fun onActivityResumed(activity: Activity) { override fun onActivityResumed(activity: Activity) {
super.onActivityResumed(activity) super.onActivityResumed(activity)
if (view == null) return if (!isBindingInitialized) return
updateFilterSheetY() updateFilterSheetY()
if (observeLater && ::presenter.isInitialized) { if (observeLater && ::presenter.isInitialized) {
presenter.getLibrary() presenter.getLibrary()

@ -395,6 +395,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
if (router.backstackSize == 1 && this !is SearchActivity && if (router.backstackSize == 1 && this !is SearchActivity &&
downloadManager.hasQueue() && !preferences.shownDownloadQueueTutorial().get() downloadManager.hasQueue() && !preferences.shownDownloadQueueTutorial().get()
) { ) {
if (!isBindingInitialized) return
val recentsItem = binding.bottomNav.getItemView(R.id.nav_recents) ?: return val recentsItem = binding.bottomNav.getItemView(R.id.nav_recents) ?: return
preferences.shownDownloadQueueTutorial().set(true) preferences.shownDownloadQueueTutorial().set(true)
TapTargetView.showFor( TapTargetView.showFor(

@ -344,11 +344,10 @@ class RecentsController(bundle: Bundle? = null) :
override fun onActivityResumed(activity: Activity) { override fun onActivityResumed(activity: Activity) {
super.onActivityResumed(activity) super.onActivityResumed(activity)
if (view != null) { if (!isBindingInitialized) return
refresh() refresh()
setBottomPadding() setBottomPadding()
binding.downloadBottomSheet.dlBottomSheet.update() binding.downloadBottomSheet.dlBottomSheet.update()
}
} }
override fun onDestroy() { override fun onDestroy() {

@ -375,6 +375,7 @@ class BrowseController :
override fun onActivityResumed(activity: Activity) { override fun onActivityResumed(activity: Activity) {
super.onActivityResumed(activity) super.onActivityResumed(activity)
if (!isBindingInitialized) return
binding.bottomSheet.root.presenter.refreshExtensions() binding.bottomSheet.root.presenter.refreshExtensions()
binding.bottomSheet.root.presenter.refreshMigrations() binding.bottomSheet.root.presenter.refreshMigrations()
setBottomPadding() setBottomPadding()

Loading…
Cancel
Save