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


Java ActionMode类代码示例

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


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

示例1: onPrepareActionMode

import android.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
    if(loaderId == INCOMPLETE_LOADER_ID || loaderId == EXPIRED_LOADER_ID){
        // remove edit action
        menu.removeItem(R.id.action_edit);
    }
    if (loaderId == DELETED_LOADER_ID){
        menu.removeItem(R.id.action_empty_bin);
    }
    return true;
}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:12,代码来源:ToduleListFragment.java

示例2: setChoiceMode

import android.view.ActionMode; //导入依赖的package包/类
@TargetApi(11)
public void setChoiceMode(int choiceMode) {
    this.mChoiceMode = choiceMode;
    if (VERSION.SDK_INT >= 11 && this.mChoiceActionMode != null) {
        if (VERSION.SDK_INT >= 11) {
            ((ActionMode) this.mChoiceActionMode).finish();
        }
        this.mChoiceActionMode = null;
    }
    if (this.mChoiceMode != 0) {
        if (this.mCheckStates == null) {
            this.mCheckStates = new SparseArrayCompat();
        }
        if (this.mCheckedIdStates == null && this.mAdapter != null && this.mAdapter.hasStableIds()) {
            this.mCheckedIdStates = new LongSparseArray();
        }
        if (VERSION.SDK_INT >= 11 && this.mChoiceMode == 3) {
            clearChoices();
            setLongClickable(true);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:23,代码来源:AbsHListView.java

示例3: 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;
}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:17,代码来源:ToduleListFragment.java

示例4: resolveActionMode

import android.view.ActionMode; //导入依赖的package包/类
/**
 * 处理item,处理点击
 * @param actionMode
 */
private ActionMode resolveActionMode(ActionMode actionMode) {
    if (actionMode != null) {
        final Menu menu = actionMode.getMenu();
        mActionMode = actionMode;
        menu.clear();
        for (int i = 0; i < mActionList.size(); i++) {
            menu.add(mActionList.get(i));
        }
        for (int i = 0; i < menu.size(); i++) {
            MenuItem menuItem = menu.getItem(i);
            menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    getSelectedData((String) item.getTitle());
                    releaseAction();
                    return true;
                }
            });
        }
    }
    mActionMode = actionMode;
    return actionMode;
}
 
开发者ID:CarGuo,项目名称:CustomActionWebView,代码行数:28,代码来源:CustomActionWebView.java

示例5: performLongPress

import android.view.ActionMode; //导入依赖的package包/类
boolean performLongPress(View child, int longPressPosition, long longPressId) {
    boolean z = true;
    if (VERSION.SDK_INT < 11 || this.mChoiceMode != 3) {
        z = false;
        if (this.mOnItemLongClickListener != null) {
            z = this.mOnItemLongClickListener.onItemLongClick(this, child, longPressPosition, longPressId);
        }
        if (!z) {
            this.mContextMenuInfo = createContextMenuInfo(child, longPressPosition, longPressId);
            z = super.showContextMenuForChild(this);
        }
        if (z) {
            performHapticFeedback(0);
        }
    } else if (this.mChoiceActionMode == null) {
        ActionMode startActionMode = startActionMode((MultiChoiceModeWrapper) this.mMultiChoiceModeCallback);
        this.mChoiceActionMode = startActionMode;
        if (startActionMode != null) {
            setItemChecked(longPressPosition, true);
            performHapticFeedback(0);
        }
    }
    return z;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:25,代码来源:AbsHListView.java

示例6: 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();
	}
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:27,代码来源:DirectoryFragment.java

示例7: onDestroyActionMode

