Example usage for android.app SearchManager getSearchableInfo

List of usage examples for android.app SearchManager getSearchableInfo

Introduction

In this page you can find the example usage for android.app SearchManager getSearchableInfo.

Prototype

public SearchableInfo getSearchableInfo(ComponentName componentName) 

Source Link

Document

Gets information about a searchable activity.

Usage

From source file:com.jefftharris.passwdsafe.PasswdSafe.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (itsNavDrawerFrag.isDrawerOpen()) {
        return super.onCreateOptionsMenu(menu);
    }/*from www  .  j  a  va  2  s.com*/

    // Only show items in the action bar relevant to this screen
    // if the drawer is not showing. Otherwise, let the drawer
    // decide what to show in the action bar.
    getMenuInflater().inflate(R.menu.activity_passwdsafe, menu);
    restoreActionBar();

    // Get the SearchView and set the searchable configuration
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    itsSearchItem = menu.findItem(R.id.menu_search);
    MenuItemCompat.collapseActionView(itsSearchItem);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(itsSearchItem);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(true);

    return true;
}

From source file:com.dsdar.thosearoundme.util.MemberAddContactsListFragment.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override//from   w w w  . j av a2  s.  c  o  m
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {

    // Inflate the menu items
    inflater.inflate(R.menu.contact_list_menu, menu);
    // Locate the search item
    MenuItem searchItem = menu.findItem(R.id.menu_search);

    // In versions prior to Android 3.0, hides the search item to prevent
    // additional
    // searches. In Android 3.0 and later, searching is done via a
    // SearchView in the ActionBar.
    // Since the search doesn't create a new Activity to do the searching,
    // the menu item
    // doesn't need to be turned off.
    if (mIsSearchResultView) {
        searchItem.setVisible(false);
    }

    // In version 3.0 and later, sets up and configures the ActionBar
    // SearchView
    if (Util.hasHoneycomb()) {

        // Retrieves the system search manager service
        final SearchManager searchManager = (SearchManager) getActivity()
                .getSystemService(Context.SEARCH_SERVICE);

        // Retrieves the SearchView from the search menu item
        final SearchView searchView = (SearchView) searchItem.getActionView();

        // Assign searchable info to SearchView
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));

        // Set listeners for SearchView
        searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String queryText) {
                // Nothing needs to happen when the user submits the
                // search string
                return true;
            }

            @Override
            public boolean onQueryTextChange(String newText) {
                // Called when the action bar search text has
                // changed. Updates
                // the search filter, and restarts the loader to do
                // a new query
                // using the new search string.
                String newFilter = !TextUtils.isEmpty(newText) ? newText : null;

                // Don't do anything if the filter is empty
                if (mSearchTerm == null && newFilter == null) {
                    return true;
                }

                // Don't do anything if the new filter is the same
                // as the current filter
                if (mSearchTerm != null && mSearchTerm.equals(newFilter)) {
                    return true;
                }

                // Updates current filter to new filter
                mSearchTerm = newFilter;

                // Restarts the loader. This triggers
                // onCreateLoader(), which builds the
                // necessary content Uri from mSearchTerm.
                mSearchQueryChanged = true;
                getLoaderManager().restartLoader(ContactsQuery.QUERY_ID, null,
                        MemberAddContactsListFragment.this);
                return true;
            }
        });

        if (Util.hasICS()) {
            // This listener added in ICS
            searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
                @Override
                public boolean onMenuItemActionExpand(MenuItem menuItem) {
                    // Nothing to do when the action item is
                    // expanded
                    return true;
                }

                @Override
                public boolean onMenuItemActionCollapse(MenuItem menuItem) {
                    // When the user collapses the SearchView the
                    // current search string is
                    // cleared and the loader restarted.
                    if (!TextUtils.isEmpty(mSearchTerm)) {
                        onSelectionCleared();
                    }
                    mSearchTerm = null;
                    getLoaderManager().restartLoader(ContactsQuery.QUERY_ID, null,
                            MemberAddContactsListFragment.this);
                    return true;
                }
            });
        }

        if (mSearchTerm != null) {
            // If search term is already set here then this fragment is
            // being restored from a saved state and the search menu item
            // needs to be expanded and populated again.

            // Stores the search term (as it will be wiped out by
            // onQueryTextChange() when the menu item is expanded).
            final String savedSearchTerm = mSearchTerm;

            // Expands the search menu item
            if (Util.hasICS()) {
                searchItem.expandActionView();
            }

            // Sets the SearchView to the previous search string
            searchView.setQuery(savedSearchTerm, false);
        }
    }
}

From source file:nl.mpcjanssen.simpletask.Simpletask.java

@Override
public boolean onCreateOptionsMenu(@NotNull final Menu menu) {
    MenuInflater inflater = getMenuInflater();
    if (m_app.isDarkActionbar()) {
        inflater.inflate(R.menu.main, menu);
    } else {/*from w  ww.j ava  2 s.  c  o m*/
        inflater.inflate(R.menu.main_light, menu);
    }

    if (!m_app.fileStoreCanSync()) {
        MenuItem mItem = menu.findItem(R.id.sync);
        mItem.setVisible(false);
    }
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    searchView.setIconifiedByDefault(false);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        public boolean m_ignoreSearchChangeCallback;

        @Override
        public boolean onQueryTextSubmit(String query) {
            // Stupid searchview code will call onQueryTextChange callback
            // When the actionView collapse and the textview is reset
            // ugly global hack around this
            m_ignoreSearchChangeCallback = true;
            menu.findItem(R.id.search).collapseActionView();
            m_ignoreSearchChangeCallback = false;
            return true;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            if (!m_ignoreSearchChangeCallback) {
                if (mFilter == null) {
                    mFilter = new ActiveFilter();
                }
                mFilter.setSearch(newText);
                mFilter.saveInPrefs(TodoApplication.getPrefs());
                if (m_adapter != null) {
                    m_adapter.setFilteredTasks();
                }
            }
            return true;
        }
    });
    this.options_menu = menu;
    return super.onCreateOptionsMenu(menu);
}

From source file:com.dycody.android.idealnote.ListFragment.java

/**
 * SearchView initialization. It's a little complex because it's not using SearchManager but is implementing on its
 * own./*from   w  ww .ja va2  s  .co  m*/
 */
@SuppressLint("NewApi")
private void initSearchView(final Menu menu) {

    // Prevents some mysterious NullPointer on app fast-switching
    if (mainActivity == null)
        return;

    // Save item as class attribute to make it collapse on drawer opening
    searchMenuItem = menu.findItem(R.id.menu_search);

    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) mainActivity.getSystemService(Context.SEARCH_SERVICE);
    searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_search));
    searchView.setSearchableInfo(searchManager.getSearchableInfo(mainActivity.getComponentName()));
    searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH);

    // Expands the widget hiding other actionbar icons
    searchView.setOnQueryTextFocusChangeListener((v, hasFocus) -> setActionItemsVisibility(menu, hasFocus));

    MenuItemCompat.setOnActionExpandListener(searchMenuItem, new MenuItemCompat.OnActionExpandListener() {

        boolean searchPerformed = false;

        @Override
        public boolean onMenuItemActionCollapse(MenuItem item) {
            // Reinitialize notes list to all notes when search is collapsed
            searchQuery = null;
            if (searchLayout.getVisibility() == View.VISIBLE) {
                toggleSearchLabel(false);
            }
            mainActivity.getIntent().setAction(Intent.ACTION_MAIN);
            initNotesList(mainActivity.getIntent());
            mainActivity.supportInvalidateOptionsMenu();
            return true;
        }

        @Override
        public boolean onMenuItemActionExpand(MenuItem item) {

            searchView.setOnQueryTextListener(new OnQueryTextListener() {
                @Override
                public boolean onQueryTextSubmit(String arg0) {

                    return prefs.getBoolean("settings_instant_search", false);
                }

                @Override
                public boolean onQueryTextChange(String pattern) {

                    if (prefs.getBoolean("settings_instant_search", false) && searchLayout != null
                            && searchPerformed && mFragment.isAdded()) {
                        searchTags = null;
                        searchQuery = pattern;
                        NoteLoaderTask.getInstance().execute("getNotesByPattern", pattern);
                        return true;
                    } else {
                        searchPerformed = true;
                        return false;
                    }
                }
            });
            return true;
        }
    });
}

