Add an actionbar to the MessageView activity.
@ -217,8 +217,8 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.fsck.k9.activity.MessageView"
|
android:name="com.fsck.k9.activity.MessageView"
|
||||||
android:theme="@android:style/Theme.Light"
|
|
||||||
android:configChanges="locale"
|
android:configChanges="locale"
|
||||||
|
android:uiOptions="splitActionBarWhenNarrow"
|
||||||
>
|
>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
BIN
res/drawable-hdpi/ic_action_next_message.png
Normal file
After Width: | Height: | Size: 720 B |
BIN
res/drawable-hdpi/ic_action_previous_message.png
Normal file
After Width: | Height: | Size: 685 B |
BIN
res/drawable-ldpi/ic_action_next_message.png
Normal file
After Width: | Height: | Size: 333 B |
BIN
res/drawable-ldpi/ic_action_previous_message.png
Normal file
After Width: | Height: | Size: 321 B |
BIN
res/drawable-mdpi/ic_action_next_message.png
Normal file
After Width: | Height: | Size: 468 B |
BIN
res/drawable-mdpi/ic_action_previous_message.png
Normal file
After Width: | Height: | Size: 418 B |
BIN
res/drawable-xhdpi/ic_action_next_message.png
Normal file
After Width: | Height: | Size: 938 B |
BIN
res/drawable-xhdpi/ic_action_previous_message.png
Normal file
After Width: | Height: | Size: 840 B |
@ -7,8 +7,4 @@
|
|||||||
|
|
||||||
<include layout="@layout/message"/>
|
<include layout="@layout/message"/>
|
||||||
|
|
||||||
<include layout="@layout/message_view_move_buttons"/>
|
|
||||||
|
|
||||||
<include layout="@layout/message_view_bottom_buttons"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/bottom_buttons"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingRight="6dip"
|
|
||||||
android:background="@android:color/transparent"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
<Button
|
|
||||||
android:id="@+id/previous"
|
|
||||||
android:text="@string/message_view_prev_action"
|
|
||||||
android:contentDescription="@string/previous_action"
|
|
||||||
android:textSize="35dip"
|
|
||||||
android:padding="0dip"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/delete"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:src="@drawable/ic_button_delete"
|
|
||||||
android:textSize="0dip"
|
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
<Button
|
|
||||||
android:id="@+id/next"
|
|
||||||
android:text="@string/message_view_next_action"
|
|
||||||
android:contentDescription="@string/next_action"
|
|
||||||
android:textSize="35dip"
|
|
||||||
android:padding="0dip"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
</LinearLayout>
|
|
||||||
</merge>
|
|
@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/move_buttons"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingRight="6dip"
|
|
||||||
android:background="@android:color/transparent"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
<Button
|
|
||||||
android:id="@+id/archive"
|
|
||||||
android:text="@string/message_view_archive_action"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
<Button
|
|
||||||
android:id="@+id/move"
|
|
||||||
android:text="@string/message_view_move_action"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/spam"
|
|
||||||
android:text="@string/message_view_spam_action"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</merge>
|
|
@ -1,68 +1,90 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/reply"
|
android:id="@+id/next_message"
|
||||||
android:alphabeticShortcut="r"
|
android:title="@string/next_action"
|
||||||
android:title="@string/reply_action"
|
android:icon="@drawable/ic_action_next_message"
|
||||||
android:icon="@drawable/ic_menu_reply"
|
android:showAsAction="always"
|
||||||
/>
|
/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/reply_all"
|
android:id="@+id/previous_message"
|
||||||
android:alphabeticShortcut="a"
|
android:title="@string/previous_action"
|
||||||
android:title="@string/reply_all_action"
|
android:icon="@drawable/ic_action_previous_message"
|
||||||
android:icon="@drawable/ic_menu_reply_all"
|
android:showAsAction="always"
|
||||||
/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/forward"
|
|
||||||
android:alphabeticShortcut="f"
|
|
||||||
android:title="@string/forward_action"
|
|
||||||
android:icon="@drawable/ic_menu_forward_mail"
|
|
||||||
/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/mark_as_unread"
|
|
||||||
android:alphabeticShortcut="u"
|
|
||||||
android:title="@string/mark_as_unread_action"
|
|
||||||
android:icon="@drawable/ic_menu_mark"
|
|
||||||
/>
|
/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/delete"
|
android:id="@+id/delete"
|
||||||
android:alphabeticShortcut="q"
|
android:alphabeticShortcut="q"
|
||||||
android:title="@string/delete_action"
|
android:title="@string/delete_action"
|
||||||
android:icon="@drawable/ic_menu_delete"
|
android:icon="@drawable/ic_action_delete"
|
||||||
|
android:showAsAction="always"
|
||||||
/>
|
/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/show_full_header"
|
android:id="@+id/single_message_options"
|
||||||
android:title="@string/show_full_header_action"
|
android:icon="@drawable/ic_action_single_message_options"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
android:title="@string/single_message_options_action">
|
||||||
|
<menu>
|
||||||
|
<item
|
||||||
|
android:id="@+id/reply"
|
||||||
|
android:title="@string/reply_action"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/reply_all"
|
||||||
|
android:title="@string/reply_all_action"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/forward"
|
||||||
|
android:title="@string/forward_action"/>
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:id="@+id/archive"
|
||||||
|
android:title="@string/archive_action"
|
||||||
|
android:icon="@drawable/ic_action_archive"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/spam"
|
||||||
|
android:title="@string/spam_action"
|
||||||
|
android:icon="@drawable/ic_action_spam"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/move_or_copy"
|
||||||
|
android:title="@string/move_or_copy_action"
|
||||||
|
android:showAsAction="ifRoom"
|
||||||
|
android:icon="@drawable/ic_action_move_or_copy">
|
||||||
|
<menu>
|
||||||
|
<item
|
||||||
|
android:id="@+id/move"
|
||||||
|
android:title="@string/move_action"
|
||||||
|
/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/copy"
|
||||||
|
android:title="@string/copy_action"
|
||||||
|
/>
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:id="@+id/toggle_unread"
|
||||||
|
android:alphabeticShortcut="u"
|
||||||
|
android:title="@string/read_toggle_action"
|
||||||
|
android:icon="@drawable/ic_action_toggle_read"
|
||||||
|
android:showAsAction="never"
|
||||||
/>
|
/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/flag"
|
android:id="@+id/flag"
|
||||||
android:alphabeticShortcut="s"
|
android:alphabeticShortcut="s"
|
||||||
android:title="@string/flag_action"
|
android:title="@string/flag_action"
|
||||||
android:icon="@drawable/ic_menu_forward_mail"
|
android:showAsAction="never"
|
||||||
/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/send_alternate"
|
|
||||||
android:title="@string/send_alternate_action"
|
|
||||||
android:icon="@drawable/ic_menu_forward_mail"
|
|
||||||
/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/archive"
|
|
||||||
android:title="@string/archive_action"
|
|
||||||
/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/spam"
|
|
||||||
android:title="@string/spam_action"
|
|
||||||
/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/move"
|
|
||||||
android:title="@string/move_action"
|
|
||||||
/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/copy"
|
|
||||||
android:title="@string/copy_action"
|
|
||||||
/>
|
/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/select_text"
|
android:id="@+id/select_text"
|
||||||
android:title="@string/select_text_action"
|
android:title="@string/select_text_action"
|
||||||
|
android:showAsAction="never"
|
||||||
/>
|
/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/share"
|
||||||
|
android:showAsAction="never"
|
||||||
|
android:title="@string/send_alternate_action"
|
||||||
|
/>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -146,7 +146,7 @@ http://k9mail.googlecode.com/
|
|||||||
|
|
||||||
<string name="accounts_action">Accounts</string>
|
<string name="accounts_action">Accounts</string>
|
||||||
<string name="mark_as_read_action">Mark as read</string>
|
<string name="mark_as_read_action">Mark as read</string>
|
||||||
<string name="read_toggle_action">(un)read</string>
|
<string name="read_toggle_action">Toggle (un)read</string>
|
||||||
<string name="send_alternate_action">Share</string>
|
<string name="send_alternate_action">Share</string>
|
||||||
<string name="send_alternate_chooser_title">Choose sender</string>
|
<string name="send_alternate_chooser_title">Choose sender</string>
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ import com.fsck.k9.view.SingleMessageView;
|
|||||||
public class MessageView extends K9Activity implements OnClickListener {
|
public class MessageView extends K9Activity implements OnClickListener {
|
||||||
private static final String EXTRA_MESSAGE_REFERENCE = "com.fsck.k9.MessageView_messageReference";
|
private static final String EXTRA_MESSAGE_REFERENCE = "com.fsck.k9.MessageView_messageReference";
|
||||||
private static final String EXTRA_MESSAGE_REFERENCES = "com.fsck.k9.MessageView_messageReferences";
|
private static final String EXTRA_MESSAGE_REFERENCES = "com.fsck.k9.MessageView_messageReferences";
|
||||||
private static final String EXTRA_NEXT = "com.fsck.k9.MessageView_next";
|
|
||||||
private static final String EXTRA_MESSAGE_LIST_EXTRAS = "com.fsck.k9.MessageView_messageListExtras";
|
private static final String EXTRA_MESSAGE_LIST_EXTRAS = "com.fsck.k9.MessageView_messageListExtras";
|
||||||
private static final String STATE_PGP_DATA = "pgpData";
|
private static final String STATE_PGP_DATA = "pgpData";
|
||||||
private static final int ACTIVITY_CHOOSE_FOLDER_MOVE = 1;
|
private static final int ACTIVITY_CHOOSE_FOLDER_MOVE = 1;
|
||||||
@ -55,13 +54,7 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
private SingleMessageView mMessageView;
|
private SingleMessageView mMessageView;
|
||||||
|
|
||||||
private PgpData mPgpData;
|
private PgpData mPgpData;
|
||||||
|
private Menu mMenu;
|
||||||
private View mNext;
|
|
||||||
private View mPrevious;
|
|
||||||
private View mDelete;
|
|
||||||
private View mArchive;
|
|
||||||
private View mMove;
|
|
||||||
private View mSpam;
|
|
||||||
private Account mAccount;
|
private Account mAccount;
|
||||||
private MessageReference mMessageReference;
|
private MessageReference mMessageReference;
|
||||||
private ArrayList<MessageReference> mMessageReferences;
|
private ArrayList<MessageReference> mMessageReferences;
|
||||||
@ -399,51 +392,14 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mAccount = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid);
|
mAccount = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid);
|
||||||
|
|
||||||
|
|
||||||
if (K9.DEBUG)
|
|
||||||
Log.d(K9.LOG_TAG, "MessageView got message " + mMessageReference);
|
|
||||||
if (intent.getBooleanExtra(EXTRA_NEXT, false)) {
|
|
||||||
mNext.requestFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
mScreenWidthInPixels = getResources().getDisplayMetrics().widthPixels;
|
mScreenWidthInPixels = getResources().getDisplayMetrics().widthPixels;
|
||||||
|
|
||||||
// Enable gesture detection for MessageViews
|
// Enable gesture detection for MessageViews
|
||||||
mGestureDetector = new GestureDetector(new MyGestureDetector(false));
|
mGestureDetector = new GestureDetector(new MyGestureDetector(false));
|
||||||
|
|
||||||
setupButtonViews();
|
|
||||||
displayMessage(mMessageReference);
|
displayMessage(mMessageReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupButtonViews() {
|
|
||||||
setOnClickListener(R.id.from);
|
|
||||||
setOnClickListener(R.id.reply);
|
|
||||||
setOnClickListener(R.id.reply_all);
|
|
||||||
setOnClickListener(R.id.delete);
|
|
||||||
setOnClickListener(R.id.forward);
|
|
||||||
setOnClickListener(R.id.next);
|
|
||||||
setOnClickListener(R.id.previous);
|
|
||||||
setOnClickListener(R.id.archive);
|
|
||||||
setOnClickListener(R.id.move);
|
|
||||||
setOnClickListener(R.id.spam);
|
|
||||||
setOnClickListener(R.id.download_remainder);
|
|
||||||
|
|
||||||
|
|
||||||
mNext = findViewById(R.id.next);
|
|
||||||
mPrevious = findViewById(R.id.previous);
|
|
||||||
mDelete = findViewById(R.id.delete);
|
|
||||||
|
|
||||||
mArchive = findViewById(R.id.archive);
|
|
||||||
mMove = findViewById(R.id.move);
|
|
||||||
mSpam = findViewById(R.id.spam);
|
|
||||||
|
|
||||||
if (!mAccount.getEnableMoveButtons()) {
|
|
||||||
View buttons = findViewById(R.id.move_buttons);
|
|
||||||
buttons.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
@ -473,46 +429,7 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
mMessageView.resetHeaderView();
|
mMessageView.resetHeaderView();
|
||||||
|
|
||||||
mController.loadMessageForView(mAccount, mMessageReference.folderName, mMessageReference.uid, mListener);
|
mController.loadMessageForView(mAccount, mMessageReference.folderName, mMessageReference.uid, mListener);
|
||||||
setupDisplayMessageButtons();
|
configureMenu(mMenu);
|
||||||
}
|
|
||||||
|
|
||||||
private void setupDisplayMessageButtons() {
|
|
||||||
mDelete.setEnabled(true);
|
|
||||||
mNext.setEnabled(mNextMessage != null);
|
|
||||||
mPrevious.setEnabled(mPreviousMessage != null);
|
|
||||||
// If moving isn't support at all, then all of them must be disabled anyway.
|
|
||||||
if (mController.isMoveCapable(mAccount)) {
|
|
||||||
// Only enable the button if they have an archive folder and it's not the current folder.
|
|
||||||
mArchive.setEnabled(!mMessageReference.folderName.equals(mAccount.getArchiveFolderName()) &&
|
|
||||||
mAccount.hasArchiveFolder());
|
|
||||||
// Only enable the button if the Spam folder is not the current folder and not NONE.
|
|
||||||
mSpam.setEnabled(!mMessageReference.folderName.equals(mAccount.getSpamFolderName()) &&
|
|
||||||
mAccount.hasSpamFolder());
|
|
||||||
mMove.setEnabled(true);
|
|
||||||
} else {
|
|
||||||
disableMoveButtons();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disableButtons() {
|
|
||||||
mMessageView.setLoadPictures(false);
|
|
||||||
disableMoveButtons();
|
|
||||||
mNext.setEnabled(false);
|
|
||||||
mPrevious.setEnabled(false);
|
|
||||||
mDelete.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disableMoveButtons() {
|
|
||||||
mArchive.setEnabled(false);
|
|
||||||
mMove.setEnabled(false);
|
|
||||||
mSpam.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setOnClickListener(int viewCode) {
|
|
||||||
View thisView = findViewById(viewCode);
|
|
||||||
if (thisView != null) {
|
|
||||||
thisView.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void findSurroundingMessagesUid() {
|
private void findSurroundingMessagesUid() {
|
||||||
@ -563,7 +480,7 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
if (mMessage != null) {
|
if (mMessage != null) {
|
||||||
// Disable the delete button after it's tapped (to try to prevent
|
// Disable the delete button after it's tapped (to try to prevent
|
||||||
// accidental clicks)
|
// accidental clicks)
|
||||||
disableButtons();
|
mMenu.findItem(R.id.delete).setEnabled(false);
|
||||||
Message messageToDelete = mMessage;
|
Message messageToDelete = mMessage;
|
||||||
showNextMessageOrReturn();
|
showNextMessageOrReturn();
|
||||||
mController.deleteMessages(new Message[] {messageToDelete}, null);
|
mController.deleteMessages(new Message[] {messageToDelete}, null);
|
||||||
@ -771,12 +688,11 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mLastDirection = NEXT;
|
mLastDirection = NEXT;
|
||||||
disableButtons();
|
//toggleActionsState(mMenu, false);
|
||||||
if (K9.showAnimations()) {
|
if (K9.showAnimations()) {
|
||||||
mMessageView.startAnimation(outToLeftAnimation());
|
mMessageView.startAnimation(outToLeftAnimation());
|
||||||
}
|
}
|
||||||
displayMessage(mNextMessage);
|
displayMessage(mNextMessage);
|
||||||
mNext.requestFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onPrevious() {
|
protected void onPrevious() {
|
||||||
@ -786,12 +702,11 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mLastDirection = PREVIOUS;
|
mLastDirection = PREVIOUS;
|
||||||
disableButtons();
|
//toggleActionsState(mMenu, false);
|
||||||
if (K9.showAnimations()) {
|
if (K9.showAnimations()) {
|
||||||
mMessageView.startAnimation(inFromRightAnimation());
|
mMessageView.startAnimation(inFromRightAnimation());
|
||||||
}
|
}
|
||||||
displayMessage(mPreviousMessage);
|
displayMessage(mPreviousMessage);
|
||||||
mPrevious.requestFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onToggleRead() {
|
private void onToggleRead() {
|
||||||
@ -815,33 +730,6 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
|
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.reply:
|
|
||||||
onReply();
|
|
||||||
break;
|
|
||||||
case R.id.reply_all:
|
|
||||||
onReplyAll();
|
|
||||||
break;
|
|
||||||
case R.id.delete:
|
|
||||||
onDelete();
|
|
||||||
break;
|
|
||||||
case R.id.forward:
|
|
||||||
onForward();
|
|
||||||
break;
|
|
||||||
case R.id.archive:
|
|
||||||
onRefile(mAccount.getArchiveFolderName());
|
|
||||||
break;
|
|
||||||
case R.id.spam:
|
|
||||||
onRefile(mAccount.getSpamFolderName());
|
|
||||||
break;
|
|
||||||
case R.id.move:
|
|
||||||
onMove();
|
|
||||||
break;
|
|
||||||
case R.id.next:
|
|
||||||
onNext();
|
|
||||||
break;
|
|
||||||
case R.id.previous:
|
|
||||||
onPrevious();
|
|
||||||
break;
|
|
||||||
case R.id.download:
|
case R.id.download:
|
||||||
((AttachmentView)view).saveFile();
|
((AttachmentView)view).saveFile();
|
||||||
break;
|
break;
|
||||||
@ -857,6 +745,12 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
|
case R.id.next_message:
|
||||||
|
onNext();
|
||||||
|
break;
|
||||||
|
case R.id.previous_message:
|
||||||
|
onPrevious();
|
||||||
|
break;
|
||||||
case R.id.delete:
|
case R.id.delete:
|
||||||
onDelete();
|
onDelete();
|
||||||
break;
|
break;
|
||||||
@ -869,15 +763,15 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
case R.id.forward:
|
case R.id.forward:
|
||||||
onForward();
|
onForward();
|
||||||
break;
|
break;
|
||||||
case R.id.send_alternate:
|
|
||||||
onSendAlternate();
|
|
||||||
break;
|
|
||||||
case R.id.mark_as_unread:
|
|
||||||
onToggleRead();
|
|
||||||
break;
|
|
||||||
case R.id.flag:
|
case R.id.flag:
|
||||||
onFlag();
|
onFlag();
|
||||||
break;
|
break;
|
||||||
|
case R.id.share:
|
||||||
|
onSendAlternate();
|
||||||
|
break;
|
||||||
|
case R.id.toggle_unread:
|
||||||
|
onToggleRead();
|
||||||
|
break;
|
||||||
case R.id.archive:
|
case R.id.archive:
|
||||||
onRefile(mAccount.getArchiveFolderName());
|
onRefile(mAccount.getArchiveFolderName());
|
||||||
break;
|
break;
|
||||||
@ -890,14 +784,6 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
case R.id.copy:
|
case R.id.copy:
|
||||||
onCopy();
|
onCopy();
|
||||||
break;
|
break;
|
||||||
case R.id.show_full_header:
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mMessageView.showAllHeaders();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case R.id.select_text:
|
case R.id.select_text:
|
||||||
mMessageView.beginSelectingText();
|
mMessageView.beginSelectingText();
|
||||||
break;
|
break;
|
||||||
@ -911,21 +797,61 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
super.onCreateOptionsMenu(menu);
|
super.onCreateOptionsMenu(menu);
|
||||||
getSupportMenuInflater().inflate(R.menu.message_view_option, menu);
|
getSupportMenuInflater().inflate(R.menu.message_view_option, menu);
|
||||||
if (!mController.isCopyCapable(mAccount)) {
|
mMenu = menu;
|
||||||
menu.findItem(R.id.copy).setVisible(false);
|
configureMenu(menu);
|
||||||
}
|
return true;
|
||||||
if (!mController.isMoveCapable(mAccount)) {
|
}
|
||||||
|
|
||||||
|
private void configureMenu(Menu menu){
|
||||||
|
// first run displayMessage() gets called before onCreateOptionMenu()
|
||||||
|
if (menu == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// enable them all
|
||||||
|
menu.findItem(R.id.copy).setVisible(true);
|
||||||
|
menu.findItem(R.id.move).setVisible(true);
|
||||||
|
menu.findItem(R.id.archive).setVisible(true);
|
||||||
|
menu.findItem(R.id.spam).setVisible(true);
|
||||||
|
toggleActionsState(menu, true);
|
||||||
|
|
||||||
|
menu.findItem(R.id.next_message).setVisible(mNextMessage != null);
|
||||||
|
menu.findItem(R.id.previous_message).setVisible(mPreviousMessage != null);
|
||||||
|
|
||||||
|
// comply with the setting
|
||||||
|
if (!mAccount.getEnableMoveButtons()) {
|
||||||
menu.findItem(R.id.move).setVisible(false);
|
menu.findItem(R.id.move).setVisible(false);
|
||||||
menu.findItem(R.id.archive).setVisible(false);
|
menu.findItem(R.id.archive).setVisible(false);
|
||||||
menu.findItem(R.id.spam).setVisible(false);
|
menu.findItem(R.id.spam).setVisible(false);
|
||||||
|
} else {
|
||||||
|
// check message, folder capability
|
||||||
|
if (!mController.isCopyCapable(mAccount)) {
|
||||||
|
menu.findItem(R.id.copy).setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mController.isMoveCapable(mAccount)) {
|
||||||
|
menu.findItem(R.id.move).setVisible(true);
|
||||||
|
|
||||||
|
menu.findItem(R.id.archive).setVisible(
|
||||||
|
!mMessageReference.folderName.equals(mAccount.getArchiveFolderName())
|
||||||
|
&& mAccount.hasArchiveFolder());
|
||||||
|
|
||||||
|
menu.findItem(R.id.spam).setVisible(
|
||||||
|
!mMessageReference.folderName.equals(mAccount.getSpamFolderName())
|
||||||
|
&& mAccount.hasSpamFolder());
|
||||||
|
} else {
|
||||||
|
menu.findItem(R.id.copy).setVisible(false);
|
||||||
|
menu.findItem(R.id.move).setVisible(false);
|
||||||
|
menu.findItem(R.id.archive).setVisible(false);
|
||||||
|
menu.findItem(R.id.spam).setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!mAccount.hasArchiveFolder()) {
|
}
|
||||||
menu.findItem(R.id.archive).setVisible(false);
|
|
||||||
}
|
private void toggleActionsState(Menu menu, boolean state){
|
||||||
if (!mAccount.hasSpamFolder()) {
|
for(int i=0; i<menu.size(); ++i) {
|
||||||
menu.findItem(R.id.spam).setVisible(false);
|
menu.getItem(i).setEnabled(state);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: when switching to API version 8, override onCreateDialog(int, Bundle)
|
// TODO: when switching to API version 8, override onCreateDialog(int, Bundle)
|
||||||
@ -972,28 +898,6 @@ public class MessageView extends K9Activity implements OnClickListener {
|
|||||||
return super.onCreateDialog(id);
|
return super.onCreateDialog(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
|
||||||
if (menu != null) {
|
|
||||||
MenuItem flagItem = menu.findItem(R.id.flag);
|
|
||||||
if (flagItem != null && mMessage != null) {
|
|
||||||
flagItem.setTitle((mMessage.isSet(Flag.FLAGGED) ? R.string.unflag_action : R.string.flag_action));
|
|
||||||
}
|
|
||||||
MenuItem additionalHeadersItem = menu.findItem(R.id.show_full_header);
|
|
||||||
if (additionalHeadersItem != null) {
|
|
||||||
additionalHeadersItem.setTitle(mMessageView.additionalHeadersVisible() ?
|
|
||||||
R.string.hide_full_header_action : R.string.show_full_header_action);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mMessage != null) {
|
|
||||||
int actionTitle = mMessage.isSet(Flag.SEEN) ?
|
|
||||||
R.string.mark_as_unread_action : R.string.mark_as_read_action;
|
|
||||||
menu.findItem(R.id.mark_as_unread).setTitle(actionTitle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.onPrepareOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Listener extends MessagingListener {
|
class Listener extends MessagingListener {
|
||||||
@Override
|
@Override
|
||||||
public void loadMessageForViewHeadersAvailable(final Account account, String folder, String uid,
|
public void loadMessageForViewHeadersAvailable(final Account account, String folder, String uid,
|
||||||
|