diff --git a/briar-android/res/drawable-hdpi/message_delivered.png b/briar-android/res/drawable-hdpi/message_delivered.png deleted file mode 100644 index efade6391..000000000 Binary files a/briar-android/res/drawable-hdpi/message_delivered.png and /dev/null differ diff --git a/briar-android/res/drawable-hdpi/message_sent.png b/briar-android/res/drawable-hdpi/message_sent.png deleted file mode 100644 index 6edef05a9..000000000 Binary files a/briar-android/res/drawable-hdpi/message_sent.png and /dev/null differ diff --git a/briar-android/res/drawable-hdpi/message_stored.png b/briar-android/res/drawable-hdpi/message_stored.png deleted file mode 100644 index 8bf1ee459..000000000 Binary files a/briar-android/res/drawable-hdpi/message_stored.png and /dev/null differ diff --git a/briar-android/res/drawable-hdpi/msg_in.9.png b/briar-android/res/drawable-hdpi/msg_in.9.png new file mode 100644 index 000000000..974d60e2d Binary files /dev/null and b/briar-android/res/drawable-hdpi/msg_in.9.png differ diff --git a/briar-android/res/drawable-hdpi/msg_out.9.png b/briar-android/res/drawable-hdpi/msg_out.9.png new file mode 100644 index 000000000..08fd35b4c Binary files /dev/null and b/briar-android/res/drawable-hdpi/msg_out.9.png differ diff --git a/briar-android/res/drawable-hdpi/social_send_now.png b/briar-android/res/drawable-hdpi/social_send_now.png deleted file mode 100644 index d6ebbaedd..000000000 Binary files a/briar-android/res/drawable-hdpi/social_send_now.png and /dev/null differ diff --git a/briar-android/res/drawable-mdpi/message_delivered.png b/briar-android/res/drawable-mdpi/message_delivered.png deleted file mode 100644 index 938c50d90..000000000 Binary files a/briar-android/res/drawable-mdpi/message_delivered.png and /dev/null differ diff --git a/briar-android/res/drawable-mdpi/message_sent.png b/briar-android/res/drawable-mdpi/message_sent.png deleted file mode 100644 index 1f3807209..000000000 Binary files a/briar-android/res/drawable-mdpi/message_sent.png and /dev/null differ diff --git a/briar-android/res/drawable-mdpi/message_stored.png b/briar-android/res/drawable-mdpi/message_stored.png deleted file mode 100644 index 01858ffc6..000000000 Binary files a/briar-android/res/drawable-mdpi/message_stored.png and /dev/null differ diff --git a/briar-android/res/drawable-mdpi/msg_in.9.png b/briar-android/res/drawable-mdpi/msg_in.9.png new file mode 100644 index 000000000..f9a0267b6 Binary files /dev/null and b/briar-android/res/drawable-mdpi/msg_in.9.png differ diff --git a/briar-android/res/drawable-mdpi/msg_out.9.png b/briar-android/res/drawable-mdpi/msg_out.9.png new file mode 100644 index 000000000..f22c541f7 Binary files /dev/null and b/briar-android/res/drawable-mdpi/msg_out.9.png differ diff --git a/briar-android/res/drawable-mdpi/social_send_now.png b/briar-android/res/drawable-mdpi/social_send_now.png deleted file mode 100644 index 90b17a017..000000000 Binary files a/briar-android/res/drawable-mdpi/social_send_now.png and /dev/null differ diff --git a/briar-android/res/drawable-xhdpi/message_delivered.png b/briar-android/res/drawable-xhdpi/message_delivered.png deleted file mode 100644 index 991091136..000000000 Binary files a/briar-android/res/drawable-xhdpi/message_delivered.png and /dev/null differ diff --git a/briar-android/res/drawable-xhdpi/message_sent.png b/briar-android/res/drawable-xhdpi/message_sent.png deleted file mode 100644 index a40d4d94c..000000000 Binary files a/briar-android/res/drawable-xhdpi/message_sent.png and /dev/null differ diff --git a/briar-android/res/drawable-xhdpi/message_stored.png b/briar-android/res/drawable-xhdpi/message_stored.png deleted file mode 100644 index b8eb1384a..000000000 Binary files a/briar-android/res/drawable-xhdpi/message_stored.png and /dev/null differ diff --git a/briar-android/res/drawable-xhdpi/social_send_now.png b/briar-android/res/drawable-xhdpi/social_send_now.png deleted file mode 100644 index 6fa26d165..000000000 Binary files a/briar-android/res/drawable-xhdpi/social_send_now.png and /dev/null differ diff --git a/briar-android/res/drawable-xxhdpi/message_stored.png b/briar-android/res/drawable-xxhdpi/message_stored.png deleted file mode 100644 index 153650a1f..000000000 Binary files a/briar-android/res/drawable-xxhdpi/message_stored.png and /dev/null differ diff --git a/briar-android/res/drawable-xxhdpi/msg_in.9.png b/briar-android/res/drawable-xxhdpi/msg_in.9.png new file mode 100644 index 000000000..3db9979cf Binary files /dev/null and b/briar-android/res/drawable-xxhdpi/msg_in.9.png differ diff --git a/briar-android/res/drawable-xxhdpi/msg_out.9.png b/briar-android/res/drawable-xxhdpi/msg_out.9.png new file mode 100644 index 000000000..b7aa02377 Binary files /dev/null and b/briar-android/res/drawable-xxhdpi/msg_out.9.png differ diff --git a/briar-android/res/drawable-xxxhdpi/message_stored.png b/briar-android/res/drawable-xxxhdpi/message_stored.png deleted file mode 100644 index b3833bc3e..000000000 Binary files a/briar-android/res/drawable-xxxhdpi/message_stored.png and /dev/null differ diff --git a/briar-android/res/drawable/message_delivered.xml b/briar-android/res/drawable/message_delivered.xml new file mode 100644 index 000000000..7df040f3c --- /dev/null +++ b/briar-android/res/drawable/message_delivered.xml @@ -0,0 +1,5 @@ + + + diff --git a/briar-android/res/drawable/message_sent.xml b/briar-android/res/drawable/message_sent.xml new file mode 100644 index 000000000..8a074e0fc --- /dev/null +++ b/briar-android/res/drawable/message_sent.xml @@ -0,0 +1,5 @@ + + + diff --git a/briar-android/res/drawable/message_stored.xml b/briar-android/res/drawable/message_stored.xml new file mode 100644 index 000000000..b91196f03 --- /dev/null +++ b/briar-android/res/drawable/message_stored.xml @@ -0,0 +1,5 @@ + + + diff --git a/briar-android/res/drawable/social_send_now.xml b/briar-android/res/drawable/social_send_now.xml new file mode 100644 index 000000000..bd34e7fc2 --- /dev/null +++ b/briar-android/res/drawable/social_send_now.xml @@ -0,0 +1,5 @@ + + + diff --git a/briar-android/res/layout/activity_conversation.xml b/briar-android/res/layout/activity_conversation.xml index 1a07f07eb..8bc064d2a 100644 --- a/briar-android/res/layout/activity_conversation.xml +++ b/briar-android/res/layout/activity_conversation.xml @@ -39,9 +39,7 @@ android:layout_height="wrap_content" android:background="@color/button_bar_background" android:paddingLeft="@dimen/margin_medium" - android:paddingStart="@dimen/margin_medium" - android:paddingRight="@dimen/margin_medium" - android:paddingEnd="@dimen/margin_medium"> + android:paddingStart="@dimen/margin_medium"> + android:paddingRight="@dimen/margin_medium" + android:paddingEnd="@dimen/margin_medium" + android:paddingBottom="@dimen/margin_medium"/> \ No newline at end of file diff --git a/briar-android/res/layout/list_item_msg_in.xml b/briar-android/res/layout/list_item_msg_in.xml new file mode 100644 index 000000000..8194f5453 --- /dev/null +++ b/briar-android/res/layout/list_item_msg_in.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/briar-android/res/layout/list_item_msg_out.xml b/briar-android/res/layout/list_item_msg_out.xml new file mode 100644 index 000000000..baacbb39f --- /dev/null +++ b/briar-android/res/layout/list_item_msg_out.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/briar-android/res/values/color.xml b/briar-android/res/values/color.xml index 01b15430a..0ecc0f1ba 100644 --- a/briar-android/res/values/color.xml +++ b/briar-android/res/values/color.xml @@ -5,7 +5,6 @@ #2D3E50 #FFFFFF #FFFFFF - #FFFFFF #AAAAAA #FFFFFF #CCCCCC diff --git a/briar-android/src/org/briarproject/android/contact/ConversationActivity.java b/briar-android/src/org/briarproject/android/contact/ConversationActivity.java index 98dcd179f..02bc2b83a 100644 --- a/briar-android/src/org/briarproject/android/contact/ConversationActivity.java +++ b/briar-android/src/org/briarproject/android/contact/ConversationActivity.java @@ -142,14 +142,7 @@ implements EventListener, OnClickListener, OnItemClickListener { } }; list.setLayoutParams(MATCH_WRAP_1); - int pad = LayoutUtils.getPadding(this); - list.setPadding(0, pad, 0, pad); - list.setClipToPadding(false); - // Make the dividers the same colour as the background - Resources res = getResources(); - int background = res.getColor(android.R.color.transparent); - list.setDivider(new ColorDrawable(background)); - list.setDividerHeight(pad); + list.setDivider(null); list.setAdapter(adapter); list.setOnItemClickListener(this); list.setEmptyView(loading); diff --git a/briar-android/src/org/briarproject/android/contact/ConversationAdapter.java b/briar-android/src/org/briarproject/android/contact/ConversationAdapter.java index a95b00e47..0e2499c7e 100644 --- a/briar-android/src/org/briarproject/android/contact/ConversationAdapter.java +++ b/briar-android/src/org/briarproject/android/contact/ConversationAdapter.java @@ -1,40 +1,28 @@ package org.briarproject.android.contact; import android.content.Context; -import android.content.res.Resources; import android.text.format.DateUtils; +import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; -import android.widget.ImageButton; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.TextView; import org.briarproject.R; -import org.briarproject.android.util.ElasticHorizontalSpace; -import org.briarproject.android.util.LayoutUtils; import org.briarproject.api.messaging.PrivateMessageHeader; import org.briarproject.util.StringUtils; import java.util.ArrayList; -import static android.view.Gravity.BOTTOM; -import static android.view.Gravity.LEFT; -import static android.widget.LinearLayout.HORIZONTAL; -import static android.widget.LinearLayout.VERTICAL; -import static org.briarproject.android.util.CommonLayoutParams.MATCH_WRAP; import static org.briarproject.api.messaging.PrivateMessageHeader.Status.DELIVERED; import static org.briarproject.api.messaging.PrivateMessageHeader.Status.SENT; class ConversationAdapter extends ArrayAdapter { - private final int pad; - ConversationAdapter(Context ctx) { super(ctx, android.R.layout.simple_expandable_list_item_1, new ArrayList()); - pad = LayoutUtils.getPadding(ctx); } @Override @@ -42,46 +30,15 @@ class ConversationAdapter extends ArrayAdapter { ConversationItem item = getItem(position); PrivateMessageHeader header = item.getHeader(); Context ctx = getContext(); - Resources res = ctx.getResources(); - LinearLayout layout = new LinearLayout(ctx); - layout.setOrientation(VERTICAL); - if (header.isLocal()) layout.setPadding(3 * pad, 0, 0, 0); - else layout.setPadding(0, 0, 3 * pad, 0); - - int background = res.getColor(R.color.private_message_background); - - View content; - if (item.getBody() == null) { - TextView ellipsis = new TextView(ctx); - ellipsis.setText("\u2026"); - content = ellipsis; - } else if (header.getContentType().equals("text/plain")) { - TextView text = new TextView(ctx); - text.setText(StringUtils.fromUtf8(item.getBody())); - content = text; - } else { - ImageButton attachment = new ImageButton(ctx); - attachment.setImageResource(R.drawable.content_attachment); - content = attachment; - } - content.setLayoutParams(MATCH_WRAP); - content.setBackgroundColor(background); - content.setPadding(pad, pad, pad, 0); - layout.addView(content); + LayoutInflater inflater = (LayoutInflater) ctx.getSystemService + (Context.LAYOUT_INFLATER_SERVICE); + View v; if (header.isLocal()) { - LinearLayout footer = new LinearLayout(ctx); - footer.setLayoutParams(MATCH_WRAP); - footer.setOrientation(HORIZONTAL); - footer.setGravity(BOTTOM); - footer.setPadding(pad, 0, pad, pad); - footer.setBackgroundColor(background); + v = inflater.inflate(R.layout.list_item_msg_out, null); - footer.addView(new ElasticHorizontalSpace(ctx)); - - ImageView status = new ImageView(ctx); - status.setPadding(0, 0, pad, 0); + ImageView status = (ImageView) v.findViewById(R.id.msgStatus); if (item.getStatus() == DELIVERED) { status.setImageResource(R.drawable.message_delivered); } else if (item.getStatus() == SENT) { @@ -89,27 +46,24 @@ class ConversationAdapter extends ArrayAdapter { } else { status.setImageResource(R.drawable.message_stored); } - footer.addView(status); - - TextView date = new TextView(ctx); - date.setTextColor(res.getColor(R.color.private_message_date)); - long timestamp = header.getTimestamp(); - date.setText(DateUtils.getRelativeTimeSpanString(ctx, timestamp)); - footer.addView(date); - - layout.addView(footer); } else { - TextView date = new TextView(ctx); - date.setLayoutParams(MATCH_WRAP); - date.setGravity(LEFT); - date.setTextColor(res.getColor(R.color.private_message_date)); - date.setBackgroundColor(background); - date.setPadding(pad, 0, pad, pad); - long timestamp = header.getTimestamp(); - date.setText(DateUtils.getRelativeTimeSpanString(ctx, timestamp)); - layout.addView(date); + v = inflater.inflate(R.layout.list_item_msg_in, null); } - return layout; + TextView body = (TextView) v.findViewById(R.id.msgBody); + + if (item.getBody() == null) { + body.setText("\u2026"); + } else if (header.getContentType().equals("text/plain")) { + body.setText(StringUtils.fromUtf8(item.getBody())); + } else { + // TODO support other content types + } + + TextView date = (TextView) v.findViewById(R.id.msgTime); + long timestamp = header.getTimestamp(); + date.setText(DateUtils.getRelativeTimeSpanString(ctx, timestamp)); + + return v; } } \ No newline at end of file diff --git a/briar-android/src/org/briarproject/android/contact/ReadPrivateMessageActivity.java b/briar-android/src/org/briarproject/android/contact/ReadPrivateMessageActivity.java index 7ece03b02..01ba00303 100644 --- a/briar-android/src/org/briarproject/android/contact/ReadPrivateMessageActivity.java +++ b/briar-android/src/org/briarproject/android/contact/ReadPrivateMessageActivity.java @@ -40,6 +40,7 @@ import static org.briarproject.android.util.CommonLayoutParams.MATCH_WRAP_1; import static org.briarproject.android.util.CommonLayoutParams.WRAP_WRAP_1; import static org.briarproject.api.identity.Author.Status.VERIFIED; +@Deprecated public class ReadPrivateMessageActivity extends BriarActivity implements OnClickListener {