Improves back navigation

This commit is contained in:
ericdecanini 2022-05-17 17:00:21 +02:00
parent 60adecedd6
commit 626c6933a3
2 changed files with 8 additions and 14 deletions

View File

@ -271,7 +271,7 @@ class HomeActivity :
} }
private fun closeGroup() { private fun closeGroup() {
views.drawerLayout.openDrawer(GravityCompat.START) // views.drawerLayout.openDrawer(GravityCompat.START)
} }
private fun handleShowAnalyticsOptIn() { private fun handleShowAnalyticsOptIn() {

View File

@ -16,7 +16,6 @@
package im.vector.app.features.home package im.vector.app.features.home
import android.content.res.ColorStateList
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.Menu import android.view.Menu
@ -25,14 +24,12 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator import android.view.animation.DecelerateInterpolator
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.core.widget.ImageViewCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.airbnb.mvrx.activityViewModel import com.airbnb.mvrx.activityViewModel
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.badge.BadgeDrawable import com.google.android.material.badge.BadgeDrawable
import com.google.android.material.color.MaterialColors
import im.vector.app.AppStateHandler import im.vector.app.AppStateHandler
import im.vector.app.R import im.vector.app.R
import im.vector.app.RoomGroupingMethod import im.vector.app.RoomGroupingMethod
@ -158,12 +155,13 @@ class HomeDetailFragment @Inject constructor(
} }
views.backButtonLayout.setOnClickListener { views.backButtonLayout.setOnClickListener {
val currentSpace = sharedActionViewModel.space.value navigateUpOneSpace()
val directParent = currentSpace?.spaceParents?.firstOrNull() // val currentSpace = sharedActionViewModel.space.value
viewModel.handleSelectSpace(directParent?.roomSummary) // val directParent = currentSpace?.spaceParents?.firstOrNull()
sharedActionViewModel.space.value = directParent?.roomSummary // viewModel.handleSelectSpace(directParent?.roomSummary)
sharedActionViewModel.post(HomeActivitySharedAction.OpenGroup(false)) // sharedActionViewModel.space.value = directParent?.roomSummary
onSpaceChange(directParent?.roomSummary) // sharedActionViewModel.post(HomeActivitySharedAction.OpenGroup(false))
// onSpaceChange(directParent?.roomSummary)
} }
views.dimView.setOnClickListener { views.dimView.setOnClickListener {
@ -188,10 +186,6 @@ class HomeDetailFragment @Inject constructor(
updateTabVisibilitySafely(R.id.bottom_action_dial_pad, showDialPadTab) updateTabVisibilitySafely(R.id.bottom_action_dial_pad, showDialPadTab)
} }
views.groupToolbarNavigateUp.setOnClickListener {
navigateUpOneSpace()
}
viewModel.observeViewEvents { viewEvent -> viewModel.observeViewEvents { viewEvent ->
when (viewEvent) { when (viewEvent) {
HomeDetailViewEvents.CallStarted -> handleCallStarted() HomeDetailViewEvents.CallStarted -> handleCallStarted()