Build 1.0_r1(from source)

android.app
Class SearchDialog

java.lang.Object
  extended by android.app.Dialog
      extended by android.app.SearchDialog
All Implemented Interfaces:
DialogInterface, KeyEvent.Callback, View.OnCreateContextMenuListener, Window.Callback

public class SearchDialog
extends Dialog

In-application-process implementation of Search Bar. This is still controlled by the SearchManager, but it runs in the current activity's process to keep things lighter weight.


Nested Class Summary
 
Nested classes/interfaces inherited from interface android.content.DialogInterface
DialogInterface.OnCancelListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, DialogInterface.OnKeyListener, DialogInterface.OnMultiChoiceClickListener
 
Field Summary
(package private) static int DBG_JAM_THREADING
           
(package private) static String LOG_TAG
           
(package private)  IntentFilter mCloseDialogsFilter
           
(package private)  View.OnClickListener mGoButtonClickListener
          React to a click in the GO button by launching a search.
(package private)  View.OnKeyListener mGoButtonKeyListener
          React to typing in the GO button by refocusing to EditText.
(package private)  IntentFilter mPackageFilter
           
(package private)  View.OnFocusChangeListener mSuggestFocusListener
          Update query text based on transitions in and out of suggestions list.
(package private)  View.OnKeyListener mSuggestionsKeyListener
          React to the user typing while the suggestions are focused.
(package private)  AdapterView.OnItemSelectedListener mSuggestSelectedListener
          Update query text based on movement of selection in/out of suggestion list
(package private)  View.OnKeyListener mTextKeyListener
          React to the user typing "enter" or other hardwired keys while typing in the search box.
 
Fields inherited from class android.app.Dialog
mCancelable, mContext, mDecor, mWindow, mWindowManager
 
Fields inherited from interface android.content.DialogInterface
BUTTON1, BUTTON2, BUTTON3
 
Constructor Summary
SearchDialog(Context context)
          Constructor - fires it up and makes it look like the search UI.
 
Method Summary
 void dismiss()
          Dismiss the search dialog.
 void onConfigurationChanged(Configuration newConfig)
          Hook for updating layout on a rotation
protected  void onCreate(Bundle savedInstanceState)
          We create the search dialog just once, and it stays around (hidden) until activated by the user.
 boolean onKeyDown(int keyCode, KeyEvent event)
          Dialog's OnKeyListener implements various search-specific functionality
 void onPackageListChange()
          The list of installed packages has just changed.
 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
(package private)  void setupSuggestionIntent(Cursor c, SearchableInfo si)
          When a particular suggestion has been selected, perform the various lookups required to use the suggestion.
 void show()
          The default show() for this Dialog is not supported.
 boolean show(String initialQuery, boolean selectInitialQuery, ComponentName componentName, Bundle appSearchData, boolean globalSearch)
          Set up the search dialog
(package private)  void updateSuggestionsWithCursor(Cursor c, SearchableInfo searchable)
          A new cursor (with suggestions) is ready for use.
 
Methods inherited from class android.app.Dialog
addContentView, cancel, closeOptionsMenu, dispatchKeyEvent, dispatchOnCreate, dispatchTouchEvent, dispatchTrackballEvent, findViewById, getContext, getCurrentFocus, getLayoutInflater, getOwnerActivity, getVolumeControlStream, getWindow, hide, isShowing, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onKeyMultiple, onKeyUp, onMenuItemSelected, onMenuOpened, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPrepareOptionsMenu, onPreparePanel, onSearchRequested, onStart, onStop, onTouchEvent, onTrackballEvent, onWindowAttributesChanged, onWindowFocusChanged, openContextMenu, openOptionsMenu, registerForContextMenu, requestWindowFeature, setCancelable, setCanceledOnTouchOutside, setCancelMessage, setContentView, setContentView, setContentView, setDismissMessage, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setOnCancelListener, setOnDismissListener, setOnKeyListener, setOwnerActivity, setTitle, setTitle, setVolumeControlStream, takeKeyEvents, unregisterForContextMenu
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_TAG

static final String LOG_TAG
See Also:
Constant Field Values

DBG_JAM_THREADING

static final int DBG_JAM_THREADING
See Also:
Constant Field Values

mCloseDialogsFilter

IntentFilter mCloseDialogsFilter