import android.view.ActionMode; //导入依赖的package包/类
@Override
public void onDestroyActionMode(ActionMode mode) {
    actionMode = null;
    mSelectAll = null;
    mMarkAsRead = null;
    mMarkAsUnread = null;
    mFlag = null;
    mUnflag = null;
    setSelectionState(false);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:11,代码来源:MessageListFragment.java

示例8: onCreateActionMode

import android.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    MenuInflater inflater = mode.getMenuInflater();
    inflater.inflate(R.menu.message_list_context, menu);

    // check capabilities
    setContextCapabilities(account, menu);

    return true;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:11,代码来源:MessageListFragment.java

示例9: onActionModeStarted

import android.view.ActionMode; //导入依赖的package包/类
@Override
public void onActionModeStarted(ActionMode mode) {
    super.onActionModeStarted(mode);
    Window window = getWindow();
    // clear FLAG_TRANSLUCENT_STATUS flag:
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

    // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.setStatusBarColor(ContextCompat.getColor(this, R.color.colorAccentDark));
}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:12,代码来源:MainActivity.java

示例10: onDestroyActionMode

import android.view.ActionMode; //导入依赖的package包/类
@Override
public void onDestroyActionMode(ActionMode mode) {
	mWrapped.onDestroyActionMode(mode);
	mChoiceActionMode = null;

	// Ending selection mode means deselecting everything.
	clearChoices();
	updateOnScreenCheckedViews();

	// rememberSyncState();
	requestLayout();

	setLongClickable(true);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:FreeFlowContainer.java

示例11: onClick

import android.view.ActionMode; //导入依赖的package包/类
@Override
public void onClick(final View v) {

	final int position = mCurrentView.getPositionForView(v);
	if (position != ListView.INVALID_POSITION) {
		int count = mCurrentView.getCheckedItemCount();
		switch (v.getId()) {
		case android.R.id.icon:
			if (count == 0) {
				ActionMode mChoiceActionMode = null;
				if (mChoiceActionMode == null && (mChoiceActionMode = mCurrentView.startActionMode(mMultiListener)) != null) {
					mCurrentView.setItemChecked(position, true);
					mCurrentView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
				}
			} else {
				mCurrentView.setItemChecked(position, !mCurrentView.isItemChecked(position));
				mCurrentView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
			}
			break;

		case R.id.button_popup:
			v.post(new Runnable() {
				@Override
				public void run() {
					showPopupMenu(v, position);
				}
			});
			break;
		}
	}

}
 
开发者ID:gigabytedevelopers,项目名称:FireFiles,代码行数:33,代码来源:DirectoryFragment.java

示例12: onCreateActionMode

import android.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    URLogs.d("actionmode---" + (mode == null));
    mode.getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;
    //  return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:PullToRefreshActivity.java

示例13: onCreateActionMode

import android.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
	mActionMode = mode;
	MenuInflater inflater = mode.getMenuInflater();
	inflater.inflate(R.menu.menu_main, menu);
	return true;
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:8,代码来源:CustomWebView.java

示例14: confirmCheckedPositionsById

import android.view.ActionMode; //导入依赖的package包/类
void confirmCheckedPositionsById() {
    this.mCheckStates.clear();
    boolean checkedCountChanged = false;
    int checkedIndex = 0;
    while (checkedIndex < this.mCheckedIdStates.size()) {
        long id = this.mCheckedIdStates.keyAt(checkedIndex);
        int lastPos = ((Integer) this.mCheckedIdStates.valueAt(checkedIndex)).intValue();
        if (id != this.mAdapter.getItemId(lastPos)) {
            int start = Math.max(0, lastPos - 20);
            int end = Math.min(lastPos + 20, this.mItemCount);
            boolean found = false;
            for (int searchPos = start; searchPos < end; searchPos++) {
                if (id == this.mAdapter.getItemId(searchPos)) {
                    found = true;
                    this.mCheckStates.put(searchPos, Boolean.valueOf(true));
                    this.mCheckedIdStates.setValueAt(checkedIndex, Integer.valueOf(searchPos));
                    break;
                }
            }
            if (!found) {
                this.mCheckedIdStates.delete(id);
                checkedIndex--;
                this.mCheckedItemCount--;
                checkedCountChanged = true;
                if (!(VERSION.SDK_INT <= 11 || this.mChoiceActionMode == null || this.mMultiChoiceModeCallback == null)) {
                    ((MultiChoiceModeWrapper) this.mMultiChoiceModeCallback).onItemCheckedStateChanged((ActionMode) this.mChoiceActionMode, lastPos, id, false);
                }
            }
        } else {
            this.mCheckStates.put(lastPos, Boolean.valueOf(true));
        }
        checkedIndex++;
    }
    if (checkedCountChanged && this.mChoiceActionMode != null && VERSION.SDK_INT > 11) {
        ((ActionMode) this.mChoiceActionMode).invalidate();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:38,代码来源:AbsHListView.java

示例15: onCreateActionMode

import android.view.ActionMode; //导入依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
	TerminalTextViewOverlay.this.selectionActionMode = mode;

	menu.clear();

	menu.add(0, COPY, 0, R.string.console_menu_copy)
			.setIcon(R.drawable.ic_action_copy)
			.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_IF_ROOM);
	menu.add(0, PASTE, 1, R.string.console_menu_paste)
			.setIcon(R.drawable.ic_action_paste)
			.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_IF_ROOM);

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


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