mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Show bomb icon for messages with auto-destruct timer
This commit is contained in:
@@ -22,7 +22,7 @@ abstract class ConversationItem {
|
||||
protected String text;
|
||||
private final MessageId id;
|
||||
private final GroupId groupId;
|
||||
private final long time;
|
||||
private final long time, autoDeleteTimer;
|
||||
private final boolean isIncoming;
|
||||
private boolean read, sent, seen;
|
||||
|
||||
@@ -32,6 +32,7 @@ abstract class ConversationItem {
|
||||
this.id = h.getId();
|
||||
this.groupId = h.getGroupId();
|
||||
this.time = h.getTimestamp();
|
||||
this.autoDeleteTimer = h.getAutoDeleteTimer();
|
||||
this.read = h.isRead();
|
||||
this.sent = h.isSent();
|
||||
this.seen = h.isSeen();
|
||||
@@ -68,6 +69,10 @@ abstract class ConversationItem {
|
||||
return time;
|
||||
}
|
||||
|
||||
public long getAutoDeleteTimer() {
|
||||
return autoDeleteTimer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only useful for incoming messages.
|
||||
*/
|
||||
|
||||
@@ -12,8 +12,11 @@ import androidx.annotation.UiThread;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static org.briarproject.bramble.util.StringUtils.trim;
|
||||
import static org.briarproject.briar.android.util.UiUtils.formatDate;
|
||||
import static org.briarproject.briar.api.autodelete.AutoDeleteConstants.NO_AUTO_DELETE_TIMER;
|
||||
|
||||
@UiThread
|
||||
@NotNullByDefault
|
||||
@@ -26,6 +29,7 @@ abstract class ConversationItemViewHolder extends ViewHolder {
|
||||
private final OutItemViewHolder outViewHolder;
|
||||
private final TextView text;
|
||||
protected final TextView time;
|
||||
private final View bomb;
|
||||
@Nullable
|
||||
private String itemKey = null;
|
||||
|
||||
@@ -38,6 +42,7 @@ abstract class ConversationItemViewHolder extends ViewHolder {
|
||||
layout = v.findViewById(R.id.layout);
|
||||
text = v.findViewById(R.id.text);
|
||||
time = v.findViewById(R.id.time);
|
||||
bomb = v.findViewById(R.id.bomb);
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@@ -52,6 +57,9 @@ abstract class ConversationItemViewHolder extends ViewHolder {
|
||||
long timestamp = item.getTime();
|
||||
time.setText(formatDate(time.getContext(), timestamp));
|
||||
|
||||
boolean showBomb = item.getAutoDeleteTimer() != NO_AUTO_DELETE_TIMER;
|
||||
bomb.setVisibility(showBomb ? VISIBLE : GONE);
|
||||
|
||||
if (outViewHolder != null) outViewHolder.bind(item);
|
||||
}
|
||||
|
||||
|
||||
9
briar-android/src/main/res/drawable/ic_bomb.xml
Normal file
9
briar-android/src/main/res/drawable/ic_bomb.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="16dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M11.25,6A3.25,3.25 0 0,1 14.5,2.75A3.25,3.25 0 0,1 17.75,6C17.75,6.42 18.08,6.75 18.5,6.75C18.92,6.75 19.25,6.42 19.25,6V5.25H20.75V6A2.25,2.25 0 0,1 18.5,8.25A2.25,2.25 0 0,1 16.25,6A1.75,1.75 0 0,0 14.5,4.25A1.75,1.75 0 0,0 12.75,6H14V7.29C16.89,8.15 19,10.83 19,14A7,7 0 0,1 12,21A7,7 0 0,1 5,14C5,10.83 7.11,8.15 10,7.29V6H11.25M22,6H24V7H22V6M19,4V2H20V4H19M20.91,4.38L22.33,2.96L23.04,3.67L21.62,5.09L20.91,4.38Z" />
|
||||
</vector>
|
||||
@@ -68,6 +68,16 @@
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Dec 24, 13:37" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bomb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
app:srcCompat="@drawable/ic_bomb"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -67,6 +67,16 @@
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Dec 24, 13:37" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bomb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
app:srcCompat="@drawable/ic_bomb"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -68,6 +68,17 @@
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Dec 24, 13:37" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bomb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
app:srcCompat="@drawable/ic_bomb"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -73,11 +73,20 @@
|
||||
style="@style/TextMessage.Timestamp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:textColor="@color/private_message_date_inverse"
|
||||
tools:text="Dec 24, 13:37" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bomb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
app:srcCompat="@drawable/ic_bomb"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -48,10 +48,28 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_timestamp_margin"
|
||||
app:layout_constraintEnd_toEndOf="@+id/text"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bomb"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text"
|
||||
tools:text="Dec 24, 13:37" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bomb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="@dimen/message_bubble_timestamp_margin"
|
||||
app:layout_constraintEnd_toEndOf="@+id/text"
|
||||
app:layout_constraintStart_toEndOf="@+id/time"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text"
|
||||
app:srcCompat="@drawable/ic_bomb"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -55,14 +55,26 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/text"
|
||||
tools:text="Dec 24, 13:37" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bomb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/time"
|
||||
app:layout_constraintStart_toEndOf="@+id/time"
|
||||
app:layout_constraintTop_toTopOf="@+id/time"
|
||||
app:srcCompat="@drawable/ic_bomb"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/margin_medium"
|
||||
android:layout_marginLeft="@dimen/margin_medium"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/time"
|
||||
app:layout_constraintStart_toEndOf="@+id/time"
|
||||
app:layout_constraintStart_toEndOf="@+id/bomb"
|
||||
app:layout_constraintTop_toTopOf="@+id/time"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:src="@drawable/message_delivered" />
|
||||
|
||||
@@ -68,10 +68,27 @@
|
||||
style="@style/TextMessage.Timestamp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/bomb"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/acceptButton"
|
||||
tools:text="Dec 24, 13:37" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bomb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/time"
|
||||
app:layout_constraintTop_toBottomOf="@+id/acceptButton"
|
||||
app:srcCompat="@drawable/ic_bomb"
|
||||
app:tint="?android:attr/textColorSecondary"
|
||||
tools:ignore="ContentDescription"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user