Пример #1
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);

    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    mSearchView = (SearchView) menu.findItem(R.id.search).getActionView();
    mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    mSearchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {

            //                mNoteList = mDbHelper.queryName(query);
            //                mAdapter.notifyDataSetChanged();
            return false;
          }

          @Override
          public boolean onQueryTextChange(String newText) {

            if (TextUtils.isEmpty(newText)) {
              mNoteList = mDbHelper.queryAll();
            } else {
              mNoteList = mDbHelper.queryName(newText);
            }
            sortList(mNoteList);
            mAdapter.notifyDataSetChanged();
            return true;
          }
        });

    return true;
  }
  @Override
  public boolean onCreateOptionsMenu(final Menu menu) {
    final MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.stops_menu, menu);

    SearchView searchView = (SearchView) menu.findItem(R.id.searchStop).getActionView();

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    ComponentName cn = new ComponentName(this, StopsActivity_.class);
    SearchableInfo info = searchManager.getSearchableInfo(cn);
    searchView.setSearchableInfo(info);

    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @SuppressWarnings("unchecked")
          @Override
          public boolean onQueryTextSubmit(String s) {
            ArrayAdapter<Stop> adapter = (ArrayAdapter<Stop>) getListAdapter();
            adapter.getFilter().filter(s.toLowerCase());
            return true;
          }

          @SuppressWarnings("unchecked")
          @Override
          public boolean onQueryTextChange(String s) {
            ArrayAdapter<Stop> adapter = (ArrayAdapter<Stop>) getListAdapter();
            adapter.getFilter().filter(s.toLowerCase());
            return true;
          }
        });

    return true;
  }
Пример #3
0
  @TargetApi(Build.VERSION_CODES.FROYO)
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getSupportMenuInflater().inflate(R.menu.activity_channel, menu);

    searchItem = menu.findItem(R.id.menu_search);

    if (mViewPager == null) fullscreenButton = menu.findItem(R.id.menu_fullscreen);

    if (VERSION.SDK_INT >= 8) { // SearchManager supported by Froyo+.
      SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
      SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
      searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    } else {
      searchItem.setVisible(false);
    }

    mutedButton = menu.findItem(R.id.menu_mute_button);
    deafenedButton = menu.findItem(R.id.menu_deafen_button);

    if (mService != null && mService.getCurrentUser() != null) {
      updateMuteDeafenMenuItems(mService.isMuted(), mService.isDeafened());
    }

    return true;
  }
Пример #4
0
  /**
   * Returns a widget with category {@link AppWidgetProviderInfo#WIDGET_CATEGORY_SEARCHBOX} provided
   * by the same package which is set to be global search activity. If widgetCategory is not
   * supported, or no such widget is found, returns the first widget provided by the package.
   */
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
  public static AppWidgetProviderInfo getSearchWidgetProvider(Context context) {
    SearchManager searchManager = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
    ComponentName searchComponent = searchManager.getGlobalSearchActivity();
    if (searchComponent == null) return null;
    String providerPkg = searchComponent.getPackageName();

    AppWidgetProviderInfo defaultWidgetForSearchPackage = null;

    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
    for (AppWidgetProviderInfo info : appWidgetManager.getInstalledProviders()) {
      if (info.provider.getPackageName().equals(providerPkg)) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
          if ((info.widgetCategory & AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX) != 0) {
            return info;
          } else if (defaultWidgetForSearchPackage == null) {
            defaultWidgetForSearchPackage = info;
          }
        } else {
          return info;
        }
      }
    }
    return defaultWidgetForSearchPackage;
  }
Пример #5
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    if (fdroidApp.bluetoothAdapter == null) {
      // ignore on devices without Bluetooth
      MenuItem btItem = menu.findItem(R.id.action_bluetooth_apk);
      btItem.setVisible(false);
    }

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchMenuItem = menu.findItem(R.id.action_search);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    // LayoutParams.MATCH_PARENT does not work, use a big value instead
    searchView.setMaxWidth(1000000);
    searchView.setOnQueryTextListener(this);

    // If we were asked to execute a search before getting around to building the options
    // menu, then we should deal with that now that the options menu is all sorted out.
    if (pendingSearchQuery != null) {
      performSearch(pendingSearchQuery);
      pendingSearchQuery = null;
    }

    return super.onCreateOptionsMenu(menu);
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_makal, menu);

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    if (null != searchView) {
      searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    }
    SearchView.OnQueryTextListener queryTextListener =
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String s) {
            //      Toast.makeText(getActivity(), "TEXT:" + s, Toast.LENGTH_SHORT).show();
            return false;
          }

          @Override
          public boolean onQueryTextChange(String s) {
            SearchAdapter(s);
            return false;
          }
        };
    searchView.setOnQueryTextListener(queryTextListener);
    return true;
  }
