|
22 | 22 | import android.text.Selection; |
23 | 23 | import android.text.Spannable; |
24 | 24 | import android.text.TextWatcher; |
25 | | -import android.webkit.WebView; |
26 | | -import android.widget.EditText; |
27 | | -import android.widget.TextView; |
28 | 25 | import android.view.ActionMode; |
29 | 26 | import android.view.LayoutInflater; |
30 | 27 | import android.view.Menu; |
31 | | -import android.view.MenuInflater; |
32 | 28 | import android.view.MenuItem; |
33 | 29 | import android.view.View; |
34 | 30 | import android.view.inputmethod.InputMethodManager; |
| 31 | +import android.widget.EditText; |
| 32 | +import android.widget.TextView; |
35 | 33 |
|
36 | 34 | class FindActionModeCallback implements ActionMode.Callback, TextWatcher, |
37 | 35 | View.OnLongClickListener, View.OnClickListener { |
@@ -203,6 +201,7 @@ public boolean onCreateActionMode(ActionMode mode, Menu menu) { |
203 | 201 |
|
204 | 202 | @Override |
205 | 203 | public void onDestroyActionMode(ActionMode mode) { |
| 204 | + mActionMode = null; |
206 | 205 | mWebView.notifyFindDialogDismissed(); |
207 | 206 | mInput.hideSoftInputFromWindow(mWebView.getWindowToken(), 0); |
208 | 207 | } |
@@ -255,4 +254,13 @@ public void afterTextChanged(Editable s) { |
255 | 254 | // Does nothing. Needed to implement TextWatcher. |
256 | 255 | } |
257 | 256 |
|
| 257 | + public int getActionModeHeight() { |
| 258 | + if (mActionMode == null) { |
| 259 | + return 0; |
| 260 | + } |
| 261 | + View parent = (View) mCustomView.getParent(); |
| 262 | + return parent != null ? parent.getMeasuredHeight() |
| 263 | + : mCustomView.getMeasuredHeight(); |
| 264 | + } |
| 265 | + |
258 | 266 | } |
0 commit comments