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

Commit 40086b75 authored by Miranda Kephart's avatar Miranda Kephart
Browse files

Close clipboard text editor when text is copied

If the user copies text from the text editor itself, we should
close the editor (and just open the clipboard UI) since it no
longer represents the contents of the clipboard.

Bug: 225361313
Fix: 225361313
Test: manual
Change-Id: Ie71e80d101c131d803c2eb2dafb622e116ddbeb3
parent 4e45ade9
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@ import com.android.systemui.R;
/**
 * Lightweight activity for editing text clipboard contents
 */
public class EditTextActivity extends Activity {
public class EditTextActivity extends Activity
        implements ClipboardManager.OnPrimaryClipChangedListener {
    private static final String TAG = "EditTextActivity";

    private EditText mEditText;
@@ -71,6 +72,18 @@ public class EditTextActivity extends Activity {
        }
        mEditText.setText(clip.getItemAt(0).getText());
        mEditText.requestFocus();
        mClipboardManager.addPrimaryClipChangedListener(this);
    }

    @Override
    protected void onPause() {
        mClipboardManager.removePrimaryClipChangedListener(this);
        super.onPause();
    }

    @Override // ClipboardManager.OnPrimaryClipChangedListener
    public void onPrimaryClipChanged() {
        hideImeAndFinish();
    }

    private void saveToClipboard() {