Пример #7
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.options_menu, menu);
    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            return false;
          }

          @Override
          public boolean onQueryTextChange(String newText) {
            for (int i = 0; i < mListView.getCount(); i++) {
              if (mNames.get(i).toLowerCase().startsWith(newText.toLowerCase())) {
                mListView.setSelection(i);
                break;
              } else if (mNames.get(i).toLowerCase().contains(newText.toLowerCase())) {
                mListView.setSelection(i);
                break;
              }
            }
            return true;
          }
        });
    return true;
  }
Пример #8
0
 @TargetApi(11)
 private void setSearchView(Menu menu) {
   // Associate searchable configuration with the SearchView
   SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
   SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
   searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
 }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.setGroupVisible(R.id.sortGroup, true);
    menu.findItem(R.id.search).setVisible(true);

    SearchManager searchManager =
        (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
    searchMenuItem = menu.findItem(R.id.search);
    searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
    searchView.setSubmitButtonEnabled(true);
    searchView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextChange(String newText) {
            searchFilter(newText);
            return true;
          }

          @Override
          public boolean onQueryTextSubmit(String query) {
            InputMethodManager imm =
                (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
            return true;
          }
        });
    searchView.setOnFocusChangeListener(searchViewOnFocusChangeListener);
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater menuInflater = getMenuInflater();
    menuInflater.inflate(R.menu.activity_recent_menu, menu);

    MenuItem searchItem = menu.findItem(R.id.activity_recent_search);
    searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    // searchView.setOnQueryTextListener(this);
    searchView.setQueryHint(getString(R.string.hint_search_activity_recent));
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    // Handle the query that user types in action bar search field
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            Intent intent = new Intent(RecentActivity.this, SearchResultsActivity.class);
            intent.putExtra("query", query);
            startActivity(intent);
            return false;
          }

          @Override
          public boolean onQueryTextChange(String query) {
            return false;
          }
        });

    return super.onCreateOptionsMenu(menu);
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    this.optionsMenu = menu;
    getMenuInflater().inflate(R.menu.stations_list, menu);

    if (jsonDownloadTask != null
        && (jsonDownloadTask.getStatus() == AsyncTask.Status.PENDING
            || jsonDownloadTask.getStatus() == AsyncTask.Status.RUNNING)) {
      setRefreshActionButtonState(true);
    }

    SearchManager manager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);

    searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
    searchView.setSearchableInfo(manager.getSearchableInfo(getComponentName()));
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {

          @Override
          public boolean onQueryTextSubmit(String s) {
            return false;
          }

          @Override
          public boolean onQueryTextChange(String s) {
            loadData(s);
            return true;
          }
        });

    return true;
  }
 public boolean onCreateOptionsMenu(Menu menu) {
   // If the mode is valid, then set the initial menu
   if (mMode == ViewMode.UNKNOWN) {
     return false;
   }
   mSearch = menu.findItem(R.id.search);
   if (mSearch != null) {
     mSearchWidget = (SearchView) mSearch.getActionView();
     mSearch.setOnActionExpandListener(this);
     SearchManager searchManager =
         (SearchManager) mActivity.getActivityContext().getSystemService(Context.SEARCH_SERVICE);
     if (searchManager != null && mSearchWidget != null) {
       SearchableInfo info = searchManager.getSearchableInfo(mActivity.getComponentName());
       mSearchWidget.setSearchableInfo(info);
       mSearchWidget.setOnQueryTextListener(this);
       mSearchWidget.setOnSuggestionListener(this);
       mSearchWidget.setIconifiedByDefault(true);
     }
   }
   mHelpItem = menu.findItem(R.id.help_info_menu_item);
   mSendFeedbackItem = menu.findItem(R.id.feedback_menu_item);
   mRefreshItem = menu.findItem(R.id.refresh);
   mFolderSettingsItem = menu.findItem(R.id.folder_options);
   mEmptyTrashItem = menu.findItem(R.id.empty_trash);
   mEmptySpamItem = menu.findItem(R.id.empty_spam);
   return true;
 }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_simple, menu);

    // Get the SearchView and set the searchable configuration
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    svActionSearch = (SearchView) menu.findItem(R.id.svActionSearch).getActionView();
    // Assumes current activity is the searchable activity
    svActionSearch.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    svActionSearch.setOnQueryTextListener(
        new OnQueryTextListener() {

          @Override
          public boolean onQueryTextSubmit(String query) {
            strQuery = query;
            performSearch(strQuery);
            return false;
          }

          @Override
          public boolean onQueryTextChange(String query) {
            // TODO Auto-generated method stub
            return true;
          }
        });
    return true;
  }
