当前位置: 首页>>代码示例>>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;未经允许,请勿转载。