mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-26 09:38:52 -05:00
Set (un)read toggle title based on current message state.
This commit is contained in:
parent
e4d2830ec7
commit
891dde2baf
@ -731,6 +731,7 @@ public class MessageView extends K9Activity implements OnClickListener {
|
||||
mMessageView.setHeaders(mMessage, mAccount);
|
||||
String subject = mMessage.getSubject();
|
||||
setTitle(subject);
|
||||
updateUnreadToggleTitle();
|
||||
}
|
||||
}
|
||||
|
||||
@ -837,7 +838,6 @@ public class MessageView extends K9Activity implements OnClickListener {
|
||||
}
|
||||
|
||||
if (mPreviousMessage != null) {
|
||||
|
||||
menu.findItem(R.id.previous_message).setEnabled(true);
|
||||
menu.findItem(R.id.previous_message).getIcon().setAlpha(255);
|
||||
} else {
|
||||
@ -845,6 +845,8 @@ public class MessageView extends K9Activity implements OnClickListener {
|
||||
menu.findItem(R.id.previous_message).setEnabled(false);
|
||||
}
|
||||
|
||||
updateUnreadToggleTitle();
|
||||
|
||||
// comply with the setting
|
||||
if (!mAccount.getEnableMoveButtons()) {
|
||||
menu.findItem(R.id.move).setVisible(false);
|
||||
@ -875,6 +877,19 @@ public class MessageView extends K9Activity implements OnClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the title of the "Toggle Unread" menu item based upon the current read state of the message.
|
||||
*/
|
||||
public void updateUnreadToggleTitle() {
|
||||
if (mMessage != null && mMenu != null) {
|
||||
if (mMessage.isSet(Flag.SEEN)) {
|
||||
mMenu.findItem(R.id.toggle_unread).setTitle(R.string.mark_as_unread_action);
|
||||
} else {
|
||||
mMenu.findItem(R.id.toggle_unread).setTitle(R.string.mark_as_read_action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleActionsState(Menu menu, boolean state) {
|
||||
for (int i = 0; i < menu.size(); ++i) {
|
||||
menu.getItem(i).setEnabled(state);
|
||||
@ -988,6 +1003,7 @@ public class MessageView extends K9Activity implements OnClickListener {
|
||||
mMessage = message;
|
||||
mMessageView.setMessage(account, (LocalMessage) message, mPgpData,
|
||||
mController, mListener);
|
||||
updateUnreadToggleTitle();
|
||||
|
||||
} catch (MessagingException e) {
|
||||
Log.v(K9.LOG_TAG, "loadMessageForViewBodyAvailable", e);
|
||||
|
Loading…
Reference in New Issue
Block a user