mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 04:39:04 +00:00
Fix header showing in the wrong places
This commit is contained in:
parent
7e43b261b1
commit
873f6ab49d
12 changed files with 35 additions and 65 deletions
|
|
@ -148,7 +148,7 @@ android {
|
|||
buildConfigField "String", "STORE", "\"google\""
|
||||
multiDexEnabled true
|
||||
|
||||
versionCode 2057
|
||||
versionCode 2058
|
||||
versionName "1.7"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class AboutFragment : BaseMainFragment() {
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
this.hidesToolbar = true
|
||||
return inflater.inflate(R.layout.fragment_about, container, false)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ abstract class BaseMainFragment : BaseFragment() {
|
|||
var bottomNavigation: BottomBar? = null
|
||||
var floatingMenuWrapper: ViewGroup? = null
|
||||
var usesTabLayout: Boolean = false
|
||||
var hidesToolbar: Boolean = false
|
||||
var usesBottomNavigation = false
|
||||
var fragmentSidebarIdentifier: String? = null
|
||||
open var user: User? = null
|
||||
|
||||
open fun updateUserData(user: User?) {
|
||||
|
|
@ -79,6 +79,14 @@ abstract class BaseMainFragment : BaseFragment() {
|
|||
|
||||
updateTabLayoutVisibility()
|
||||
|
||||
if (hidesToolbar) {
|
||||
hideToolbar()
|
||||
disableToolbarScrolling()
|
||||
} else {
|
||||
showToolbar()
|
||||
enableToolbarScrolling()
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
@ -105,20 +113,20 @@ abstract class BaseMainFragment : BaseFragment() {
|
|||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
fun hideToolbar() {
|
||||
private fun hideToolbar() {
|
||||
activity?.avatarWithBars?.visibility = View.GONE
|
||||
}
|
||||
|
||||
fun showToolbar() {
|
||||
private fun showToolbar() {
|
||||
activity?.avatarWithBars?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
fun disableToolbarScrolling() {
|
||||
private fun disableToolbarScrolling() {
|
||||
val params = collapsingToolbar?.layoutParams as? AppBarLayout.LayoutParams
|
||||
params?.scrollFlags = 0
|
||||
}
|
||||
|
||||
fun enableToolbarScrolling() {
|
||||
private fun enableToolbarScrolling() {
|
||||
val params = collapsingToolbar?.layoutParams as? AppBarLayout.LayoutParams
|
||||
params?.scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL or AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,9 @@ import kotlinx.android.synthetic.main.fragment_news.*
|
|||
class NewsFragment : BaseMainFragment() {
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
this.hidesToolbar = true
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
val view = container?.inflate(R.layout.fragment_news)
|
||||
hideToolbar()
|
||||
return view
|
||||
return container?.inflate(R.layout.fragment_news)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
|
@ -36,11 +35,6 @@ class NewsFragment : BaseMainFragment() {
|
|||
newsWebview.loadUrl("$address/static/new-stuff")
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
showToolbar()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun injectFragment(component: AppComponent) {
|
||||
component.inject(this)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,18 +60,12 @@ class StatsFragment: BaseMainFragment() {
|
|||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
tutorialStepIdentifier = "stats"
|
||||
tutorialText = getString(R.string.tutorial_stats)
|
||||
|
||||
this.hidesToolbar = true
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
hideToolbar()
|
||||
|
||||
return container?.inflate(R.layout.fragment_stats)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
showToolbar()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
inventoryRepository.close()
|
||||
super.onDestroy()
|
||||
|
|
|
|||
|
|
@ -26,9 +26,8 @@ class ShopsFragment : BaseMainFragment() {
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
this.usesTabLayout = true
|
||||
this.hidesToolbar = true
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
hideToolbar()
|
||||
disableToolbarScrolling()
|
||||
return inflater.inflate(R.layout.fragment_viewpager, container, false)
|
||||
}
|
||||
|
||||
|
|
@ -42,12 +41,14 @@ class ShopsFragment : BaseMainFragment() {
|
|||
|
||||
override fun onDestroyView() {
|
||||
toolbarAccessoryContainer?.removeView(currencyView)
|
||||
showToolbar()
|
||||
enableToolbarScrolling()
|
||||
inventoryRepository.close()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
inventoryRepository.close()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun injectFragment(component: AppComponent) {
|
||||
component.inject(this)
|
||||
}
|
||||
|
|
@ -55,7 +56,7 @@ class ShopsFragment : BaseMainFragment() {
|
|||
private fun setViewPagerAdapter() {
|
||||
val fragmentManager = childFragmentManager
|
||||
|
||||
viewPager!!.adapter = object : FragmentPagerAdapter(fragmentManager) {
|
||||
viewPager?.adapter = object : FragmentPagerAdapter(fragmentManager) {
|
||||
|
||||
override fun getItem(position: Int): androidx.fragment.app.Fragment {
|
||||
|
||||
|
|
@ -77,10 +78,10 @@ class ShopsFragment : BaseMainFragment() {
|
|||
|
||||
override fun getPageTitle(position: Int): CharSequence? {
|
||||
return when (position) {
|
||||
0 -> return context?.getString(R.string.market)
|
||||
1 -> return context?.getString(R.string.quests)
|
||||
2 -> return context?.getString(R.string.seasonalShop)
|
||||
3 -> return context?.getString(R.string.timeTravelers)
|
||||
0 -> context?.getString(R.string.market)
|
||||
1 -> context?.getString(R.string.quests)
|
||||
2 -> context?.getString(R.string.seasonalShop)
|
||||
3 -> context?.getString(R.string.timeTravelers)
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,18 +44,11 @@ class GuildFragment : BaseMainFragment() {
|
|||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
this.usesTabLayout = true
|
||||
this.hidesToolbar = true
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
hideToolbar()
|
||||
disableToolbarScrolling()
|
||||
return inflater.inflate(R.layout.fragment_viewpager, container, false)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
showToolbar()
|
||||
enableToolbarScrolling()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
socialRepository.close()
|
||||
super.onDestroy()
|
||||
|
|
|
|||
|
|
@ -38,9 +38,8 @@ class InboxFragment : BaseMainFragment(), androidx.swiperefreshlayout.widget.Swi
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
this.hidesToolbar = true
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
hideToolbar()
|
||||
disableToolbarScrolling()
|
||||
|
||||
compositeSubscription.add(this.socialRepository.markPrivateMessagesRead(user).subscribe(Consumer { }, RxErrorHandler.handleEmptyError()))
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,8 @@ class InboxMessageListFragment : BaseMainFragment(), androidx.swiperefreshlayout
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
this.hidesToolbar = true
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
hideToolbar()
|
||||
disableToolbarScrolling()
|
||||
|
||||
return inflater.inflate(R.layout.fragment_inbox_message_list, container, false)
|
||||
}
|
||||
|
|
@ -98,12 +97,6 @@ class InboxMessageListFragment : BaseMainFragment(), androidx.swiperefreshlayout
|
|||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
showToolbar()
|
||||
enableToolbarScrolling()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
socialRepository.close()
|
||||
super.onDestroy()
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class QuestDetailFragment : BaseMainFragment() {
|
|||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
this.hidesToolbar = true
|
||||
return inflater.inflate(R.layout.fragment_quest_detail, container, false)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,9 +27,8 @@ class TavernFragment : BaseMainFragment() {
|
|||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
this.usesTabLayout = true
|
||||
this.hidesToolbar = true
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
hideToolbar()
|
||||
disableToolbarScrolling()
|
||||
val v = inflater.inflate(R.layout.fragment_viewpager, container, false)
|
||||
this.tutorialStepIdentifier = "tavern"
|
||||
this.tutorialText = getString(R.string.tutorial_tavern)
|
||||
|
|
@ -43,12 +42,6 @@ class TavernFragment : BaseMainFragment() {
|
|||
viewPager.currentItem = 0
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
showToolbar()
|
||||
enableToolbarScrolling()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
socialRepository.close()
|
||||
super.onDestroy()
|
||||
|
|
|
|||
|
|
@ -42,9 +42,8 @@ class PartyFragment : BaseMainFragment() {
|
|||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
this.usesTabLayout = true
|
||||
this.hidesToolbar = true
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
hideToolbar()
|
||||
disableToolbarScrolling()
|
||||
return inflater.inflate(R.layout.fragment_viewpager, container, false)
|
||||
}
|
||||
|
||||
|
|
@ -79,12 +78,6 @@ class PartyFragment : BaseMainFragment() {
|
|||
return user?.party?.id?.isNotEmpty() == true
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
showToolbar()
|
||||
enableToolbarScrolling()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun injectFragment(component: AppComponent) {
|
||||
component.inject(this)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue