kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix row selection in new bottom sheet.
rodzic
42d2799264
commit
2d29298ec4
|
@ -5,6 +5,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
import org.signal.core.util.ThreadUtil
|
||||||
import org.thoughtcrime.securesms.contacts.paged.ContactSearchKey
|
import org.thoughtcrime.securesms.contacts.paged.ContactSearchKey
|
||||||
import org.thoughtcrime.securesms.database.IdentityDatabase
|
import org.thoughtcrime.securesms.database.IdentityDatabase
|
||||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||||
|
@ -20,7 +21,7 @@ import org.thoughtcrime.securesms.testing.SignalActivityRule
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class SafetyNumberChangeDialogPreviewer {
|
class SafetyNumberChangeDialogPreviewer {
|
||||||
|
|
||||||
@get:Rule val harness = SignalActivityRule(othersCount = 10)
|
@get:Rule val harness = SignalActivityRule(othersCount = 5)
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testShowLongName() {
|
fun testShowLongName() {
|
||||||
|
@ -46,7 +47,7 @@ class SafetyNumberChangeDialogPreviewer {
|
||||||
othersRecipients.forEach { other ->
|
othersRecipients.forEach { other ->
|
||||||
SignalDatabase.recipients.setProfileName(other.id, ProfileName.fromParts("My", "Name"))
|
SignalDatabase.recipients.setProfileName(other.id, ProfileName.fromParts("My", "Name"))
|
||||||
|
|
||||||
harness.setVerified(other, IdentityDatabase.VerifiedStatus.VERIFIED)
|
harness.setVerified(other, IdentityDatabase.VerifiedStatus.DEFAULT)
|
||||||
harness.changeIdentityKey(other)
|
harness.changeIdentityKey(other)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +62,6 @@ class SafetyNumberChangeDialogPreviewer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncomment to make dialog stay on screen, otherwise will show/dismiss immediately
|
// Uncomment to make dialog stay on screen, otherwise will show/dismiss immediately
|
||||||
// ThreadUtil.sleep(15000)
|
ThreadUtil.sleep(15000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.safety
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import org.signal.core.util.DimensionUnit
|
||||||
import org.signal.core.util.or
|
import org.signal.core.util.or
|
||||||
import org.thoughtcrime.securesms.R
|
import org.thoughtcrime.securesms.R
|
||||||
import org.thoughtcrime.securesms.components.AvatarImageView
|
import org.thoughtcrime.securesms.components.AvatarImageView
|
||||||
|
@ -47,7 +48,6 @@ object SafetyNumberRecipientRowItem {
|
||||||
private val avatar: AvatarImageView = itemView.findViewById(R.id.safety_number_recipient_avatar)
|
private val avatar: AvatarImageView = itemView.findViewById(R.id.safety_number_recipient_avatar)
|
||||||
private val name: TextView = itemView.findViewById(R.id.safety_number_recipient_name)
|
private val name: TextView = itemView.findViewById(R.id.safety_number_recipient_name)
|
||||||
private val identifier: TextView = itemView.findViewById(R.id.safety_number_recipient_identifier)
|
private val identifier: TextView = itemView.findViewById(R.id.safety_number_recipient_identifier)
|
||||||
private val menu: View = itemView.findViewById(R.id.safety_number_recipient_menu)
|
|
||||||
|
|
||||||
override fun bind(model: Model) {
|
override fun bind(model: Model) {
|
||||||
avatar.setRecipient(model.recipient)
|
avatar.setRecipient(model.recipient)
|
||||||
|
@ -62,8 +62,12 @@ object SafetyNumberRecipientRowItem {
|
||||||
|
|
||||||
identifier.text = subLineText
|
identifier.text = subLineText
|
||||||
identifier.visible = !subLineText.isNullOrBlank()
|
identifier.visible = !subLineText.isNullOrBlank()
|
||||||
menu.setOnClickListener {
|
|
||||||
|
itemView.setOnClickListener {
|
||||||
|
itemView.isSelected = true
|
||||||
SignalContextMenu.Builder(itemView, itemView.rootView as ViewGroup)
|
SignalContextMenu.Builder(itemView, itemView.rootView as ViewGroup)
|
||||||
|
.offsetY(DimensionUnit.DP.toPixels(12f).toInt())
|
||||||
|
.onDismiss { itemView.isSelected = false }
|
||||||
.show(model.getContextMenuActions(model))
|
.show(model.getContextMenuActions(model))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,22 +4,25 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/dsl_settings_gutter"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginEnd="4dp"
|
android:layout_marginEnd="12dp"
|
||||||
|
android:background="@drawable/selectable_list_item_background"
|
||||||
android:minHeight="64dp">
|
android:minHeight="64dp">
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.AvatarImageView
|
<org.thoughtcrime.securesms.components.AvatarImageView
|
||||||
android:id="@+id/safety_number_recipient_avatar"
|
android:id="@+id/safety_number_recipient_avatar"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/safety_number_recipient_menu"
|
android:id="@+id/safety_number_recipient_menu"
|
||||||
android:layout_width="48dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="48dp"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
android:contentDescription="@string/SafetyNumberRecipientRowItem__open_context_menu"
|
android:contentDescription="@string/SafetyNumberRecipientRowItem__open_context_menu"
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<dimen name="dsl_settings_gutter">24dp</dimen>
|
<dimen name="dsl_settings_gutter">24dp</dimen>
|
||||||
<dimen name="media_overview_toggle_gutter">10dp</dimen>
|
<dimen name="media_overview_toggle_gutter">10dp</dimen>
|
||||||
<dimen name="wallpaper_selection_gutter">16dp</dimen>
|
<dimen name="wallpaper_selection_gutter">16dp</dimen>
|
||||||
|
<dimen name="safety_number_recipient_row_item_gutter">12dp</dimen>
|
||||||
|
|
||||||
<dimen name="chat_colors_preview_bubble_max_width">260dp</dimen>
|
<dimen name="chat_colors_preview_bubble_max_width">260dp</dimen>
|
||||||
|
|
||||||
|
|
|
@ -199,6 +199,7 @@
|
||||||
<dimen name="dsl_settings_gutter">16dp</dimen>
|
<dimen name="dsl_settings_gutter">16dp</dimen>
|
||||||
<dimen name="media_overview_toggle_gutter">2dp</dimen>
|
<dimen name="media_overview_toggle_gutter">2dp</dimen>
|
||||||
<dimen name="wallpaper_selection_gutter">8dp</dimen>
|
<dimen name="wallpaper_selection_gutter">8dp</dimen>
|
||||||
|
<dimen name="safety_number_recipient_row_item_gutter">4dp</dimen>
|
||||||
|
|
||||||
<dimen name="chat_colors_preview_bubble_max_width">240dp</dimen>
|
<dimen name="chat_colors_preview_bubble_max_width">240dp</dimen>
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue