mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 21:29:54 +01:00
Show paperclip icon for non-text messages.
This commit is contained in:
@@ -22,8 +22,8 @@ import android.text.format.DateUtils;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
class ConversationAdapter extends ArrayAdapter<ConversationItem> {
|
class ConversationAdapter extends ArrayAdapter<ConversationItem> {
|
||||||
@@ -64,7 +64,7 @@ class ConversationAdapter extends ArrayAdapter<ConversationItem> {
|
|||||||
date.setText(DateUtils.formatSameDayTime(then, now, SHORT, SHORT));
|
date.setText(DateUtils.formatSameDayTime(then, now, SHORT, SHORT));
|
||||||
headerLayout.addView(date);
|
headerLayout.addView(date);
|
||||||
|
|
||||||
if(!item.isExpanded()) return headerLayout;
|
if(!item.isExpanded() || item.getBody() == null) return headerLayout;
|
||||||
|
|
||||||
LinearLayout expanded = new LinearLayout(ctx);
|
LinearLayout expanded = new LinearLayout(ctx);
|
||||||
expanded.setOrientation(VERTICAL);
|
expanded.setOrientation(VERTICAL);
|
||||||
@@ -72,18 +72,17 @@ class ConversationAdapter extends ArrayAdapter<ConversationItem> {
|
|||||||
expanded.setBackgroundColor(background);
|
expanded.setBackgroundColor(background);
|
||||||
expanded.addView(headerLayout);
|
expanded.addView(headerLayout);
|
||||||
|
|
||||||
byte[] body = item.getBody();
|
if(header.getContentType().equals("text/plain")) {
|
||||||
if(body == null) {
|
|
||||||
ProgressBar progress = new ProgressBar(ctx);
|
|
||||||
progress.setPadding(pad, 0, pad, pad);
|
|
||||||
progress.setIndeterminate(true);
|
|
||||||
expanded.addView(progress);
|
|
||||||
} else if(header.getContentType().equals("text/plain")) {
|
|
||||||
TextView text = new TextView(ctx);
|
TextView text = new TextView(ctx);
|
||||||
text.setPadding(pad, 0, pad, pad);
|
text.setPadding(pad, 0, pad, pad);
|
||||||
text.setBackgroundColor(background);
|
text.setBackgroundColor(background);
|
||||||
text.setText(StringUtils.fromUtf8(body));
|
text.setText(StringUtils.fromUtf8(item.getBody()));
|
||||||
expanded.addView(text);
|
expanded.addView(text);
|
||||||
|
} else {
|
||||||
|
ImageButton attachment = new ImageButton(ctx);
|
||||||
|
attachment.setPadding(pad, 0, pad, pad);
|
||||||
|
attachment.setImageResource(R.drawable.content_attachment);
|
||||||
|
expanded.addView(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
return expanded;
|
return expanded;
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ import android.text.format.DateUtils;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ImageButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
class GroupAdapter extends ArrayAdapter<GroupItem> {
|
class GroupAdapter extends ArrayAdapter<GroupItem> {
|
||||||
@@ -66,7 +66,7 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
|
|||||||
date.setText(DateUtils.formatSameDayTime(then, now, SHORT, SHORT));
|
date.setText(DateUtils.formatSameDayTime(then, now, SHORT, SHORT));
|
||||||
headerLayout.addView(date);
|
headerLayout.addView(date);
|
||||||
|
|
||||||
if(!item.isExpanded()) return headerLayout;
|
if(!item.isExpanded() || item.getBody() == null) return headerLayout;
|
||||||
|
|
||||||
LinearLayout expanded = new LinearLayout(ctx);
|
LinearLayout expanded = new LinearLayout(ctx);
|
||||||
expanded.setOrientation(VERTICAL);
|
expanded.setOrientation(VERTICAL);
|
||||||
@@ -74,20 +74,19 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
|
|||||||
expanded.setBackgroundColor(background);
|
expanded.setBackgroundColor(background);
|
||||||
expanded.addView(headerLayout);
|
expanded.addView(headerLayout);
|
||||||
|
|
||||||
byte[] body = item.getBody();
|
if(header.getContentType().equals("text/plain")) {
|
||||||
if(body == null) {
|
|
||||||
ProgressBar progress = new ProgressBar(ctx);
|
|
||||||
progress.setPadding(pad, 0, pad, pad);
|
|
||||||
progress.setIndeterminate(true);
|
|
||||||
expanded.addView(progress);
|
|
||||||
} else if(header.getContentType().equals("text/plain")) {
|
|
||||||
TextView text = new TextView(ctx);
|
TextView text = new TextView(ctx);
|
||||||
text.setPadding(pad, 0, pad, pad);
|
text.setPadding(pad, 0, pad, pad);
|
||||||
text.setBackgroundColor(background);
|
text.setBackgroundColor(background);
|
||||||
text.setText(StringUtils.fromUtf8(body));
|
text.setText(StringUtils.fromUtf8(item.getBody()));
|
||||||
expanded.addView(text);
|
expanded.addView(text);
|
||||||
|
} else {
|
||||||
|
ImageButton attachment = new ImageButton(ctx);
|
||||||
|
attachment.setPadding(pad, 0, pad, pad);
|
||||||
|
attachment.setImageResource(R.drawable.content_attachment);
|
||||||
|
expanded.addView(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
return expanded;
|
return expanded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user