本文整理汇总了Java中android.view.ActionMode.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java ActionMode.setTitle方法的具体用法?Java ActionMode.setTitle怎么用?Java ActionMode.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.ActionMode
的用法示例。
在下文中一共展示了ActionMode.setTitle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemCheckedStateChanged
import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
if (checked) {
// Directories and footer items cannot be checked
boolean valid = false;
final Cursor cursor = mAdapter.getItem(position);
if (cursor != null) {
final String docMimeType = getCursorString(cursor, Document.COLUMN_MIME_TYPE);
final int docFlags = getCursorInt(cursor, Document.COLUMN_FLAGS);
// if (!Document.MIME_TYPE_DIR.equals(docMimeType)) {
valid = isDocumentEnabled(docMimeType, docFlags);
// }
}
if (!valid) {
mCurrentView.setItemChecked(position, false);
}
}
int count = mCurrentView.getCheckedItemCount();
mode.setTitle(getResources().getString(R.string.mode_selected_count, count));
if (count == 1 || count == 2) {
mode.invalidate();
}
}
示例2: onCreateActionMode
import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
MenuInflater inflater = actionMode.getMenuInflater();
inflater.inflate(getMenuRes(loaderId), menu);
// Show checkboxes
if(mAdapter instanceof HistoryAdapter){
((HistoryAdapter) mAdapter).setShowCheckbox(true);
} else if (mAdapter instanceof MainCursorAdapter){
((MainCursorAdapter) mAdapter).setShowCheckbox(true);
}
actionMode.setTitle(selectedIds.size() + " selected");
mActionMode = actionMode;
return true;
}
示例3: onPrepareActionMode
import android.view.ActionMode; //导入方法依赖的package包/类
/**
* Called each time the action mode is shown. Always called after onCreateActionMode,
* but may be called multiple times if the mode is invalidated.
*/
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
int childCount = mWallpapersView.getChildCount();
int numCheckedItems = 0;
for (int i = 0; i < childCount; i++) {
CheckableFrameLayout c = (CheckableFrameLayout) mWallpapersView.getChildAt(i);
if (c.isChecked()) {
numCheckedItems++;
}
}
if (numCheckedItems == 0) {
mode.finish();
return true;
} else {
mode.setTitle(getResources().getQuantityString(
R.plurals.number_of_items_selected, numCheckedItems, numCheckedItems));
return true;
}
}
示例4: updateActionModeTitle
import android.view.ActionMode; //导入方法依赖的package包/类
public static void updateActionModeTitle(ActionMode mode, Context context, int selectedNum)
{
if (mode != null)
{
mode.setTitle(context.getString(R.string.app_id, selectedNum));
if (selectedNum == 0)
{
mode.finish();
}
}
}
示例5: setSubtitle
import android.view.ActionMode; //导入方法依赖的package包/类
private void setSubtitle(ActionMode mode, int selectedCount) {
switch (selectedCount) {
case 0:
mode.setSubtitle(null);
break;
default:
mode.setTitle(SimpleNotesApplication.getResourceStringNotesSelectedNumber() + String.valueOf(selectedCount));
break;
}
}
示例6: onCreateActionMode
import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
inflater.inflate(R.menu.filesystem__context_menu, menu);
mode.setTitle(getResources().getString(R.string.select_elements));
return true;
}
示例7: onItemCheckedStateChanged
import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public void onItemCheckedStateChanged(ActionMode actionMode, int i, long l, boolean b) {
if(b){
selectedIds.put(l, b);
} else {
selectedIds.remove(l);
}
actionMode.setTitle(selectedIds.size() + " selected");
}
示例8: onCreateActionMode
import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
MenuInflater inflater = actionMode.getMenuInflater();
inflater.inflate(R.menu.menu_action_mode_label, menu);
lAdapter.setShowCheckbox(true);
actionMode.setTitle(selectedIds.size() + " selected");
return true;
}
示例9: onActionModeStarted
import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public void onActionModeStarted(ActionMode mode) {
if (mActionMode == null) {
mActionMode = mode;
Menu menu = mode.getMenu();
menu.clear();
if (!shouldDisplayFloatingSelectionMenu()) {
MenuInflater inflater = new MenuInflater(this);
inflater.inflate(R.menu.text_selection_context_menu, menu);
mode.setTitle(null);
menu.findItem(R.id.action_copy_text).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.findItem(R.id.action_select_all_text).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.findItem(R.id.action_add_comment).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.findItem(R.id.action_share_text).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.findItem(R.id.action_add_highlight).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
if (mHighlightClickedFlag) {
menu.findItem(R.id.action_add_comment).setVisible(true);
menu.findItem(R.id.highlight_remove).setVisible(true);
}
}
}
super.onActionModeStarted(mode);
for (ActionModeChangeListener actionModeChangeListener : mActionModeChangeListener) {
actionModeChangeListener.actionModeStarted();
}
}
示例10: onCreateActionMode
import android.view.ActionMode; //导入方法依赖的package包/类
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
actionMode.setTitle(R.string.photo_selection_cab_title);
MenuInflater inflater = getActivity().getMenuInflater();
inflater.inflate(R.menu.photo_context_menu, menu);
return true;
}
示例11: onCreateActionMode
import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
editMode = root != null && root.isEditSupported();
int menuId = R.menu.mode_simple_directory;
if (null != root && root.isApp()) {
menuId = R.menu.mode_apps;
} else {
menuId = R.menu.mode_directory;
}
mode.getMenuInflater().inflate(menuId, menu);
int count = mCurrentView.getCheckedItemCount();
mode.setTitle(count+"");
return true;
}