Minor layout and colour changes.
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 689 B |
|
Before Width: | Height: | Size: 605 B After Width: | Height: | Size: 605 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -1,6 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<color name="content_background">#FFFFFF</color>
|
||||||
|
<color name="unread_background">#FFFFFF</color>
|
||||||
<color name="horizontal_border">#CCCCCC</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>
|
<color name="pseudonymous_author">#000000</color>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -25,4 +25,12 @@ public abstract class BriarActivity extends RoboActivity {
|
|||||||
public void onSaveInstanceState(Bundle state) {
|
public void onSaveInstanceState(Bundle state) {
|
||||||
// Don't allow the superclass to save state
|
// Don't allow the superclass to save state
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void finishOnUiThread() {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,9 @@ implements OnItemClickListener {
|
|||||||
|
|
||||||
ImageView bulb = new ImageView(ctx);
|
ImageView bulb = new ImageView(ctx);
|
||||||
bulb.setPadding(10, 10, 10, 10);
|
bulb.setPadding(10, 10, 10, 10);
|
||||||
if(item.isConnected()) bulb.setImageResource(R.drawable.green_bulb);
|
if(item.isConnected())
|
||||||
else bulb.setImageResource(R.drawable.grey_bulb);
|
bulb.setImageResource(R.drawable.contact_connected);
|
||||||
|
else bulb.setImageResource(R.drawable.contact_disconnected);
|
||||||
layout.addView(bulb);
|
layout.addView(bulb);
|
||||||
|
|
||||||
TextView name = new TextView(ctx);
|
TextView name = new TextView(ctx);
|
||||||
|
|||||||
@@ -139,11 +139,7 @@ OnClickListener, OnItemClickListener {
|
|||||||
updateConversation(headers, ratings);
|
updateConversation(headers, ratings);
|
||||||
} catch(NoSuchSubscriptionException e) {
|
} catch(NoSuchSubscriptionException e) {
|
||||||
if(LOG.isLoggable(INFO)) LOG.info("Subscription removed");
|
if(LOG.isLoggable(INFO)) LOG.info("Subscription removed");
|
||||||
runOnUiThread(new Runnable() {
|
finishOnUiThread();
|
||||||
public void run() {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
LOG.log(WARNING, e.toString(), e);
|
LOG.log(WARNING, e.toString(), e);
|
||||||
@@ -200,7 +196,7 @@ OnClickListener, OnItemClickListener {
|
|||||||
SubscriptionRemovedEvent s = (SubscriptionRemovedEvent) e;
|
SubscriptionRemovedEvent s = (SubscriptionRemovedEvent) e;
|
||||||
if(s.getGroupId().equals(groupId)) {
|
if(s.getGroupId().equals(groupId)) {
|
||||||
if(LOG.isLoggable(INFO)) LOG.info("Subscription removed");
|
if(LOG.isLoggable(INFO)) LOG.info("Subscription removed");
|
||||||
finish();
|
finishOnUiThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,16 +40,20 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
|
|||||||
// FIXME: Use a RelativeLayout
|
// FIXME: Use a RelativeLayout
|
||||||
LinearLayout layout = new LinearLayout(ctx);
|
LinearLayout layout = new LinearLayout(ctx);
|
||||||
layout.setOrientation(HORIZONTAL);
|
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);
|
LinearLayout innerLayout = new LinearLayout(ctx);
|
||||||
// Give me all the unused width
|
// Give me all the unused width
|
||||||
innerLayout.setLayoutParams(CommonLayoutParams.WRAP_WRAP_1);
|
innerLayout.setLayoutParams(CommonLayoutParams.WRAP_WRAP_1);
|
||||||
innerLayout.setOrientation(VERTICAL);
|
innerLayout.setOrientation(VERTICAL);
|
||||||
|
|
||||||
LinearLayout innerInnerLayout = new LinearLayout(ctx);
|
LinearLayout authorLayout = new LinearLayout(ctx);
|
||||||
innerInnerLayout.setOrientation(HORIZONTAL);
|
authorLayout.setOrientation(HORIZONTAL);
|
||||||
innerInnerLayout.setGravity(CENTER_VERTICAL);
|
authorLayout.setGravity(CENTER_VERTICAL);
|
||||||
|
|
||||||
ImageView thumb = new ImageView(ctx);
|
ImageView thumb = new ImageView(ctx);
|
||||||
thumb.setPadding(10, 10, 10, 10);
|
thumb.setPadding(10, 10, 10, 10);
|
||||||
@@ -57,9 +61,11 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
|
|||||||
if(rating == GOOD) thumb.setImageResource(R.drawable.rating_good);
|
if(rating == GOOD) thumb.setImageResource(R.drawable.rating_good);
|
||||||
else thumb.setImageResource(R.drawable.rating_bad);
|
else thumb.setImageResource(R.drawable.rating_bad);
|
||||||
if(rating == UNRATED) thumb.setVisibility(INVISIBLE);
|
if(rating == UNRATED) thumb.setVisibility(INVISIBLE);
|
||||||
innerInnerLayout.addView(thumb);
|
authorLayout.addView(thumb);
|
||||||
|
|
||||||
TextView name = new TextView(ctx);
|
TextView name = new TextView(ctx);
|
||||||
|
// Give me all the unused width
|
||||||
|
name.setLayoutParams(CommonLayoutParams.WRAP_WRAP_1);
|
||||||
name.setTextSize(18);
|
name.setTextSize(18);
|
||||||
name.setMaxLines(1);
|
name.setMaxLines(1);
|
||||||
name.setPadding(0, 10, 10, 10);
|
name.setPadding(0, 10, 10, 10);
|
||||||
@@ -72,8 +78,8 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
|
|||||||
name.setTextColor(res.getColor(R.color.pseudonymous_author));
|
name.setTextColor(res.getColor(R.color.pseudonymous_author));
|
||||||
name.setText(author.getName());
|
name.setText(author.getName());
|
||||||
}
|
}
|
||||||
innerInnerLayout.addView(name);
|
authorLayout.addView(name);
|
||||||
innerLayout.addView(innerInnerLayout);
|
innerLayout.addView(authorLayout);
|
||||||
|
|
||||||
if(item.getContentType().equals("text/plain")) {
|
if(item.getContentType().equals("text/plain")) {
|
||||||
TextView subject = new TextView(ctx);
|
TextView subject = new TextView(ctx);
|
||||||
@@ -84,12 +90,15 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
|
|||||||
subject.setText(item.getSubject());
|
subject.setText(item.getSubject());
|
||||||
innerLayout.addView(subject);
|
innerLayout.addView(subject);
|
||||||
} else {
|
} else {
|
||||||
|
LinearLayout attachmentLayout = new LinearLayout(ctx);
|
||||||
|
attachmentLayout.setOrientation(HORIZONTAL);
|
||||||
ImageView attachment = new ImageView(ctx);
|
ImageView attachment = new ImageView(ctx);
|
||||||
attachment.setPadding(10, 0, 10, 10);
|
attachment.setPadding(10, 0, 10, 10);
|
||||||
attachment.setImageResource(R.drawable.content_attachment);
|
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);
|
layout.addView(innerLayout);
|
||||||
|
|
||||||
TextView date = new TextView(ctx);
|
TextView date = new TextView(ctx);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package net.sf.briar.android.groups;
|
package net.sf.briar.android.groups;
|
||||||
|
|
||||||
import static android.graphics.Typeface.BOLD;
|
import static android.graphics.Typeface.BOLD;
|
||||||
import static android.view.Gravity.CENTER_VERTICAL;
|
|
||||||
import static android.view.Gravity.LEFT;
|
import static android.view.Gravity.LEFT;
|
||||||
import static android.widget.LinearLayout.HORIZONTAL;
|
import static android.widget.LinearLayout.HORIZONTAL;
|
||||||
import static android.widget.LinearLayout.VERTICAL;
|
import static android.widget.LinearLayout.VERTICAL;
|
||||||
@@ -9,10 +8,12 @@ import static java.text.DateFormat.SHORT;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import net.sf.briar.R;
|
||||||
import net.sf.briar.android.widgets.CommonLayoutParams;
|
import net.sf.briar.android.widgets.CommonLayoutParams;
|
||||||
import net.sf.briar.util.StringUtils;
|
import net.sf.briar.util.StringUtils;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -36,7 +37,10 @@ implements OnItemClickListener {
|
|||||||
Context ctx = getContext();
|
Context ctx = getContext();
|
||||||
LinearLayout layout = new LinearLayout(ctx);
|
LinearLayout layout = new LinearLayout(ctx);
|
||||||
layout.setOrientation(HORIZONTAL);
|
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);
|
LinearLayout innerLayout = new LinearLayout(ctx);
|
||||||
// Give me all the unused width
|
// Give me all the unused width
|
||||||
|
|||||||
@@ -124,6 +124,8 @@ implements OnClickListener {
|
|||||||
|
|
||||||
LinearLayout message = new LinearLayout(this);
|
LinearLayout message = new LinearLayout(this);
|
||||||
message.setOrientation(VERTICAL);
|
message.setOrientation(VERTICAL);
|
||||||
|
Resources res = getResources();
|
||||||
|
message.setBackgroundColor(res.getColor(R.color.content_background));
|
||||||
|
|
||||||
LinearLayout header = new LinearLayout(this);
|
LinearLayout header = new LinearLayout(this);
|
||||||
header.setLayoutParams(CommonLayoutParams.MATCH_WRAP);
|
header.setLayoutParams(CommonLayoutParams.MATCH_WRAP);
|
||||||
@@ -143,7 +145,6 @@ implements OnClickListener {
|
|||||||
author.setTextSize(18);
|
author.setTextSize(18);
|
||||||
author.setMaxLines(1);
|
author.setMaxLines(1);
|
||||||
author.setPadding(10, 10, 10, 10);
|
author.setPadding(10, 10, 10, 10);
|
||||||
Resources res = getResources();
|
|
||||||
if(authorName == null) {
|
if(authorName == null) {
|
||||||
author.setTextColor(res.getColor(R.color.anonymous_author));
|
author.setTextColor(res.getColor(R.color.anonymous_author));
|
||||||
author.setText(R.string.anonymous);
|
author.setText(R.string.anonymous);
|
||||||
@@ -280,11 +281,7 @@ implements OnClickListener {
|
|||||||
});
|
});
|
||||||
} catch(NoSuchMessageException e) {
|
} catch(NoSuchMessageException e) {
|
||||||
if(LOG.isLoggable(INFO)) LOG.info("Message removed");
|
if(LOG.isLoggable(INFO)) LOG.info("Message removed");
|
||||||
runOnUiThread(new Runnable() {
|
finishOnUiThread();
|
||||||
public void run() {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
LOG.log(WARNING, e.toString(), e);
|
LOG.log(WARNING, e.toString(), e);
|
||||||
|
|||||||
@@ -124,11 +124,7 @@ implements DatabaseListener, OnClickListener, OnItemClickListener {
|
|||||||
updateConversation(headers);
|
updateConversation(headers);
|
||||||
} catch(NoSuchContactException e) {
|
} catch(NoSuchContactException e) {
|
||||||
if(LOG.isLoggable(INFO)) LOG.info("Contact removed");
|
if(LOG.isLoggable(INFO)) LOG.info("Contact removed");
|
||||||
runOnUiThread(new Runnable() {
|
finishOnUiThread();
|
||||||
public void run() {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
LOG.log(WARNING, e.toString(), e);
|
LOG.log(WARNING, e.toString(), e);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package net.sf.briar.android.messages;
|
package net.sf.briar.android.messages;
|
||||||
|
|
||||||
import static android.graphics.Typeface.BOLD;
|
import static android.graphics.Typeface.BOLD;
|
||||||
import static android.view.Gravity.CENTER_VERTICAL;
|
|
||||||
import static android.widget.LinearLayout.HORIZONTAL;
|
import static android.widget.LinearLayout.HORIZONTAL;
|
||||||
import static java.text.DateFormat.SHORT;
|
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.android.widgets.HorizontalSpace;
|
||||||
import net.sf.briar.api.db.PrivateMessageHeader;
|
import net.sf.briar.api.db.PrivateMessageHeader;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -33,7 +33,10 @@ class ConversationAdapter extends ArrayAdapter<PrivateMessageHeader> {
|
|||||||
Context ctx = getContext();
|
Context ctx = getContext();
|
||||||
LinearLayout layout = new LinearLayout(ctx);
|
LinearLayout layout = new LinearLayout(ctx);
|
||||||
layout.setOrientation(HORIZONTAL);
|
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")) {
|
if(item.getContentType().equals("text/plain")) {
|
||||||
TextView subject = new TextView(ctx);
|
TextView subject = new TextView(ctx);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package net.sf.briar.android.messages;
|
package net.sf.briar.android.messages;
|
||||||
|
|
||||||
import static android.graphics.Typeface.BOLD;
|
import static android.graphics.Typeface.BOLD;
|
||||||
import static android.view.Gravity.CENTER_VERTICAL;
|
|
||||||
import static android.view.Gravity.LEFT;
|
import static android.view.Gravity.LEFT;
|
||||||
import static android.widget.LinearLayout.HORIZONTAL;
|
import static android.widget.LinearLayout.HORIZONTAL;
|
||||||
import static android.widget.LinearLayout.VERTICAL;
|
import static android.widget.LinearLayout.VERTICAL;
|
||||||
@@ -9,10 +8,12 @@ import static java.text.DateFormat.SHORT;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import net.sf.briar.R;
|
||||||
import net.sf.briar.android.widgets.CommonLayoutParams;
|
import net.sf.briar.android.widgets.CommonLayoutParams;
|
||||||
import net.sf.briar.util.StringUtils;
|
import net.sf.briar.util.StringUtils;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -36,7 +37,10 @@ implements OnItemClickListener {
|
|||||||
Context ctx = getContext();
|
Context ctx = getContext();
|
||||||
LinearLayout layout = new LinearLayout(ctx);
|
LinearLayout layout = new LinearLayout(ctx);
|
||||||
layout.setOrientation(HORIZONTAL);
|
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);
|
LinearLayout innerLayout = new LinearLayout(ctx);
|
||||||
// Give me all the unused width
|
// Give me all the unused width
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import net.sf.briar.api.db.DbException;
|
|||||||
import net.sf.briar.api.db.NoSuchMessageException;
|
import net.sf.briar.api.db.NoSuchMessageException;
|
||||||
import net.sf.briar.api.messaging.MessageId;
|
import net.sf.briar.api.messaging.MessageId;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -101,6 +102,8 @@ implements OnClickListener {
|
|||||||
|
|
||||||
LinearLayout message = new LinearLayout(this);
|
LinearLayout message = new LinearLayout(this);
|
||||||
message.setOrientation(VERTICAL);
|
message.setOrientation(VERTICAL);
|
||||||
|
Resources res = getResources();
|
||||||
|
message.setBackgroundColor(res.getColor(R.color.content_background));
|
||||||
|
|
||||||
LinearLayout header = new LinearLayout(this);
|
LinearLayout header = new LinearLayout(this);
|
||||||
header.setLayoutParams(CommonLayoutParams.MATCH_WRAP);
|
header.setLayoutParams(CommonLayoutParams.MATCH_WRAP);
|
||||||
@@ -114,8 +117,8 @@ implements OnClickListener {
|
|||||||
name.setMaxLines(1);
|
name.setMaxLines(1);
|
||||||
name.setPadding(10, 10, 10, 10);
|
name.setPadding(10, 10, 10, 10);
|
||||||
String format;
|
String format;
|
||||||
if(incoming) format = getResources().getString(R.string.format_from);
|
if(incoming) format = res.getString(R.string.format_from);
|
||||||
else format = getResources().getString(R.string.format_to);
|
else format = res.getString(R.string.format_to);
|
||||||
name.setText(String.format(format, contactName));
|
name.setText(String.format(format, contactName));
|
||||||
header.addView(name);
|
header.addView(name);
|
||||||
|
|
||||||
@@ -229,11 +232,7 @@ implements OnClickListener {
|
|||||||
});
|
});
|
||||||
} catch(NoSuchMessageException e) {
|
} catch(NoSuchMessageException e) {
|
||||||
if(LOG.isLoggable(INFO)) LOG.info("Message removed");
|
if(LOG.isLoggable(INFO)) LOG.info("Message removed");
|
||||||
runOnUiThread(new Runnable() {
|
finishOnUiThread();
|
||||||
public void run() {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
LOG.log(WARNING, e.toString(), e);
|
LOG.log(WARNING, e.toString(), e);
|
||||||
|
|||||||