本文整理匯總了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;
}