Small code change on MessageCompose

Change how we show/hide CC/BCC.  The new way will work for the tab UI too,
where we show the labels to these fields as well.

Also hide the "+Cc/Bcc" button when they're visible.

Bug 3138037
Bug 3192841

Change-Id: Ic78b3200c418430c8eade3ca1238b0d0f1ee4731
This commit is contained in:
Makoto Onuki 2010-11-12 14:55:23 -08:00
parent 6926cf85ef
commit 4977ce62f0
2 changed files with 43 additions and 35 deletions

View File

@ -14,6 +14,8 @@
limitations under the License.
-->
<!-- TODO Simplify this. This layout is way too deep. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:layout_width="match_parent"
android:orientation="vertical" android:background="#ffffff">
@ -36,28 +38,36 @@
android:inputType="textEmailAddress|textMultiLine"
android:imeOptions="actionNext"
android:hint="@string/message_compose_to_hint" />
<com.android.email.activity.AddressTextView
android:id="@+id/cc" android:layout_width="match_parent"
<LinearLayout
android:id="@+id/cc_bcc_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorSecondary"
android:layout_marginLeft="6dip"
android:layout_marginRight="6dip"
android:inputType="textEmailAddress|textMultiLine"
android:imeOptions="actionNext"
android:hint="@string/message_compose_cc_hint"
android:visibility="gone" />
<com.android.email.activity.AddressTextView
android:id="@+id/bcc" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorSecondary"
android:layout_marginLeft="6dip"
android:layout_marginRight="6dip"
android:inputType="textEmailAddress|textMultiLine"
android:imeOptions="actionNext"
android:hint="@string/message_compose_bcc_hint"
android:visibility="gone" />
android:orientation="vertical"
android:visibility="gone"
>
<com.android.email.activity.AddressTextView
android:id="@+id/cc" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorSecondary"
android:layout_marginLeft="6dip"
android:layout_marginRight="6dip"
android:inputType="textEmailAddress|textMultiLine"
android:imeOptions="actionNext"
android:hint="@string/message_compose_cc_hint"
/>
<com.android.email.activity.AddressTextView
android:id="@+id/bcc" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorSecondary"
android:layout_marginLeft="6dip"
android:layout_marginRight="6dip"
android:inputType="textEmailAddress|textMultiLine"
android:imeOptions="actionNext"
android:hint="@string/message_compose_bcc_hint"
/>
</LinearLayout>
<EditText android:id="@+id/subject"
android:layout_width="match_parent"
android:textAppearance="?android:attr/textAppearanceMedium"

View File

@ -97,8 +97,6 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
private static final String EXTRA_MESSAGE_ID = "message_id";
private static final String STATE_KEY_CC_SHOWN =
"com.android.email.activity.MessageCompose.ccShown";
private static final String STATE_KEY_BCC_SHOWN =
"com.android.email.activity.MessageCompose.bccShown";
private static final String STATE_KEY_QUOTED_TEXT_SHOWN =
"com.android.email.activity.MessageCompose.quotedTextShown";
private static final String STATE_KEY_SOURCE_MESSAGE_PROCED =
@ -148,6 +146,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
private MultiAutoCompleteTextView mToView;
private MultiAutoCompleteTextView mCcView;
private MultiAutoCompleteTextView mBccView;
private View mCcBccContainer;
private EditText mSubjectView;
private EditText mMessageContentView;
private LinearLayout mAttachments;
@ -406,8 +405,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
if (draftId != -1) {
outState.putLong(STATE_KEY_DRAFT_ID, draftId);
}
outState.putBoolean(STATE_KEY_CC_SHOWN, mCcView.getVisibility() == View.VISIBLE);
outState.putBoolean(STATE_KEY_BCC_SHOWN, mBccView.getVisibility() == View.VISIBLE);
outState.putBoolean(STATE_KEY_CC_SHOWN, mCcBccContainer.getVisibility() == View.VISIBLE);
outState.putBoolean(STATE_KEY_QUOTED_TEXT_SHOWN,
mQuotedTextBar.getVisibility() == View.VISIBLE);
outState.putBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, mSourceMessageProcessed);
@ -416,10 +414,9 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
mCcView.setVisibility(savedInstanceState.getBoolean(STATE_KEY_CC_SHOWN) ?
View.VISIBLE : View.GONE);
mBccView.setVisibility(savedInstanceState.getBoolean(STATE_KEY_BCC_SHOWN) ?
View.VISIBLE : View.GONE);
if (savedInstanceState.getBoolean(STATE_KEY_CC_SHOWN)) {
showCcBccFields();
}
mQuotedTextBar.setVisibility(savedInstanceState.getBoolean(STATE_KEY_QUOTED_TEXT_SHOWN) ?
View.VISIBLE : View.GONE);
mQuotedText.setVisibility(savedInstanceState.getBoolean(STATE_KEY_QUOTED_TEXT_SHOWN) ?
@ -438,6 +435,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
mToView = (MultiAutoCompleteTextView)findViewById(R.id.to);
mCcView = (MultiAutoCompleteTextView)findViewById(R.id.cc);
mBccView = (MultiAutoCompleteTextView)findViewById(R.id.bcc);
mCcBccContainer = findViewById(R.id.cc_bcc_container);
mSubjectView = (EditText)findViewById(R.id.subject);
mMessageContentView = (EditText)findViewById(R.id.message_content);
mAttachments = (LinearLayout)findViewById(R.id.attachments);
@ -1033,9 +1031,9 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
finish();
}
private void onAddCcBcc() {
mCcView.setVisibility(View.VISIBLE);
mBccView.setVisibility(View.VISIBLE);
private void showCcBccFields() {
mCcBccContainer.setVisibility(View.VISIBLE);
findViewById(R.id.add_cc_bcc).setVisibility(View.GONE);
}
/**
@ -1223,7 +1221,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
onIncludeQuotedTextChanged();
return true;
case R.id.add_cc_bcc:
onAddCcBcc();
showCcBccFields();
return true;
case R.id.add_attachment:
onAddAttachment();
@ -1537,12 +1535,12 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
Address[] cc = Address.unpack(message.mCc);
if (cc.length > 0) {
addAddresses(mCcView, cc);
mCcView.setVisibility(View.VISIBLE);
showCcBccFields();
}
Address[] bcc = Address.unpack(message.mBcc);
if (bcc.length > 0) {
addAddresses(mBccView, bcc);
mBccView.setVisibility(View.VISIBLE);
showCcBccFields();
}
mMessageContentView.setText(message.mText);