當前位置: 首頁>>代碼示例>>Java>>正文


Java AppCompatActivity.startSupportActionMode方法代碼示例

本文整理匯總了Java中android.support.v7.app.AppCompatActivity.startSupportActionMode方法的典型用法代碼示例。如果您正苦於以下問題:Java AppCompatActivity.startSupportActionMode方法的具體用法?Java AppCompatActivity.startSupportActionMode怎麽用?Java AppCompatActivity.startSupportActionMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.app.AppCompatActivity的用法示例。


在下文中一共展示了AppCompatActivity.startSupportActionMode方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startActionMode

import android.support.v7.app.AppCompatActivity; //導入方法依賴的package包/類
@Nullable
@Override
public ActionMode startActionMode(@NonNull final ActionMode.Callback callback) {
    final FragmentActivity activity = mFragment.getActivity();
    if (activity instanceof AppCompatActivity) {
        final AppCompatActivity appCompatActivity = (AppCompatActivity) activity;
        return appCompatActivity.startSupportActionMode(callback);
    } else {
        throw new IllegalStateException("Your activity should extend AppCompatActivity.");
    }
}
 
開發者ID:GlobusLTD,項目名稱:recyclerview-android,代碼行數:12,代碼來源:ActionModeCompat.java

示例2: startActionMode

import android.support.v7.app.AppCompatActivity; //導入方法依賴的package包/類
public void startActionMode(AppCompatActivity activity, View actionModeOwner, FormulaChangeIf formulaChangeIf)
{
    this.actionModeOwner = actionModeOwner;
    this.formulaChangeIf = formulaChangeIf;

    ArrayList<View> list = null;
    if (this.actionModeOwner != null && this.actionModeOwner instanceof CustomEditText)
    {
        list = new ArrayList<View>();
        list.add(this.actionModeOwner);
    }

    this.formulaChangeIf.onTermSelection(this.actionModeOwner, true, list);
    if (isMenuEmpty())
    {
        this.formulaChangeIf.onObjectProperties(this.actionModeOwner);
        this.formulaChangeIf.onTermSelection(this.actionModeOwner, false, list);
        return;
    }
    actionMode = activity.startSupportActionMode(actionModeCallback);
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:22,代碼來源:ContextMenuHandler.java

示例3: onLongClick

import android.support.v7.app.AppCompatActivity; //導入方法依賴的package包/類
/**
 * Implements the basic behavior of a CAB and multi select behavior onLongClick.
 *
 * @param activity the current Activity
 * @param position the position of the clicked item
 * @return the initialized ActionMode or null if nothing was done
 * @since 5.0.0-b6
 */
@NonNull
public ActionMode onLongClick(AppCompatActivity activity, int position) {
	// Activate ActionMode
	if (mActionMode == null) {
		mActionMode = activity.startSupportActionMode(this);
	}
	// We have to select this on our own as we will consume the event
	toggleSelection(position);
	return mActionMode;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:ActionModeHelper.java

示例4: onLongClick

import android.support.v7.app.AppCompatActivity; //導入方法依賴的package包/類
/**
 * implements the basic behavior of a CAB and multi select behavior onLongClick
 *
 * @param act      the current Activity
 * @param position the position of the clicked item
 * @return the initialized ActionMode or null if nothing was done
 */
public ActionMode onLongClick(AppCompatActivity act, int position) {
    if (mActionMode == null && mFastAdapter.getItem(position).isSelectable()) {
        //may check if actionMode is already displayed
        mActionMode = act.startSupportActionMode(mInternalCallback);
        //we have to select this on our own as we will consume the event
        mFastAdapter.select(position);
        // update title
        checkActionMode(act, 1);
        //we consume this event so the normal onClick isn't called anymore
        return mActionMode;
    }
    return mActionMode;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:ActionModeHelper.java

示例5: checkActionMode

import android.support.v7.app.AppCompatActivity; //導入方法依賴的package包/類
private ActionMode checkActionMode(AppCompatActivity act, int selected) {
    if (selected == 0) {
        if (mActionMode != null) {
            mActionMode.finish();
            mActionMode = null;
        }
    } else if (mActionMode == null) {
        if (act != null) // without an activity, we cannot start the action mode
            mActionMode = act.startSupportActionMode(mInternalCallback);
    }
    updateTitle(selected);
    return mActionMode;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:ActionModeHelper.java

示例6: onLongClick

import android.support.v7.app.AppCompatActivity; //導入方法依賴的package包/類
@Override
public boolean onLongClick(View v) {
    AppCompatActivity activity = MainActivity.this;
    activity.startSupportActionMode(mDeleteMode);
    mMultiSelector.setSelected(this, true);
    return true;
}
 
開發者ID:attiqrehman1991,項目名稱:Task-Reminder,代碼行數:8,代碼來源:MainActivity.java


注:本文中的android.support.v7.app.AppCompatActivity.startSupportActionMode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。