mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Make user details bottom sheet look better
This commit is contained in:
parent
e7ae08fe7a
commit
04b62df83c
@ -38,21 +38,21 @@ class UserDetailsBottomSheet : BottomSheetDialogFragment() {
|
|||||||
nameTextViewContainer.visibility = View.VISIBLE
|
nameTextViewContainer.visibility = View.VISIBLE
|
||||||
nameTextViewContainer.setOnClickListener {
|
nameTextViewContainer.setOnClickListener {
|
||||||
nameTextViewContainer.visibility = View.INVISIBLE
|
nameTextViewContainer.visibility = View.INVISIBLE
|
||||||
nameEditContainer.visibility = View.VISIBLE
|
nameEditTextContainer.visibility = View.VISIBLE
|
||||||
nameEditText.text = null
|
nicknameEditText.text = null
|
||||||
nameEditText.requestFocus()
|
nicknameEditText.requestFocus()
|
||||||
showSoftKeyboard()
|
showSoftKeyboard()
|
||||||
}
|
}
|
||||||
btnCancelNickNameEdit.setOnClickListener {
|
cancelNicknameEditingButton.setOnClickListener {
|
||||||
nameEditText.clearFocus()
|
nicknameEditText.clearFocus()
|
||||||
hideSoftKeyboard()
|
hideSoftKeyboard()
|
||||||
nameTextViewContainer.visibility = View.VISIBLE
|
nameTextViewContainer.visibility = View.VISIBLE
|
||||||
nameEditContainer.visibility = View.INVISIBLE
|
nameEditTextContainer.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
btnSaveNickNameEdit.setOnClickListener {
|
saveNicknameButton.setOnClickListener {
|
||||||
saveNickName(recipient)
|
saveNickName(recipient)
|
||||||
}
|
}
|
||||||
nameEditText.setOnEditorActionListener { _, actionId, _ ->
|
nicknameEditText.setOnEditorActionListener { _, actionId, _ ->
|
||||||
when (actionId) {
|
when (actionId) {
|
||||||
EditorInfo.IME_ACTION_DONE -> {
|
EditorInfo.IME_ACTION_DONE -> {
|
||||||
saveNickName(recipient)
|
saveNickName(recipient)
|
||||||
@ -72,13 +72,13 @@ class UserDetailsBottomSheet : BottomSheetDialogFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun saveNickName(recipient: Recipient) {
|
fun saveNickName(recipient: Recipient) {
|
||||||
nameEditText.clearFocus()
|
nicknameEditText.clearFocus()
|
||||||
hideSoftKeyboard()
|
hideSoftKeyboard()
|
||||||
nameTextViewContainer.visibility = View.VISIBLE
|
nameTextViewContainer.visibility = View.VISIBLE
|
||||||
nameEditContainer.visibility = View.INVISIBLE
|
nameEditTextContainer.visibility = View.INVISIBLE
|
||||||
var newNickName: String? = null
|
var newNickName: String? = null
|
||||||
if (nameEditText.text.isNotEmpty()) {
|
if (nicknameEditText.text.isNotEmpty()) {
|
||||||
newNickName = nameEditText.text.toString()
|
newNickName = nicknameEditText.text.toString()
|
||||||
}
|
}
|
||||||
val publicKey = recipient.address.serialize()
|
val publicKey = recipient.address.serialize()
|
||||||
val contactDB = DatabaseFactory.getSessionContactDatabase(context)
|
val contactDB = DatabaseFactory.getSessionContactDatabase(context)
|
||||||
@ -91,11 +91,11 @@ class UserDetailsBottomSheet : BottomSheetDialogFragment() {
|
|||||||
@SuppressLint("ServiceCast")
|
@SuppressLint("ServiceCast")
|
||||||
fun showSoftKeyboard() {
|
fun showSoftKeyboard() {
|
||||||
val imm = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
|
val imm = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
|
||||||
imm?.showSoftInput(nameEditText, 0)
|
imm?.showSoftInput(nicknameEditText, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hideSoftKeyboard() {
|
fun hideSoftKeyboard() {
|
||||||
val imm = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
|
val imm = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
|
||||||
imm?.hideSoftInputFromWindow(nameEditText.windowToken, 0)
|
imm?.hideSoftInputFromWindow(nicknameEditText.windowToken, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,27 +29,37 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
android:visibility="visible">
|
android:visibility="visible">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/nameTextView"
|
android:id="@+id/nameTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:textSize="@dimen/massive_font_size"
|
android:layout_marginStart="@dimen/small_spacing"
|
||||||
|
android:layout_marginEnd="@dimen/small_spacing"
|
||||||
|
android:textSize="@dimen/large_font_size"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:text="Spiderman"
|
android:text="Spiderman" />
|
||||||
android:paddingStart="24dp"
|
|
||||||
android:paddingEnd="0dp"
|
<ImageView
|
||||||
android:drawableEnd="@drawable/ic_baseline_edit_24"
|
android:layout_width="20dp"
|
||||||
android:drawablePadding="@dimen/small_spacing" />
|
android:layout_height="22dp"
|
||||||
|
android:paddingTop="2dp"
|
||||||
|
android:src="@drawable/ic_baseline_edit_24" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/nameEditContainer"
|
android:id="@+id/nameEditTextContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
@ -57,34 +67,32 @@
|
|||||||
android:visibility="invisible">
|
android:visibility="invisible">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/btnCancelNickNameEdit"
|
android:id="@+id/cancelNicknameEditingButton"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:src="@drawable/ic_baseline_clear_24"/>
|
android:src="@drawable/ic_baseline_clear_24" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/nameEditText"
|
android:id="@+id/nicknameEditText"
|
||||||
style="@style/SessionEditText"
|
style="@style/SmallSessionEditText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginStart="@dimen/small_spacing"
|
android:layout_marginStart="@dimen/small_spacing"
|
||||||
android:layout_marginEnd="@dimen/small_spacing"
|
android:layout_marginEnd="@dimen/small_spacing"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textSize="@dimen/very_large_font_size"
|
android:paddingTop="12dp"
|
||||||
android:paddingTop="16dp"
|
android:paddingBottom="12dp"
|
||||||
android:paddingBottom="16dp"
|
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:imeOptions="actionDone"
|
android:imeOptions="actionDone"
|
||||||
android:hint="Enter a name"/>
|
android:hint="@string/fragment_user_details_bottom_sheet_edit_text_hint" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/btnSaveNickNameEdit"
|
android:id="@+id/saveNicknameButton"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:layout_gravity="center"
|
android:src="@drawable/ic_baseline_done_24" />
|
||||||
android:src="@drawable/ic_baseline_done_24"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -95,8 +103,8 @@
|
|||||||
android:id="@+id/publicKeyTextView"
|
android:id="@+id/publicKeyTextView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="@dimen/large_font_size"
|
android:layout_marginTop="@dimen/medium_spacing"
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
android:textSize="@dimen/medium_font_size"
|
||||||
android:textIsSelectable="true"
|
android:textIsSelectable="true"
|
||||||
android:text="05987d601943c267879be41830888066c6a024cbdc9a548d06813924bf3372ea78" />
|
android:text="05987d601943c267879be41830888066c6a024cbdc9a548d06813924bf3372ea78" />
|
||||||
|
|
||||||
|
@ -813,8 +813,10 @@
|
|||||||
<string name="activity_backup_restore_select_file">Select a file</string>
|
<string name="activity_backup_restore_select_file">Select a file</string>
|
||||||
<string name="activity_backup_restore_explanation_1">Select a backup file and enter the passphrase it was created with.</string>
|
<string name="activity_backup_restore_explanation_1">Select a backup file and enter the passphrase it was created with.</string>
|
||||||
<string name="activity_backup_restore_passphrase">30-digit passphrase</string>
|
<string name="activity_backup_restore_passphrase">30-digit passphrase</string>
|
||||||
<!-- LinkDeviceActivity -->
|
|
||||||
<string name="activity_link_device_skip_prompt">This is taking a while, would you like to skip?</string>
|
<string name="activity_link_device_skip_prompt">This is taking a while, would you like to skip?</string>
|
||||||
<string name="activity_join_public_chat_join_rooms">Or join one of these…</string>
|
<string name="activity_join_public_chat_join_rooms">Or join one of these…</string>
|
||||||
|
|
||||||
|
<string name="fragment_user_details_bottom_sheet_edit_text_hint">Enter a nickname</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -137,7 +137,7 @@
|
|||||||
<style name="SessionIDTextView">
|
<style name="SessionIDTextView">
|
||||||
<item name="android:background">@drawable/session_id_text_view_background</item>
|
<item name="android:background">@drawable/session_id_text_view_background</item>
|
||||||
<item name="android:padding">@dimen/medium_spacing</item>
|
<item name="android:padding">@dimen/medium_spacing</item>
|
||||||
<item name="android:textSize">@dimen/large_font_size</item>
|
<item name="android:textSize">20sp</item>
|
||||||
<item name="android:textColor">@color/text</item>
|
<item name="android:textColor">@color/text</item>
|
||||||
<item name="android:fontFamily">@font/space_mono_regular</item>
|
<item name="android:fontFamily">@font/space_mono_regular</item>
|
||||||
<item name="android:textAlignment">viewStart</item>
|
<item name="android:textAlignment">viewStart</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user