fix: forgotten uncle onRestart (#244)
* fix: forgotten uncle onRestart It functions a lot like onResume, but assumes that onCreate ran and the user navigated away from the activity completely. * fix: don't change to the current tab
This commit is contained in:
parent
f0040b8392
commit
41eea667e5
1 changed files with 11 additions and 10 deletions
|
@ -49,7 +49,6 @@ import ani.dantotsu.settings.saving.PrefName
|
||||||
import ani.dantotsu.settings.saving.SharedPreferenceBooleanLiveData
|
import ani.dantotsu.settings.saving.SharedPreferenceBooleanLiveData
|
||||||
import ani.dantotsu.subcriptions.Subscription.Companion.startSubscription
|
import ani.dantotsu.subcriptions.Subscription.Companion.startSubscription
|
||||||
import ani.dantotsu.themes.ThemeManager
|
import ani.dantotsu.themes.ThemeManager
|
||||||
import ani.dantotsu.util.Logger
|
|
||||||
import com.google.android.material.snackbar.BaseTransientBottomBar
|
import com.google.android.material.snackbar.BaseTransientBottomBar
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import eu.kanade.domain.source.service.SourcePreferences
|
import eu.kanade.domain.source.service.SourcePreferences
|
||||||
|
@ -208,6 +207,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
binding.root.doOnAttach {
|
binding.root.doOnAttach {
|
||||||
initActivity(this)
|
initActivity(this)
|
||||||
|
window.navigationBarColor = getColor(android.R.color.transparent)
|
||||||
selectedOption = if (fragment != null) {
|
selectedOption = if (fragment != null) {
|
||||||
when (fragment) {
|
when (fragment) {
|
||||||
AnimeFragment::class.java.name -> 0
|
AnimeFragment::class.java.name -> 0
|
||||||
|
@ -272,12 +272,14 @@ class MainActivity : AppCompatActivity() {
|
||||||
mainViewPager.setCurrentItem(newIndex, false)
|
mainViewPager.setCurrentItem(newIndex, false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
navbar.selectTabAt(selectedOption)
|
if (mainViewPager.getCurrentItem() != selectedOption) {
|
||||||
mainViewPager.post {
|
navbar.selectTabAt(selectedOption)
|
||||||
mainViewPager.setCurrentItem(
|
mainViewPager.post {
|
||||||
selectedOption,
|
mainViewPager.setCurrentItem(
|
||||||
false
|
selectedOption,
|
||||||
)
|
false
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
binding.mainProgressBar.visibility = View.GONE
|
binding.mainProgressBar.visibility = View.GONE
|
||||||
|
@ -355,9 +357,8 @@ class MainActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onRestart() {
|
||||||
super.onResume()
|
super.onRestart()
|
||||||
initActivity(this)
|
|
||||||
window.navigationBarColor = getColor(android.R.color.transparent)
|
window.navigationBarColor = getColor(android.R.color.transparent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue