School and teachers UI fixes (#1644)

This commit is contained in:
Mikołaj Pich
2021-11-16 21:45:14 +01:00
committed by GitHub
parent b098ac029b
commit 39327ff3ea
3 changed files with 40 additions and 25 deletions

View File

@ -13,7 +13,7 @@ import io.github.wulkanowy.ui.modules.account.AccountView
import io.github.wulkanowy.ui.modules.account.accountdetails.AccountDetailsView
import io.github.wulkanowy.ui.modules.grade.GradeView
import io.github.wulkanowy.ui.modules.message.MessageView
import io.github.wulkanowy.ui.modules.schoolandteachers.school.SchoolView
import io.github.wulkanowy.ui.modules.schoolandteachers.SchoolAndTeachersView
import io.github.wulkanowy.ui.modules.studentinfo.StudentInfoView
import io.github.wulkanowy.utils.AnalyticsHelper
import io.github.wulkanowy.utils.flowWithResource
@ -92,8 +92,8 @@ class MainPresenter @Inject constructor(
fun onViewChange(destinationView: BaseView) {
view?.apply {
showBottomNavigation(destinationView !is AccountView && destinationView !is StudentInfoView && destinationView !is AccountDetailsView)
showActionBarElevation(destinationView !is GradeView && destinationView !is MessageView && destinationView !is SchoolView)
showBottomNavigation(shouldShowBottomNavigation(destinationView))
showActionBarElevation(shouldShowActionBarElevation(destinationView))
currentViewTitle?.let { setViewTitle(it) }
currentViewSubtitle?.let { setViewSubTitle(it.ifBlank { null }) }
currentStackSize?.let {
@ -103,6 +103,20 @@ class MainPresenter @Inject constructor(
}
}
private fun shouldShowActionBarElevation(destination: BaseView) = when (destination) {
is GradeView,
is MessageView,
is SchoolAndTeachersView -> false
else -> true
}
private fun shouldShowBottomNavigation(destination: BaseView) = when (destination) {
is AccountView,
is StudentInfoView,
is AccountDetailsView -> false
else -> true
}
fun onAccountManagerSelected(): Boolean {
if (studentsWitSemesters.isNullOrEmpty()) return true

View File

@ -79,7 +79,6 @@ class MessageFragment : BaseFragment<FragmentMessageBinding>(R.layout.fragment_m
binding.messageTabLayout.elevation = requireContext().dpToPx(4f)
binding.openSendMessageButton.setOnClickListener { presenter.onSendMessageButtonClicked() }
}
@ -103,7 +102,8 @@ class MessageFragment : BaseFragment<FragmentMessageBinding>(R.layout.fragment_m
}
override fun notifyChildLoadData(index: Int, forceRefresh: Boolean) {
(pagerAdapter.getFragmentInstance(index) as? MessageTabFragment)?.onParentLoadData(forceRefresh)
(pagerAdapter.getFragmentInstance(index) as? MessageTabFragment)
?.onParentLoadData(forceRefresh)
}
override fun openSendMessage() {