kopia lustrzana https://github.com/ryukoposting/Signal-Android
Adjust badge positioning.
rodzic
5bcb7cece4
commit
19a95f479e
|
@ -25,12 +25,20 @@ class BadgeImageView @JvmOverloads constructor(
|
||||||
context.obtainStyledAttributes(attrs, R.styleable.BadgeImageView).use {
|
context.obtainStyledAttributes(attrs, R.styleable.BadgeImageView).use {
|
||||||
badgeSize = it.getInt(R.styleable.BadgeImageView_badge_size, 0)
|
badgeSize = it.getInt(R.styleable.BadgeImageView_badge_size, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isClickable = false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setOnClickListener(l: OnClickListener?) {
|
||||||
|
val wasClickable = isClickable
|
||||||
|
super.setOnClickListener(l)
|
||||||
|
this.isClickable = wasClickable
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setBadgeFromRecipient(recipient: Recipient?) {
|
fun setBadgeFromRecipient(recipient: Recipient?) {
|
||||||
getGlideRequests()?.let {
|
getGlideRequests()?.let {
|
||||||
setBadgeFromRecipient(recipient, it)
|
setBadgeFromRecipient(recipient, it)
|
||||||
} ?: setImageDrawable(null)
|
} ?: clearDrawable()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setBadgeFromRecipient(recipient: Recipient?, glideRequests: GlideRequests) {
|
fun setBadgeFromRecipient(recipient: Recipient?, glideRequests: GlideRequests) {
|
||||||
|
@ -44,7 +52,7 @@ class BadgeImageView @JvmOverloads constructor(
|
||||||
fun setBadge(badge: Badge?) {
|
fun setBadge(badge: Badge?) {
|
||||||
getGlideRequests()?.let {
|
getGlideRequests()?.let {
|
||||||
setBadge(badge, it)
|
setBadge(badge, it)
|
||||||
} ?: setImageDrawable(null)
|
} ?: clearDrawable()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setBadge(badge: Badge?, glideRequests: GlideRequests) {
|
fun setBadge(badge: Badge?, glideRequests: GlideRequests) {
|
||||||
|
@ -54,13 +62,20 @@ class BadgeImageView @JvmOverloads constructor(
|
||||||
.downsample(DownsampleStrategy.NONE)
|
.downsample(DownsampleStrategy.NONE)
|
||||||
.transform(BadgeSpriteTransformation(BadgeSpriteTransformation.Size.fromInteger(badgeSize), badge.imageDensity, ThemeUtil.isDarkTheme(context)))
|
.transform(BadgeSpriteTransformation(BadgeSpriteTransformation.Size.fromInteger(badgeSize), badge.imageDensity, ThemeUtil.isDarkTheme(context)))
|
||||||
.into(this)
|
.into(this)
|
||||||
|
|
||||||
|
isClickable = true
|
||||||
} else {
|
} else {
|
||||||
glideRequests
|
glideRequests
|
||||||
.clear(this)
|
.clear(this)
|
||||||
setImageDrawable(null)
|
clearDrawable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun clearDrawable() {
|
||||||
|
setImageDrawable(null)
|
||||||
|
isClickable = false
|
||||||
|
}
|
||||||
|
|
||||||
private fun getGlideRequests(): GlideRequests? {
|
private fun getGlideRequests(): GlideRequests? {
|
||||||
return try {
|
return try {
|
||||||
GlideApp.with(this)
|
GlideApp.with(this)
|
||||||
|
|
|
@ -152,7 +152,11 @@ public final class RecipientBottomSheetDialogFragment extends BottomSheetDialogF
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
avatar.setAvatar(recipient);
|
avatar.setAvatar(recipient);
|
||||||
badgeImageView.setBadgeFromRecipient(recipient);
|
|
||||||
|
if (!recipient.isSelf()) {
|
||||||
|
badgeImageView.setBadgeFromRecipient(recipient);
|
||||||
|
}
|
||||||
|
|
||||||
if (recipient.isSelf()) {
|
if (recipient.isSelf()) {
|
||||||
avatar.setOnClickListener(v -> {
|
avatar.setOnClickListener(v -> {
|
||||||
dismiss();
|
dismiss();
|
||||||
|
|
|
@ -39,15 +39,14 @@
|
||||||
android:id="@+id/check_box"
|
android:id="@+id/check_box"
|
||||||
android:layout_width="22dp"
|
android:layout_width="22dp"
|
||||||
android:layout_height="22dp"
|
android:layout_height="22dp"
|
||||||
android:layout_marginStart="20dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:alpha="0"
|
android:alpha="0"
|
||||||
android:background="@drawable/contact_selection_checkbox"
|
android:background="@drawable/contact_selection_checkbox"
|
||||||
android:button="@null"
|
android:button="@null"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
app:layout_constraintStart_toStartOf="@id/contact_photo_image"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/contact_photo_image" />
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.FromTextView
|
<org.thoughtcrime.securesms.components.FromTextView
|
||||||
android:id="@+id/name"
|
android:id="@+id/name"
|
||||||
|
@ -104,13 +103,15 @@
|
||||||
android:id="@+id/sms_tag"
|
android:id="@+id/sms_tag"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
android:text="@string/ContactSelectionListItem__sms"
|
android:text="@string/ContactSelectionListItem__sms"
|
||||||
android:textAppearance="@style/TextAppearance.Signal.Body2"
|
android:textAppearance="@style/TextAppearance.Signal.Body2"
|
||||||
android:textColor="@color/signal_text_secondary"
|
android:textColor="@color/signal_text_secondary"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toStartOf="@id/check_box"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_goneMarginEnd="0dp"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.contacts.ContactSelectionListItem>
|
</org.thoughtcrime.securesms.contacts.ContactSelectionListItem>
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.badges.BadgeImageView
|
<org.thoughtcrime.securesms.badges.BadgeImageView
|
||||||
android:id="@+id/message_request_badge"
|
android:id="@+id/message_request_badge"
|
||||||
android:layout_width="32dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="36dp"
|
||||||
android:layout_marginStart="47dp"
|
android:layout_marginStart="44dp"
|
||||||
android:layout_marginTop="48dp"
|
android:layout_marginTop="52dp"
|
||||||
android:contentDescription="@string/ImageView__badge"
|
android:contentDescription="@string/ImageView__badge"
|
||||||
app:badge_size="large"
|
app:badge_size="large"
|
||||||
app:layout_constraintStart_toStartOf="@id/message_request_avatar"
|
app:layout_constraintStart_toStartOf="@id/message_request_avatar"
|
||||||
|
|
|
@ -178,8 +178,8 @@
|
||||||
android:id="@+id/conversation_list_item_badge"
|
android:id="@+id/conversation_list_item_badge"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:layout_marginStart="26dp"
|
android:layout_marginStart="28dp"
|
||||||
android:layout_marginTop="26dp"
|
android:layout_marginTop="30dp"
|
||||||
android:contentDescription="@string/ImageView__badge"
|
android:contentDescription="@string/ImageView__badge"
|
||||||
app:badge_size="medium"
|
app:badge_size="medium"
|
||||||
app:layout_constraintStart_toStartOf="@id/conversation_list_item_avatar"
|
app:layout_constraintStart_toStartOf="@id/conversation_list_item_avatar"
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.badges.BadgeImageView
|
<org.thoughtcrime.securesms.badges.BadgeImageView
|
||||||
android:id="@+id/bio_preference_badge"
|
android:id="@+id/bio_preference_badge"
|
||||||
android:layout_width="32dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="36dp"
|
||||||
android:layout_marginStart="47dp"
|
android:layout_marginStart="44dp"
|
||||||
android:layout_marginTop="48dp"
|
android:layout_marginTop="52dp"
|
||||||
android:contentDescription="@string/ImageView__badge"
|
android:contentDescription="@string/ImageView__badge"
|
||||||
app:badge_size="large"
|
app:badge_size="large"
|
||||||
app:layout_constraintStart_toStartOf="@id/bio_preference_avatar"
|
app:layout_constraintStart_toStartOf="@id/bio_preference_avatar"
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
android:layout_height="16dp"
|
android:layout_height="16dp"
|
||||||
android:layout_alignStart="@id/contact_photo_image"
|
android:layout_alignStart="@id/contact_photo_image"
|
||||||
android:layout_alignTop="@id/contact_photo_image"
|
android:layout_alignTop="@id/contact_photo_image"
|
||||||
android:layout_marginStart="22dp"
|
android:layout_marginStart="20dp"
|
||||||
android:layout_marginTop="22dp"
|
android:layout_marginTop="23dp"
|
||||||
android:contentDescription="@string/ImageView__badge"
|
android:contentDescription="@string/ImageView__badge"
|
||||||
app:badge_size="small" />
|
app:badge_size="small" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.badges.BadgeImageView
|
<org.thoughtcrime.securesms.badges.BadgeImageView
|
||||||
android:id="@+id/rbs_badge"
|
android:id="@+id/rbs_badge"
|
||||||
android:layout_width="32dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="36dp"
|
||||||
android:layout_marginStart="47dp"
|
android:layout_marginStart="44dp"
|
||||||
android:layout_marginTop="48dp"
|
android:layout_marginTop="52dp"
|
||||||
android:contentDescription="@string/ImageView__badge"
|
android:contentDescription="@string/ImageView__badge"
|
||||||
app:badge_size="large"
|
app:badge_size="large"
|
||||||
app:layout_constraintStart_toStartOf="@id/rbs_recipient_avatar"
|
app:layout_constraintStart_toStartOf="@id/rbs_recipient_avatar"
|
||||||
|
|
Ładowanie…
Reference in New Issue