Minor layout and colour changes.

This commit is contained in:
akwizgran
2013-03-13 10:41:07 +00:00
parent c02ce6cb12
commit c783958d94
17 changed files with 61 additions and 42 deletions

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 689 B

After

Width:  |  Height:  |  Size: 689 B

View File

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 605 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="content_background">#FFFFFF</color>
<color name="unread_background">#FFFFFF</color>
<color name="horizontal_border">#CCCCCC</color>
<color name="anonymous_author">#999999</color>
<color name="anonymous_author">#AAAAAA</color>
<color name="pseudonymous_author">#000000</color>
</resources>

View File

@@ -25,4 +25,12 @@ public abstract class BriarActivity extends RoboActivity {
public void onSaveInstanceState(Bundle state) {
// Don't allow the superclass to save state
}
protected void finishOnUiThread() {
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
}
}

View File

@@ -37,8 +37,9 @@ implements OnItemClickListener {
ImageView bulb = new ImageView(ctx);
bulb.setPadding(10, 10, 10, 10);
if(item.isConnected()) bulb.setImageResource(R.drawable.green_bulb);
else bulb.setImageResource(R.drawable.grey_bulb);
if(item.isConnected())
bulb.setImageResource(R.drawable.contact_connected);
else bulb.setImageResource(R.drawable.contact_disconnected);
layout.addView(bulb);
TextView name = new TextView(ctx);

View File

@@ -139,11 +139,7 @@ OnClickListener, OnItemClickListener {
updateConversation(headers, ratings);
} catch(NoSuchSubscriptionException e) {
if(LOG.isLoggable(INFO)) LOG.info("Subscription removed");
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
finishOnUiThread();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
@@ -200,7 +196,7 @@ OnClickListener, OnItemClickListener {
SubscriptionRemovedEvent s = (SubscriptionRemovedEvent) e;
if(s.getGroupId().equals(groupId)) {
if(LOG.isLoggable(INFO)) LOG.info("Subscription removed");
finish();
finishOnUiThread();
}
}
}

View File

@@ -40,16 +40,20 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
// FIXME: Use a RelativeLayout
LinearLayout layout = new LinearLayout(ctx);
layout.setOrientation(HORIZONTAL);
layout.setGravity(CENTER_VERTICAL);
// layout.setGravity(CENTER_VERTICAL);
if(!item.isRead()) {
Resources res = ctx.getResources();
layout.setBackgroundColor(res.getColor(R.color.unread_background));
}
LinearLayout innerLayout = new LinearLayout(ctx);
// Give me all the unused width
innerLayout.setLayoutParams(CommonLayoutParams.WRAP_WRAP_1);
innerLayout.setOrientation(VERTICAL);
LinearLayout innerInnerLayout = new LinearLayout(ctx);
innerInnerLayout.setOrientation(HORIZONTAL);
innerInnerLayout.setGravity(CENTER_VERTICAL);
LinearLayout authorLayout = new LinearLayout(ctx);
authorLayout.setOrientation(HORIZONTAL);
authorLayout.setGravity(CENTER_VERTICAL);
ImageView thumb = new ImageView(ctx);
thumb.setPadding(10, 10, 10, 10);
@@ -57,9 +61,11 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
if(rating == GOOD) thumb.setImageResource(R.drawable.rating_good);
else thumb.setImageResource(R.drawable.rating_bad);
if(rating == UNRATED) thumb.setVisibility(INVISIBLE);
innerInnerLayout.addView(thumb);
authorLayout.addView(thumb);
TextView name = new TextView(ctx);
// Give me all the unused width
name.setLayoutParams(CommonLayoutParams.WRAP_WRAP_1);
name.setTextSize(18);
name.setMaxLines(1);
name.setPadding(0, 10, 10, 10);
@@ -72,8 +78,8 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
name.setTextColor(res.getColor(R.color.pseudonymous_author));
name.setText(author.getName());
}
innerInnerLayout.addView(name);
innerLayout.addView(innerInnerLayout);
authorLayout.addView(name);
innerLayout.addView(authorLayout);
if(item.getContentType().equals("text/plain")) {
TextView subject = new TextView(ctx);
@@ -84,12 +90,15 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
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);
innerInnerLayout.addView(attachment);
attachmentLayout.addView(attachment);
attachmentLayout.addView(new HorizontalSpace(ctx));
innerLayout.addView(attachmentLayout);
}
innerInnerLayout.addView(new HorizontalSpace(ctx));
layout.addView(innerLayout);
TextView date = new TextView(ctx);

View File

