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 efade63916a2f36a74400bf378d587a763b690a6..0000000000000000000000000000000000000000 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 6edef05a95505d6e4605621b5975f179b331c04e..0000000000000000000000000000000000000000 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 8bf1ee459425236b46f96cc10c1912fec981d739..0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..974d60e2d7aeec5229de2b26495af671ddb579ba 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 0000000000000000000000000000000000000000..08fd35b4cbdba08150bb224a4981df94431749e7 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 d6ebbaedd28c504ab516d2cc79641d66dc9e04f6..0000000000000000000000000000000000000000 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 938c50d909e9dfbf0e931632a4a6282f6fe922b4..0000000000000000000000000000000000000000 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 1f3807209e1db00dc0b3f07fa5f2fd0e2bd813ad..0000000000000000000000000000000000000000 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 01858ffc64ddf763b244d301acaa33657a5ea3d5..0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..f9a0267b6e8cc706a1350b1d0fccf6f4a0887b16 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 0000000000000000000000000000000000000000..f22c541f7f9087c833dd863c6cf07faab5c1d58e 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 90b17a0170b63efad3051c1d15807a77e17f90d4..0000000000000000000000000000000000000000 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 99109113666357edda634c9bbcb9ebd2048e68a8..0000000000000000000000000000000000000000 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 a40d4d94c0fca5e85e08ce21f3ce99f8c74ceeea..0000000000000000000000000000000000000000 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 b8eb1384a23a5819bde40bf9679643dd477604d6..0000000000000000000000000000000000000000 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 6fa26d165211460883e53df6953fb117fc5ae76f..0000000000000000000000000000000000000000 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 153650a1f50238963f883cfeb8990d51d9ac57a0..0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..3db9979cf1b13128da38558494e6604e730098b6 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 0000000000000000000000000000000000000000..b7aa02377fd49c6a462c58ed7972719f41ccd978 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 b3833bc3e76f11b4abe7f1a487bb87025f003075..0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..7df040f3c06ecd6bed995d92b0a6caa440e518c5 --- /dev/null +++ b/briar-android/res/drawable/message_delivered.xml @@ -0,0 +1,5 @@ +<vector android:alpha="0.56" android:height="16dp" + android:viewportHeight="24.0" android:viewportWidth="24.0" + android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="#FF000000" android:pathData="M18,7l-1.41,-1.41 -6.34,6.34 1.41,1.41L18,7zm4.24,-1.41L11.66,16.17 7.48,12l-1.41,1.41L11.66,19l12,-12 -1.42,-1.41zM0.41,13.41L6,19l1.41,-1.41L1.83,12 0.41,13.41z"/> +</vector> diff --git a/briar-android/res/drawable/message_sent.xml b/briar-android/res/drawable/message_sent.xml new file mode 100644 index 0000000000000000000000000000000000000000..8a074e0fc85ef1382231f9bc8d30ac90bb237a64 --- /dev/null +++ b/briar-android/res/drawable/message_sent.xml @@ -0,0 +1,5 @@ +<vector android:alpha="0.56" android:height="16dp" + android:viewportHeight="24.0" android:viewportWidth="24.0" + android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="#FF000000" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/> +</vector> diff --git a/briar-android/res/drawable/message_stored.xml b/briar-android/res/drawable/message_stored.xml new file mode 100644 index 0000000000000000000000000000000000000000..b91196f03297bba45c20d43a0549f6c65ffce690 --- /dev/null +++ b/briar-android/res/drawable/message_stored.xml @@ -0,0 +1,5 @@ +<vector android:alpha="0.56" android:height="16dp" + android:viewportHeight="24.0" android:viewportWidth="24.0" + android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillAlpha=".9" android:fillColor="#FF000000" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/> +</vector> 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 0000000000000000000000000000000000000000..bd34e7fc219291f9a17e5c1d0a57f9afc1b5e6cf --- /dev/null +++ b/briar-android/res/drawable/social_send_now.xml @@ -0,0 +1,5 @@ +<vector android:alpha="0.56" android:height="24dp" + android:viewportHeight="24.0" android:viewportWidth="24.0" + android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> + <path android:fillColor="#FF000000" android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/> +</vector> diff --git a/briar-android/res/layout/activity_conversation.xml b/briar-android/res/layout/activity_conversation.xml index 1a07f07eb738e7d7b31df0edd0130f6eedf816a9..8bc064d2ad71fef07556fac587025506633e6583 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"> <EditText android:id="@+id/contentView" @@ -53,12 +51,16 @@ <ImageButton android:id="@+id/sendButton" - android:layout_width="wrap_content" - android:layout_height="wrap_content" + android:layout_width="38dp" + android:layout_height="38dp" + android:layout_gravity="bottom" android:src="@drawable/social_send_now" - android:background="@color/button_bar_background" + android:background="?attr/selectableItemBackground" + android:scaleType="fitEnd" android:contentDescription="@string/send" - android:layout_gravity="center"/> + android:paddingRight="@dimen/margin_medium" + android:paddingEnd="@dimen/margin_medium" + android:paddingBottom="@dimen/margin_medium"/> </LinearLayout> </LinearLayout> \ 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 0000000000000000000000000000000000000000..8194f5453a9efc4493af990f207dcc2c7f4681c4 --- /dev/null +++ b/briar-android/res/layout/list_item_msg_in.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingRight="@dimen/margin_medium" + android:paddingEnd="@dimen/margin_medium" + android:paddingTop="@dimen/margin_small" + android:paddingBottom="@dimen/margin_small"> + + <RelativeLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="left|start" + android:background="@drawable/msg_in" + android:paddingLeft="17dp" + android:paddingTop="5dp" + android:paddingRight="7dp" + android:paddingBottom="5dp"> + + <TextView + android:id="@+id/msgBody" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:minWidth="80dp" + android:textIsSelectable="true" + tools:text="Short message"/> + + <TextView + android:id="@+id/msgTime" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="10sp" + android:textColor="@color/private_message_date" + android:layout_below="@+id/msgBody" + tools:text="Dec 24, 13:37"/> + + </RelativeLayout> + +</LinearLayout> \ 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 0000000000000000000000000000000000000000..baacbb39fc9a7864ff1336c1090cca744c3959a8 --- /dev/null +++ b/briar-android/res/layout/list_item_msg_out.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingLeft="@dimen/margin_medium" + android:paddingStart="@dimen/margin_medium" + android:paddingTop="@dimen/margin_small" + android:paddingBottom="@dimen/margin_small"> + + <RelativeLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="right|end" + android:background="@drawable/msg_out" + android:paddingLeft="7dp" + android:paddingTop="5dp" + android:paddingRight="17dp" + android:paddingBottom="5dp"> + + <TextView + android:id="@+id/msgBody" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textIsSelectable="true" + android:minWidth="80dp" + tools:text="This is a long long long message that spans over several lines.\n\nIt ends here."/> + + <TextView + android:id="@+id/msgTime" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/msgBody" + android:layout_toLeftOf="@+id/msgStatus" + android:textSize="10sp" + android:textColor="@color/private_message_date" + android:singleLine="true" + tools:text="Dec 24, 13:37"/> + + <ImageView + android:id="@+id/msgStatus" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignBottom="@+id/msgTime" + android:layout_alignRight="@+id/msgBody" + android:layout_alignEnd="@+id/msgBody" + android:layout_marginLeft="3dp" + tools:src="@drawable/message_delivered"/> + + </RelativeLayout> + +</LinearLayout> \ No newline at end of file diff --git a/briar-android/res/values/color.xml b/briar-android/res/values/color.xml index 01b15430a4971d8de351a03ae47085fb9ee1c7d9..0ecc0f1ba7ad2565ad31c956d2d8673066342b9a 100644 --- a/briar-android/res/values/color.xml +++ b/briar-android/res/values/color.xml @@ -5,7 +5,6 @@ <color name="action_bar_background">#2D3E50</color> <color name="button_bar_background">#FFFFFF</color> <color name="dashboard_background">#FFFFFF</color> - <color name="private_message_background">#FFFFFF</color> <color name="private_message_date">#AAAAAA</color> <color name="unread_background">#FFFFFF</color> <color name="horizontal_border">#CCCCCC</color> diff --git a/briar-android/src/org/briarproject/android/contact/ConversationActivity.java b/briar-android/src/org/briarproject/android/contact/ConversationActivity.java index 98dcd179f828d0e5a40e8681fda3916076be9d17..02bc2b83a123e1c278083ca61a30ff500ce20214 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 a95b00e47574f78f119492ca232e871efdfcd001..0e2499c7eccbb23a4b5db2c24d08b0ab173df7e1 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<ConversationItem> { - private final int pad; - ConversationAdapter(Context ctx) { super(ctx, android.R.layout.simple_expandable_list_item_1, new ArrayList<ConversationItem>()); - pad = LayoutUtils.getPadding(ctx); } @Override @@ -42,46 +30,15 @@ class ConversationAdapter extends ArrayAdapter<ConversationItem> { 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<ConversationItem> { } else { status.setImageResource(R.drawable.message_stored); } - footer.addView(status); + } else { + v = inflater.inflate(R.layout.list_item_msg_in, null); + } - 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); + TextView body = (TextView) v.findViewById(R.id.msgBody); - layout.addView(footer); + if (item.getBody() == null) { + body.setText("\u2026"); + } else if (header.getContentType().equals("text/plain")) { + body.setText(StringUtils.fromUtf8(item.getBody())); } 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); + // TODO support other content types } - return layout; + 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 7ece03b027193c23925f04f8dcd79659c315af2a..01ba0030336eb2ae066eca735caa921fe5b447bf 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 {