Merge pull request #5232 from plan3d/issue_2485
This commit is contained in:
commit
a6f91e284e
2 changed files with 33 additions and 12 deletions
|
@ -789,10 +789,15 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
private void onDiscard() {
|
||||
if (draftMessageId != null) {
|
||||
messagingController.deleteDraft(account, draftMessageId);
|
||||
draftMessageId = null;
|
||||
}
|
||||
internalMessageHandler.sendEmptyMessage(MSG_DISCARDED_DRAFT);
|
||||
finishWithoutChanges();
|
||||
}
|
||||
|
||||
private void finishWithoutChanges() {
|
||||
draftMessageId = null;
|
||||
changesMadeSinceLastSave = false;
|
||||
|
||||
if (navigateUp) {
|
||||
openDefaultFolder();
|
||||
} else {
|
||||
|
@ -1102,11 +1107,33 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
|
||||
@Override
|
||||
public Dialog onCreateDialog(int id) {
|
||||
final Builder builder;
|
||||
switch (id) {
|
||||
case DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE:
|
||||
return new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.save_or_discard_draft_message_dlg_title)
|
||||
.setMessage(R.string.save_or_discard_draft_message_instructions_fmt)
|
||||
builder = new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.save_or_discard_draft_message_dlg_title);
|
||||
if (draftMessageId == null) {
|
||||
builder
|
||||
.setMessage(R.string.save_or_discard_draft_message_instructions_fmt)
|
||||
.setNegativeButton(R.string.discard_action, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
dismissDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
|
||||
onDiscard();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
builder
|
||||
.setMessage(R.string.save_or_discard_draft_message_changes)
|
||||
.setNegativeButton(R.string.discard_action, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
dismissDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
|
||||
finishWithoutChanges();
|
||||
}
|
||||
});
|
||||
}
|
||||
return builder
|
||||
.setPositiveButton(R.string.save_draft_action, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
|
@ -1114,13 +1141,6 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
checkToSaveDraftAndSave();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.discard_action, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
dismissDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
|
||||
onDiscard();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
case DIALOG_CONFIRM_DISCARD_ON_BACK:
|
||||
return new AlertDialog.Builder(this)
|
||||
|
@ -1146,7 +1166,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
|||
case DIALOG_CHOOSE_IDENTITY:
|
||||
int dialogThemeResourceId = getThemeManager().getDialogThemeResourceId();
|
||||
Context context = new ContextThemeWrapper(this, dialogThemeResourceId);
|
||||
Builder builder = new AlertDialog.Builder(context);
|
||||
builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(R.string.send_as);
|
||||
final IdentityAdapter adapter = new IdentityAdapter(context);
|
||||
builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
|
||||
|
|
|
@ -897,6 +897,7 @@ Please submit bug reports, contribute new features and ask questions at
|
|||
|
||||
<string name="save_or_discard_draft_message_dlg_title">Save draft message?</string>
|
||||
<string name="save_or_discard_draft_message_instructions_fmt">Save or Discard this message?</string>
|
||||
<string name="save_or_discard_draft_message_changes">Save or Discard changes?</string>
|
||||
|
||||
<string name="confirm_discard_draft_message_title">Discard message?</string>
|
||||
<string name="confirm_discard_draft_message">Are you sure you want to discard this message?</string>
|
||||
|
|
Loading…
Reference in a new issue