forked from upstream-mirrors/quik
Improved draft support
This commit is contained in:
@@ -162,10 +162,6 @@ public class ConversationLegacy {
|
|||||||
|
|
||||||
public void saveDraft(final String draft) {
|
public void saveDraft(final String draft) {
|
||||||
|
|
||||||
new AsyncTask<Void, Void, Void>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Void doInBackground(Void... params) {
|
|
||||||
clearDrafts();
|
clearDrafts();
|
||||||
|
|
||||||
if (draft.length() > 0) {
|
if (draft.length() > 0) {
|
||||||
@@ -188,16 +184,8 @@ public class ConversationLegacy {
|
|||||||
ConversationLegacy.this.draft = null;
|
ConversationLegacy.this.draft = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(Void aVoid) {
|
|
||||||
super.onPostExecute(aVoid);
|
|
||||||
Toast.makeText(context, R.string.toast_draft, Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, R.string.toast_draft, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}.execute((Void[]) null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
|
|||||||
@@ -268,6 +268,12 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
|||||||
onOpenConversation();
|
onOpenConversation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
mComposeView.saveDraft();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
outState.putLong(ARG_THREAD_ID, mThreadId);
|
outState.putLong(ARG_THREAD_ID, mThreadId);
|
||||||
@@ -511,14 +517,6 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
|
|||||||
v.vibrate(vibrateTime);
|
v.vibrate(vibrateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
|
|
||||||
// Save the draft. This should also clear the EditText.
|
|
||||||
mComposeView.saveDraft();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Photo Selection result
|
* Photo Selection result
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -742,8 +742,7 @@ public class ComposeView extends LinearLayout implements View.OnClickListener {
|
|||||||
mConversationLegacy.clearDrafts();
|
mConversationLegacy.clearDrafts();
|
||||||
|
|
||||||
} else if (!TextUtils.isEmpty(draft) &&
|
} else if (!TextUtils.isEmpty(draft) &&
|
||||||
(!mConversationLegacy.hasDraft() ||
|
(!mConversationLegacy.hasDraft() || !draft.equals(mConversationLegacy.getDraft()))) {
|
||||||
!draft.equals(mConversationLegacy.getDraft()))) {
|
|
||||||
mConversationLegacy.saveDraft(draft);
|
mConversationLegacy.saveDraft(draft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user