Пример #14
0
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.actionbar_menu_atuserfragment, menu);
    SearchManager searchManager =
        (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
    searchView.setIconifiedByDefault(false);
    searchView.setQueryHint(getString(R.string.at_other));
    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            return false;
          }

          @Override
          public boolean onQueryTextChange(String newText) {
            if (!TextUtils.isEmpty(newText)) {
              if (task != null) {
                task.cancel(true);
              }
              task = new AtUserTask(newText);
              task.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
            } else {
              result.clear();
              atList.clear();
              adapter.notifyDataSetChanged();
            }
            return false;
          }
        });
  }
Пример #15
0
 private ComponentName getSearchWidgetProvider() {
   SearchManager searchManager =
       (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
   ComponentName searchComponent = searchManager.getGlobalSearchActivity();
   if (searchComponent == null) return null;
   return getProviderInPackage(searchComponent.getPackageName());
 }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflator = getMenuInflater();
    if (currentMode.equals(mode.DRIVERS_LIST.name())) {
      inflator.inflate(R.menu.menu_search_home, menu);
    } else {
      inflator.inflate(R.menu.menu_vehicles_drivers_page, menu);
    }
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchMenuItem = menu.findItem(R.id.action_search);
    searchView = (SearchView) searchMenuItem.getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setSubmitButtonEnabled(false);
    searchView.setOnQueryTextListener(this);
    searchView.addOnAttachStateChangeListener(
        new View.OnAttachStateChangeListener() {
          @Override
          public void onViewAttachedToWindow(View v) {}

          @Override
          public void onViewDetachedFromWindow(View v) {
            Utilities.hideSoftKeyboard(DriversActivity.this);
            searchView.setQuery("", false);
          }
        });
    return true;
  }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {

    if (getIntent().ACTION_SEARCH.equals(getIntent().getAction())
        || getIntent().getExtras().containsKey("searchTerm")) {

      getMenuInflater().inflate(R.menu.search_results, menu);
      super.menu = menu;

      SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
      SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
      searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
      searchView.setQuery(searchQuery, false);
      searchView.clearFocus();
      searchView.setIconifiedByDefault(false);
      SharedPreferences shared = getSharedPreferences("customerData", MODE_PRIVATE);
      Boolean isLoggedIn = (shared.getBoolean("isLoggedIn", false));
      String isSeller = (shared.getString("isSeller", ""));
      MenuItem loginMenuItem = menu.findItem(R.id.login);
      MenuItem signupMenuItem = (MenuItem) menu.findItem(R.id.signup);
      if (isLoggedIn) {
        loginMenuItem.setTitle(getResources().getString(R.string.logout_title));
        signupMenuItem.setVisible(false);
        if (isSeller.equalsIgnoreCase("1")) {
          menu.findItem(R.id.sellerDashboard).setVisible(true);
          menu.findItem(R.id.sellerOrder).setVisible(true);
        }
      }
      return true;
    }
    return super.onCreateOptionsMenu(menu);
  }
Пример #18
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    // Get the SearchView and set the searchable configuration
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    final SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(false);
    searchView.setInputType(InputType.TYPE_CLASS_NUMBER);
    searchMenuItem = menu.findItem(R.id.action_search);

    searchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            MenuItem searchMenuItem = getSearchMenuItem();
            if (searchMenuItem != null) {
              searchMenuItem.collapseActionView();
              searchView.setQuery("", false);
            }
            return false;
          }

          @Override
          public boolean onQueryTextChange(String newText) {
            return false;
          }
        });
    return true;
  }
