From 04b62df83ca7da805bfd2a4a6d4ce67ac05928f4 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Mon, 24 May 2021 11:08:08 +1000 Subject: [PATCH] Make user details bottom sheet look better --- .../loki/dialogs/UserDetailsBottomSheet.kt | 28 +++++------ .../fragment_user_details_bottom_sheet.xml | 48 +++++++++++-------- app/src/main/res/values/strings.xml | 4 +- app/src/main/res/values/styles.xml | 2 +- 4 files changed, 46 insertions(+), 36 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/dialogs/UserDetailsBottomSheet.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/dialogs/UserDetailsBottomSheet.kt index 530e95585c..c020fc3aee 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/dialogs/UserDetailsBottomSheet.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/loki/dialogs/UserDetailsBottomSheet.kt @@ -38,21 +38,21 @@ class UserDetailsBottomSheet : BottomSheetDialogFragment() { nameTextViewContainer.visibility = View.VISIBLE nameTextViewContainer.setOnClickListener { nameTextViewContainer.visibility = View.INVISIBLE - nameEditContainer.visibility = View.VISIBLE - nameEditText.text = null - nameEditText.requestFocus() + nameEditTextContainer.visibility = View.VISIBLE + nicknameEditText.text = null + nicknameEditText.requestFocus() showSoftKeyboard() } - btnCancelNickNameEdit.setOnClickListener { - nameEditText.clearFocus() + cancelNicknameEditingButton.setOnClickListener { + nicknameEditText.clearFocus() hideSoftKeyboard() nameTextViewContainer.visibility = View.VISIBLE - nameEditContainer.visibility = View.INVISIBLE + nameEditTextContainer.visibility = View.INVISIBLE } - btnSaveNickNameEdit.setOnClickListener { + saveNicknameButton.setOnClickListener { saveNickName(recipient) } - nameEditText.setOnEditorActionListener { _, actionId, _ -> + nicknameEditText.setOnEditorActionListener { _, actionId, _ -> when (actionId) { EditorInfo.IME_ACTION_DONE -> { saveNickName(recipient) @@ -72,13 +72,13 @@ class UserDetailsBottomSheet : BottomSheetDialogFragment() { } fun saveNickName(recipient: Recipient) { - nameEditText.clearFocus() + nicknameEditText.clearFocus() hideSoftKeyboard() nameTextViewContainer.visibility = View.VISIBLE - nameEditContainer.visibility = View.INVISIBLE + nameEditTextContainer.visibility = View.INVISIBLE var newNickName: String? = null - if (nameEditText.text.isNotEmpty()) { - newNickName = nameEditText.text.toString() + if (nicknameEditText.text.isNotEmpty()) { + newNickName = nicknameEditText.text.toString() } val publicKey = recipient.address.serialize() val contactDB = DatabaseFactory.getSessionContactDatabase(context) @@ -91,11 +91,11 @@ class UserDetailsBottomSheet : BottomSheetDialogFragment() { @SuppressLint("ServiceCast") fun showSoftKeyboard() { val imm = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager - imm?.showSoftInput(nameEditText, 0) + imm?.showSoftInput(nicknameEditText, 0) } fun hideSoftKeyboard() { val imm = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager - imm?.hideSoftInputFromWindow(nameEditText.windowToken, 0) + imm?.hideSoftInputFromWindow(nicknameEditText.windowToken, 0) } } \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_user_details_bottom_sheet.xml b/app/src/main/res/layout/fragment_user_details_bottom_sheet.xml index f172a42f75..993e05615f 100644 --- a/app/src/main/res/layout/fragment_user_details_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_user_details_bottom_sheet.xml @@ -29,27 +29,37 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" + android:orientation="horizontal" + android:layout_centerInParent="true" android:visibility="visible"> + + + android:text="Spiderman" /> + + + android:src="@drawable/ic_baseline_clear_24" /> + android:hint="@string/fragment_user_details_bottom_sheet_edit_text_hint" /> + android:src="@drawable/ic_baseline_done_24" /> @@ -95,8 +103,8 @@ android:id="@+id/publicKeyTextView" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textSize="@dimen/large_font_size" - android:layout_marginTop="@dimen/large_spacing" + android:layout_marginTop="@dimen/medium_spacing" + android:textSize="@dimen/medium_font_size" android:textIsSelectable="true" android:text="05987d601943c267879be41830888066c6a024cbdc9a548d06813924bf3372ea78" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a6244533f0..8c325d6787 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -813,8 +813,10 @@ Select a file Select a backup file and enter the passphrase it was created with. 30-digit passphrase - + This is taking a while, would you like to skip? Or join one of theseā€¦ + Enter a nickname + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index dd6d4fc576..3a798194c2 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -137,7 +137,7 @@