当前位置: 首页>>代码示例>>Java>>正文


Java ActionMode.finish方法代码示例

本文整理汇总了Java中android.view.ActionMode.finish方法的典型用法代码示例。如果您正苦于以下问题:Java ActionMode.finish方法的具体用法?Java ActionMode.finish怎么用?Java ActionMode.finish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.ActionMode的用法示例。


在下文中一共展示了ActionMode.finish方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:25,代码来源:WallpaperPickerActivity.java

示例2: onItemCheckedStateChanged

import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public void onItemCheckedStateChanged(ActionMode mode, int section,
		int position, long id, boolean checked) {
	mWrapped.onItemCheckedStateChanged(mode, section, position, id,
			checked);

	// If there are no items selected we no longer need the selection
	// mode.
	if (getCheckedItemCount() == 0) {
		mode.finish();
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:FreeFlowContainer.java

示例3: onActionItemClicked

import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
	switch (item.getItemId()) {
	case COPY:
		copyCurrentSelectionToClipboard();
		return true;
	case PASTE:
		pasteClipboard();
		mode.finish();
		return true;
	}

	return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:TerminalTextViewOverlay.java

示例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();
  }
}
 }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:12,代码来源:Util.java

示例5: onActionItemClicked

import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
    SparseBooleanArray sparseBooleanArray = listView.getCheckedItemPositions();
    switch (menuItem.getItemId()) {
        case R.id.delete_all_action:
            //SparseBooleanArray sparseBooleanArray = listView.getCheckedItemPositions();
            // Перебираем с конца, чтобы не нарушать порядок нумерации в списке
            for (int i = (sparseBooleanArray.size() - 1); i >= 0; i--) {
                if (sparseBooleanArray.valueAt(i)) {
                    parentActivity.notes.remove(sparseBooleanArray.keyAt(i));
                }
            }
            actionMode.finish();
            parentActivity.adapter.notifyDataSetChanged();
            parentActivity.listView.smoothScrollToPosition(0);
            Toast.makeText(parentActivity, R.string.deleted_successfully_toast, Toast.LENGTH_LONG).show();
            return true;
        case R.id.copy_all_action:
            StringBuilder textToCopy = new StringBuilder("");
            String label = "Notes text";
            for (int i = 0; i < sparseBooleanArray.size(); i++) {
                if (sparseBooleanArray.valueAt(i)) {
                    textToCopy.append(parentActivity.notes.get(sparseBooleanArray.keyAt(i)).getText());
                    textToCopy.append("\n");
                }
            }
            ClipboardManager clipboard = (ClipboardManager) parentActivity.getSystemService(CLIPBOARD_SERVICE);
            ClipData clip = ClipData.newPlainText(label, textToCopy.toString());
            clipboard.setPrimaryClip(clip);
            actionMode.finish();
            Toast.makeText(parentActivity, R.string.copied_to_clipboard_toast, Toast.LENGTH_LONG).show();
            return true;
        default:
            return false;
    }
}
 
开发者ID:coffeeplanter,项目名称:SimpleNotes,代码行数:37,代码来源:MultiChoiceImplementation.java

示例6: onActionItemClicked

import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_delete_line:
            mEditor.deleteLine();
            return true;
        case R.id.action_copy_line:
            mEditor.copyLine();
            mode.finish();
            return true;
    }
    return mCallback.onActionItemClicked(mode, item);
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:14,代码来源:EditorActionModeCallback.java

示例7: onActionItemClicked

import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_item_one:
            mode.finish(); // Action picked, so close the CAB
            return true;
        default:
            return false;
    }
}
 
开发者ID:smashingboxes,项目名称:android-analytics,代码行数:11,代码来源:MainFragment.java

示例8: onActionItemClicked

import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
    switch(menuItem.getItemId()){
        case R.id.action_delete:
            deleteSelectedLabels();
            actionMode.finish();
            return true;
    }
    return false;
}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:11,代码来源:ToduleLabelFragment.java

示例9: onActionItemClicked

import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
    switch (menuItem.getItemId()) {
        case R.id.action_soft_delete:
            softDeleteSelectedItems();
            actionMode.finish(); // Action picked, so close the CAB
            return true;
        case R.id.action_archive:
            archiveSelectedItems();
            actionMode.finish();
            return true;
        case R.id.action_unarchive:
            unarchiveSelectedItems();
            actionMode.finish();
            return true;
        case R.id.action_restore:
            restoreSelectedItems();
            actionMode.finish();
            return true;
        case R.id.action_delete_forever:
            deleteSelectedItems();
            actionMode.finish();
            return true;
        default:
            return false;
    }
}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:28,代码来源:ToduleListFragment.java

示例10: onItemCheckedStateChanged

