Skip to content

Commit 222f561

Browse files
George MountAndroid (Google) Code Review
authored andcommitted
Merge "Use setCustomSelectActionModeCallback to disallow action bar." into jb-dev
2 parents a95e9da + 7e9f62e commit 222f561

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

core/java/android/webkit/FindActionModeCallback.java

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import android.widget.TextView;
3535

3636
class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
37-
View.OnLongClickListener, View.OnClickListener {
37+
View.OnClickListener {
3838
private View mCustomView;
3939
private EditText mEditText;
4040
private TextView mMatches;
@@ -51,9 +51,7 @@ class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
5151
com.android.internal.R.layout.webview_find, null);
5252
mEditText = (EditText) mCustomView.findViewById(
5353
com.android.internal.R.id.edit);
54-
// Override long click so that select ActionMode is not opened, which
55-
// would exit find ActionMode.
56-
mEditText.setOnLongClickListener(this);
54+
mEditText.setCustomSelectionActionModeCallback(new NoAction());
5755
mEditText.setOnClickListener(this);
5856
setText("");
5957
mMatches = (TextView) mCustomView.findViewById(
@@ -174,11 +172,6 @@ private void updateMatchesString() {
174172
mMatches.setVisibility(View.VISIBLE);
175173
}
176174

177-
// OnLongClickListener implementation
178-
179-
@Override
180-
public boolean onLongClick(View v) { return true; }
181-
182175
// OnClickListener implementation
183176

184177
@Override
@@ -280,4 +273,24 @@ public int getActionModeGlobalBottom() {
280273
return mGlobalVisibleRect.bottom;
281274
}
282275

276+
public static class NoAction implements ActionMode.Callback {
277+
@Override
278+
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
279+
return false;
280+
}
281+
282+
@Override
283+
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
284+
return false;
285+
}
286+
287+
@Override
288+
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
289+
return false;
290+
}
291+
292+
@Override
293+
public void onDestroyActionMode(ActionMode mode) {
294+
}
295+
}
283296
}

0 commit comments

Comments
 (0)