Rename sessions screen learn more

This commit is contained in:
Maxime NATUREL 2022-09-28 14:01:09 +02:00
parent 20a24162f4
commit 28dee84aee
2 changed files with 19 additions and 1 deletions

View file

@ -24,9 +24,11 @@ import androidx.core.widget.doOnTextChanged
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.extensions.showKeyboard import im.vector.app.core.extensions.showKeyboard
import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.core.platform.VectorBaseFragment
import im.vector.app.databinding.FragmentSessionRenameBinding import im.vector.app.databinding.FragmentSessionRenameBinding
import im.vector.app.features.settings.devices.v2.more.SessionLearnMoreBottomSheet
import javax.inject.Inject import javax.inject.Inject
/** /**
@ -51,6 +53,7 @@ class RenameSessionFragment :
initEditText() initEditText()
initSaveButton() initSaveButton()
initWithLastEditedName() initWithLastEditedName()
initInfoView()
} }
private fun initToolbar() { private fun initToolbar() {
@ -75,6 +78,20 @@ class RenameSessionFragment :
viewModel.handle(RenameSessionAction.InitWithLastEditedName) viewModel.handle(RenameSessionAction.InitWithLastEditedName)
} }
private fun initInfoView() {
views.renameSessionInfo.onLearnMoreClickListener = {
showLearnMoreInfo()
}
}
private fun showLearnMoreInfo() {
val args = SessionLearnMoreBottomSheet.Args(
title = getString(R.string.device_manager_learn_more_session_rename_title),
description = getString(R.string.device_manager_learn_more_session_rename),
)
SessionLearnMoreBottomSheet.show(childFragmentManager, args)
}
private fun observeViewEvents() { private fun observeViewEvents() {
viewModel.observeViewEvents { viewModel.observeViewEvents {
when (it) { when (it) {

View file

@ -60,6 +60,7 @@
app:layout_constraintTop_toBottomOf="@id/renameSessionInputLayout" /> app:layout_constraintTop_toBottomOf="@id/renameSessionInputLayout" />
<im.vector.app.features.settings.devices.v2.SessionWarningInfoView <im.vector.app.features.settings.devices.v2.SessionWarningInfoView
android:id="@+id/renameSessionInfo"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/layout_horizontal_margin" android:layout_marginHorizontal="@dimen/layout_horizontal_margin"
@ -68,6 +69,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/renameSessionDescription" app:layout_constraintTop_toBottomOf="@id/renameSessionDescription"
app:sessionsWarningInfoDescription="@string/device_manager_session_rename_warning" app:sessionsWarningInfoDescription="@string/device_manager_session_rename_warning"
app:sessionsWarningInfoHasLearnMore="false" /> app:sessionsWarningInfoHasLearnMore="true" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>