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
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user