Java 类android.app.SearchableInfo 实例源码

项目:CSipSimple    文件:SearchView.java   
/**
 * Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used
 * to display labels, hints, suggestions, create intents for launching search results screens
 * and controlling other affordances such as a voice button.
 *
 * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific
 * activity or a global search provider.
 */
public void setSearchableInfo(SearchableInfo searchable) {
    mSearchable = searchable;
    if (mSearchable != null) {
        updateSearchAutoComplete();
        updateQueryHint();
    }
    // Cache the voice search capability
    mVoiceButtonEnabled = hasVoiceSearch();

    if (mVoiceButtonEnabled) {
        // Disable the microphone on the keyboard, as a mic is displayed near the text box
        // TODO: use imeOptions to disable voice input when the new API will be available
        mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
    updateViewsVisibility(isIconified());
}
项目:CSipSimple    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:boohee_v5.6    文件:SuggestionsAdapter.java   
Cursor getSearchManagerSuggestions(SearchableInfo searchable, String query, int limit) {
    if (searchable == null) {
        return null;
    }
    String authority = searchable.getSuggestAuthority();
    if (authority == null) {
        return null;
    }
    Builder uriBuilder = new Builder().scheme(Utils.RESPONSE_CONTENT).authority(authority).query("").fragment("");
    String contentPath = searchable.getSuggestPath();
    if (contentPath != null) {
        uriBuilder.appendEncodedPath(contentPath);
    }
    uriBuilder.appendPath("search_suggest_query");
    String selection = searchable.getSuggestSelection();
    String[] selArgs = null;
    if (selection != null) {
        selArgs = new String[]{query};
    } else {
        uriBuilder.appendPath(query);
    }
    if (limit > 0) {
        uriBuilder.appendQueryParameter("limit", String.valueOf(limit));
    }
    return this.mContext.getContentResolver().query(uriBuilder.build(), null, selection, selArgs, null);
}
项目:Ymir    文件:ActivityBasedSearchableManager.java   
public ActivityBasedSearchableManager(Context context, Map<String, String> searchablesConfigs) {
    searchables = new HashMap<>(searchablesConfigs.size());

    SearchManager searchManager = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
    for (Entry<String, String> entry : searchablesConfigs.entrySet()) {
        String entityName = entry.getKey();
        String activityName = entry.getValue();

        //Se não possui o pacote, tem que colocar o pacote da aplicação.
        if (activityName.startsWith(".")) {
            activityName = context.getApplicationInfo().packageName + activityName; 
        }

        ComponentName componentName = new ComponentName(context, activityName);
        SearchableInfo searchableInfo = searchManager.getSearchableInfo(componentName);
        if (searchableInfo == null) {
            throw new IllegalArgumentException("Searchable not found for " + activityName);
        }

        searchables.put(entityName, searchableInfo);
    }
}
项目:solved-hacking-problem    文件:da.java   
public da(Context context, SearchView searchView, SearchableInfo searchableInfo, WeakHashMap weakHashMap) {
    super(context, searchView.getSuggestionRowLayout(), null, true);
    this.f1490p = false;
    this.f1491q = 1;
    this.f1493s = -1;
    this.f1494t = -1;
    this.f1495u = -1;
    this.f1496v = -1;
    this.f1497w = -1;
    this.f1498x = -1;
    this.f1484j = (SearchManager) this.d.getSystemService("search");
    this.f1485k = searchView;
    this.f1486l = searchableInfo;
    this.f1489o = searchView.getSuggestionCommitIconResId();
    this.f1487m = context;
    this.f1488n = weakHashMap;
}
项目:solved-hacking-problem    文件:da.java   
public da(Context context, SearchView searchView, SearchableInfo searchableInfo, WeakHashMap weakHashMap) {
    super(context, searchView.getSuggestionRowLayout(), null, true);
    this.f1490p = false;
    this.f1491q = 1;
    this.f1493s = -1;
    this.f1494t = -1;
    this.f1495u = -1;
    this.f1496v = -1;
    this.f1497w = -1;
    this.f1498x = -1;
    this.f1484j = (SearchManager) this.d.getSystemService("search");
    this.f1485k = searchView;
    this.f1486l = searchableInfo;
    this.f1489o = searchView.getSuggestionCommitIconResId();
    this.f1487m = context;
    this.f1488n = weakHashMap;
}
项目:permissionsModule    文件:SearchView.java   
/**
 * Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used
 * to display labels, hints, suggestions, create intents for launching search results screens
 * and controlling other affordances such as a voice button.
 *
 * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific
 * activity or a global search provider.
 */
public void setSearchableInfo(SearchableInfo searchable) {
    mSearchable = searchable;
    if (mSearchable != null) {
        if (IS_AT_LEAST_FROYO) {
            updateSearchAutoComplete();
        }
        updateQueryHint();
    }
    // Cache the voice search capability
    mVoiceButtonEnabled = IS_AT_LEAST_FROYO && hasVoiceSearch();

    if (mVoiceButtonEnabled) {
        // Disable the microphone on the keyboard, as a mic is displayed near the text box
        // TODO: use imeOptions to disable voice input when the new API will be available
        mSearchSrcTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
    updateViewsVisibility(isIconified());
}
项目:permissionsModule    文件:SearchView.java   
@TargetApi(Build.VERSION_CODES.FROYO)
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:darksms    文件:SearchView.java   
/**
 * Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used
 * to display labels, hints, suggestions, create intents for launching search results screens
 * and controlling other affordances such as a voice button.
 *
 * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific
 *                   activity or a global search provider.
 */
public void setSearchableInfo(SearchableInfo searchable) {
    mSearchable = searchable;
    if (mSearchable != null) {
        updateSearchAutoComplete();
        updateQueryHint();
    }
    // Cache the voice search capability
    mVoiceButtonEnabled = hasVoiceSearch();

    if (mVoiceButtonEnabled) {
        // Disable the microphone on the keyboard, as a mic is displayed near the text box
        // TODO: use imeOptions to disable voice input when the new API will be available
        mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
    updateViewsVisibility(isIconified());
}
项目:darksms    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:aptoide-backup-apps    文件:SearchView.java   
/**
 * Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used
 * to display labels, hints, suggestions, create intents for launching search results screens
 * and controlling other affordances such as a voice button.
 *
 * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific
 * activity or a global search provider.
 */
public void setSearchableInfo(SearchableInfo searchable) {
    mSearchable = searchable;
    if (mSearchable != null) {
        updateSearchAutoComplete();
        updateQueryHint();
    }
    // Cache the voice search capability
    mVoiceButtonEnabled = hasVoiceSearch();

    if (mVoiceButtonEnabled) {
        // Disable the microphone on the keyboard, as a mic is displayed near the text box
        // TODO: use imeOptions to disable voice input when the new API will be available
        mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
    updateViewsVisibility(isIconified());
}
项目:aptoide-backup-apps    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:Audinaut    文件:SubsonicFragment.java   
protected void onFinishSetupOptionsMenu(final Menu menu) {
    searchItem = menu.findItem(R.id.menu_global_search);
    if(searchItem != null) {
        searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
        SearchManager searchManager = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
        SearchableInfo searchableInfo = searchManager.getSearchableInfo(context.getComponentName());
        if(searchableInfo == null) {
            Log.w(TAG, "Failed to get SearchableInfo");
        } else {
            searchView.setSearchableInfo(searchableInfo);
        }

        String currentQuery = getCurrentQuery();
        if(currentQuery != null) {
            searchView.setOnSearchClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    searchView.setQuery(getCurrentQuery(), false);
                }
            });
        }
    }
}
项目:Toutiao    文件:SearchActivity.java   
@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_search, menu);
        MenuItem item = menu.findItem(R.id.action_search);
        searchView = (SearchView) MenuItemCompat.getActionView(item);
        // 关联检索配置与 SearchActivity
        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        SearchableInfo searchableInfo = searchManager.getSearchableInfo(
                new ComponentName(getApplicationContext(), SearchActivity.class));
        searchView.setSearchableInfo(searchableInfo);
        searchView.onActionViewExpanded();
