Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c37088ab authored by Moez Bhatti's avatar Moez Bhatti
Browse files

Improved draft support

parent 5cfcad07
Loading
Loading
Loading
Loading
+17 −29
Original line number Diff line number Diff line
@@ -162,10 +162,6 @@ public class ConversationLegacy {

    public void saveDraft(final String draft) {

        new AsyncTask<Void, Void, Void>() {

            @Override
            protected Void doInBackground(Void... params) {
        clearDrafts();

        if (draft.length() > 0) {
@@ -188,16 +184,8 @@ public class ConversationLegacy {
            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();
    }
        }.execute((Void[]) null);
    }

    public int getType() {
        if (type == 0) {
+6 −8
Original line number Diff line number Diff line
@@ -268,6 +268,12 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
        onOpenConversation();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        mComposeView.saveDraft();
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        outState.putLong(ARG_THREAD_ID, mThreadId);
@@ -511,14 +517,6 @@ public class MessageListFragment extends QKContentFragment implements ActivityLa
        v.vibrate(vibrateTime);
    }

    @Override
    public void onPause() {
        super.onPause();

        // Save the draft. This should also clear the EditText.
        mComposeView.saveDraft();
    }

    /**
     * Photo Selection result
     */
+1 −2
Original line number Diff line number Diff line
@@ -742,8 +742,7 @@ public class ComposeView extends LinearLayout implements View.OnClickListener {
                mConversationLegacy.clearDrafts();

            } else if (!TextUtils.isEmpty(draft) &&
                    (!mConversationLegacy.hasDraft() ||
                            !draft.equals(mConversationLegacy.getDraft()))) {
                    (!mConversationLegacy.hasDraft() || !draft.equals(mConversationLegacy.getDraft()))) {
                mConversationLegacy.saveDraft(draft);
            }
        }