Example usage for android.view ActionMode setTitle

List of usage examples for android.view ActionMode setTitle

Introduction

In this page you can find the example usage for android.view ActionMode setTitle.

Prototype

public abstract void setTitle(@StringRes int resId);

Source Link

Document

Set the title of the action mode.

Usage

From source file:com.btmura.android.reddit.app.CommentListFragment.java

@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
    int count = getListView().getCheckedItemCount();
    mode.setTitle(getResources().getQuantityString(R.plurals.comments, count, count));
    int position = Views.getCheckedPosition(getListView());
    controller.prepareActionMenu(menu, getListView(), position);
    return true;/*from  www . jav a 2  s .c om*/
}

From source file:com.btmura.android.reddit.app.MessageThreadListController.java

@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu, ListView listView) {
    int count = listView.getCheckedItemCount();
    int position = Views.getCheckedPosition(listView);

    mode.setTitle(context.getResources().getQuantityString(R.plurals.messages, count, count));
    prepareReplyActionItem(menu, count, position);
    prepareAuthorActionItem(menu, count, position);
    return true;/*from w  w  w.  j a v a 2s  .com*/
}

From source file:com.commonsware.cwac.masterdetail.MasterDetailController.java

void updateActionModeTitle(ActionMode mode) {
    mode.setTitle(getActionModeTitle());
    mode.setSubtitle(getActionModeSubtitle());
}

From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.FileActions.java

@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    mode.setTitle(createTitle());
    return true;
}

From source file:com.cummins.mowo.activity.swipelistview.SwipeListViewExampleActivity.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override//ww w  .  ja  va  2s .  co  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.swipe_list_view_activity);

    data = new ArrayList<PackageItem>();

    adapter = new PackageAdapter(this, data);

    swipeListView = (SwipeListView) findViewById(R.id.example_lv_list);

    if (Build.VERSION.SDK_INT >= 11) {
        swipeListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        swipeListView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {

            @Override
            public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
                mode.setTitle("Selected (" + swipeListView.getCountSelected() + ")");
            }

            @Override
            public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                int id = item.getItemId();
                if (id == R.id.menu_delete) {
                    swipeListView.dismissSelected();
                    return true;
                }
                return false;
            }

            @Override
            public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                MenuInflater inflater = mode.getMenuInflater();
                inflater.inflate(R.menu.menu_choice_items, menu);
                return true;
            }

            @Override
            public void onDestroyActionMode(ActionMode mode) {
                swipeListView.unselectedChoiceStates();
            }

            @Override
            public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                return false;
            }
        });
    }

    swipeListView.setSwipeListViewListener(new BaseSwipeListViewListener() {
        @Override
        public void onOpened(int position, boolean toRight) {
        }

        @Override
        public void onClosed(int position, boolean fromRight) {
        }

        @Override
        public void onListChanged() {
        }

        @Override
        public void onMove(int position, float x) {
        }

        @Override
        public void onStartOpen(int position, int action, boolean right) {
            Log.d("swipe", String.format("onStartOpen %d - action %d", position, action));
        }

        @Override
        public void onStartClose(int position, boolean right) {
            Log.d("swipe", String.format("onStartClose %d", position));
        }

        @Override
        public void onClickFrontView(int position) {
            Log.d("swipe", String.format("onClickFrontView %d", position));
        }

        @Override
        public void onClickBackView(int position) {
            Log.d("swipe", String.format("onClickBackView %d", position));
        }

        @Override
        public void onDismiss(int[] reverseSortedPositions) {
            for (int position : reverseSortedPositions) {
                data.remove(position);
            }
            adapter.notifyDataSetChanged();
        }

    });

    swipeListView.setAdapter(adapter);

    reload();

    new ListAppTask().execute();

    progressDialog = new ProgressDialog(this);
    progressDialog.setMessage(getString(R.string.loading));
    progressDialog.setCancelable(false);
    progressDialog.show();

}