//        // 设置搜索文字样式
//        EditText searchEditText = (EditText) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
//        searchEditText.setTextColor(getResources().getColor(R.color.textColorPrimary));
//        searchEditText.setHintTextColor(getResources().getColor(R.color.textColorPrimary));
//        searchEditText.setBackgroundColor(Color.WHITE);
        setOnQuenyTextChangeListener();

        return super.onCreateOptionsMenu(menu);
    }
项目:PalmCampus    文件:SearchView.java   
/**
 * Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used
 * to display labels, hints, suggestions, create intents for launching search results screens
 * and controlling other affordances such as a voice button.
 *
 * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific
 * activity or a global search provider.
 */
public void setSearchableInfo(SearchableInfo searchable) {
    mSearchable = searchable;
    if (mSearchable != null) {
        updateSearchAutoComplete();
        updateQueryHint();
    }
    // Cache the voice search capability
    mVoiceButtonEnabled = hasVoiceSearch();

    if (mVoiceButtonEnabled) {
        // Disable the microphone on the keyboard, as a mic is displayed near the text box
        // TODO: use imeOptions to disable voice input when the new API will be available
        mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
    updateViewsVisibility(isIconified());
}
项目:PalmCampus    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:FMTech    文件:SearchView.java   
public void setSearchableInfo(SearchableInfo paramSearchableInfo)
{
  this.mSearchable = paramSearchableInfo;
  if (this.mSearchable != null)
  {
    if (IS_AT_LEAST_FROYO) {
      updateSearchAutoComplete();
    }
    updateQueryHint();
  }
  if ((IS_AT_LEAST_FROYO) && (hasVoiceSearch())) {}
  for (boolean bool = true;; bool = false)
  {
    this.mVoiceButtonEnabled = bool;
    if (this.mVoiceButtonEnabled) {
      this.mSearchSrcTextView.setPrivateImeOptions("nm");
    }
    updateViewsVisibility(isIconified());
    return;
  }
}
项目:MinMinGuard    文件:SearchView.java   
/**
 * Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used
 * to display labels, hints, suggestions, create intents for launching search results screens
 * and controlling other affordances such as a voice button.
 *
 * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific
 * activity or a global search provider.
 */
public void setSearchableInfo(SearchableInfo searchable) {
    mSearchable = searchable;
    if (mSearchable != null) {
        updateSearchAutoComplete();
        updateQueryHint();
    }
    // Cache the voice search capability
    mVoiceButtonEnabled = hasVoiceSearch();

    if (mVoiceButtonEnabled) {
        // Disable the microphone on the keyboard, as a mic is displayed near the text box
        // TODO: use imeOptions to disable voice input when the new API will be available
        mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
    updateViewsVisibility(isIconified());
}
项目:MinMinGuard    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:DailyMettaApp    文件:ArticleActivityC.java   
@Override
public boolean onCreateOptionsMenu(Menu iMenu) {
    //Inflating the menu (which will add items to the action bar)
    getMenuInflater().inflate(R.menu.menu_article, iMenu);

    //Setting up the SearchView
    SearchManager tSearchManager = (SearchManager)getSystemService(Context.SEARCH_SERVICE);
    SearchView tSearchView = (SearchView) iMenu.findItem(R.id.action_text_search).getActionView();
    ComponentName tComponentName = this.getComponentName();
    SearchableInfo tSearchableInfo = tSearchManager.getSearchableInfo(tComponentName);
    tSearchView.setSearchableInfo(tSearchableInfo);
    tSearchView.setIconifiedByDefault(false);

    if(BuildConfig.DEBUG == false){
        MenuItem tMenuItem = iMenu.findItem(R.id.action_debug_download);
        tMenuItem.setVisible(false);
    }

    return true;
}
项目:PacketSender-Android    文件:MainActivity.java   
private void setupSearchView(MenuItem searchItem) {

        //searchItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);

        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        if (searchManager != null) {
            List<SearchableInfo> searchables = searchManager.getSearchablesInGlobalSearch();

            SearchableInfo info = searchManager.getSearchableInfo(getComponentName());
            for (SearchableInfo inf : searchables) {
                if (inf.getSuggestAuthority() != null
                        && inf.getSuggestAuthority().startsWith("applications")) {
                    info = inf;
                }
            }
            mSearchView.setSearchableInfo(info);
        }

        mSearchView.setOnQueryTextListener(this);
    }
项目:DoubanOnline    文件:SearchView.java   
/**
 * Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used
 * to display labels, hints, suggestions, create intents for launching search results screens
 * and controlling other affordances such as a voice button.
 *
 * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific
 * activity or a global search provider.
 */
public void setSearchableInfo(SearchableInfo searchable) {
    mSearchable = searchable;
    if (mSearchable != null) {
        updateSearchAutoComplete();
        updateQueryHint();
    }
    // Cache the voice search capability
    mVoiceButtonEnabled = hasVoiceSearch();

    if (mVoiceButtonEnabled) {
        // Disable the microphone on the keyboard, as a mic is displayed near the text box
        // TODO: use imeOptions to disable voice input when the new API will be available
        mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
    updateViewsVisibility(isIconified());
}
项目:DoubanOnline    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:ApkLauncher    文件:SearchViewActionBar.java   
private void setupSearchView(MenuItem searchItem) {

        if (isAlwaysExpanded()) {
            mSearchView.setIconifiedByDefault(false);
        } else {
            searchItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM
                    | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
        }

        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        if (searchManager != null) {
            List<SearchableInfo> searchables = searchManager.getSearchablesInGlobalSearch();

            // Try to use the "applications" global search provider
            SearchableInfo info = searchManager.getSearchableInfo(getComponentName());
            for (SearchableInfo inf : searchables) {
                if (inf.getSuggestAuthority() != null
                        && inf.getSuggestAuthority().startsWith("applications")) {
                    info = inf;
                }
            }
            mSearchView.setSearchableInfo(info);
        }

        mSearchView.setOnQueryTextListener(this);
    }
项目:Popeens-DSub    文件:SubsonicFragment.java   
protected void onFinishSetupOptionsMenu(final Menu menu) {
    searchItem = menu.findItem(R.id.menu_global_search);
    if(searchItem != null) {
        searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
        SearchManager searchManager = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
        SearchableInfo searchableInfo = searchManager.getSearchableInfo(context.getComponentName());
        if(searchableInfo == null) {
            Log.w(TAG, "Failed to get SearchableInfo");
        } else {
            searchView.setSearchableInfo(searchableInfo);
        }

        String currentQuery = getCurrentQuery();
        if(currentQuery != null) {
            searchView.setOnSearchClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    searchView.setQuery(getCurrentQuery(), false);
                }
            });
        }
    }
}
项目:travelinfo    文件:SearchView.java   
/**
 * Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used
 * to display labels, hints, suggestions, create intents for launching search results screens
 * and controlling other affordances such as a voice button.
 *
 * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific
 * activity or a global search provider.
 */
