UI change: MassageCompose

Basic changes for the new UI.  At this point we don't know what the new phone
UI will look like, so I didn't bother trying to preserve the old behavior on
the phone UI.  The changes will affect both the phone UI and the tablet UI.

- Send, Save Draft, and Discard are now action bar commands.
- Add CC/BCC and Add Attachment are now regular buttons.
- Activity title changed to "Compose"
- Some string changes per new wireframe

Further changes (actual layout changes for the latest wireframe) should be made
only for the xlarge layout.

Change-Id: I68c9c37dfdca6736b1e35053e7f196800fcfce2e
This commit is contained in:
Makoto Onuki 2010-11-03 14:20:10 -07:00
parent c81bef6720
commit bf678771b7
5 changed files with 77 additions and 76 deletions

View File

@ -201,7 +201,7 @@
</activity>
<activity
android:name=".activity.MessageCompose"
android:label="@string/app_name"
android:label="@string/compose_title"
android:enabled="false"
>
<intent-filter>

View File

@ -144,20 +144,15 @@
android:paddingBottom="1dip"
android:background="@android:drawable/bottom_bar" >
<Button
android:id="@+id/send"
android:text="@string/send_action"
android:id="@+id/add_cc_bcc"
android:text="@string/add_cc_bcc_action"
android:layout_height="match_parent"
android:layout_width="0dip"
android:layout_weight="1" />
<!-- STOPSHIP Need icon -->
<Button
android:id="@+id/save"
android:text="@string/save_draft_action"
android:layout_height="match_parent"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/discard"
android:text="@string/discard_action"
android:id="@+id/add_attachment"
android:text="@string/add_attachment_action"
android:layout_height="match_parent"
android:layout_width="0dip"
android:layout_weight="1" />

View File

@ -15,18 +15,24 @@
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<!-- STOPSHIP Need icon-->
<item
android:id="@+id/add_cc_bcc"
android:alphabeticShortcut="c"
android:title="@string/add_cc_bcc_action"
android:icon="@drawable/ic_menu_cc"
android:id="@+id/send"
android:title="@string/send_action"
android:showAsAction="always"
android:alphabeticShortcut="s"
/>
<item
android:id="@+id/add_attachment"
android:alphabeticShortcut="n"
android:title="@string/add_attachment_action"
android:icon="@drawable/ic_menu_attachment"
android:id="@+id/save"
android:title="@string/save_draft_action"
android:showAsAction="always"
android:alphabeticShortcut="d"
/>
<!-- STOPSHIP Need icon, don't need title-->
<item
android:id="@+id/discard"
android:title="@string/discard_action"
android:showAsAction="always"
android:alphabeticShortcut="q"
/>
</menu>

View File

@ -82,8 +82,8 @@
<string name="done_action">Done</string>
<!-- Menu item/button name -->
<string name="discard_action">Discard</string>
<!-- Menu item/button name -->
<string name="save_draft_action">Save as draft</string>
<!-- Menu item/button name [CHAR_LIMIT=16] -->
<string name="save_draft_action">Save draft</string>
<!-- Menu item/button name -->
<string name="read_unread_action">Read/Unread</string>
<!-- Menu item/button name -->
@ -122,8 +122,8 @@
<string name="mark_as_unread_action">Mark as unread</string>
<!-- Menu item for moving messages to folders [CHAR LIMIT=10] -->
<string name="move_action" translatable="false">Move</string>
<!-- Menu item -->
<string name="add_cc_bcc_action">Add Cc/Bcc</string>
<!-- Menu item / button label for adding CC/BCC fields on message compose. [CHAR LIMIT=16] -->
<string name="add_cc_bcc_action">+ Cc/Bcc</string>
<!-- Menu item -->
<string name="add_attachment_action">Add attachment</string>
<!-- Menu item (debug screen) -->

View File