From source file:de.sourcestream.movieDB.MainActivity.java

/**
 * Initialize the contents of the Activity's standard options menu.
 * This is only called once, the first time the options menu is displayed.
 *
 * @param menu the options menu in which we place our items.
 * @return You must return true for the menu to be displayed; if you return false it will not be shown.
 *//*from  ww w .j  a v a 2s .c  o  m*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    searchViewItem = menu.findItem(R.id.search);
    searchView = (SearchView) MenuItemCompat.getActionView(searchViewItem);

    searchView.setQueryHint(getResources().getString(R.string.search_hint));
    searchView.setOnQueryTextListener(searchViewOnQueryTextListener);
    searchView.setOnSuggestionListener(searchSuggestionListener);

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

    String[] from = { SearchManager.SUGGEST_COLUMN_ICON_1, SearchManager.SUGGEST_COLUMN_TEXT_1,
            SearchManager.SUGGEST_COLUMN_TEXT_2 };
    int[] to = { R.id.posterPath, R.id.title, R.id.info };
    searchAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.suggestionrow, null, from, to,
            0) {
        @Override
        public void changeCursor(Cursor cursor) {
            super.swapCursor(cursor);
        }
    };
    searchViewItemC.setSuggestionsAdapter(searchAdapter);

    MenuItemCompat.setOnActionExpandListener(searchViewItem, onSearchViewItemExpand);

    return true;
}

From source file:github.popeen.dsub.fragments.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 {//from w  w  w  .  ja va 2 s.c  o  m
            searchView.setSearchableInfo(searchableInfo);
        }

        String currentQuery = getCurrentQuery();
        if (currentQuery != null) {
            searchView.setOnSearchClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    searchView.setQuery(getCurrentQuery(), false);
                }
            });
        }
    }
}

From source file:com.dmsl.anyplace.UnifiedNavigationActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getSupportMenuInflater();
    inflater.inflate(R.menu.unified_options_menu, menu);

    // ****************************************** Search View
    // ***************************************************************** /
    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setQueryHint("Search outdoor");
    searchView.setAddStatesFromChildren(true);

    // set query change listener
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override/*from   w w  w  . j  a v  a 2s  .com*/
        public boolean onQueryTextChange(final String newText) {
            // return false; // false since we do not handle this call

            if (newText == null || newText.trim().length() < 1) {
                if (mSuggestionsTask != null && !mSuggestionsTask.isCancelled()) {
                    mSuggestionsTask.cancel(true);
                }
                searchView.setSuggestionsAdapter(null);
                return true;
            }

            if (mSuggestionsTask != null) {
                mSuggestionsTask.cancel(true);
            }

            if (searchType == SearchTypes.INDOOR_MODE) {
                if (!userData.isFloorSelected()) {
                    List<IPoisClass> places = new ArrayList<IPoisClass>(1);
                    PoisModel pm = new PoisModel();
                    pm.name = "Load a building first ...";
                    places.add(pm);
                    Cursor cursor = AnyPlaceSeachingHelper.prepareSearchViewCursor(places);
                    showSearchResult(cursor);
                    return true;
                }
            }

            GeoPoint gp = userData.getLatestUserPosition();

            mSuggestionsTask = new AnyplaceSuggestionsTask(
                    new AnyplaceSuggestionsTask.AnyplaceSuggestionsListener() {
                        @Override
                        public void onSuccess(String result, List<? extends IPoisClass> pois) {
                            showSearchResult(AnyPlaceSeachingHelper.prepareSearchViewCursor(pois, newText));
                        }

                        @Override
                        public void onErrorOrCancel(String result) {
                            Log.d("AnyplaceSuggestions", result);
                        }

                        @Override
                        public void onUpdateStatus(String string, Cursor cursor) {
                            showSearchResult(cursor);
                        }

                    }, UnifiedNavigationActivity.this, searchType,
                    (gp == null) ? new GeoPoint(csLat, csLon) : gp, newText);
            mSuggestionsTask.execute(null, null);

            // we return true to avoid caling the provider set in the xml
            return true;
        }

        @Override
        public boolean onQueryTextSubmit(String query) {
            return false;
        }
    });
    searchView.setSubmitButtonEnabled(true);
    searchView.setQueryRefinementEnabled(false);

    // ****************************************** Select building
    // ***************************************************************** /
    // Select building and floor to start navigating and positioning
    final SubMenu subMenuPlace = menu.addSubMenu("Select Building");
    final MenuItem sPlace = subMenuPlace.getItem();
    sPlace.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    sPlace.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            // start the activity where the user can select the FROM and TO
            // pois he wants to navigate
            GeoPoint gp = userData.getLatestUserPosition();
            loadSelectBuildingActivity(gp, false);
            return true;
        }
    });

    // ********************************** CLEAR NAVIGATION
    // *********************************************** /
    final SubMenu subMenuResetNav = menu.addSubMenu("Clear Navigation");
    final MenuItem ResetNav = subMenuResetNav.getItem();
    ResetNav.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    ResetNav.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            clearLastNavigationInfo();
            return true;
        }
    });

    // ***********************Load Ayplace Logger
    // ************************************** /
    final SubMenu subMenuLoadLogger = menu.addSubMenu("Show Logger");
    final MenuItem LoadLogger = subMenuLoadLogger.getItem();
    LoadLogger.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    LoadLogger.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            Intent intent = new Intent(getApplicationContext(), AnyplaceLoggerActivity.class);
            startActivity(intent);
            return true;
        }
    });

    // ****************************************** preferences
    // ********************************************** /
    final SubMenu subMenuPreferences = menu.addSubMenu("Preferences");
    final MenuItem prefsMenu = subMenuPreferences.getItem();
    prefsMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    prefsMenu.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            Intent i = new Intent(UnifiedNavigationActivity.this, AnyplacePrefs.class);
            startActivityForResult(i, PREFERENCES_ACTIVITY_RESULT);
            return true;
        }
    });

    // ****************************************** about
    // ********************************************** /
    final SubMenu subMenuAbout = menu.addSubMenu("About");
    final MenuItem about = subMenuAbout.getItem();
    about.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    about.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            startActivity(new Intent(UnifiedNavigationActivity.this, AnyplaceAboutActivity.class));
            return true;
        }
    });

    // ****************************************** exit
    // ********************************************** /
    final SubMenu subMenuExit = menu.addSubMenu("Exit");
    final MenuItem Exit = subMenuExit.getItem();
    Exit.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    Exit.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            finish();
            return true;
        }
    });

    /***************************************** END OF MAIN MENU ***************************************************************/

    return super.onCreateOptionsMenu(menu);
}

