mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 09:56:00 +03:00
hiding the toolbar back button and handling system back as take the user home if the display name personalisation is not supported
This commit is contained in:
parent
a033243475
commit
46be481eda
2 changed files with 14 additions and 0 deletions
|
@ -22,6 +22,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.isInvisible
|
||||
import com.airbnb.mvrx.withState
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
|
@ -70,6 +71,8 @@ class FtueAuthChooseProfilePictureFragment @Inject constructor(
|
|||
}
|
||||
|
||||
override fun updateWithState(state: OnboardingViewState) {
|
||||
views.profilePictureToolbar.isInvisible = !state.personalizationState.supportsChangingDisplayName
|
||||
|
||||
val hasSetPicture = state.personalizationState.selectedPictureUri != null
|
||||
views.profilePictureSubmit.isEnabled = hasSetPicture
|
||||
views.changeProfilePictureIcon.setImageResource(if (hasSetPicture) R.drawable.ic_edit else R.drawable.ic_camera_plain)
|
||||
|
@ -93,4 +96,14 @@ class FtueAuthChooseProfilePictureFragment @Inject constructor(
|
|||
override fun resetViewModel() {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
override fun onBackPressed(toolbarButton: Boolean): Boolean {
|
||||
return when (withState(viewModel) { it.personalizationState.supportsChangingDisplayName }) {
|
||||
true -> super.onBackPressed(toolbarButton)
|
||||
false -> {
|
||||
viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnTakeMeHome))
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
style="@style/Widget.Vector.Toolbar.Settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toTopOf="@id/profilePictureView"
|
||||
app:layout_constraintTop_toBottomOf="@id/profilePictureToolbar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
|
Loading…
Reference in a new issue