moving tabs at the bottom at Insert Or Edit activity too

This commit is contained in:
tibbi
2022-06-26 09:23:38 +02:00
parent 8dc1fda8ba
commit e82481be8e
3 changed files with 87 additions and 60 deletions

View File

@ -339,9 +339,8 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
view_pager.offscreenPageLimit = tabsList.size - 1
view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) {
if (isSearchOpen) {
getCurrentFragment()?.onSearchQueryChanged("")
searchMenuItem?.collapseActionView()
if (state == ViewPager.SCROLL_STATE_SETTLING) {
closeSearch()
}
}
@ -387,19 +386,12 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
updateBottomTabItemColors(it.customView, false)
},
tabSelectedAction = {
closeSearch()
view_pager.currentItem = it.position
updateBottomTabItemColors(it.customView, true)
}
)
// selecting the proper tab sometimes glitches, add an extra selector to make sure we have it right
/*main_tabs_holder.onGlobalLayout {
Handler().postDelayed({
main_tabs_holder.getTabAt(getDefaultTab())?.select()
invalidateOptionsMenu()
}, 100L)
}*/
main_tabs_holder.beGoneIf(main_tabs_holder.tabCount == 1)
}
@ -542,11 +534,13 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
}
private fun launchSettings() {
closeSearch()
hideKeyboard()
startActivity(Intent(applicationContext, SettingsActivity::class.java))
}
private fun launchAbout() {
closeSearch()
val licenses = LICENSE_JODA or LICENSE_GLIDE or LICENSE_GSON or LICENSE_INDICATOR_FAST_SCROLL
val faqItems = arrayListOf(
@ -638,6 +632,15 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
}
}
private fun closeSearch() {
if (isSearchOpen) {
getAllFragments().forEach {
it?.onSearchQueryChanged("")
}
searchMenuItem?.collapseActionView()
}
}
private fun checkWhatsNewDialog() {
arrayListOf<Release>().apply {
add(Release(10, R.string.release_10))