More crash fixes

This commit is contained in:
Jays2Kings 2021-04-11 16:31:17 -04:00
parent 56d7331aae
commit 1f93f82752
6 changed files with 9 additions and 6 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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