@ -62,7 +62,6 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageButton;
@ -82,9 +81,8 @@ import java.util.List;
* Activity to compose a message.
*
* TODO Revive shortcuts command for removed menu options.
* S: send
* D: save draft
* Q: discard
* C: add cc/bcc
* N: add attachment
*/
public class MessageCompose extends Activity implements OnClickListener, OnFocusChangeListener {
private static final String ACTION_REPLY = "com.android.email.intent.action.REPLY";
@ -149,9 +147,6 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
private MultiAutoCompleteTextView mBccView;
private EditText mSubjectView;
private EditText mMessageContentView;
private Button mSendButton;
private Button mDiscardButton;
private Button mSaveButton;
private LinearLayout mAttachments;
private View mQuotedTextBar;
private CheckBox mIncludeQuotedTextCheckBox;
@ -167,6 +162,9 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
private EmailAddressAdapter mAddressAdapterCc;
private EmailAddressAdapter mAddressAdapterBcc;
/** Whether the save command should be enabled. */
private boolean mSaveEnabled;
/**
* Compose a new message using the given account. If account is -1 the default account
* will be used.
@ -428,7 +426,8 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
private void setDraftNeedsSaving(boolean needsSaving) {
mDraftNeedsSaving = needsSaving;
mSaveButton.setEnabled(needsSaving);
mSaveEnabled = needsSaving;
invalidateOptionsMenu();
}
private void initViews() {
@ -438,9 +437,6 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
mBccView = (MultiAutoCompleteTextView)findViewById(R.id.bcc);
mSubjectView = (EditText)findViewById(R.id.subject);
mMessageContentView = (EditText)findViewById(R.id.message_content);
mSendButton = (Button)findViewById(R.id.send);
mDiscardButton = (Button)findViewById(R.id.discard);
mSaveButton = (Button)findViewById(R.id.save);
mAttachments = (LinearLayout)findViewById(R.id.attachments);
mQuotedTextBar = findViewById(R.id.quoted_text_bar);
mIncludeQuotedTextCheckBox = (CheckBox) findViewById(R.id.include_quoted_text);
@ -546,9 +542,8 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
mBccView.setTokenizer(new Rfc822Tokenizer());
mBccView.setValidator(addressValidator);
mSendButton.setOnClickListener(this);
mDiscardButton.setOnClickListener(this);
mSaveButton.setOnClickListener(this);
findViewById(R.id.add_cc_bcc).setOnClickListener(this);
findViewById(R.id.add_attachment).setOnClickListener(this);
mSubjectView.setOnFocusChangeListener(this);
mMessageContentView.setOnFocusChangeListener(this);
@ -1139,30 +1134,21 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
setDraftNeedsSaving(true);
}
public void onClick(View view) {
switch (view.getId()) {
case R.id.send:
onSend();
break;
case R.id.save:
onSave();
break;
case R.id.discard:
onDiscard();
break;
case R.id.attachment_delete:
onDeleteAttachment(view);
break;
case R.id.include_quoted_text:
onIncludeQuotedTextChanged();
break;
}
}
private boolean includeQuotedText() {
return mIncludeQuotedTextCheckBox.isChecked();
}
public void onClick(View view) {
if (handleCommand(view.getId())) {
return;
}
switch (view.getId()) {
case R.id.attachment_delete:
onDeleteAttachment(view); // Needs a view; can't be a menu item
break;
}
}
private void setIncludeQuotedText(boolean include) {
mIncludeQuotedTextCheckBox.setChecked(include);
onIncludeQuotedTextChanged();
@ -1200,26 +1186,34 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.send:
onSend();
break;
case R.id.save:
onSave();
break;
case R.id.discard:
onDiscard();
break;
case R.id.add_cc_bcc:
onAddCcBcc();
break;
case R.id.add_attachment:
onAddAttachment();
break;
default:
return super.onOptionsItemSelected(item);
if (handleCommand(item.getItemId())) {
return true;
}
return true;
return super.onOptionsItemSelected(item);
}
private boolean handleCommand(int viewId) {
switch (viewId) {
case R.id.send:
onSend();
return true;
case R.id.save:
onSave();
return true;
case R.id.discard:
onDiscard();
return true;
case R.id.include_quoted_text:
onIncludeQuotedTextChanged();
return true;
case R.id.add_cc_bcc:
onAddCcBcc();
return true;
case R.id.add_attachment:
onAddAttachment();
return true;
}
return false;
}
@Override
@ -1229,6 +1223,12 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.save).setEnabled(mSaveEnabled);
return true;
}
/**
* Set a message body and a signature when the Activity is launched.
*