@@ -1,7 +1,6 @@
package net.sf.briar.android.groups;
import static android.graphics.Typeface.BOLD;
import static android.view.Gravity.CENTER_VERTICAL;
import static android.view.Gravity.LEFT;
import static android.widget.LinearLayout.HORIZONTAL;
import static android.widget.LinearLayout.VERTICAL;
@@ -9,10 +8,12 @@ import static java.text.DateFormat.SHORT;
import java.util.ArrayList;
import net.sf.briar.R;
import net.sf.briar.android.widgets.CommonLayoutParams;
import net.sf.briar.util.StringUtils;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.text.format.DateUtils;
import android.view.View;
import android.view.ViewGroup;
@@ -36,7 +37,10 @@ implements OnItemClickListener {
Context ctx = getContext();
LinearLayout layout = new LinearLayout(ctx);
layout.setOrientation(HORIZONTAL);
layout.setGravity(CENTER_VERTICAL);
if(item.getUnreadCount() > 0) {
Resources res = ctx.getResources();
layout.setBackgroundColor(res.getColor(R.color.unread_background));
}
LinearLayout innerLayout = new LinearLayout(ctx);
// Give me all the unused width

View File

@@ -124,6 +124,8 @@ implements OnClickListener {
LinearLayout message = new LinearLayout(this);
message.setOrientation(VERTICAL);
Resources res = getResources();
message.setBackgroundColor(res.getColor(R.color.content_background));
LinearLayout header = new LinearLayout(this);
header.setLayoutParams(CommonLayoutParams.MATCH_WRAP);
@@ -143,7 +145,6 @@ implements OnClickListener {
author.setTextSize(18);
author.setMaxLines(1);
author.setPadding(10, 10, 10, 10);
Resources res = getResources();
if(authorName == null) {
author.setTextColor(res.getColor(R.color.anonymous_author));
author.setText(R.string.anonymous);
@@ -280,11 +281,7 @@ implements OnClickListener {
});
} catch(NoSuchMessageException e) {
if(LOG.isLoggable(INFO)) LOG.info("Message removed");
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
finishOnUiThread();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);

View File

@@ -124,11 +124,7 @@ implements DatabaseListener, OnClickListener, OnItemClickListener {
updateConversation(headers);
} catch(NoSuchContactException e) {
if(LOG.isLoggable(INFO)) LOG.info("Contact removed");
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
finishOnUiThread();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);

View File

@@ -1,7 +1,6 @@
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 java.text.DateFormat.SHORT;
@@ -12,6 +11,7 @@ import net.sf.briar.android.widgets.CommonLayoutParams;
import net.sf.briar.android.widgets.HorizontalSpace;
import net.sf.briar.api.db.PrivateMessageHeader;
import android.content.Context;
import android.content.res.Resources;
import android.text.format.DateUtils;
import android.view.View;
import android.view.ViewGroup;
@@ -33,7 +33,10 @@ class ConversationAdapter extends ArrayAdapter<PrivateMessageHeader> {
Context ctx = getContext();
LinearLayout layout = new LinearLayout(ctx);
layout.setOrientation(HORIZONTAL);
layout.setGravity(CENTER_VERTICAL);
if(!item.isRead()) {
Resources res = ctx.getResources();
layout.setBackgroundColor(res.getColor(R.color.unread_background));
}
if(item.getContentType().equals("text/plain")) {
TextView subject = new TextView(ctx);

View File

@@ -1,7 +1,6 @@
package net.sf.briar.android.messages;
import static android.graphics.Typeface.BOLD;
import static android.view.Gravity.CENTER_VERTICAL;
import static android.view.Gravity.LEFT;
import static android.widget.LinearLayout.HORIZONTAL;
import static android.widget.LinearLayout.VERTICAL;
@@ -9,10 +8,12 @@ import static java.text.DateFormat.SHORT;
import java.util.ArrayList;
import net.sf.briar.R;
import net.sf.briar.android.widgets.CommonLayoutParams;
import net.sf.briar.util.StringUtils;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.text.format.DateUtils;
import android.view.View;
import android.view.ViewGroup;
@@ -36,7 +37,10 @@ implements OnItemClickListener {
Context ctx = getContext();
LinearLayout layout = new LinearLayout(ctx);
layout.setOrientation(HORIZONTAL);
layout.setGravity(CENTER_VERTICAL);
if(item.getUnreadCount() > 0) {
Resources res = ctx.getResources();
layout.setBackgroundColor(res.getColor(R.color.unread_background));
}
LinearLayout innerLayout = new LinearLayout(ctx);
// Give me all the unused width

View File

@@ -27,6 +27,7 @@ import net.sf.briar.api.db.DbException;
import net.sf.briar.api.db.NoSuchMessageException;
import net.sf.briar.api.messaging.MessageId;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.format.DateUtils;
import android.view.View;
@@ -101,6 +102,8 @@ implements OnClickListener {
LinearLayout message = new LinearLayout(this);
message.setOrientation(VERTICAL);
Resources res = getResources();
message.setBackgroundColor(res.getColor(R.color.content_background));
LinearLayout header = new LinearLayout(this);
header.setLayoutParams(CommonLayoutParams.MATCH_WRAP);
@@ -114,8 +117,8 @@ implements OnClickListener {
name.setMaxLines(1);
name.setPadding(10, 10, 10, 10);
String format;
if(incoming) format = getResources().getString(R.string.format_from);
else format = getResources().getString(R.string.format_to);
if(incoming) format = res.getString(R.string.format_from);
else format = res.getString(R.string.format_to);
name.setText(String.format(format, contactName));
header.addView(name);
@@ -229,11 +232,7 @@ implements OnClickListener {
});
} catch(NoSuchMessageException e) {
if(LOG.isLoggable(INFO)) LOG.info("Message removed");
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
finishOnUiThread();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);