forked from github/wulkanowy-mirror
School and teachers UI fixes (#1644)
This commit is contained in:
parent
b098ac029b
commit
39327ff3ea
@ -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.account.accountdetails.AccountDetailsView
|
||||||
import io.github.wulkanowy.ui.modules.grade.GradeView
|
import io.github.wulkanowy.ui.modules.grade.GradeView
|
||||||
import io.github.wulkanowy.ui.modules.message.MessageView
|
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.ui.modules.studentinfo.StudentInfoView
|
||||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||||
import io.github.wulkanowy.utils.flowWithResource
|
import io.github.wulkanowy.utils.flowWithResource
|
||||||
@ -92,8 +92,8 @@ class MainPresenter @Inject constructor(
|
|||||||
|
|
||||||
fun onViewChange(destinationView: BaseView) {
|
fun onViewChange(destinationView: BaseView) {
|
||||||
view?.apply {
|
view?.apply {
|
||||||
showBottomNavigation(destinationView !is AccountView && destinationView !is StudentInfoView && destinationView !is AccountDetailsView)
|
showBottomNavigation(shouldShowBottomNavigation(destinationView))
|
||||||
showActionBarElevation(destinationView !is GradeView && destinationView !is MessageView && destinationView !is SchoolView)
|
showActionBarElevation(shouldShowActionBarElevation(destinationView))
|
||||||
currentViewTitle?.let { setViewTitle(it) }
|
currentViewTitle?.let { setViewTitle(it) }
|
||||||
currentViewSubtitle?.let { setViewSubTitle(it.ifBlank { null }) }
|
currentViewSubtitle?.let { setViewSubTitle(it.ifBlank { null }) }
|
||||||
currentStackSize?.let {
|
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 {
|
fun onAccountManagerSelected(): Boolean {
|
||||||
if (studentsWitSemesters.isNullOrEmpty()) return true
|
if (studentsWitSemesters.isNullOrEmpty()) return true
|
||||||
|
|
||||||
|
@ -79,7 +79,6 @@ class MessageFragment : BaseFragment<FragmentMessageBinding>(R.layout.fragment_m
|
|||||||
|
|
||||||
binding.messageTabLayout.elevation = requireContext().dpToPx(4f)
|
binding.messageTabLayout.elevation = requireContext().dpToPx(4f)
|
||||||
|
|
||||||
|
|
||||||
binding.openSendMessageButton.setOnClickListener { presenter.onSendMessageButtonClicked() }
|
binding.openSendMessageButton.setOnClickListener { presenter.onSendMessageButtonClicked() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +102,8 @@ class MessageFragment : BaseFragment<FragmentMessageBinding>(R.layout.fragment_m
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun notifyChildLoadData(index: Int, forceRefresh: Boolean) {
|
override fun notifyChildLoadData(index: Int, forceRefresh: Boolean) {
|
||||||
(pagerAdapter.getFragmentInstance(index) as? MessageTabFragment)?.onParentLoadData(forceRefresh)
|
(pagerAdapter.getFragmentInstance(index) as? MessageTabFragment)
|
||||||
|
?.onParentLoadData(forceRefresh)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun openSendMessage() {
|
override fun openSendMessage() {
|
||||||
|
@ -15,19 +15,18 @@
|
|||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
android:id="@+id/schoolSwipe"
|
android:id="@+id/schoolSwipe"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:paddingStart="8dp"
|
|
||||||
android:paddingLeft="8dp"
|
|
||||||
android:paddingTop="8dp"
|
|
||||||
android:paddingEnd="12dp"
|
|
||||||
android:paddingRight="12dp"
|
|
||||||
android:paddingBottom="8dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/schoolContent"
|
android:id="@+id/schoolContent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:paddingVertical="8dp"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:paddingEnd="12dp"
|
||||||
|
android:visibility="invisible"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -60,6 +59,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -92,14 +92,14 @@
|
|||||||
android:id="@+id/schoolAddressButton"
|
android:id="@+id/schoolAddressButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:srcCompat="@drawable/ic_school_directions"
|
android:layout_gravity="center_vertical"
|
||||||
android:contentDescription="@string/school_address_button"
|
android:layout_marginLeft="8dp"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
|
||||||
android:padding="4dp"
|
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
android:layout_marginLeft="8dp"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:layout_gravity="center_vertical"
|
android:contentDescription="@string/school_address_button"
|
||||||
|
android:padding="4dp"
|
||||||
|
app:srcCompat="@drawable/ic_school_directions"
|
||||||
app:tint="?colorPrimary" />
|
app:tint="?colorPrimary" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -107,6 +107,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -139,14 +140,14 @@
|
|||||||
android:id="@+id/schoolTelephoneButton"
|
android:id="@+id/schoolTelephoneButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:srcCompat="@drawable/ic_all_phone"
|
android:layout_gravity="center_vertical"
|
||||||
android:contentDescription="@string/school_telephone_button"
|
android:layout_marginLeft="8dp"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
|
||||||
android:padding="4dp"
|
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginRight="8dp"
|
||||||
android:layout_marginLeft="8dp"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:layout_gravity="center_vertical"
|
android:contentDescription="@string/school_telephone_button"
|
||||||
|
android:padding="4dp"
|
||||||
|
app:srcCompat="@drawable/ic_all_phone"
|
||||||
app:tint="?colorPrimary" />
|
app:tint="?colorPrimary" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user