Removed star icons, added padding around text, renamed boards -> groups.

This commit is contained in:
akwizgran
2013-03-11 10:57:44 +00:00
parent 056eaa2797
commit 19a6178b54
14 changed files with 26 additions and 82 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -5,7 +5,7 @@
<string name="notification_text">Touch to quit.</string>
<string name="contact_list_button">Contacts</string>
<string name="messages_button">Messages</string>
<string name="boards_button">Boards</string>
<string name="groups_button">Groups</string>
<string name="blogs_button">Blogs</string>
<string name="synchronize_button">Synchronize</string>
<string name="quit_button">Quit</string>

View File

@@ -80,18 +80,18 @@ public class HomeScreenActivity extends BriarActivity {
});
buttons.add(messagesButton);
Button boardsButton = new Button(this);
boardsButton.setLayoutParams(matchParent);
boardsButton.setBackgroundResource(0);
boardsButton.setCompoundDrawablesWithIntrinsicBounds(0,
Button groupsButton = new Button(this);
groupsButton.setLayoutParams(matchParent);
groupsButton.setBackgroundResource(0);
groupsButton.setCompoundDrawablesWithIntrinsicBounds(0,
R.drawable.social_chat, 0, 0);
boardsButton.setText(R.string.boards_button);
boardsButton.setOnClickListener(new OnClickListener() {
groupsButton.setText(R.string.groups_button);
groupsButton.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
// FIXME: Hook this button up to an activity
}
});
buttons.add(boardsButton);
buttons.add(groupsButton);
Button blogsButton = new Button(this);
blogsButton.setLayoutParams(matchParent);

View File