Пример #19
0
  /**
   * *********************************************************************************************
   */
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_search, menu);
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    searchView.setSubmitButtonEnabled(true);
    searchView.setQuery(searchText, true);
    searchView.setIconifiedByDefault(false);
    searchView.setQueryHint("Search Images ..");

    SearchView.OnQueryTextListener textChangeListener =
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextChange(String newText) {

            return true;
          }

          @Override
          public boolean onQueryTextSubmit(String queryValue) {
            searchText = queryValue;
            currentPage = 1;
            imageItemList.clear();
            imageItemAdapter.notifyDataSetChanged();
            refreshItems(currentPage);
            return true;
          }
        };
    searchView.setOnQueryTextListener(textChangeListener);
    return true;
  }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    if (mUnfoldableView.isUnfolded()) {
      inflater.inflate(R.menu.detail_bar, menu);
    } else {
      inflater.inflate(R.menu.main_bar, menu);
      SearchManager searchManager =
          (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
      SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
      searchView.setIconifiedByDefault(true);
      int id =
          searchView
              .getContext()
              .getResources()
              .getIdentifier("android:id/search_close_btn", null, null);
      ((ImageView) Views.find(searchView, id)).setImageResource(R.drawable.ab_search_clear);
      int searchId =
          searchView
              .getContext()
              .getResources()
              .getIdentifier("android:id/search_mag_icon", null, null);
      //            SearchView.SearchAutoComplete autoComplete =
      // (SearchView.SearchAutoComplete)ll3.getChildAt(0);
      //            Drawable drawable= getResources().getDrawable(R.drawable.ic_action_search);
      //            drawable.setBounds(0, 0, drawable.getMinimumWidth(),
      // drawable.getMinimumHeight());
      ((ImageView) Views.find(searchView, searchId)).setImageResource(R.drawable.ic_action_search);
      int searchId2 =
          searchView
              .getContext()
              .getResources()
              .getIdentifier("android:id/search_button", null, null);
      ((ImageView) Views.find(searchView, searchId2))
          .setBackgroundResource(R.drawable.ic_action_search);
      searchView.setSearchableInfo(
          searchManager.getSearchableInfo(getActivity().getComponentName()));

      try {
        Field searchField = SearchView.class.getDeclaredField("mSearchButton");
        searchField.setAccessible(true);
        ImageView searchBtn = (ImageView) searchField.get(searchView);
        searchBtn.setImageResource(R.drawable.ic_action_search);
        searchField = SearchView.class.getDeclaredField("mSearchPlate");
        searchField.setAccessible(true);
        //                LinearLayout searchPlate = (LinearLayout)searchField.get(searchView);
        //                Drawable drawable=
        // getResources().getDrawable(R.drawable.ic_action_search);
        //                drawable.setBounds(0, 0, drawable.getMinimumWidth(),
        // drawable.getMinimumHeight());
        //
        // ((TextView)searchPlate.getChildAt(0)).setCompoundDrawables(drawable,null,null,null);
        //                searchPlate.setBackgroundResource(R.drawable.edit_text_bkg);
      } catch (NoSuchFieldException e) {
        Log.e(TAG, e.getMessage(), e);
      } catch (IllegalAccessException e) {
        Log.e(TAG, e.getMessage(), e);
      }
    }
  }
Пример #21
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   getSupportMenuInflater().inflate(R.menu.lte_coverage_menu, menu);
   SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
   SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
   searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
   return true;
 }
Пример #22
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {

    /*getMenuInflater().inflate(R.menu.common_actionbar, _menu);

    this.menu = _menu;

    SearchManager manager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    menuSearch = menu.findItem(R.id.search);
    menuform = menu.findItem(R.id.survey_mi);

    final SearchView search = (SearchView) menu.findItem(R.id.search).getActionView();
    search.setQueryHint(Html.fromHtml("<font color = #FFFFFF>" + getResources().getString(R.string.search) + "</font>"));
    Log.d("bis", "pl info= " + manager.getSearchableInfo(getComponentName()).getSearchActivity());
    search.setSearchableInfo(manager.getSearchableInfo(getComponentName()));

    search.setOnQueryTextListener(new OnQueryTextListener()
    {

        @Override
        public boolean onQueryTextChange(String query)
        {
            Log.d("bis", "sv query pl" + query);
            if (query.toString().length() < 1)
            {
                return true;
            }
            else
            {
                loadHistory(query);

                return true;
            }
        }

        @Override
        public boolean onQueryTextSubmit(String query)
        {
            // TODO Auto-generated method stub
            return false;
        }

    });


    return true;*/

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.common_actionbar, menu);

    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    return true;
  }
