當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。