Removed subject line, which won't be used in new conversation views.

This commit is contained in:
akwizgran
2013-11-30 15:09:26 +00:00
parent d771f6c94c
commit 3e6d7ba66a
15 changed files with 60 additions and 236 deletions

View File

@@ -1,16 +1,12 @@
package net.sf.briar.android.groups;
import static android.graphics.Typeface.BOLD;
import static android.view.Gravity.CENTER_VERTICAL;
import static android.widget.LinearLayout.HORIZONTAL;
import static android.widget.LinearLayout.VERTICAL;
import static java.text.DateFormat.SHORT;
import static net.sf.briar.android.util.CommonLayoutParams.WRAP_WRAP_1;
import java.util.ArrayList;
import net.sf.briar.R;
import net.sf.briar.android.util.HorizontalSpace;
import net.sf.briar.api.Author;
import net.sf.briar.api.db.GroupMessageHeader;
import android.content.Context;
@@ -19,7 +15,6 @@ import android.text.format.DateUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -41,16 +36,6 @@ class GroupAdapter extends ArrayAdapter<GroupMessageHeader> {
if(!item.isRead())
layout.setBackgroundColor(res.getColor(R.color.unread_background));
LinearLayout innerLayout = new LinearLayout(ctx);
// Give me all the unused width
innerLayout.setLayoutParams(WRAP_WRAP_1);
innerLayout.setOrientation(VERTICAL);
// FIXME: Can this layout be removed?
LinearLayout authorLayout = new LinearLayout(ctx);
authorLayout.setOrientation(HORIZONTAL);
authorLayout.setGravity(CENTER_VERTICAL);
TextView name = new TextView(ctx);
// Give me all the unused width
name.setLayoutParams(WRAP_WRAP_1);
@@ -64,33 +49,11 @@ class GroupAdapter extends ArrayAdapter<GroupMessageHeader> {
} else {
name.setText(author.getName());
}
authorLayout.addView(name);
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);
String s = item.getSubject();
subject.setText(s == null ? "" : s);
innerLayout.addView(subject);
} else {
LinearLayout attachmentLayout = new LinearLayout(ctx);
attachmentLayout.setOrientation(HORIZONTAL);
ImageView attachment = new ImageView(ctx);
attachment.setPadding(5, 0, 5, 5);
attachment.setImageResource(R.drawable.content_attachment);
attachmentLayout.addView(attachment);
attachmentLayout.addView(new HorizontalSpace(ctx));
innerLayout.addView(attachmentLayout);
}
layout.addView(innerLayout);
layout.addView(name);
TextView date = new TextView(ctx);
date.setTextSize(14);
date.setPadding(0, 10, 10, 10);
date.setPadding(10, 10, 10, 10);
long then = item.getTimestamp(), now = System.currentTimeMillis();
date.setText(DateUtils.formatSameDayTime(then, now, SHORT, SHORT));
layout.addView(date);

View File

