Search in sources :

Example 1 with SearchActionModeCallback

use of org.wikipedia.history.SearchActionModeCallback in project apps-android-wikipedia by wikimedia.

the class ReadingListsFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_search_lists:
            ((AppCompatActivity) requireActivity()).startSupportActionMode(searchActionModeCallback);
            return true;
        case R.id.menu_sort:
            bottomSheetPresenter.show(getChildFragmentManager(), SortReadingListsDialog.newInstance(Prefs.getReadingListSortMode(ReadingList.SORT_BY_NAME_ASC)));
            return true;
        case R.id.create_list:
            String title = getString(R.string.reading_list_name_sample);
            List<String> existingTitles = new ArrayList<>();
            for (ReadingList tempList : readingLists) {
                existingTitles.add(tempList.title());
            }
            ReadingListTitleDialog.readingListTitleDialog(requireContext(), title, "", existingTitles, (text, description) -> {
                ReadingListDbHelper.instance().createList(text, description);
                updateLists();
            }).show();
            return true;
        case R.id.refresh:
            refreshSync();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
Also used : SearchActionModeCallback(org.wikipedia.history.SearchActionModeCallback) Bundle(android.os.Bundle) ReadingListsFunnel(org.wikipedia.analytics.ReadingListsFunnel) DrawableItemDecoration(org.wikipedia.views.DrawableItemDecoration) ImageView(android.widget.ImageView) CallbackTask(org.wikipedia.concurrency.CallbackTask) ReadingList(org.wikipedia.readinglist.database.ReadingList) ReadingListPage(org.wikipedia.readinglist.database.ReadingListPage) StringUtils(org.apache.commons.lang3.StringUtils) BindView(butterknife.BindView) LayoutTransition(android.animation.LayoutTransition) StringUtil(org.wikipedia.util.StringUtil) View(android.view.View) ResourceUtil.getThemedAttributeId(org.wikipedia.util.ResourceUtil.getThemedAttributeId) Constants(org.wikipedia.Constants) SearchEmptyView(org.wikipedia.views.SearchEmptyView) Unbinder(butterknife.Unbinder) ActionMode(android.support.v7.view.ActionMode) Fragment(android.support.v4.app.Fragment) ContextCompat(android.support.v4.content.ContextCompat) AppCompatActivity(android.support.v7.app.AppCompatActivity) ViewGroup(android.view.ViewGroup) List(java.util.List) TextView(android.widget.TextView) L(org.wikipedia.util.log.L) Nullable(android.support.annotation.Nullable) Snackbar(android.support.design.widget.Snackbar) ReadingListSyncEvent(org.wikipedia.readinglist.sync.ReadingListSyncEvent) ButterKnife(butterknife.ButterKnife) NonNull(android.support.annotation.NonNull) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) ReadingListDbHelper(org.wikipedia.readinglist.database.ReadingListDbHelper) MenuInflater(android.view.MenuInflater) WikipediaApp(org.wikipedia.WikipediaApp) Menu(android.view.Menu) ReadingListSyncAdapter(org.wikipedia.readinglist.sync.ReadingListSyncAdapter) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) AccountUtil(org.wikipedia.auth.AccountUtil) R(org.wikipedia.R) LayoutInflater(android.view.LayoutInflater) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) TextUtils(android.text.TextUtils) ExclusiveBottomSheetPresenter(org.wikipedia.page.ExclusiveBottomSheetPresenter) Subscribe(com.squareup.otto.Subscribe) Prefs(org.wikipedia.settings.Prefs) RecyclerView(android.support.v7.widget.RecyclerView) OnboardingView(org.wikipedia.onboarding.OnboardingView) AlertDialog(android.support.v7.app.AlertDialog) FeedFragment(org.wikipedia.feed.FeedFragment) FeedbackUtil(org.wikipedia.util.FeedbackUtil) ViewUtil(org.wikipedia.views.ViewUtil) AppCompatActivity(android.support.v7.app.AppCompatActivity) ArrayList(java.util.ArrayList) ReadingList(org.wikipedia.readinglist.database.ReadingList)

Aggregations

LayoutTransition (android.animation.LayoutTransition)1 Bundle (android.os.Bundle)1 NonNull (android.support.annotation.NonNull)1 Nullable (android.support.annotation.Nullable)1 Snackbar (android.support.design.widget.Snackbar)1 Fragment (android.support.v4.app.Fragment)1 ContextCompat (android.support.v4.content.ContextCompat)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 AlertDialog (android.support.v7.app.AlertDialog)1 AppCompatActivity (android.support.v7.app.AppCompatActivity)1 ActionMode (android.support.v7.view.ActionMode)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 TextUtils (android.text.TextUtils)1 LayoutInflater (android.view.LayoutInflater)1 Menu (android.view.Menu)1 MenuInflater (android.view.MenuInflater)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1