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

Commit 4f313676 authored by George Mount's avatar George Mount Committed by Android Git Automerger
Browse files

am 222f5613: Merge "Use setCustomSelectActionModeCallback to disallow action bar." into jb-dev

* commit '222f5613':
  Use setCustomSelectActionModeCallback to disallow action bar.
parents cde7efde 222f5613
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) {
        }
    }
}