Brighter colours.

This commit is contained in:
akwizgran
2014-02-27 00:10:47 +00:00
parent d21ced30ba
commit 094cda8573
15 changed files with 47 additions and 36 deletions

View File

@@ -2,6 +2,7 @@
<resources> <resources>
<style name="LightTheme" parent="android:Theme.Holo.Light.DarkActionBar"> <style name="LightTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/CustomActionBar</item> <item name="android:actionBarStyle">@style/CustomActionBar</item>
<item name="android:windowBackground">@color/window_background</item>
</style> </style>
<style name="CustomActionBar" <style name="CustomActionBar"
parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse"> parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse">

View File

@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="window_background">#EEEEEE</color>
<color name="action_bar_background">#2D3E50</color> <color name="action_bar_background">#2D3E50</color>
<color name="home_screen_background">#FFFFFF</color> <color name="button_bar_background">#FFFFFF</color>
<color name="content_background">#FFFFFF</color> <color name="private_message_background">#FFFFFF</color>
<color name="conversation_background">#DDDDDD</color> <color name="private_message_date">#AAAAAA</color>
<color name="unread_background">#FFFFFF</color> <color name="unread_background">#FFFFFF</color>
<color name="read_background">#EEEEEE</color>
<color name="compose_background">#FFFFFF</color>
<color name="horizontal_border">#CCCCCC</color> <color name="horizontal_border">#CCCCCC</color>
<color name="no_posts">#AAAAAA</color> <color name="no_posts">#AAAAAA</color>
<color name="private_message_date">#AAAAAA</color>
</resources> </resources>

View File

