From 8619f89890b79b4d35677981d2c167547e7331c5 Mon Sep 17 00:00:00 2001 From: akwizgran Date: Thu, 27 Feb 2014 15:34:52 +0000 Subject: [PATCH] Cleaned up composition screen layouts. --- briar-android/res/values/strings.xml | 12 +++++------- .../contact/WritePrivateMessageActivity.java | 17 +++++------------ .../groups/WriteGroupPostActivity.java | 19 +++---------------- 3 files changed, 13 insertions(+), 35 deletions(-) diff --git a/briar-android/res/values/strings.xml b/briar-android/res/values/strings.xml index 32bc6f1a9..b6e54ad64 100644 --- a/briar-android/res/values/strings.xml +++ b/briar-android/res/values/strings.xml @@ -22,7 +22,6 @@ Forums Synchronize Sign Out - New identity\u2026 Contacts Connected Last connected <br /> %s @@ -47,13 +46,9 @@ Contact added Type message Message sent - From: %s - To: %s Private Message New Private Message - From: - To: - Anonymous + From: %s New contact\u2026 Forums @@ -68,7 +63,10 @@ Share this forum with chosen contacts Done New Post - New forum\u2026 + From: + Anonymous + New identity\u2026 + Type forum post Available Forums No forums available from contacts Subscribed, shared with all contacts diff --git a/briar-android/src/org/briarproject/android/contact/WritePrivateMessageActivity.java b/briar-android/src/org/briarproject/android/contact/WritePrivateMessageActivity.java index d802d6f64..1a92f3c99 100644 --- a/briar-android/src/org/briarproject/android/contact/WritePrivateMessageActivity.java +++ b/briar-android/src/org/briarproject/android/contact/WritePrivateMessageActivity.java @@ -60,7 +60,7 @@ implements OnClickListener { Logger.getLogger(WritePrivateMessageActivity.class.getName()); @Inject @CryptoExecutor private Executor cryptoExecutor; - private TextView from = null, to = null; + private TextView from = null; private ImageButton sendButton = null; private EditText content = null; @@ -84,6 +84,7 @@ implements OnClickListener { Intent i = getIntent(); contactName = i.getStringExtra("briar.CONTACT_NAME"); if(contactName == null) throw new IllegalStateException(); + setTitle(contactName); byte[] b = i.getByteArrayExtra("briar.GROUP_ID"); if(b == null) throw new IllegalStateException(); groupId = new GroupId(b); @@ -98,7 +99,7 @@ implements OnClickListener { layout.setLayoutParams(MATCH_WRAP); layout.setOrientation(VERTICAL); int pad = LayoutUtils.getPadding(this); - layout.setPadding(pad, pad, pad, pad); + layout.setPadding(pad, 0, pad, pad); RelativeLayout header = new RelativeLayout(this); @@ -107,7 +108,7 @@ implements OnClickListener { from.setTextSize(18); from.setSingleLine(); from.setEllipsize(END); - from.setPadding(0, 0, pad, pad); + from.setPadding(0, 0, pad, 0); from.setText(R.string.from); RelativeLayout.LayoutParams leftOf = CommonLayoutParams.relative(); leftOf.addRule(ALIGN_PARENT_LEFT); @@ -127,20 +128,12 @@ implements OnClickListener { header.addView(sendButton, right); layout.addView(header); - to = new TextView(this); - to.setTextSize(18); - to.setSingleLine(); - to.setEllipsize(END); - to.setPadding(0, 0, pad, pad); - String format = getResources().getString(R.string.format_to); - to.setText(String.format(format, contactName)); - layout.addView(to); - content = new EditText(this); content.setId(3); int inputType = TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | TYPE_TEXT_FLAG_CAP_SENTENCES; content.setInputType(inputType); + content.setHint(R.string.private_message_hint); layout.addView(content); setContentView(layout); diff --git a/briar-android/src/org/briarproject/android/groups/WriteGroupPostActivity.java b/briar-android/src/org/briarproject/android/groups/WriteGroupPostActivity.java index a15793694..db9cca5bf 100644 --- a/briar-android/src/org/briarproject/android/groups/WriteGroupPostActivity.java +++ b/briar-android/src/org/briarproject/android/groups/WriteGroupPostActivity.java @@ -2,7 +2,6 @@ package org.briarproject.android.groups; import static android.text.InputType.TYPE_CLASS_TEXT; import static android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; -import static android.text.TextUtils.TruncateAt.END; import static android.widget.LinearLayout.VERTICAL; import static android.widget.RelativeLayout.ALIGN_PARENT_LEFT; import static android.widget.RelativeLayout.ALIGN_PARENT_RIGHT; @@ -48,7 +47,6 @@ import org.briarproject.api.messaging.MessageId; import org.briarproject.util.StringUtils; import android.content.Intent; -import android.content.res.Resources; import android.os.Bundle; import android.text.InputType; import android.view.View; @@ -73,7 +71,6 @@ implements OnItemSelectedListener, OnClickListener { private LocalAuthorSpinnerAdapter adapter = null; private Spinner spinner = null; private ImageButton sendButton = null; - private TextView to = null; private EditText content = null; private AuthorId localAuthorId = null; private GroupId groupId = null; @@ -111,14 +108,13 @@ implements OnItemSelectedListener, OnClickListener { layout.setLayoutParams(MATCH_WRAP); layout.setOrientation(VERTICAL); int pad = LayoutUtils.getPadding(this); - layout.setPadding(pad, pad, pad, pad); + layout.setPadding(pad, 0, pad, pad); RelativeLayout header = new RelativeLayout(this); TextView from = new TextView(this); from.setId(1); from.setTextSize(18); - from.setPadding(0, 0, 0, pad); from.setText(R.string.from); RelativeLayout.LayoutParams left = CommonLayoutParams.relative(); left.addRule(ALIGN_PARENT_LEFT); @@ -148,19 +144,12 @@ implements OnItemSelectedListener, OnClickListener { header.addView(sendButton, right); layout.addView(header); - to = new TextView(this); - to.setTextSize(18); - to.setSingleLine(); - to.setEllipsize(END); - to.setPadding(0, 0, pad, pad); - to.setText(R.string.to); - layout.addView(to); - content = new EditText(this); content.setId(4); int inputType = TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE | TYPE_TEXT_FLAG_CAP_SENTENCES; content.setInputType(inputType); + content.setHint(R.string.group_post_hint); layout.addView(content); setContentView(layout); @@ -216,9 +205,7 @@ implements OnItemSelectedListener, OnClickListener { break; } } - Resources res = getResources(); - String format = res.getString(R.string.format_to); - to.setText(String.format(format, group.getName())); + setTitle(group.getName()); sendButton.setEnabled(true); } });