public void setSearchableInfo(SearchableInfo searchable) {
    mSearchable = searchable;
    if (mSearchable != null) {
        updateSearchAutoComplete();
        updateQueryHint();
    }
    // Cache the voice search capability
    mVoiceButtonEnabled = hasVoiceSearch();

    if (mVoiceButtonEnabled) {
        // Disable the microphone on the keyboard, as a mic is displayed near the text box
        // TODO: use imeOptions to disable voice input when the new API will be available
        mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
    updateViewsVisibility(isIconified());
}
项目:travelinfo    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:io2015-codelabs    文件:SearchActivity.java   
private void setupSearchView(MenuItem searchItem) {

        mSearchView.setIconifiedByDefault(false);

        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        if (searchManager != null) {
            List<SearchableInfo> searchables = searchManager.getSearchablesInGlobalSearch();

            SearchableInfo info = searchManager.getSearchableInfo(getComponentName());
            for (SearchableInfo inf : searchables) {
                if (inf.getSuggestAuthority() != null
                        && inf.getSuggestAuthority().startsWith("applications")) {
                    info = inf;
                }
            }
            mSearchView.setSearchableInfo(info);
        }

        mSearchView.setOnQueryTextListener(this);
        mSearchView.setFocusable(false);
        mSearchView.setFocusableInTouchMode(false);
    }
项目:ApiDemos    文件:SearchViewActionBar.java   
private void setupSearchView(MenuItem searchItem) {

        if (isAlwaysExpanded()) {
            mSearchView.setIconifiedByDefault(false);
        } else {
            searchItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM
                    | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
        }

        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        if (searchManager != null) {
            List<SearchableInfo> searchables = searchManager.getSearchablesInGlobalSearch();

            // Try to use the "applications" global search provider
            SearchableInfo info = searchManager.getSearchableInfo(getComponentName());
            for (SearchableInfo inf : searchables) {
                if (inf.getSuggestAuthority() != null
                        && inf.getSuggestAuthority().startsWith("applications")) {
                    info = inf;
                }
            }
            mSearchView.setSearchableInfo(info);
        }

        mSearchView.setOnQueryTextListener(this);
    }
项目:MyCTFWriteUps    文件:SearchView.java   
public void setSearchableInfo(SearchableInfo searchableinfo)
{
    mSearchable = searchableinfo;
    if (mSearchable != null)
    {
        if (IS_AT_LEAST_FROYO)
        {
            updateSearchAutoComplete();
        }
        updateQueryHint();
    }
    boolean flag;
    if (IS_AT_LEAST_FROYO && hasVoiceSearch())
    {
        flag = true;
    } else
    {
        flag = false;
    }
    mVoiceButtonEnabled = flag;
    if (mVoiceButtonEnabled)
    {
        mSearchSrcTextView.setPrivateImeOptions("nm");
    }
    updateViewsVisibility(isIconified());
}
项目:MyCTFWriteUps    文件:SuggestionsAdapter.java   
public SuggestionsAdapter(Context context, SearchView searchview, SearchableInfo searchableinfo, WeakHashMap weakhashmap)
{
    super(context, searchview.getSuggestionRowLayout(), null, true);
    mClosed = false;
    mQueryRefinement = 1;
    mText1Col = -1;
    mText2Col = -1;
    mText2UrlCol = -1;
    mIconName1Col = -1;
    mIconName2Col = -1;
    mFlagsCol = -1;
    mSearchManager = (SearchManager)mContext.getSystemService("search");
    mSearchView = searchview;
    mSearchable = searchableinfo;
    mCommitIconResId = searchview.getSuggestionCommitIconResId();
    mProviderContext = context;
    mOutsideDrawablesCache = weakhashmap;
}
项目:BitcoinAuthenticator-Android    文件:SearchView.java   
/**
 * Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used
 * to display labels, hints, suggestions, create intents for launching search results screens
 * and controlling other affordances such as a voice button.
 *
 * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific
 * activity or a global search provider.
 */
public void setSearchableInfo(SearchableInfo searchable) {
    mSearchable = searchable;
    if (mSearchable != null) {
        updateSearchAutoComplete();
        updateQueryHint();
    }
    // Cache the voice search capability
    mVoiceButtonEnabled = hasVoiceSearch();

    if (mVoiceButtonEnabled) {
        // Disable the microphone on the keyboard, as a mic is displayed near the text box
        // TODO: use imeOptions to disable voice input when the new API will be available
        mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
    updateViewsVisibility(isIconified());
}
项目:MonsterHunter3UDatabase    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:zhangshangwuda    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:OurDailyBread    文件:SearchView.java   
/**
 * Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used
 * to display labels, hints, suggestions, create intents for launching search results screens
 * and controlling other affordances such as a voice button.
 *
 * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific
 * activity or a global search provider.
 */
public void setSearchableInfo(SearchableInfo searchable) {
    mSearchable = searchable;
    if (mSearchable != null) {
        updateSearchAutoComplete();
        updateQueryHint();
    }
    // Cache the voice search capability
    mVoiceButtonEnabled = hasVoiceSearch();

    if (mVoiceButtonEnabled) {
        // Disable the microphone on the keyboard, as a mic is displayed near the text box
        // TODO: use imeOptions to disable voice input when the new API will be available
        mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
    updateViewsVisibility(isIconified());
}
项目:OurDailyBread    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:MinhaBibliaCatolica    文件:SearchView.java   
/**
 * Sets the SearchableInfo for this SearchView. Properties in the SearchableInfo are used
 * to display labels, hints, suggestions, create intents for launching search results screens
 * and controlling other affordances such as a voice button.
 *
 * @param searchable a SearchableInfo can be retrieved from the SearchManager, for a specific
 * activity or a global search provider.
 */
public void setSearchableInfo(SearchableInfo searchable) {
    mSearchable = searchable;
    if (mSearchable != null) {
        updateSearchAutoComplete();
        updateQueryHint();
    }
    // Cache the voice search capability
    mVoiceButtonEnabled = hasVoiceSearch();

    if (mVoiceButtonEnabled) {
        // Disable the microphone on the keyboard, as a mic is displayed near the text box
        // TODO: use imeOptions to disable voice input when the new API will be available
        mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
    updateViewsVisibility(isIconified());
}
项目:upes-academics    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:beautyClock    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}
项目:songseeker    文件:SearchView.java   
private void onVoiceClicked() {
    // guard against possible race conditions
    if (mSearchable == null) {
        return;
    }
    SearchableInfo searchable = mSearchable;
    try {
        if (searchable.getVoiceSearchLaunchWebSearch()) {
            Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
                    searchable);
            getContext().startActivity(webSearchIntent);
        } else if (searchable.getVoiceSearchLaunchRecognizer()) {
            Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                    searchable);
            getContext().startActivity(appSearchIntent);
        }
    } catch (ActivityNotFoundException e) {
        // Should not happen, since we check the availability of
        // voice search before showing the button. But just in case...
        Log.w(LOG_TAG, "Could not find voice search activity");
    }
}