import android.view.ActionMode; //导入方法依赖的package包/类
@TargetApi( Build.VERSION_CODES.HONEYCOMB )
@Override
public void onItemCheckedStateChanged( ActionMode mode, int position, long id, boolean checked ) {
	mWrapped.onItemCheckedStateChanged( mode, position, id, checked );
	
	// If there are no items selected we no longer need the selection mode.
	if ( mView.getCheckedItemCount() == 0 ) {
		mode.finish();
	}
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:11,代码来源:MultiChoiceModeWrapper.java

示例11: onActionItemClicked

import android.view.ActionMode; //导入方法依赖的package包/类
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
    switch (menuItem.getItemId()) {
        case R.id.menu_share:
            shareCurrentPhoto();
            actionMode.finish();
            return true;
    }
    return false;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:10,代码来源:ContentFragment.java

示例12: onActionItemClicked

import android.view.ActionMode; //导入方法依赖的package包/类
/**
 * Called when the user selects a contextual menu item
 */
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    int itemId = item.getItemId();
    if (itemId == R.id.menu_delete) {
        int childCount = mWallpapersView.getChildCount();
        ArrayList<View> viewsToRemove = new ArrayList<>();
        boolean selectedTileRemoved = false;
        for (int i = 0; i < childCount; i++) {
            CheckableFrameLayout c =
                    (CheckableFrameLayout) mWallpapersView.getChildAt(i);
            if (c.isChecked()) {
                WallpaperTileInfo info = (WallpaperTileInfo) c.getTag();
                info.onDelete(WallpaperPickerActivity.this);
                viewsToRemove.add(c);
                if (i == mSelectedIndex) {
                    selectedTileRemoved = true;
                }
            }
        }
        for (View v : viewsToRemove) {
            mWallpapersView.removeView(v);
        }
        if (selectedTileRemoved) {
            mSelectedIndex = -1;
            mSelectedTile = null;
            setSystemWallpaperVisiblity(true);
        }
        updateTileIndices();
        mode.finish(); // Action picked, so close the CAB
        return true;
    } else {
        return false;
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:38,代码来源:WallpaperPickerActivity.java

示例13: onActionItemClicked

import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
	mode.finish();
	return false;

}
 
开发者ID:NewCasino,项目名称:browser,代码行数:7,代码来源:CustomWebView.java

示例14: onActionItemClicked

import android.view.ActionMode; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
	final SparseBooleanArray checked = mCurrentView.getCheckedItemPositions();
	final ArrayList<DocumentInfo> docs = new ArrayList<>();
	final int size = checked.size();
	for (int i = 0; i < size; i++) {
		if (checked.valueAt(i)) {
			final Cursor cursor = mAdapter.getItem(checked.keyAt(i));
                  if(null != cursor) {
                      final DocumentInfo doc = DocumentInfo.fromDirectoryCursor(cursor);
                      docs.add(doc);
                  }
		}
	}
          if(docs.isEmpty()){
              return false;
          }
	final int id = item.getItemId();
	switch (id) {
	case R.id.menu_open:
		BaseActivity.get(DirectoryFragment.this).onDocumentsPicked(docs);
		mode.finish();
		return true;

	case R.id.menu_share:
		onShareDocuments(docs);
		mode.finish();
		return true;

	case R.id.menu_copy:
		moveDocument(docs, false);
		mode.finish();
		return true;

	case R.id.menu_cut:
		moveDocument(docs, true);
		mode.finish();
		return true;

	case R.id.menu_delete:
		deleteDocument(docs, id);
		mode.finish();
		return true;

	case R.id.menu_stop:
		stopDocument(docs, id);
		mode.finish();
		return true;
	case R.id.menu_save:
          case R.id.menu_compress:
		new OperationTask(docs, id).execute();
		mode.finish();
		return true;

	case R.id.menu_select_all:
		int count = mAdapter.getCount();
		for (int i = 0; i < count; i++) {
			mCurrentView.setItemChecked(i, selectAll);
		}
		selectAll = !selectAll;
		Bundle params = new Bundle();
		params.putInt(FILE_COUNT, count);
		AnalyticsManager.logEvent("select", params);
		return true;

	case R.id.menu_info:
		infoDocument(docs.get(0));
		mode.finish();
		return true;

	case R.id.menu_rename:
		renameDocument(docs.get(0));
		mode.finish();
		return true;

	default:
		return false;
	}
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:80,代码来源:DirectoryFragment.java

示例15: onActionItemClicked

import android.view.ActionMode; //导入方法依赖的package包/类
/**
 * Called to report a user click on an action button.
 *
 * @param mode The current ActionMode
 * @param item The item that was clicked
 * @return true if this callback handled the event, false if the standard MenuItem
 * invocation should continue.
 */
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    int start = getSelectionStart();
    int end = getSelectionEnd(item.getItemId());
    switch (item.getItemId()) {
        case R.id.menu_bold:
            getText().insert(start, MD_BOLD);
            getText().insert(end, MD_BOLD, 0, MD_BOLD.length());
            mode.finish();
            return true;
        case R.id.menu_italic:
            getText().insert(start, MD_ITALIC);
            getText().insert(end, MD_ITALIC, 0, MD_ITALIC.length());
            mode.finish();
            return true;
        case R.id.menu_strike:
            getText().insert(start, MD_STRIKE);
            getText().insert(end, MD_STRIKE, 0, MD_STRIKE.length());
            mode.finish();
            return true;
        case R.id.menu_list:
            getText().insert(start, MD_NUMBER);
            mode.finish();
            return true;
        case R.id.menu_bullet:
            getText().insert(start, MD_BULLET);
            mode.finish();
            return true;
        case R.id.menu_heading:
            getText().insert(start, MD_HEADING);
            mode.finish();
            return true;
        case R.id.menu_center:
            getText().insert(start, MD_CENTER_ALIGN);
            getText().insert(end, MD_CENTER_ALIGN, 0, MD_CENTER_ALIGN.length());
            mode.finish();
            return true;
        case R.id.menu_quote:
            getText().insert(start, MD_QUOTE);
            mode.finish();
            return true;
        case R.id.menu_code:
            getText().insert(start, MD_CODE);
            getText().insert(end, MD_CODE, 0, MD_CODE.length());
            mode.finish();
            return true;
    }
    return false;
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:58,代码来源:MarkdownInputEditor.java


注:本文中的android.view.ActionMode.finish方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。