mPackageFilter

IntentFilter mPackageFilter

mGoButtonKeyListener

View.OnKeyListener mGoButtonKeyListener
React to typing in the GO button by refocusing to EditText. Continue typing the query.


mGoButtonClickListener

View.OnClickListener mGoButtonClickListener
React to a click in the GO button by launching a search.


mTextKeyListener

View.OnKeyListener mTextKeyListener
React to the user typing "enter" or other hardwired keys while typing in the search box. This handles these special keys while the edit box has focus.


mSuggestionsKeyListener

View.OnKeyListener mSuggestionsKeyListener
React to the user typing while the suggestions are focused. First, check for action keys. If not handled, try refocusing regular characters into the EditText. In this case, replace the query text (start typing fresh text).


mSuggestFocusListener

View.OnFocusChangeListener mSuggestFocusListener
Update query text based on transitions in and out of suggestions list.


mSuggestSelectedListener

AdapterView.OnItemSelectedListener mSuggestSelectedListener
Update query text based on movement of selection in/out of suggestion list

Constructor Detail

SearchDialog

public SearchDialog(Context context)
Constructor - fires it up and makes it look like the search UI.

Parameters:
context - Application Context we can use for system acess
Method Detail

onCreate

protected void onCreate(Bundle savedInstanceState)
We create the search dialog just once, and it stays around (hidden) until activated by the user.

Overrides:
onCreate in class Dialog
Parameters:
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.

show

public boolean show(String initialQuery,
                    boolean selectInitialQuery,
                    ComponentName componentName,
                    Bundle appSearchData,
                    boolean globalSearch)
Set up the search dialog

Parameters:
Returns - true if search dialog launched, false if not

show

public void show()
The default show() for this Dialog is not supported.

Overrides:
show in class Dialog

dismiss

public void dismiss()
Dismiss the search dialog. This function is designed to be idempotent so it can be safely called at any time (even if already closed) and more likely to really dump any memory. No leaks!

Specified by:
dismiss in interface DialogInterface
Overrides:
dismiss in class Dialog

onSaveInstanceState

public Bundle onSaveInstanceState()
Save the minimal set of data necessary to recreate the search

Overrides:
onSaveInstanceState in class Dialog
Returns:
A bundle with the state of the dialog.

onRestoreInstanceState

public void onRestoreInstanceState(Bundle savedInstanceState)
Restore the state of the dialog from a previously saved bundle.

Overrides:
onRestoreInstanceState in class Dialog
Parameters:
savedInstanceState - The state of the dialog previously saved by onSaveInstanceState().

onConfigurationChanged

public void onConfigurationChanged(Configuration newConfig)
Hook for updating layout on a rotation


onPackageListChange

public void onPackageListChange()
The list of installed packages has just changed. This means that our current context may no longer be valid. This would only happen if a package is installed/removed exactly when the search bar is open. So for now we're just going to close the search bar. Anything fancier would require some checks to see if the user's context was still valid. Which would be messier.


onKeyDown

public boolean onKeyDown(int keyCode,
                         KeyEvent event)
Dialog's OnKeyListener implements various search-specific functionality

Specified by:
onKeyDown in interface KeyEvent.Callback
Overrides:
onKeyDown in class Dialog
Parameters:
keyCode - This is the keycode of the typed key, and is the same value as found in the KeyEvent parameter.
event - The complete event record for the typed key
Returns:
Return true if the event was handled here, or false if not.
See Also:
Dialog.onKeyUp(int, android.view.KeyEvent), KeyEvent

updateSuggestionsWithCursor

void updateSuggestionsWithCursor(Cursor c,
                                 SearchableInfo searchable)
A new cursor (with suggestions) is ready for use. Update the UI.


setupSuggestionIntent

void setupSuggestionIntent(Cursor c,
                           SearchableInfo si)
When a particular suggestion has been selected, perform the various lookups required to use the suggestion. This includes checking the cursor for suggestion-specific data, and/or falling back to the XML for defaults; It also creates REST style Uri data when the suggestion includes a data id. NOTE: Return values are in member variables mSuggestionAction & mSuggestionData.

Parameters:
c - The suggestions cursor, moved to the row of the user's selection
si - The searchable activity's info record

Build 1.0_r1(from source)

Please submit a feedback, bug or feature