Пример #23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_contactlist);

    mAppController = AppController.getInstance();
    mContext = this;

    tvHinweis = (TextView) findViewById(R.id.tvHinweis);

    Toolbar toolbar = (Toolbar) findViewById(R.id.activity_contacts_toolbar);
    if (toolbar != null) {
      setSupportActionBar(toolbar);
      getSupportActionBar().setDisplayShowHomeEnabled(true);
      // getSupportActionBar().setSubtitle(null);
    }

    suggestions =
        new SearchRecentSuggestions(
            this, OrderSuggestionProvider.AUTHORITY, OrderSuggestionProvider.MODE);

    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchView = new SearchView(getSupportActionBar().getThemedContext());
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(true);
    searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH); // Lupe anzeigen in der Tastatur
    // searchView.setSubmitButtonEnabled(true); //OK-Button anzeigen
    SearchView.SearchAutoComplete searchAutoComplete =
        (SearchView.SearchAutoComplete)
            searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);

    // Collapse the search menu when the user hits the back key
    searchAutoComplete.setOnFocusChangeListener(
        new View.OnFocusChangeListener() {

          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) showSearch(false);
          }
        });

    try {
      // This sets the cursor resource ID to 0 or @null which will make it visible on white
      // background
      Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
      mCursorDrawableRes.setAccessible(true);
      mCursorDrawableRes.set(searchAutoComplete, 0);

    } catch (Exception e) {
    }

    checkServerConnection checkServerConnection = new checkServerConnection();
    checkServerConnection.execute("qw1");
  }
Пример #24
0
  @Override
  public boolean onCreateOptionsMenu(final Menu menu) {
    getMenuInflater().inflate(R.menu.main_activity_options, menu);
    final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    final MenuItem searchItem = menu.findItem(R.id.menu_gosearch);
    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    return true;
  }
Пример #25
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    productsListFragment =
        (ProductsListFragment) getFragmentManager().findFragmentById(R.id.ProductsListFragment);

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.actionbar, menu);

    itemAdd = menu.findItem(R.id.ItemAdd);
    itemEdit = menu.findItem(R.id.ItemEdit);
    itemDelete = menu.findItem(R.id.ItemDelete);
    itemSearch = menu.findItem(R.id.ItemSearch);
    itemAccept = menu.findItem(R.id.ItemAccept);
    itemCancel = menu.findItem(R.id.ItemCancel);
    searchView = (SearchView) menu.findItem(R.id.ItemSearch).getActionView();
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);

    if (stateEdit) actionbarSetEdit();
    else actionbarSetView();

    if (searchView != null) {

      if (searchState) {
        searchView.setQuery(search, true);
        searchView.setFocusable(true);
        searchView.setIconified(false);
        searchView.requestFocusFromTouch();
        // productsListFragment.showList(true, search);

        itemSearch.collapseActionView();
      }
      searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    }

    SearchView.OnQueryTextListener queryTextListener =
        new SearchView.OnQueryTextListener() {
          public boolean onQueryTextChange(String newText) {
            searchState = true;
            search = newText.trim();
            productsListFragment.showList(true, search);
            return true;
          }

          public boolean onQueryTextSubmit(String query) {
            searchState = true;
            search = query.trim();
            productsListFragment.showList(true, search);
            return true;
          }
        };

    searchView.setOnQueryTextListener(queryTextListener);
    return super.onCreateOptionsMenu(menu);
    //    return true;
  }
Пример #26
0
 /** In der ActionBar die SearchView initialisieren */
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   inflater.inflate(R.menu.fragment_wplist, menu);
   SearchManager searchManager =
       (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
   SearchView searchView =
       (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_List_search));
   searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
   searchView.setOnQueryTextListener(this);
   super.onCreateOptionsMenu(menu, inflater);
 }
Пример #27
0
 @TargetApi(Build.VERSION_CODES.HONEYCOMB)
 private void setupSearchMenuItem(Menu menu) {
   MenuItem searchItem = menu.findItem(R.id.menu_search);
   if (searchItem != null && UIUtils.hasHoneycomb()) {
     SearchView searchView = (SearchView) searchItem.getActionView();
     if (searchView != null) {
       SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
       searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
     }
   }
 }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.search_options_menu, menu);

    SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();

    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    return true;
  }
Пример #29
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    // Inflate menu to add items to action bar if it is present.
    inflater.inflate(R.menu.menu_main, menu);
    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    return true;
  }
Пример #30
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main_actions, menu);
    // setMenuBackground();
    // Associate searchable configuration with the SearchView

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    return super.onCreateOptionsMenu(menu);
  }