public class SearchDialog extends Dialog
Modifier and Type | Class and Description |
---|---|
static class |
SearchDialog.SearchBar
The root element in the search bar layout.
|
DialogInterface.OnCancelListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, DialogInterface.OnKeyListener, DialogInterface.OnMultiChoiceClickListener, DialogInterface.OnShowListener
mCancelable
BUTTON_NEGATIVE, BUTTON_NEUTRAL, BUTTON_POSITIVE, BUTTON1, BUTTON2, BUTTON3
Constructor and Description |
---|
SearchDialog(Context context,
SearchManager searchManager)
Constructor - fires it up and makes it look like the search UI.
|
Modifier and Type | Method and Description |
---|---|
void |
hide()
Hide the dialog, but do not dismiss it.
|
void |
launchQuerySearch()
Launch a search for the text in the query text field.
|
protected void |
launchQuerySearch(int actionKey,
String actionMsg)
Launch a search for the text in the query text field.
|
void |
onBackPressed()
Called when the dialog has detected the user's press of the back
key.
|
void |
onConfigurationChanged()
Called after resources have changed, e.g.
|
protected void |
onCreate(Bundle savedInstanceState)
Create the search dialog and any resources that are used for the
entire lifetime of the dialog.
|
void |
onRestoreInstanceState(Bundle savedInstanceState)
Restore the state of the dialog from a previously saved bundle.
|
Bundle |
onSaveInstanceState()
Save the minimal set of data necessary to recreate the search
|
void |
onStart()
Called when the dialog is starting.
|
void |
onStop()
The search dialog is being dismissed, so handle all of the local shutdown operations.
|
boolean |
onTouchEvent(MotionEvent event)
Dialog.onTouchEvent(MotionEvent) will cancel the dialog only when the
touch is outside the window. |
void |
setListSelection(int index)
Sets the list item selection in the AutoCompleteTextView's ListView.
|
void |
setWorking(boolean working)
Sets the search dialog to the 'working' state, which shows a working spinner in the
right hand size of the text field.
|
boolean |
show(String initialQuery,
boolean selectInitialQuery,
ComponentName componentName,
Bundle appSearchData)
Set up the search dialog
|
addContentView, cancel, closeOptionsMenu, dismiss, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, findViewById, getActionBar, getContext, getCurrentFocus, getLayoutInflater, getOwnerActivity, getVolumeControlStream, getWindow, invalidateOptionsMenu, isShowing, onActionModeFinished, onActionModeStarted, onAttachedToWindow, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onDetachedFromWindow, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onMenuItemSelected, onMenuOpened, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPrepareOptionsMenu, onPreparePanel, onSearchRequested, onTrackballEvent, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, openOptionsMenu, registerForContextMenu, requestWindowFeature, setCancelable, setCanceledOnTouchOutside, setCancelMessage, setContentView, setContentView, setContentView, setDismissMessage, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setOnCancelListener, setOnDismissListener, setOnKeyListener, setOnShowListener, setOwnerActivity, setTitle, setTitle, setVolumeControlStream, show, takeCancelAndDismissListeners, takeKeyEvents, unregisterForContextMenu
public SearchDialog(Context context, SearchManager searchManager)
context
- Application Context we can use for system acessprotected void onCreate(Bundle savedInstanceState)
onCreate
in class Dialog
savedInstanceState
- If this dialog is being reinitalized after a
the hosting activity was previously shut down, holds the result from
the most recent call to Dialog.onSaveInstanceState()
, or null if this
is the first time.public boolean show(String initialQuery, boolean selectInitialQuery, ComponentName componentName, Bundle appSearchData)
public void onStart()
Dialog
public void onStop()
public void setWorking(boolean working)
working
- true to show spinner, false to hide spinnerpublic Bundle onSaveInstanceState()
onSaveInstanceState
in class Dialog
null
if the search
dialog is not showing.public void onRestoreInstanceState(Bundle savedInstanceState)
onRestoreInstanceState
in class Dialog
savedInstanceState
- The state of the dialog previously saved by
onSaveInstanceState()
.public void onConfigurationChanged()
public boolean onTouchEvent(MotionEvent event)
Dialog.onTouchEvent(MotionEvent)
will cancel the dialog only when the
touch is outside the window. But the window includes space for the drop-down,
so we also cancel on taps outside the search bar when the drop-down is not showing.onTouchEvent
in class Dialog
event
- The touch screen event being processed.public void hide()
Dialog
public void launchQuerySearch()
protected void launchQuerySearch(int actionKey, String actionMsg)
actionKey
- The key code of the action key that was pressed,
or KeyEvent.KEYCODE_UNKNOWN
if none.actionMsg
- The message for the action key that was pressed,
or null
if none.public void setListSelection(int index)
public void onBackPressed()
Dialog
onBackPressed
in class Dialog