@@ -37,7 +37,7 @@ implements OnItemClickListener {
layout.setGravity(CENTER_VERTICAL);
ImageView bulb = new ImageView(ctx);
bulb.setPadding(5, 5, 5, 5);
bulb.setPadding(10, 10, 10, 10);
if(item.isConnected()) bulb.setImageResource(R.drawable.green_bulb);
else bulb.setImageResource(R.drawable.grey_bulb);
layout.addView(bulb);
@@ -46,12 +46,13 @@ implements OnItemClickListener {
// Give me all the unused width
name.setLayoutParams(CommonLayoutParams.WRAP_WRAP_1);
name.setTextSize(18);
name.setPadding(0, 10, 10, 10);
name.setText(item.getName());
layout.addView(name);
TextView connected = new TextView(ctx);
connected.setTextSize(14);
connected.setPadding(5, 0, 5, 0);
connected.setPadding(0, 10, 10, 10);
if(item.isConnected()) {
connected.setText(R.string.contact_connected);
} else {

View File

@@ -34,15 +34,9 @@ class ConversationAdapter extends ArrayAdapter<PrivateMessageHeader> {
layout.setOrientation(HORIZONTAL);
layout.setGravity(CENTER_VERTICAL);
ImageView star = new ImageView(ctx);
star.setPadding(5, 5, 5, 5);
if(item.isStarred()) star.setImageResource(R.drawable.rating_important);
else star.setImageResource(R.drawable.rating_not_important);
layout.addView(star);
if(!item.getContentType().equals("text/plain")) {
ImageView attachment = new ImageView(ctx);
attachment.setPadding(0, 5, 5, 5);
attachment.setPadding(10, 10, 10, 10);
attachment.setImageResource(R.drawable.content_attachment);
layout.addView(attachment);
}
@@ -52,13 +46,14 @@ class ConversationAdapter extends ArrayAdapter<PrivateMessageHeader> {
subject.setLayoutParams(CommonLayoutParams.WRAP_WRAP_1);
subject.setTextSize(14);
subject.setMaxLines(2);
subject.setPadding(10, 10, 10, 10);
if(!item.isRead()) subject.setTypeface(null, BOLD);
subject.setText(item.getSubject());
layout.addView(subject);
TextView date = new TextView(ctx);
date.setTextSize(14);
date.setPadding(10, 0, 10, 0);
date.setPadding(0, 10, 10, 10);
long then = item.getTimestamp(), now = System.currentTimeMillis();
date.setText(DateUtils.formatSameDayTime(then, now, SHORT, SHORT));
layout.addView(date);

View File

@@ -9,7 +9,6 @@ import static java.text.DateFormat.SHORT;
import java.util.ArrayList;
import net.sf.briar.R;
import net.sf.briar.android.widgets.CommonLayoutParams;
import android.content.Context;
import android.content.Intent;
@@ -19,7 +18,6 @@ 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;
@@ -39,12 +37,6 @@ implements OnItemClickListener {
layout.setOrientation(HORIZONTAL);
layout.setGravity(CENTER_VERTICAL);
ImageView star = new ImageView(ctx);
star.setPadding(5, 5, 5, 5);
if(item.isStarred()) star.setImageResource(R.drawable.rating_important);
else star.setImageResource(R.drawable.rating_not_important);
layout.addView(star);
LinearLayout innerLayout = new LinearLayout(ctx);
// Give me all the unused width
innerLayout.setLayoutParams(CommonLayoutParams.WRAP_WRAP_1);
@@ -53,12 +45,14 @@ implements OnItemClickListener {
TextView name = new TextView(ctx);
name.setTextSize(18);
name.setPadding(10, 10, 10, 0);
name.setText(item.getName() + " (" + item.getLength() + ")");
innerLayout.addView(name);
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);
@@ -66,7 +60,7 @@ implements OnItemClickListener {
TextView date = new TextView(ctx);
date.setTextSize(14);
date.setPadding(10, 0, 10, 0);
date.setPadding(0, 10, 10, 10);
long then = item.getTimestamp(), now = System.currentTimeMillis();
date.setText(DateUtils.formatSameDayTime(then, now, SHORT, SHORT));
layout.addView(date);

View File

@@ -13,7 +13,7 @@ class ConversationListItem {
private final String name, subject;
private final long timestamp;
private final int length;
private final boolean read, starred;
private final boolean read;
ConversationListItem(Contact contact, List<PrivateMessageHeader> headers) {
if(headers.isEmpty()) throw new IllegalArgumentException();
@@ -23,13 +23,9 @@ class ConversationListItem {
subject = headers.get(0).getSubject();
timestamp = headers.get(0).getTimestamp();
length = headers.size();
boolean allRead = true, anyStarred = false;
for(PrivateMessageHeader h : headers) {
allRead &= h.isRead();
anyStarred |= h.isStarred();
}
boolean allRead = true;
for(PrivateMessageHeader h : headers) allRead &= h.isRead();
read = allRead;
starred = anyStarred;
}
ContactId getContactId() {
@@ -52,10 +48,6 @@ class ConversationListItem {
return read;
}
boolean isStarred() {
return starred;
}
int getLength() {
return length;
}

View File

@@ -58,7 +58,7 @@ implements OnClickListener {
private String contactName = null;
private MessageId messageId = null;
private boolean first, last, starred, read;
private ImageButton starButton = null, readButton = null;
private ImageButton readButton = null;
private ImageButton prevButton = null, nextButton = null;
private ImageButton replyButton = null;
private TextView content = null;
@@ -132,14 +132,14 @@ implements OnClickListener {
// Give me all the unused width
name.setLayoutParams(CommonLayoutParams.WRAP_WRAP_1);
name.setTextSize(18);
name.setPadding(10, 0, 0, 0);
name.setPadding(10, 10, 10, 10);
String format = getResources().getString(R.string.message_from);
name.setText(String.format(format, contactName));
header.addView(name);
TextView date = new TextView(this);
date.setTextSize(14);
date.setPadding(0, 0, 10, 0);
date.setPadding(0, 10, 10, 10);
long now = System.currentTimeMillis();
date.setText(DateUtils.formatSameDayTime(timestamp, now, SHORT, SHORT));
header.addView(date);
@@ -148,7 +148,7 @@ implements OnClickListener {
if(contentType.equals("text/plain")) {
// Load and display the message body
content = new TextView(this);
content.setPadding(10, 10, 10, 10);
content.setPadding(10, 0, 10, 10);
message.addView(content);
loadMessageBody();
}
@@ -162,15 +162,6 @@ implements OnClickListener {
footer.setOrientation(HORIZONTAL);
footer.setGravity(CENTER);
starButton = new ImageButton(this);
starButton.setPadding(10, 10, 10, 10);
starButton.setBackgroundResource(0);
if(starred) starButton.setImageResource(R.drawable.rating_important);
else starButton.setImageResource(R.drawable.rating_not_important);
starButton.setOnClickListener(this);
footer.addView(starButton);
footer.addView(new HorizontalSpace(this));
readButton = new ImageButton(this);
readButton.setPadding(10, 10, 10, 10);
readButton.setBackgroundResource(0);
@@ -255,30 +246,7 @@ implements OnClickListener {
}
public void onClick(View view) {
if(view == starButton) {
final MessageId messageId = this.messageId;
final boolean starred = !this.starred;
dbExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
db.setStarredFlag(messageId, starred);
runOnUiThread(new Runnable() {
public void run() {
setStarred(starred);
}
});
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
Thread.currentThread().interrupt();
}
}
});
} else if(view == readButton) {
if(view == readButton) {
final MessageId messageId = this.messageId;
final boolean read = !this.read;
dbExecutor.execute(new Runnable() {
@@ -318,12 +286,6 @@ implements OnClickListener {
}
}
private void setStarred(boolean starred) {
this.starred = starred;
if(starred) starButton.setImageResource(R.drawable.rating_important);
else starButton.setImageResource(R.drawable.rating_not_important);
}
private void setRead(boolean read) {
this.read = read;
if(read) readButton.setImageResource(R.drawable.content_unread);

View File

@@ -80,7 +80,7 @@ implements OnClickListener {
TextView to = new TextView(this);
// Give me all the unused width
to.setLayoutParams(CommonLayoutParams.WRAP_WRAP_1);
to.setPadding(10, 0, 0, 0);
to.setPadding(10, 10, 10, 10);
to.setTextSize(18);
String format = getResources().getString(R.string.message_to);
to.setText(String.format(format, contactName));