From source file:com.fortysevendeg.android.swipelistview.sample.activities.SwipeListViewExampleActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.swipe_list_view_activity);

    data = new ArrayList<PackageItem>();

    adapter = new PackageAdapter(this, data);

    swipeListView = (SwipeListView) findViewById(R.id.example_lv_list);

    swipeListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        swipeListView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {

            @Override//  w ww  . j a v  a 2s.c  o  m
            public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
                mode.setTitle("Selected (" + swipeListView.getCountSelected() + ")");
            }

            @Override
            public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                switch (item.getItemId()) {
                case R.id.menu_delete:
                    swipeListView.dismissSelected();
                    mode.finish();
                    return true;
                default:
                    return false;
                }
            }

            @Override
            public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                MenuInflater inflater = mode.getMenuInflater();
                inflater.inflate(R.menu.menu_choice_items, menu);
                return true;
            }

            @Override
            public void onDestroyActionMode(ActionMode mode) {
                swipeListView.unselectedChoiceStates();
            }

            @Override
            public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                return false;
            }
        });
    }

    swipeListView.setSwipeListViewListener(new BaseSwipeListViewListener() {
        @Override
        public void onOpened(int position, boolean toRight) {
        }

        @Override
        public void onClosed(int position, boolean fromRight) {
        }

        @Override
        public void onListChanged() {
        }

        @Override
        public void onMove(int position, float x) {
        }

        @Override
        public void onStartOpen(int position, int action, boolean right) {
            Log.d("swipe", String.format("onStartOpen %d - action %d", position, action));
        }

        @Override
        public void onStartClose(int position, boolean right) {
            Log.d("swipe", String.format("onStartClose %d", position));
        }

        @Override
        public void onClickFrontView(int position) {
            Log.d("swipe", String.format("onClickFrontView %d", position));
        }

        @Override
        public void onClickBackView(int position) {
            Log.d("swipe", String.format("onClickBackView %d", position));
        }

        @Override
        public void onDismiss(int[] reverseSortedPositions) {
            for (int position : reverseSortedPositions) {
                data.remove(position);
            }
            adapter.notifyDataSetChanged();
        }

    });

    swipeListView.setAdapter(adapter);

    reload();

    new ListAppTask().execute();

    progressDialog = new ProgressDialog(this);
    progressDialog.setMessage(getString(R.string.loading));
    progressDialog.setCancelable(false);
    progressDialog.show();

}

From source file:com.parking.swipelistview.sample.activities.SwipeListViewExampleActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.swipe_list_view_activity);
    ctx = SwipeListViewExampleActivity.this;
    data = new ArrayList<MallItem>();

    adapter = new MallAdapter(this, data);

    swipeListView = (SwipeListView) findViewById(R.id.example_lv_list);

    swipeListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        swipeListView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {

            @Override//from ww w . j  av a  2 s  .co m
            public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
                mode.setTitle("Selected (" + swipeListView.getCountSelected() + ")");
            }

            @Override
            public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                switch (item.getItemId()) {
                case R.id.menu_delete:
                    swipeListView.dismissSelected();
                    mode.finish();
                    return true;
                default:
                    return false;
                }
            }

            @Override
            public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                MenuInflater inflater = mode.getMenuInflater();
                inflater.inflate(R.menu.menu_choice_items, menu);
                return true;
            }

            @Override
            public void onDestroyActionMode(ActionMode mode) {
                swipeListView.unselectedChoiceStates();
            }

            @Override
            public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                return false;
            }
        });
    }

    swipeListView.setSwipeListViewListener(new BaseSwipeListViewListener() {
        @Override
        public void onOpened(int position, boolean toRight) {
        }

        @Override
        public void onClosed(int position, boolean fromRight) {
        }

        @Override
        public void onListChanged() {
        }

        @Override
        public void onMove(int position, float x) {
        }

        @Override
        public void onStartOpen(int position, int action, boolean right) {
            Log.d("swipe", String.format("onStartOpen %d - action %d", position, action));
        }

        @Override
        public void onStartClose(int position, boolean right) {
            Log.d("swipe", String.format("onStartClose %d", position));
        }

        @Override
        public void onClickFrontView(int position) {
            Log.d("swipe", String.format("onClickFrontView %d", position));
        }

        @Override
        public void onClickBackView(int position) {
            Log.d("swipe", String.format("onClickBackView %d", position));
        }

        @Override
        public void onDismiss(int[] reverseSortedPositions) {
            for (int position : reverseSortedPositions) {
                data.remove(position);
            }
            adapter.notifyDataSetChanged();
        }

    });

    swipeListView.setAdapter(adapter);

    reload();

    new ListAppTask().execute();

    progressDialog = new ProgressDialog(this);
    progressDialog.setMessage(getString(R.string.loading));
    progressDialog.setCancelable(false);
    progressDialog.show();

}

From source file:net.lp.actionbarpoirot.helpers.FragmentHelperHoneycomb.java

/**
 * Change the CAB title./*from  w w  w. j a v  a2 s.  c  om*/
 * 
 * @param mode
 */
protected void changeTitle(ActionMode mode) {
    int numSelected = mSelectedPositionsUris.size();
    mode.setTitle(mActionModeUser.getContextualActionBarTitle(numSelected));
}

From source file:de.vanita5.twittnuker.fragment.BaseFiltersFragment.java

private void updateTitle(final ActionMode mode) {
    if (mListView == null || mode == null || getActivity() == null)
        return;//from  w w w .  ja v  a 2 s  .  c  o m
    final int count = mListView.getCheckedItemCount();
    mode.setTitle(getResources().getQuantityString(R.plurals.Nitems_selected, count, count));
}

From source file:de.vanita5.twittnuker.activity.support.DraftsActivity.java

private void updateTitle(final ActionMode mode) {
    if (mListView == null || mode == null)
        return;/*  w  w  w. j a va  2s  .  co m*/
    final int count = mListView.getCheckedItemCount();
    mode.setTitle(getResources().getQuantityString(R.plurals.Nitems_selected, count, count));
}