add location icon beside message time

This commit is contained in:
B. Petersen
2019-04-24 20:43:17 +02:00
parent d5bce6512e
commit aa14ed5107
5 changed files with 22 additions and 5 deletions
+6
View File
@@ -1117,6 +1117,12 @@ JNIEXPORT jboolean Java_com_b44t_messenger_DcMsg_hasDeviatingTimestamp(JNIEnv *e
}
JNIEXPORT jboolean Java_com_b44t_messenger_DcMsg_hasLocation(JNIEnv *env, jobject obj)
{
return dc_msg_has_location(get_dc_msg(env, obj))!=0;
}
JNIEXPORT jint Java_com_b44t_messenger_DcMsg_getType(JNIEnv *env, jobject obj)
{
return dc_msg_get_viewtype(get_dc_msg(env, obj));
Binary file not shown.

After

Width:  |  Height:  |  Size: 670 B

+10
View File
@@ -28,6 +28,16 @@
android:textColor="?conversation_item_outgoing_text_secondary_color"
tools:text="30 mins"/>
<ImageView
android:id="@+id/footer_location_indicator"
android:layout_width="12dp"
android:layout_height="11dp"
android:src="@drawable/ic_location_msg"
android:visibility="gone"
android:layout_gravity="center_vertical|end"
android:contentDescription="@string/location"
tools:visibility="gone"/>
<ImageView android:id="@+id/delivery_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+1
View File
@@ -59,6 +59,7 @@ public class DcMsg {
public native long getTimestamp ();
public native long getSortTimestamp ();
public native boolean hasDeviatingTimestamp();
public native boolean hasLocation ();
public native int getType ();
public native int getState ();
public native int getChatId ();
@@ -21,6 +21,7 @@ public class ConversationItemFooter extends LinearLayout {
private TextView dateView;
private ImageView secureIndicatorView;
private ImageView locationIndicatorView;
private DeliveryStatusView deliveryStatusView;
public ConversationItemFooter(Context context) {
@@ -43,6 +44,7 @@ public class ConversationItemFooter extends LinearLayout {
dateView = findViewById(R.id.footer_date);
secureIndicatorView = findViewById(R.id.footer_secure_indicator);
locationIndicatorView = findViewById(R.id.footer_location_indicator);
deliveryStatusView = new DeliveryStatusView(findViewById(R.id.delivery_indicator));
if (attrs != null) {
@@ -59,13 +61,15 @@ public class ConversationItemFooter extends LinearLayout {
public void setMessageRecord(@NonNull DcMsg messageRecord, @NonNull Locale locale) {
presentDate(messageRecord, locale);
presentSecureIndicator(messageRecord);
secureIndicatorView.setVisibility(messageRecord.isSecure() ? View.VISIBLE : View.GONE);
locationIndicatorView.setVisibility(messageRecord.hasLocation() ? View.VISIBLE : View.GONE);
presentDeliveryStatus(messageRecord);
}
public void setTextColor(int color) {
dateView.setTextColor(color);
secureIndicatorView.setColorFilter(color);
locationIndicatorView.setColorFilter(color);
deliveryStatusView.setTint(color);
}
@@ -79,10 +83,6 @@ public class ConversationItemFooter extends LinearLayout {
// }
}
private void presentSecureIndicator(@NonNull DcMsg messageRecord) {
secureIndicatorView.setVisibility(messageRecord.isSecure() ? View.VISIBLE : View.GONE);
}
private void presentDeliveryStatus(@NonNull DcMsg messageRecord) {
if (!messageRecord.isOutgoing()) deliveryStatusView.setNone();
else if (messageRecord.isRemoteRead()) deliveryStatusView.setRead();