From c3d359e58f363a67aae5bcd5d9b728b03bebb552 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Mon, 19 Sep 2022 15:57:08 +0200 Subject: [PATCH] Adding edit text into the screen --- .../src/main/res/values/strings.xml | 3 ++ .../v2/rename/RenameSessionFragment.kt | 9 +++-- .../res/layout/fragment_session_rename.xml | 33 ++++++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/library/ui-strings/src/main/res/values/strings.xml b/library/ui-strings/src/main/res/values/strings.xml index 8fd7d2e811..fdb04a6e76 100644 --- a/library/ui-strings/src/main/res/values/strings.xml +++ b/library/ui-strings/src/main/res/values/strings.xml @@ -3296,6 +3296,9 @@ Last activity IP address Rename session + Session name + Custom session names can help you recognize your devices more easily. + Please be aware that session names are also visible to people you communicate with. %s\nis looking a little empty. diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/rename/RenameSessionFragment.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/rename/RenameSessionFragment.kt index c8757f64c5..7bb4eaaed7 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/rename/RenameSessionFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/rename/RenameSessionFragment.kt @@ -40,6 +40,8 @@ class RenameSessionFragment : @Inject lateinit var viewNavigator: RenameSessionViewNavigator + private var renameEditTextInitialized = false + override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentSessionRenameBinding { return FragmentSessionRenameBinding.inflate(inflater, container, false) } @@ -66,7 +68,10 @@ class RenameSessionFragment : } } - override fun invalidate() = withState(viewModel) { _ -> - // TODO + override fun invalidate() = withState(viewModel) { state -> + if(renameEditTextInitialized.not()) { + views.renameSessionEditText.setText(state.deviceName) + renameEditTextInitialized = true + } } } diff --git a/vector/src/main/res/layout/fragment_session_rename.xml b/vector/src/main/res/layout/fragment_session_rename.xml index 7911f36b00..cd0a47ae82 100644 --- a/vector/src/main/res/layout/fragment_session_rename.xml +++ b/vector/src/main/res/layout/fragment_session_rename.xml @@ -1,8 +1,39 @@ + + + + + + + +