Fix issue #512 - Drafts removed when no changes after opening them
This commit is contained in:
parent
5f1cd06566
commit
c729b091e8
|
@ -110,6 +110,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
private StatusDraft statusDraft;
|
private StatusDraft statusDraft;
|
||||||
private ComposeAdapter composeAdapter;
|
private ComposeAdapter composeAdapter;
|
||||||
private boolean promptSaveDraft;
|
private boolean promptSaveDraft;
|
||||||
|
private boolean restoredDraft;
|
||||||
|
|
||||||
|
|
||||||
private final BroadcastReceiver imageReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver imageReceiver = new BroadcastReceiver() {
|
||||||
|
@ -235,12 +236,14 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
AlertDialog alert = alt_bld.create();
|
AlertDialog alert = alt_bld.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
} else {
|
} else {
|
||||||
try {
|
if (!restoredDraft) {
|
||||||
new StatusDraft(ComposeActivity.this).removeDraft(statusDraft);
|
try {
|
||||||
finish();
|
new StatusDraft(ComposeActivity.this).removeDraft(statusDraft);
|
||||||
} catch (DBException e) {
|
} catch (DBException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
finish();
|
finish();
|
||||||
|
@ -446,6 +449,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
setSupportActionBar(binding.toolbar);
|
setSupportActionBar(binding.toolbar);
|
||||||
promptSaveDraft = false;
|
promptSaveDraft = false;
|
||||||
|
restoredDraft = false;
|
||||||
ActionBar actionBar = getSupportActionBar();
|
ActionBar actionBar = getSupportActionBar();
|
||||||
//Remove title
|
//Remove title
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
|
@ -576,6 +580,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (statusDraft != null) {//Restore a draft with all messages
|
} else if (statusDraft != null) {//Restore a draft with all messages
|
||||||
|
restoredDraft = true;
|
||||||
if (statusDraft.statusReplyList != null) {
|
if (statusDraft.statusReplyList != null) {
|
||||||
statusList.addAll(statusDraft.statusReplyList);
|
statusList.addAll(statusDraft.statusReplyList);
|
||||||
binding.recyclerView.addItemDecoration(new DividerDecorationSimple(ComposeActivity.this, statusList));
|
binding.recyclerView.addItemDecoration(new DividerDecorationSimple(ComposeActivity.this, statusList));
|
||||||
|
|
Loading…
Reference in New Issue