@@ -1,9 +1,7 @@
package net.sf.briar.android.groups;
import static android.graphics.Typeface.BOLD;
import static android.view.Gravity.CENTER;
import static android.widget.LinearLayout.HORIZONTAL;
import static android.widget.LinearLayout.VERTICAL;
import static java.text.DateFormat.SHORT;
import static net.sf.briar.android.groups.GroupListItem.MANAGE;
import static net.sf.briar.android.util.CommonLayoutParams.WRAP_WRAP_1;
@@ -14,14 +12,12 @@ import java.util.Comparator;
import java.util.List;
import net.sf.briar.R;
import net.sf.briar.android.util.HorizontalSpace;
import android.content.Context;
import android.content.res.Resources;
import android.text.format.DateUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -79,12 +75,9 @@ class GroupListAdapter extends BaseAdapter {
if(item.getUnreadCount() > 0)
layout.setBackgroundColor(res.getColor(R.color.unread_background));
LinearLayout innerLayout = new LinearLayout(ctx);
// Give me all the unused width
innerLayout.setLayoutParams(WRAP_WRAP_1);
innerLayout.setOrientation(VERTICAL);
TextView name = new TextView(ctx);
// Give me all the unused width
name.setLayoutParams(WRAP_WRAP_1);
name.setTextSize(18);
name.setMaxLines(1);
name.setPadding(10, 10, 10, 10);
@@ -92,7 +85,7 @@ class GroupListAdapter extends BaseAdapter {
String groupName = item.getGroup().getName();
if(unread > 0) name.setText(groupName + " (" + unread + ")");
else name.setText(groupName);
innerLayout.addView(name);
layout.addView(name);
if(item.isEmpty()) {
TextView noPosts = new TextView(ctx);
@@ -100,33 +93,11 @@ class GroupListAdapter extends BaseAdapter {
noPosts.setPadding(10, 0, 10, 10);
noPosts.setTextColor(res.getColor(R.color.no_posts));
noPosts.setText(R.string.no_posts);
innerLayout.addView(noPosts);
layout.addView(innerLayout);
layout.addView(noPosts);
} else {
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.getUnreadCount() > 0) subject.setTypeface(null, BOLD);
String s = item.getSubject();
subject.setText(s == null ? "" : s);
innerLayout.addView(subject);
} else {
LinearLayout attachmentLayout = new LinearLayout(ctx);
attachmentLayout.setOrientation(HORIZONTAL);
ImageView attachment = new ImageView(ctx);
attachment.setPadding(5, 0, 5, 5);
attachment.setImageResource(R.drawable.content_attachment);
attachmentLayout.addView(attachment);
attachmentLayout.addView(new HorizontalSpace(ctx));
innerLayout.addView(attachmentLayout);
}
layout.addView(innerLayout);
TextView date = new TextView(ctx);
date.setTextSize(14);
date.setPadding(0, 10, 10, 10);
date.setPadding(10, 0, 10, 10);
long then = item.getTimestamp(), now = System.currentTimeMillis();
date.setText(DateUtils.formatSameDayTime(then, now, SHORT, SHORT));
layout.addView(date);

View File

@@ -17,7 +17,7 @@ class GroupListItem {
private final Group group;
private final boolean empty;
private final String authorName, contentType, subject;
private final String authorName, contentType;
private final long timestamp;
private final int unread;
@@ -27,7 +27,6 @@ class GroupListItem {
if(empty) {
authorName = null;
contentType = null;
subject = null;
timestamp = 0;
unread = 0;
} else {
@@ -39,7 +38,6 @@ class GroupListItem {
if(a == null) authorName = null;
else authorName = a.getName();
contentType = newest.getContentType();
subject = newest.getSubject();
timestamp = newest.getTimestamp();
int unread = 0;
for(GroupMessageHeader h : list) if(!h.isRead()) unread++;
@@ -63,10 +61,6 @@ class GroupListItem {
return contentType;
}
String getSubject() {
return subject;
}
long getTimestamp() {
return timestamp;
}

View File

@@ -1,16 +1,12 @@
package net.sf.briar.android.messages;
import static android.graphics.Typeface.BOLD;
import static android.view.Gravity.CENTER_VERTICAL;
import static android.widget.LinearLayout.HORIZONTAL;
import static android.widget.LinearLayout.VERTICAL;
import static java.text.DateFormat.SHORT;
import static net.sf.briar.android.util.CommonLayoutParams.WRAP_WRAP_1;
import java.util.ArrayList;
import net.sf.briar.R;
import net.sf.briar.android.util.HorizontalSpace;
import net.sf.briar.api.db.PrivateMessageHeader;
import android.content.Context;
import android.content.res.Resources;
@@ -18,7 +14,6 @@ import android.text.format.DateUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -41,16 +36,6 @@ class ConversationAdapter extends ArrayAdapter<PrivateMessageHeader> {
layout.setBackgroundColor(res.getColor(R.color.unread_background));
}
LinearLayout innerLayout = new LinearLayout(ctx);
// Give me all the unused width
innerLayout.setLayoutParams(WRAP_WRAP_1);
innerLayout.setOrientation(VERTICAL);
// FIXME: Can this layout be removed?
LinearLayout authorLayout = new LinearLayout(ctx);
authorLayout.setOrientation(HORIZONTAL);
authorLayout.setGravity(CENTER_VERTICAL);
TextView name = new TextView(ctx);
// Give me all the unused width
name.setLayoutParams(WRAP_WRAP_1);
@@ -58,29 +43,7 @@ class ConversationAdapter extends ArrayAdapter<PrivateMessageHeader> {
name.setMaxLines(1);
name.setPadding(10, 10, 10, 10);
name.setText(item.getAuthor().getName());
authorLayout.addView(name);
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);
String s = item.getSubject();
subject.setText(s == null ? "" : s);
innerLayout.addView(subject);
} else {
LinearLayout attachmentLayout = new LinearLayout(ctx);
attachmentLayout.setOrientation(HORIZONTAL);
ImageView attachment = new ImageView(ctx);
attachment.setPadding(5, 0, 5, 5);
attachment.setImageResource(R.drawable.content_attachment);
attachmentLayout.addView(attachment);
attachmentLayout.addView(new HorizontalSpace(ctx));
innerLayout.addView(attachmentLayout);
}
layout.addView(innerLayout);
layout.addView(name);
TextView date = new TextView(ctx);
date.setTextSize(14);

View File

@@ -1,9 +1,6 @@
package net.sf.briar.android.messages;
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;
import static net.sf.briar.android.util.CommonLayoutParams.WRAP_WRAP_1;
@@ -41,13 +38,9 @@ implements OnItemClickListener {
if(item.getUnreadCount() > 0)
layout.setBackgroundColor(res.getColor(R.color.unread_background));
LinearLayout innerLayout = new LinearLayout(ctx);
// Give me all the unused width
innerLayout.setLayoutParams(WRAP_WRAP_1);
innerLayout.setOrientation(VERTICAL);
innerLayout.setGravity(LEFT);
TextView name = new TextView(ctx);
// Give me all the unused width
name.setLayoutParams(WRAP_WRAP_1);
name.setTextSize(18);
name.setMaxLines(1);
name.setPadding(10, 10, 10, 10);
@@ -55,7 +48,7 @@ implements OnItemClickListener {
String contactName = item.getContactName();
if(unread > 0) name.setText(contactName + " (" + unread + ")");
else name.setText(contactName);
innerLayout.addView(name);
layout.addView(name);
if(item.isEmpty()) {
TextView noMessages = new TextView(ctx);
@@ -63,19 +56,8 @@ implements OnItemClickListener {
noMessages.setPadding(10, 0, 10, 10);
noMessages.setTextColor(res.getColor(R.color.no_messages));
noMessages.setText(R.string.no_messages);
innerLayout.addView(noMessages);
layout.addView(innerLayout);
layout.addView(noMessages);
} else {
TextView subject = new TextView(ctx);
subject.setTextSize(14);
subject.setMaxLines(2);
subject.setPadding(10, 0, 10, 10);
if(unread > 0) subject.setTypeface(null, BOLD);
String s = item.getSubject();
subject.setText(s == null ? "" : s);
innerLayout.addView(subject);
layout.addView(innerLayout);
TextView date = new TextView(ctx);
date.setTextSize(14);
date.setPadding(0, 10, 10, 10);

View File

@@ -15,7 +15,6 @@ class ConversationListItem {
private final Contact contact;
private final boolean empty;
private final String subject;
private final long timestamp;
private final int unread;
@@ -24,14 +23,12 @@ class ConversationListItem {
this.contact = contact;
empty = headers.isEmpty();
if(empty) {
subject = null;
timestamp = 0;
unread = 0;
} else {
List<PrivateMessageHeader> list =
new ArrayList<PrivateMessageHeader>(headers);
Collections.sort(list, DescendingHeaderComparator.INSTANCE);
subject = list.get(0).getSubject();
timestamp = list.get(0).getTimestamp();
int unread = 0;
for(PrivateMessageHeader h : list) if(!h.isRead()) unread++;
@@ -55,10 +52,6 @@ class ConversationListItem {
return empty;
}
String getSubject() {
return subject;
}
long getTimestamp() {
return timestamp;
}