public class FindActionModeCallback extends Object implements ActionMode.Callback, TextWatcher, View.OnClickListener, WebView.FindListener
Modifier and Type | Class and Description |
---|---|
static class |
FindActionModeCallback.NoAction |
NoCopySpan.Concrete
Constructor and Description |
---|
FindActionModeCallback(Context context) |
Modifier and Type | Method and Description |
---|---|
void |
afterTextChanged(Editable s)
This method is called to notify you that, somewhere within
s , the text has been changed. |
void |
beforeTextChanged(CharSequence s,
int start,
int count,
int after)
This method is called to notify you that, within
s ,
the count characters beginning at start
are about to be replaced by new text with length after . |
void |
findAll() |
void |
finish() |
int |
getActionModeGlobalBottom() |
boolean |
onActionItemClicked(ActionMode mode,
MenuItem item)
Called to report a user click on an action button.
|
void |
onClick(View v)
Called when a view has been clicked.
|
boolean |
onCreateActionMode(ActionMode mode,
Menu menu)
Called when action mode is first created.
|
void |
onDestroyActionMode(ActionMode mode)
Called when an action mode is about to be exited and destroyed.
|
void |
onFindResultReceived(int activeMatchOrdinal,
int numberOfMatches,
boolean isDoneCounting)
Notifies the listener about progress made by a find operation.
|
boolean |
onPrepareActionMode(ActionMode mode,
Menu menu)
Called to refresh an action mode's action menu whenever it is invalidated.
|
void |
onTextChanged(CharSequence s,
int start,
int before,
int count)
This method is called to notify you that, within
s ,
the count characters beginning at start
have just replaced old text that had length before . |
void |
setText(String text) |
void |
setWebView(WebView webView) |
void |
showSoftInput() |
void |
updateMatchCount(int matchIndex,
int matchCount,
boolean isEmptyFind) |
public FindActionModeCallback(Context context)
public void finish()
public void setText(String text)
public void setWebView(WebView webView)
public void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches, boolean isDoneCounting)
WebView.FindListener
onFindResultReceived
in interface WebView.FindListener
activeMatchOrdinal
- the zero-based ordinal of the currently selected matchnumberOfMatches
- how many matches have been foundisDoneCounting
- whether the find operation has actually completed. The listener
may be notified multiple times while the
operation is underway, and the numberOfMatches
value should not be considered final unless
isDoneCounting is true.public void findAll()
public void showSoftInput()
public void updateMatchCount(int matchIndex, int matchCount, boolean isEmptyFind)
public void onClick(View v)
View.OnClickListener
onClick
in interface View.OnClickListener
v
- The view that was clicked.public boolean onCreateActionMode(ActionMode mode, Menu menu)
ActionMode.Callback
onCreateActionMode
in interface ActionMode.Callback
mode
- ActionMode being createdmenu
- Menu used to populate action buttonspublic void onDestroyActionMode(ActionMode mode)
ActionMode.Callback
onDestroyActionMode
in interface ActionMode.Callback
mode
- The current ActionMode being destroyedpublic boolean onPrepareActionMode(ActionMode mode, Menu menu)
ActionMode.Callback
onPrepareActionMode
in interface ActionMode.Callback
mode
- ActionMode being preparedmenu
- Menu used to populate action buttonspublic boolean onActionItemClicked(ActionMode mode, MenuItem item)
ActionMode.Callback
onActionItemClicked
in interface ActionMode.Callback
mode
- The current ActionModeitem
- The item that was clickedpublic void beforeTextChanged(CharSequence s, int start, int count, int after)
TextWatcher
s
,
the count
characters beginning at start
are about to be replaced by new text with length after
.
It is an error to attempt to make changes to s
from
this callback.beforeTextChanged
in interface TextWatcher
public void onTextChanged(CharSequence s, int start, int before, int count)
TextWatcher
s
,
the count
characters beginning at start
have just replaced old text that had length before
.
It is an error to attempt to make changes to s
from
this callback.onTextChanged
in interface TextWatcher
public void afterTextChanged(Editable s)
TextWatcher
s
, the text has been changed.
It is legitimate to make further changes to s
from
this callback, but be careful not to get yourself into an infinite
loop, because any changes you make will cause this method to be
called again recursively.
(You are not told where the change took place because other
afterTextChanged() methods may already have made other changes
and invalidated the offsets. But if you need to know here,
you can use Spannable.setSpan(java.lang.Object, int, int, int)
in TextWatcher.onTextChanged(java.lang.CharSequence, int, int, int)
to mark your place and then look up from here where the span
ended up.afterTextChanged
in interface TextWatcher
public int getActionModeGlobalBottom()