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