SES-3367 - properly allowing for user name edit in groups (#963)

pull/1710/head
ThomasSession 1 month ago committed by GitHub
parent 097dc273b0
commit b412bf16ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -165,6 +165,7 @@ import org.thoughtcrime.securesms.database.model.ReactionRecord
import org.thoughtcrime.securesms.dependencies.ConfigFactory
import org.thoughtcrime.securesms.giph.ui.GiphyActivity
import org.thoughtcrime.securesms.groups.OpenGroupManager
import org.thoughtcrime.securesms.home.UserDetailsBottomSheet
import org.thoughtcrime.securesms.home.search.getSearchName
import org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository
import org.thoughtcrime.securesms.linkpreview.LinkPreviewUtil
@ -220,7 +221,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
ConversationActionModeCallbackDelegate, VisibleMessageViewDelegate, RecipientModifiedListener,
SearchBottomBar.EventListener, LoaderManager.LoaderCallbacks<Cursor>, ConversationActionBarDelegate,
OnReactionSelectedListener, ReactWithAnyEmojiDialogFragment.Callback, ReactionsDialogFragment.Callback,
ConversationMenuHelper.ConversationMenuListener {
ConversationMenuHelper.ConversationMenuListener, UserDetailsBottomSheet.UserDetailsBottomSheetCallback {
private lateinit var binding: ActivityConversationV2Binding
@ -2473,6 +2474,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
this.searchViewModel.onMoveDown()
}
override fun onNicknameSaved() {
adapter.notifyDataSetChanged()
}
private fun jumpToMessage(author: Address, timestamp: Long, highlight: Boolean, onMessageNotFound: Runnable?) {
SimpleTask.run(lifecycle, {
mmsSmsDb.getMessagePositionInConversation(viewModel.threadId, timestamp, author, reverseMessageList)

@ -24,6 +24,7 @@ import org.session.libsession.utilities.Address
import org.session.libsession.utilities.recipients.Recipient
import org.session.libsignal.utilities.IdPrefix
import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2
import org.thoughtcrime.securesms.database.DatabaseContentProviders
import org.thoughtcrime.securesms.database.ThreadDatabase
import javax.inject.Inject
@ -86,7 +87,7 @@ class UserDetailsBottomSheet: BottomSheetDialogFragment() {
}
nameTextView.text = recipient.name
nameEditIcon.isVisible = threadRecipient.isContactRecipient
nameEditIcon.isVisible = recipient.isContactRecipient
&& !threadRecipient.isCommunityInboxRecipient
&& !threadRecipient.isCommunityOutboxRecipient
@ -141,6 +142,9 @@ class UserDetailsBottomSheet: BottomSheetDialogFragment() {
contact.nickname = newNickName
storage.setContact(contact)
nameTextView.text = recipient.name
(parentFragment as? UserDetailsBottomSheetCallback)
?: (requireActivity() as? UserDetailsBottomSheetCallback)?.onNicknameSaved()
}
@SuppressLint("ServiceCast")
@ -156,4 +160,8 @@ class UserDetailsBottomSheet: BottomSheetDialogFragment() {
val imm = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
imm?.hideSoftInputFromWindow(binding.nicknameEditText.windowToken, 0)
}
interface UserDetailsBottomSheetCallback {
fun onNicknameSaved()
}
}

@ -25,29 +25,26 @@
android:layout_marginTop="@dimen/medium_spacing"
android:gravity="center">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/nameTextViewContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/medium_spacing"
android:paddingEnd="@dimen/medium_spacing"
android:gravity="center"
android:orientation="horizontal"
android:layout_centerInParent="true"
android:visibility="visible">
<View
android:layout_width="24dp"
android:layout_height="24dp" />
<TextView
android:id="@+id/nameTextView"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="@dimen/small_spacing"
android:layout_marginEnd="@dimen/small_spacing"
app:layout_constraintWidth_max="wrap"
app:layout_constraintWidth_percent="0.8"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:textSize="@dimen/large_font_size"
android:textStyle="bold"
android:textColor="?android:textColorPrimary"
@ -58,14 +55,18 @@
android:id="@+id/nameEditIcon"
android:layout_width="20dp"
android:layout_height="22dp"
app:layout_constraintStart_toEndOf="@+id/nameTextView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="@dimen/small_spacing"
android:contentDescription="@string/AccessibilityId_displayNameNew"
android:paddingTop="2dp"
android:layout_marginEnd="20dp"
android:src="@drawable/ic_baseline_edit_24" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/nameEditTextContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -77,16 +78,24 @@
android:id="@+id/cancelNicknameEditingButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="@dimen/large_spacing"
app:layout_constraintEnd_toStartOf="@+id/nicknameEditText"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginEnd="@dimen/small_spacing"
android:contentDescription="@string/AccessibilityId_cancel"
android:src="@drawable/ic_baseline_clear_24" />
<EditText
android:id="@+id/nicknameEditText"
style="@style/SmallSessionEditText"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintWidth_max="wrap"
app:layout_constraintWidth_percent="0.8"
android:contentDescription="@string/AccessibilityId_displayName"
android:textAlignment="center"
android:paddingVertical="12dp"
@ -100,11 +109,14 @@
android:id="@+id/saveNicknameButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginRight="@dimen/large_spacing"
app:layout_constraintStart_toEndOf="@+id/nicknameEditText"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="@dimen/small_spacing"
android:contentDescription="@string/AccessibilityId_apply"
android:src="@drawable/ic_baseline_done_24" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>

Loading…
Cancel
Save