From source file:com.lgallardo.youtorrentcontroller.RefreshListener.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);

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

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

    if (searchView != null) {
        searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
        searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
    }//from  ww w .j a  v a2s .  com

    return true;
}

From source file:com.lgallardo.qbittorrentclient.RefreshListener.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    // Retrieve the SearchView and plug it into SearchManager
    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
    SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default

    // Handle open/close SearchView (using an item menu)
    final MenuItem menuItem = menu.findItem(R.id.action_search);

    // When back is pressed or the SearchView is close, delete the query field
    // and close the SearchView using the item menu
    searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
        @Override//from w w  w.j ava 2 s. co m
        public void onFocusChange(View view, boolean queryTextFocused) {
            if (!queryTextFocused) {
                menuItem.collapseActionView();
                searchView.setQuery("", false);
                searchField = "";

                refreshSwipeLayout();
                refreshCurrent();
            }
        }
    });

    // This must be implemented to override defaul searchview behaviour, in order to
    // make it work with tablets
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {

            //Log.d("Debug", "onQueryTextSubmit - searchField: " + query);

            // false: don't actually send the query. We are going to do something different
            searchView.setQuery(query, false);

            // Set the variable we use in the intent to perform the search
            searchField = query;

            // Refresh using the search field
            refreshSwipeLayout();
            refreshCurrent();

            // Close the soft keyboard
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(menuItem.getActionView().getWindowToken(), 0);

            // Here true means, override default searchview query
            return true;
        }

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

    // There is a bug setting the hint from searchable.xml, so force it
    searchView.setQueryHint(getResources().getString(R.string.search_hint));

    return true;
}

