diff --git a/briar-android/src/org/briarproject/android/contact/ConversationAdapter.java b/briar-android/src/org/briarproject/android/contact/ConversationAdapter.java index a48ed35b832598039f3b3db4cae137a32f5a0b5a..ff514ef239694cc67554a7d8aad617dc54bc1023 100644 --- a/briar-android/src/org/briarproject/android/contact/ConversationAdapter.java +++ b/briar-android/src/org/briarproject/android/contact/ConversationAdapter.java @@ -22,8 +22,8 @@ import android.text.format.DateUtils; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.ImageButton; import android.widget.LinearLayout; -import android.widget.ProgressBar; import android.widget.TextView; class ConversationAdapter extends ArrayAdapter<ConversationItem> { @@ -64,7 +64,7 @@ class ConversationAdapter extends ArrayAdapter<ConversationItem> { date.setText(DateUtils.formatSameDayTime(then, now, SHORT, SHORT)); headerLayout.addView(date); - if(!item.isExpanded()) return headerLayout; + if(!item.isExpanded() || item.getBody() == null) return headerLayout; LinearLayout expanded = new LinearLayout(ctx); expanded.setOrientation(VERTICAL); @@ -72,18 +72,17 @@ class ConversationAdapter extends ArrayAdapter<ConversationItem> { expanded.setBackgroundColor(background); expanded.addView(headerLayout); - byte[] body = item.getBody(); - 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")) { + if(header.getContentType().equals("text/plain")) { TextView text = new TextView(ctx); text.setPadding(pad, 0, pad, pad); text.setBackgroundColor(background); - text.setText(StringUtils.fromUtf8(body)); + text.setText(StringUtils.fromUtf8(item.getBody())); 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; diff --git a/briar-android/src/org/briarproject/android/groups/GroupAdapter.java b/briar-android/src/org/briarproject/android/groups/GroupAdapter.java index 1953666774ab33e92fb5b72c89b9b895a5d434ea..72de5bee563bbcb3c125bbb266ee87dfbd830c85 100644 --- a/briar-android/src/org/briarproject/android/groups/GroupAdapter.java +++ b/briar-android/src/org/briarproject/android/groups/GroupAdapter.java @@ -22,8 +22,8 @@ import android.text.format.DateUtils; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.ImageButton; import android.widget.LinearLayout; -import android.widget.ProgressBar; import android.widget.TextView; class GroupAdapter extends ArrayAdapter<GroupItem> { @@ -66,7 +66,7 @@ class GroupAdapter extends ArrayAdapter<GroupItem> { date.setText(DateUtils.formatSameDayTime(then, now, SHORT, SHORT)); headerLayout.addView(date); - if(!item.isExpanded()) return headerLayout; + if(!item.isExpanded() || item.getBody() == null) return headerLayout; LinearLayout expanded = new LinearLayout(ctx); expanded.setOrientation(VERTICAL); @@ -74,20 +74,19 @@ class GroupAdapter extends ArrayAdapter<GroupItem> { expanded.setBackgroundColor(background); expanded.addView(headerLayout); - byte[] body = item.getBody(); - 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")) { + if(header.getContentType().equals("text/plain")) { TextView text = new TextView(ctx); text.setPadding(pad, 0, pad, pad); text.setBackgroundColor(background); - text.setText(StringUtils.fromUtf8(body)); + text.setText(StringUtils.fromUtf8(item.getBody())); 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; } -} +} \ No newline at end of file