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

Commit f8d81495 authored by Gilles Debunne's avatar Gilles Debunne
Browse files

Made paste work in ExtractEditText

Bug 3064925

Instead of always passing the menu item to the original TextView, do that only
for the 'Select word' option. More ExtractEditText magic, but this ZBB so...

Change-Id: Ic4cb0526dbb9711e2f13a916b997f480307dcad1
parent a827d7bc
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package android.inputmethodservice;

import android.content.Context;
import android.util.AttributeSet;
import android.view.ContextMenu;
import android.view.inputmethod.ExtractedText;
import android.widget.EditText;

@@ -29,7 +28,6 @@ import android.widget.EditText;
public class ExtractEditText extends EditText {
    private InputMethodService mIME;
    private int mSettingExtractedText;
    private boolean mContextMenuShouldBeHandledBySuper = false;
    
    public ExtractEditText(Context context) {
        super(context, null);
@@ -99,19 +97,13 @@ public class ExtractEditText extends EditText {
        return false;
    }
    
    @Override
    protected void onCreateContextMenu(ContextMenu menu) {
        super.onCreateContextMenu(menu);
        mContextMenuShouldBeHandledBySuper = true;
    }

    @Override public boolean onTextContextMenuItem(int id) {
        if (mIME != null && !mContextMenuShouldBeHandledBySuper) {
        // Horrible hack: select word option has to be handled by original view to work.
        if (mIME != null && id != android.R.id.startSelectingText) {
            if (mIME.onExtractTextContextMenuItem(id)) {
                return true;
            }
        }
        mContextMenuShouldBeHandledBySuper = false;
        return super.onTextContextMenuItem(id);
    }