From source file:org.tvbrowser.tvbrowser.TvBrowser.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.tv_browser, menu);
    //new MenuInflater(getSupportActionBar().getThemedContext()).inflate(R.menu.tv_browser, menu);
    mMainMenu = menu;//from  w  w w.j  av a  2  s  .c  om

    //  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()));

    mUpdateItem = menu.findItem(R.id.menu_tvbrowser_action_update_data);

    if (!PrefUtils.getStringValue(R.string.PREF_AUTO_UPDATE_TYPE, R.string.pref_auto_update_type_default)
            .equals("0")) {
        mUpdateItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }

    mFilterItem = menu.findItem(R.id.action_filter_channels);
    mCreateFavorite = menu.findItem(R.id.menu_tvbrowser_action_create_favorite);

    Fragment fragment = mSectionsPagerAdapter.getItem(mViewPager.getCurrentItem());

    mFilterItem.setVisible(!(fragment instanceof FragmentFavorites));
    mCreateFavorite.setVisible(fragment instanceof FragmentFavorites);
    mScrollTimeItem = menu.findItem(R.id.action_scroll);

    updateFromFilterEdit();

    mPluginPreferencesMenuItem = menu.findItem(R.id.menu_tvbrowser_action_settings_plugins);

    mPluginPreferencesMenuItem.setEnabled(PluginHandler.pluginsAvailable());

    menu.findItem(R.id.action_reset).setVisible(TEST_VERSION);

    mSearchExpanded = false;

    // if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    addOnActionExpandListener(menu.findItem(R.id.search));
    // }

    // menu.findItem(R.id.action_synchronize_dont_want_to_see).setVisible(false);
    menu.findItem(R.id.action_synchronize_favorites).setVisible(false);

    if (mUpdateItem != null && TvDataUpdateService.IS_RUNNING) {
        updateProgressIcon(true);
    }

    mDebugMenuItem = menu.findItem(R.id.action_debug);
    mSendDataUpdateLogItem = menu.findItem(R.id.action_send_data_update_log);
    mDeleteDataUpdateLogItem = menu.findItem(R.id.action_delete_data_update_log);
    mSendReminderLogItem = menu.findItem(R.id.action_send_reminder_log);
    mDeleteReminderLogItem = menu.findItem(R.id.action_delete_reminder_log);

    mPauseReminder = menu.findItem(R.id.action_pause_reminder);
    mContinueReminder = menu.findItem(R.id.action_continue_reminder);

    mPauseReminder.setVisible(!SettingConstants.isReminderPaused(TvBrowser.this));
    mContinueReminder.setVisible(SettingConstants.isReminderPaused(TvBrowser.this));

    mScrollTimeItem.setVisible(mViewPager.getCurrentItem() != 2 && !mSearchExpanded);

    boolean dataUpdateLogEnabled = PrefUtils.getBooleanValue(R.string.WRITE_DATA_UPDATE_LOG,
            R.bool.write_data_update_log_default);
    boolean reminderLogEnabled = PrefUtils.getBooleanValue(R.string.WRITE_REMINDER_LOG,
            R.bool.write_reminder_log_default);

    mDebugMenuItem.setVisible(dataUpdateLogEnabled || reminderLogEnabled);

    mSendDataUpdateLogItem.setEnabled(dataUpdateLogEnabled);
    mDeleteDataUpdateLogItem.setEnabled(dataUpdateLogEnabled);
    mSendReminderLogItem.setEnabled(reminderLogEnabled);
    mDeleteReminderLogItem.setEnabled(reminderLogEnabled);

    updateScrollMenu();

    mOptionsMenu = menu;

    updateSynchroMenu();

    return true;
}