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

Commit 222f5613 authored by George Mount's avatar George Mount Committed by Android (Google) Code Review
Browse files

Merge "Use setCustomSelectActionModeCallback to disallow action bar." into jb-dev

parents a95e9da7 7e9f62ef
Loading
Loading
Loading
Loading
+22 −9
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ import android.widget.EditText;
import android.widget.TextView;

class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
        View.OnLongClickListener, View.OnClickListener {
        View.OnClickListener {
    private View mCustomView;
    private EditText mEditText;
    private TextView mMatches;
@@ -51,9 +51,7 @@ class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
                com.android.internal.R.layout.webview_find, null);
        mEditText = (EditText) mCustomView.findViewById(
                com.android.internal.R.id.edit);
        // Override long click so that select ActionMode is not opened, which
        // would exit find ActionMode.
        mEditText.setOnLongClickListener(this);
        mEditText.setCustomSelectionActionModeCallback(new NoAction());
        mEditText.setOnClickListener(this);
        setText("");
        mMatches = (TextView) mCustomView.findViewById(
@@ -174,11 +172,6 @@ class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
        mMatches.setVisibility(View.VISIBLE);
    }

    // OnLongClickListener implementation

    @Override
    public boolean onLongClick(View v) { return true; }

    // OnClickListener implementation

    @Override
@@ -280,4 +273,24 @@ class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
        return mGlobalVisibleRect.bottom;
    }

    public static class NoAction implements ActionMode.Callback {
        @Override
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            return false;
        }

        @Override
        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            return false;
        }

        @Override
        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
            return false;
        }

        @Override
        public void onDestroyActionMode(ActionMode mode) {
        }
    }
}