本文整理汇总了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.");
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}