@@ -26,6 +26,7 @@ import org.briarproject.api.db.DbException;
import org.briarproject.api.lifecycle.LifecycleManager; import org.briarproject.api.lifecycle.LifecycleManager;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@@ -155,8 +156,8 @@ public class DashboardActivity extends BriarActivity {
grid.setLayoutParams(matchMatch); grid.setLayoutParams(matchMatch);
grid.setGravity(CENTER); grid.setGravity(CENTER);
grid.setPadding(pad, pad, pad, pad); grid.setPadding(pad, pad, pad, pad);
grid.setBackgroundColor(getResources().getColor( Resources res = getResources();
R.color.home_screen_background)); grid.setBackgroundColor(res.getColor(R.color.button_bar_background));
grid.setNumColumns(2); grid.setNumColumns(2);
grid.setAdapter(new BaseAdapter() { grid.setAdapter(new BaseAdapter() {

View File

@@ -1,5 +1,6 @@
package org.briarproject.android.contact; package org.briarproject.android.contact;
import static android.view.Gravity.CENTER;
import static android.view.Gravity.CENTER_HORIZONTAL; import static android.view.Gravity.CENTER_HORIZONTAL;
import static android.view.View.GONE; import static android.view.View.GONE;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
@@ -7,6 +8,7 @@ import static android.widget.LinearLayout.VERTICAL;
import static java.util.logging.Level.INFO; import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING; import static java.util.logging.Level.WARNING;
import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH; import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH;
import static org.briarproject.android.util.CommonLayoutParams.MATCH_WRAP;
import static org.briarproject.android.util.CommonLayoutParams.MATCH_WRAP_1; import static org.briarproject.android.util.CommonLayoutParams.MATCH_WRAP_1;
import java.util.Collection; import java.util.Collection;
@@ -42,6 +44,7 @@ import org.briarproject.api.transport.ConnectionListener;
import org.briarproject.api.transport.ConnectionRegistry; import org.briarproject.api.transport.ConnectionRegistry;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@@ -92,11 +95,17 @@ ConnectionListener {
layout.addView(new HorizontalBorder(this)); layout.addView(new HorizontalBorder(this));
LinearLayout footer = new LinearLayout(this);
footer.setLayoutParams(MATCH_WRAP);
footer.setGravity(CENTER);
Resources res = getResources();
footer.setBackgroundColor(res.getColor(R.color.button_bar_background));
addContactButton = new ImageButton(this); addContactButton = new ImageButton(this);
addContactButton.setBackgroundResource(0); addContactButton.setBackgroundResource(0);
addContactButton.setImageResource(R.drawable.social_add_person); addContactButton.setImageResource(R.drawable.social_add_person);
addContactButton.setOnClickListener(this); addContactButton.setOnClickListener(this);
layout.addView(addContactButton); footer.addView(addContactButton);
layout.addView(footer);
setContentView(layout); setContentView(layout);
} }

View File

@@ -35,11 +35,13 @@ class ContactListAdapter extends ArrayAdapter<ContactListItem> {
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
ContactListItem item = getItem(position); ContactListItem item = getItem(position);
Context ctx = getContext(); Context ctx = getContext();
Resources res = ctx.getResources();
LinearLayout layout = new LinearLayout(ctx); LinearLayout layout = new LinearLayout(ctx);
layout.setOrientation(HORIZONTAL); layout.setOrientation(HORIZONTAL);
layout.setGravity(CENTER_VERTICAL); layout.setGravity(CENTER_VERTICAL);
Resources res = ctx.getResources(); int unread = item.getUnreadCount();
if(item.getUnreadCount() > 0) if(unread > 0)
layout.setBackgroundColor(res.getColor(R.color.unread_background)); layout.setBackgroundColor(res.getColor(R.color.unread_background));
ImageView bulb = new ImageView(ctx); ImageView bulb = new ImageView(ctx);
@@ -56,7 +58,6 @@ class ContactListAdapter extends ArrayAdapter<ContactListItem> {
name.setSingleLine(); name.setSingleLine();
name.setEllipsize(END); name.setEllipsize(END);
name.setPadding(0, pad, pad, pad); name.setPadding(0, pad, pad, pad);
int unread = item.getUnreadCount();
String contactName = item.getContact().getAuthor().getName(); String contactName = item.getContact().getAuthor().getName();
if(unread > 0) name.setText(contactName + " (" + unread + ")"); if(unread > 0) name.setText(contactName + " (" + unread + ")");
else name.setText(contactName); else name.setText(contactName);

View File

@@ -138,7 +138,7 @@ implements EventListener, OnClickListener, OnItemClickListener {
list.setClipToPadding(false); list.setClipToPadding(false);
// Make the dividers the same colour as the background // Make the dividers the same colour as the background
Resources res = getResources(); Resources res = getResources();
int background = res.getColor(R.color.conversation_background); int background = res.getColor(R.color.window_background);
list.setBackgroundColor(background); list.setBackgroundColor(background);
list.setDivider(new ColorDrawable(background)); list.setDivider(new ColorDrawable(background));
list.setDividerHeight(pad); list.setDividerHeight(pad);
@@ -158,7 +158,7 @@ implements EventListener, OnClickListener, OnItemClickListener {
footer.setOrientation(HORIZONTAL); footer.setOrientation(HORIZONTAL);
footer.setGravity(CENTER_VERTICAL); footer.setGravity(CENTER_VERTICAL);
footer.setPadding(pad, 0, 0, 0); footer.setPadding(pad, 0, 0, 0);
footer.setBackgroundColor(res.getColor(R.color.compose_background)); footer.setBackgroundColor(res.getColor(R.color.button_bar_background));
content = new EditText(this); content = new EditText(this);
content.setId(1); content.setId(1);

View File

@@ -44,9 +44,7 @@ class ConversationAdapter extends ArrayAdapter<ConversationItem> {
if(header.isLocal()) layout.setPadding(3 * pad, 0, 0, 0); if(header.isLocal()) layout.setPadding(3 * pad, 0, 0, 0);
else layout.setPadding(0, 0, 3 * pad, 0); else layout.setPadding(0, 0, 3 * pad, 0);
int background; int background = res.getColor(R.color.private_message_background);
if(header.isRead()) background = res.getColor(R.color.read_background);
else background = res.getColor(R.color.unread_background);
View content; View content;
if(item.getBody() == null) { if(item.getBody() == null) {

View File

@@ -110,8 +110,6 @@ 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(MATCH_WRAP); header.setLayoutParams(MATCH_WRAP);
@@ -148,6 +146,8 @@ implements OnClickListener {
footer.setLayoutParams(MATCH_WRAP); footer.setLayoutParams(MATCH_WRAP);
footer.setOrientation(HORIZONTAL); footer.setOrientation(HORIZONTAL);
footer.setGravity(CENTER); footer.setGravity(CENTER);
Resources res = getResources();
footer.setBackgroundColor(res.getColor(R.color.button_bar_background));
readButton = new ImageButton(this); readButton = new ImageButton(this);
readButton.setBackgroundResource(0); readButton.setBackgroundResource(0);

View File

@@ -1,5 +1,6 @@
package org.briarproject.android.groups; package org.briarproject.android.groups;
import static android.view.Gravity.CENTER;
import static android.view.Gravity.CENTER_HORIZONTAL; import static android.view.Gravity.CENTER_HORIZONTAL;
import static android.view.View.GONE; import static android.view.View.GONE;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
@@ -8,6 +9,7 @@ import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING; import static java.util.logging.Level.WARNING;
import static org.briarproject.android.groups.ReadGroupPostActivity.RESULT_PREV_NEXT; import static org.briarproject.android.groups.ReadGroupPostActivity.RESULT_PREV_NEXT;
import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH; import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH;
import static org.briarproject.android.util.CommonLayoutParams.MATCH_WRAP;
import static org.briarproject.android.util.CommonLayoutParams.MATCH_WRAP_1; import static org.briarproject.android.util.CommonLayoutParams.MATCH_WRAP_1;
import java.util.ArrayList; import java.util.ArrayList;
@@ -42,6 +44,7 @@ import org.briarproject.api.messaging.GroupId;
import org.briarproject.api.messaging.MessageId; import org.briarproject.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.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@@ -102,11 +105,17 @@ OnClickListener, OnItemClickListener {
layout.addView(new HorizontalBorder(this)); layout.addView(new HorizontalBorder(this));
LinearLayout footer = new LinearLayout(this);
footer.setLayoutParams(MATCH_WRAP);
footer.setGravity(CENTER);
Resources res = getResources();
footer.setBackgroundColor(res.getColor(R.color.button_bar_background));
ImageButton composeButton = new ImageButton(this); ImageButton composeButton = new ImageButton(this);
composeButton.setBackgroundResource(0); composeButton.setBackgroundResource(0);
composeButton.setImageResource(R.drawable.content_new_email); composeButton.setImageResource(R.drawable.content_new_email);
composeButton.setOnClickListener(this); composeButton.setOnClickListener(this);
layout.addView(composeButton); footer.addView(composeButton);
layout.addView(footer);
setContentView(layout); setContentView(layout);
} }

View File

@@ -45,10 +45,8 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
LinearLayout layout = new LinearLayout(ctx); LinearLayout layout = new LinearLayout(ctx);
layout.setOrientation(VERTICAL); layout.setOrientation(VERTICAL);
layout.setGravity(CENTER_HORIZONTAL); layout.setGravity(CENTER_HORIZONTAL);
int background; if(!header.isRead())
if(header.isRead()) background = res.getColor(R.color.read_background); layout.setBackgroundColor(res.getColor(R.color.unread_background));
else background = res.getColor(R.color.unread_background);
layout.setBackgroundColor(background);
LinearLayout headerLayout = new LinearLayout(ctx); LinearLayout headerLayout = new LinearLayout(ctx);
headerLayout.setOrientation(HORIZONTAL); headerLayout.setOrientation(HORIZONTAL);

View File

@@ -45,6 +45,7 @@ import org.briarproject.api.messaging.GroupId;
import org.briarproject.api.messaging.GroupStatus; import org.briarproject.api.messaging.GroupStatus;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@@ -100,6 +101,8 @@ implements EventListener, OnClickListener, OnItemClickListener {
footer.setLayoutParams(MATCH_WRAP); footer.setLayoutParams(MATCH_WRAP);
footer.setOrientation(HORIZONTAL); footer.setOrientation(HORIZONTAL);
footer.setGravity(CENTER); footer.setGravity(CENTER);
Resources res = getResources();
footer.setBackgroundColor(res.getColor(R.color.button_bar_background));
footer.addView(new ElasticHorizontalSpace(this)); footer.addView(new ElasticHorizontalSpace(this));
newGroupButton = new ImageButton(this); newGroupButton = new ImageButton(this);

View File

@@ -76,7 +76,8 @@ class GroupListAdapter extends BaseAdapter {
LinearLayout layout = new LinearLayout(ctx); LinearLayout layout = new LinearLayout(ctx);
layout.setOrientation(HORIZONTAL); layout.setOrientation(HORIZONTAL);
if(item.getUnreadCount() > 0) int unread = item.getUnreadCount();
if(unread > 0)
layout.setBackgroundColor(res.getColor(R.color.unread_background)); layout.setBackgroundColor(res.getColor(R.color.unread_background));
TextView name = new TextView(ctx); TextView name = new TextView(ctx);
@@ -86,7 +87,6 @@ class GroupListAdapter extends BaseAdapter {
name.setSingleLine(); name.setSingleLine();
name.setEllipsize(END); name.setEllipsize(END);
name.setPadding(pad, pad, pad, pad); name.setPadding(pad, pad, pad, pad);
int unread = item.getUnreadCount();
String groupName = item.getGroup().getName(); String groupName = item.getGroup().getName();
if(unread > 0) name.setText(groupName + " (" + unread + ")"); if(unread > 0) name.setText(groupName + " (" + unread + ")");
else name.setText(groupName); else name.setText(groupName);

View File

@@ -107,8 +107,6 @@ 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(MATCH_WRAP); header.setLayoutParams(MATCH_WRAP);
@@ -145,6 +143,8 @@ implements OnClickListener {
footer.setLayoutParams(MATCH_WRAP); footer.setLayoutParams(MATCH_WRAP);
footer.setOrientation(HORIZONTAL); footer.setOrientation(HORIZONTAL);
footer.setGravity(CENTER); footer.setGravity(CENTER);
Resources res = getResources();
footer.setBackgroundColor(res.getColor(R.color.button_bar_background));
readButton = new ImageButton(this); readButton = new ImageButton(this);
readButton.setBackgroundResource(0); readButton.setBackgroundResource(0);

View File

@@ -12,8 +12,7 @@ public class HorizontalBorder extends View {
public HorizontalBorder(Context ctx) { public HorizontalBorder(Context ctx) {
super(ctx); super(ctx);
int width = LayoutUtils.getSeparatorWidth(ctx); setLayoutParams(new LayoutParams(MATCH_PARENT, 1));
setLayoutParams(new LayoutParams(MATCH_PARENT, width));
setBackgroundColor(getResources().getColor(R.color.horizontal_border)); setBackgroundColor(getResources().getColor(R.color.horizontal_border));
} }
} }

View File

@@ -7,12 +7,6 @@ import android.view.WindowManager;
public class LayoutUtils { public class LayoutUtils {
public static int getSeparatorWidth(Context ctx) {
DisplayMetrics metrics = getDisplayMetrics(ctx);
int percent = Math.max(metrics.widthPixels, metrics.heightPixels) / 100;
return Math.max(2, percent - 8);
}
public static int getPadding(Context ctx) { public static int getPadding(Context ctx) {
DisplayMetrics metrics = getDisplayMetrics(ctx); DisplayMetrics metrics = getDisplayMetrics(ctx);
int percent = Math.max(metrics.widthPixels, metrics.heightPixels) / 100; int percent = Math.max(metrics.widthPixels, metrics.heightPixels) / 100;