mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Show attachment icon if newest message in group is not plain text.
This commit is contained in:
@@ -17,6 +17,7 @@ import net.sf.briar.android.widgets.HorizontalSpace;
|
||||
import net.sf.briar.api.Rating;
|
||||
import net.sf.briar.api.db.GroupMessageHeader;
|
||||
import net.sf.briar.api.messaging.Author;
|
||||
import net.sf.briar.util.StringUtils;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.text.format.DateUtils;
|
||||
@@ -82,13 +83,15 @@ class GroupAdapter extends ArrayAdapter<GroupMessageHeader> {
|
||||
innerLayout.addView(authorLayout);
|
||||
|
||||
if(item.getContentType().equals("text/plain")) {
|
||||
TextView subject = new TextView(ctx);
|
||||
subject.setTextSize(14);
|
||||
subject.setMaxLines(2);
|
||||
subject.setPadding(10, 0, 10, 10);
|
||||
if(!item.isRead()) subject.setTypeface(null, BOLD);
|
||||
subject.setText(item.getSubject());
|
||||
innerLayout.addView(subject);
|
||||
if(!StringUtils.isNullOrEmpty(item.getSubject())) {
|
||||
TextView subject = new TextView(ctx);
|
||||
subject.setTextSize(14);
|
||||
subject.setMaxLines(2);
|
||||
subject.setPadding(10, 0, 10, 10);
|
||||
if(!item.isRead()) subject.setTypeface(null, BOLD);
|
||||
subject.setText(item.getSubject());
|
||||
innerLayout.addView(subject);
|
||||
}
|
||||
} else {
|
||||
LinearLayout attachmentLayout = new LinearLayout(ctx);
|
||||
attachmentLayout.setOrientation(HORIZONTAL);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.sf.briar.android.groups;
|
||||
|
||||
import static android.graphics.Typeface.BOLD;
|
||||
import static android.view.Gravity.LEFT;
|
||||
import static android.widget.LinearLayout.HORIZONTAL;
|
||||
import static android.widget.LinearLayout.VERTICAL;
|
||||
import static java.text.DateFormat.SHORT;
|
||||
@@ -10,6 +9,7 @@ import java.util.ArrayList;
|
||||
|
||||
import net.sf.briar.R;
|
||||
import net.sf.briar.android.widgets.CommonLayoutParams;
|
||||
import net.sf.briar.android.widgets.HorizontalSpace;
|
||||
import net.sf.briar.util.StringUtils;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -20,6 +20,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -46,7 +47,6 @@ implements OnItemClickListener {
|
||||
// Give me all the unused width
|
||||
innerLayout.setLayoutParams(CommonLayoutParams.WRAP_WRAP_1);
|
||||
innerLayout.setOrientation(VERTICAL);
|
||||
innerLayout.setGravity(LEFT);
|
||||
|
||||
TextView name = new TextView(ctx);
|
||||
name.setTextSize(18);
|
||||
@@ -57,14 +57,25 @@ implements OnItemClickListener {
|
||||
else name.setText(item.getGroupName());
|
||||
innerLayout.addView(name);
|
||||
|
||||
if(!StringUtils.isNullOrEmpty(item.getSubject())) {
|
||||
TextView subject = new TextView(ctx);
|
||||
subject.setTextSize(14);
|
||||
subject.setMaxLines(2);
|
||||
subject.setPadding(10, 0, 10, 10);
|
||||
if(unread > 0) subject.setTypeface(null, BOLD);
|
||||
subject.setText(item.getSubject());
|
||||
innerLayout.addView(subject);
|
||||
if(item.getContentType().equals("text/plain")) {
|
||||
if(!StringUtils.isNullOrEmpty(item.getSubject())) {
|
||||
TextView subject = new TextView(ctx);
|
||||
subject.setTextSize(14);
|
||||
subject.setMaxLines(2);
|
||||
subject.setPadding(10, 0, 10, 10);
|
||||
if(item.getUnreadCount() > 0) subject.setTypeface(null, BOLD);
|
||||
subject.setText(item.getSubject());
|
||||
innerLayout.addView(subject);
|
||||
}
|
||||
} else {
|
||||
LinearLayout attachmentLayout = new LinearLayout(ctx);
|
||||
attachmentLayout.setOrientation(HORIZONTAL);
|
||||
ImageView attachment = new ImageView(ctx);
|
||||
attachment.setPadding(10, 0, 10, 10);
|
||||
attachment.setImageResource(R.drawable.content_attachment);
|
||||
attachmentLayout.addView(attachment);
|
||||
attachmentLayout.addView(new HorizontalSpace(ctx));
|
||||
innerLayout.addView(attachmentLayout);
|
||||
}
|
||||
layout.addView(innerLayout);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.sf.briar.api.messaging.GroupId;
|
||||
class GroupListItem {
|
||||
|
||||
private final Group group;
|
||||
private final String authorName, subject;
|
||||
private final String authorName, contentType, subject;
|
||||
private final long timestamp;
|
||||
private final int unread;
|
||||
|
||||
@@ -24,6 +24,7 @@ class GroupListItem {
|
||||
Author a = newest.getAuthor();
|
||||
if(a == null) authorName = null;
|
||||
else authorName = a.getName();
|
||||
contentType = newest.getContentType();
|
||||
subject = newest.getSubject();
|
||||
timestamp = newest.getTimestamp();
|
||||
int unread = 0;
|
||||
@@ -43,6 +44,10 @@ class GroupListItem {
|
||||
return authorName;
|
||||
}
|
||||
|
||||
String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
|
||||
String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user