Java Code Examples for android.view.ActionMode#setSubtitle()

The following examples show how to use android.view.ActionMode#setSubtitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FloatingPastePopupMenu.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void createPasteMenu(ActionMode mode, Menu menu) {
    mode.setTitle(DeviceFormFactor.isTablet()
                    ? mContext.getString(R.string.actionbar_textselection_title)
                    : null);
    mode.setSubtitle(null);
    SelectionPopupController.initializeMenu(mContext, mode, menu);
    if (!mDelegate.canPaste()) menu.removeItem(R.id.select_action_menu_paste);
    if (!mDelegate.canSelectAll()) menu.removeItem(R.id.select_action_menu_select_all);
    if (!mDelegate.canPasteAsPlainText()) {
        menu.removeItem(R.id.select_action_menu_paste_as_plain_text);
    }
    // TODO(ctzsm): Remove runtime title set after O SDK rolls.
    MenuItem item = menu.findItem(R.id.select_action_menu_paste_as_plain_text);
    if (item != null) {
        item.setTitle(mContext.getResources().getIdentifier(
                "paste_as_plain_text", "string", "android"));
    }
    menu.removeItem(R.id.select_action_menu_cut);
    menu.removeItem(R.id.select_action_menu_copy);
    menu.removeItem(R.id.select_action_menu_share);
    menu.removeItem(R.id.select_action_menu_web_search);
}
 
Example 2
Source File: NotesFragment.java    From writeily-pro with MIT License 6 votes vote down vote up
@Override
public void onItemCheckedStateChanged(ActionMode actionMode, int i, long l, boolean checked) {

    switch (filesListView.getCheckedItemCount()) {
        case 0:
            actionMode.setSubtitle(null);
            hideRenameButton(actionMode);
            break;
        case 1:
            actionMode.setSubtitle(getResources().getString(R.string.one_item_selected));
            manageClickedVIew(i, checked);
            showRenameButton(actionMode);
            break;
        default:
            manageClickedVIew(i, checked);
            actionMode.setSubtitle(String.format(getResources().getString(R.string.more_items_selected), filesListView.getCheckedItemCount()));
            hideRenameButton(actionMode);
            break;
    }
}
 
Example 3
Source File: ListViewMultiChoiceModeListener.java    From android-kernel-tweaker with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
	MenuInflater inflater=host.getMenuInflater();
	inflater.inflate(R.menu.main, menu);
	mDelete = (MenuItem) menu.findItem(R.id.action_delete);
	mAdd = (MenuItem) menu.findItem(R.id.action_add);

	if(delete) {
		mode.setTitle("Delete items");
		mAdd.setVisible(false);
	}else {
		mDelete.setVisible(false);
		mode.setTitle("Add on boot");
	}
	mode.setSubtitle("1 Item Selected");
	activeMode=mode;

	return(true);
}
 
Example 4
Source File: SandBoxActivity.java    From ToDay with MIT License 5 votes vote down vote up
@Override
public boolean createActionMenu(ActionMode mode, Menu menu) {
    getMenuInflater().inflate(R.menu.menu_gridview_context,menu);
    mode.setTitle("Select Items");
    mode.setSubtitle("One item selected");
    getSupportActionBar().hide();
    return true;
}
 
Example 5
Source File: PlaylistFragment.java    From BeyondUPnP with Apache License 2.0 5 votes vote down vote up
private void setSubtitle(ActionMode mode) {
    final int checkedCount = mListView.getCheckedItemCount();
    switch (checkedCount) {
        case 0:
            mode.setSubtitle(null);
            break;
        case 1:
            mode.setSubtitle("One item selected");
            break;
        default:
            mode.setSubtitle("" + checkedCount + " items selected");
            break;
    }
}
 
Example 6
Source File: SelectionPopupController.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreateActionMode(ActionMode mode, Menu menu) {
    mode.setTitle(DeviceFormFactor.isTablet()
                    ? mContext.getString(R.string.actionbar_textselection_title)
                    : null);
    mode.setSubtitle(null);
    createActionMenu(mode, menu);
}
 
Example 7
Source File: EditFragment.java    From android-sholi with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
    int count = getListView().getCheckedItemCount();
    switch (count) {
        case 0:
            mode.setSubtitle(null);
            break;
        default:
            mode.setSubtitle(getResources().getQuantityString(
                    R.plurals.selectedItems, count, count));
            break;
    }
}
 
Example 8
Source File: Grid3.java    From codeexamples-android with Eclipse Public License 1.0 5 votes vote down vote up
public void onItemCheckedStateChanged(ActionMode mode, int position, long id,
        boolean checked) {
    int selectCount = mGrid.getCheckedItemCount();
    switch (selectCount) {
    case 1:
        mode.setSubtitle("One item selected");
        break;
    default:
        mode.setSubtitle("" + selectCount + " items selected");
        break;
    }
}
 
Example 9
Source File: List16.java    From codeexamples-android with Eclipse Public License 1.0 5 votes vote down vote up
public void onItemCheckedStateChanged(ActionMode mode,
        int position, long id, boolean checked) {
    final int checkedCount = getListView().getCheckedItemCount();
    switch (checkedCount) {
        case 0:
            mode.setSubtitle(null);
            break;
        case 1:
            mode.setSubtitle("One item selected");
            break;
        default:
            mode.setSubtitle("" + checkedCount + " items selected");
            break;
    }
}
 
Example 10
Source File: List15.java    From codeexamples-android with Eclipse Public License 1.0 5 votes vote down vote up
private void setSubtitle(ActionMode mode) {
    final int checkedCount = getListView().getCheckedItemCount();
    switch (checkedCount) {
        case 0:
            mode.setSubtitle(null);
            break;
        case 1:
            mode.setSubtitle("One item selected");
            break;
        default:
            mode.setSubtitle("" + checkedCount + " items selected");
            break;
    }
}
 
Example 11
Source File: SelectActionModeCallback.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    mode.setTitle(null);
    mode.setSubtitle(null);
    mEditable = mActionHandler.isSelectionEditable();
    createActionMenu(mode, menu);
    return true;
}
 
Example 12
Source File: SelectActionModeCallback.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    mode.setTitle(null);
    mode.setSubtitle(null);
    mEditable = mActionHandler.isSelectionEditable();
    createActionMenu(mode, menu);
    return true;
}
 
Example 13
Source File: MainActivity.java    From Android-Material-Icons with Apache License 2.0 4 votes vote down vote up
private void checkActionMode(ActionMode actionMode, Menu menu) {
    boolean exportAllowed = mAdapter.getSelectedItemsCount() != 0;
    menu.findItem(R.id.action_export).setEnabled(exportAllowed);
    actionMode.setSubtitle(mAdapter.getSelectedItemsCount() + " " + getString(R.string.action_item_selected));
}
 
Example 14
Source File: ListViewMultiChoiceModeListener.java    From android-kernel-tweaker with GNU General Public License v3.0 4 votes vote down vote up
private void updateSubtitle(ActionMode mode) {
	mode.setSubtitle( lv.getCheckedItemCount() + " Items selected");
}
 
Example 15
Source File: Grid3.java    From codeexamples-android with Eclipse Public License 1.0 4 votes vote down vote up
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    mode.setTitle("Select Items");
    mode.setSubtitle("One item selected");
    return true;
}
 
Example 16
Source File: SandBoxActivity.java    From ToDay with MIT License 3 votes vote down vote up
@Override
public void updateActionMenuCheckState(ActionMode mode) {
    int selectCount = elementGridView.getCheckedItemCount();

    mode.setSubtitle("" + selectCount + " item(s) selected");

}