本文整理匯總了Java中com.actionbarsherlock.view.ActionMode類的典型用法代碼示例。如果您正苦於以下問題:Java ActionMode類的具體用法?Java ActionMode怎麽用?Java ActionMode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ActionMode類屬於com.actionbarsherlock.view包,在下文中一共展示了ActionMode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
public ActionMode startActionMode(ActionMode.Callback callback) {
boolean wasHidden = false;
if (mActionMode != null) {
wasHidden = mWasHiddenBeforeMode;
mActionMode.finish();
}
mContextView.killMode();
ActionModeImpl mode = new ActionModeImpl(callback);
if (mode.dispatchOnCreate()) {
mWasHiddenBeforeMode = !isShowing() || wasHidden;
mode.invalidate();
mContextView.initForMode(mode);
animateToMode(true);
if (mSplitView != null && mContextDisplayMode == CONTEXT_DISPLAY_SPLIT) {
// TODO animate this
mSplitView.setVisibility(View.VISIBLE);
}
mContextView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
mActionMode = mode;
return mode;
}
return null;
}
示例2: startActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
@Override
public ActionMode startActionMode(ActionMode.Callback callback) {
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[startActionMode] callback: " + callback);
if (mActionMode != null) {
mActionMode.finish();
}
ActionModeCallbackWrapper wrapped = null;
if (callback != null) {
wrapped = new ActionModeCallbackWrapper(callback);
}
//Calling this will trigger the callback wrapper's onCreate which
//is where we will set the new instance to mActionMode since we need
//to pass it through to the sherlock callbacks and the call below
//will not have returned yet to store its value.
if (mActivity.startActionMode(wrapped) == null) {
mActionMode = null;
}
if (mActivity instanceof OnActionModeStartedListener && mActionMode != null) {
((OnActionModeStartedListener)mActivity).onActionModeStarted(mActionMode);
}
return mActionMode;
}
示例3: startActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
@Override
public ActionMode startActionMode(com.actionbarsherlock.view.ActionMode.Callback callback) {
if (BuildConfig.DEBUG) Log.d(TAG, "[startActionMode] callback: " + callback);
if (mActionMode != null) {
mActionMode.finish();
}
ActionModeCallbackWrapper wrapped = null;
if (callback != null) {
wrapped = new ActionModeCallbackWrapper(callback);
}
//Calling this will trigger the callback wrapper's onCreate which
//is where we will set the new instance to mActionMode since we need
//to pass it through to the sherlock callbacks and the call below
//will not have returned yet to store its value.
if (mActivity.startActionMode(wrapped) == null) {
mActionMode = null;
}
if (mActivity instanceof OnActionModeStartedListener && mActionMode != null) {
((OnActionModeStartedListener) mActivity).onActionModeStarted(mActionMode);
}
return mActionMode;
}
示例4: startActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
@Override
public ActionMode startActionMode(com.actionbarsherlock.view.ActionMode.Callback callback) {
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[startActionMode] callback: " + callback);
if (mActionMode != null) {
mActionMode.finish();
}
ActionModeCallbackWrapper wrapped = null;
if (callback != null) {
wrapped = new ActionModeCallbackWrapper(callback);
}
//Calling this will trigger the callback wrapper's onCreate which
//is where we will set the new instance to mActionMode since we need
//to pass it through to the sherlock callbacks and the call below
//will not have returned yet to store its value.
if (mActivity.startActionMode(wrapped) == null) {
mActionMode = null;
}
if (mActivity instanceof OnActionModeStartedListener && mActionMode != null) {
((OnActionModeStartedListener)mActivity).onActionModeStarted(mActionMode);
}
return mActionMode;
}
示例5: onPrepareActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
Log.d(THIS_FILE, "onPrepareActionMode");
ListView lv = getListView();
int nbrCheckedItem = 0;
for (int i = 0; i < lv.getCount(); i++) {
if (lv.isItemChecked(i)) {
nbrCheckedItem++;
}
}
menu.findItem(R.id.delete).setVisible(nbrCheckedItem > 0);
menu.findItem(R.id.dialpad).setVisible(nbrCheckedItem == 1);
return false;
}
示例6: onActionItemClicked
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
int itemId = item.getItemId();
if(itemId == R.id.delete) {
actionModeDelete();
return true;
}else if(itemId == R.id.invert_selection) {
actionModeInvertSelection();
return true;
}else if(itemId == R.id.dialpad) {
actionModeDialpad();
return true;
}
return false;
}
示例7: onDestroyActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
@Override
public void onDestroyActionMode(ActionMode mode) {
Log.d(THIS_FILE, "onDestroyActionMode");
ListView lv = getListView();
// Uncheck all
int count = lv.getAdapter().getCount();
for (int i = 0; i < count; i++) {
lv.setItemChecked(i, false);
}
mMode = null;
}
示例8: onDestroyActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
public void onDestroyActionMode(ActionMode mode) {
mWrapped.onDestroyActionMode(mode);
if (mActionModeView != null) {
mActionModeView.setVisibility(View.GONE);
mActionModeView.removeAllViews();
}
if (mActivity instanceof OnActionModeFinishedListener) {
((OnActionModeFinishedListener)mActivity).onActionModeFinished(mActionMode);
}
mActionMode = null;
}
示例9: onCreateActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
@Override
public boolean onCreateActionMode(android.view.ActionMode mode, android.view.Menu menu) {
//See ActionBarSherlockNative#startActionMode
mActionMode = new ActionModeWrapper(mode);
return mCallback.onCreateActionMode(mActionMode, mActionMode.getMenu());
}
示例10: onDestroyActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
@Override
public void onDestroyActionMode(android.view.ActionMode mode) {
mCallback.onDestroyActionMode(mActionMode);
if (mActivity instanceof OnActionModeFinishedListener) {
((OnActionModeFinishedListener)mActivity).onActionModeFinished(mActionMode);
}
}
示例11: StandaloneActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
public StandaloneActionMode(Context context, ActionBarContextView view,
ActionMode.Callback callback, boolean isFocusable) {
mContext = context;
mContextView = view;
mCallback = callback;
mMenu = new MenuBuilder(context).setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
mMenu.setCallback(this);
mFocusable = isFocusable;
}
示例12: onDestroyActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
public void onDestroyActionMode(ActionMode mode) {
mWrapped.onDestroyActionMode(mode);
if (mActionModeView != null) {
mActionModeView.setVisibility(View.GONE);
mActionModeView.removeAllViews();
}
if (mActivity instanceof OnActionModeFinishedListener) {
((OnActionModeFinishedListener) mActivity).onActionModeFinished(mActionMode);
}
mActionMode = null;
}
示例13: onDestroyActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
@Override
public void onDestroyActionMode(android.view.ActionMode mode) {
mCallback.onDestroyActionMode(mActionMode);
if (mActivity instanceof OnActionModeFinishedListener) {
((OnActionModeFinishedListener) mActivity).onActionModeFinished(mActionMode);
}
}
示例14: onCreateActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
mode.setTitle("Download");
inflater.inflate(R.menu.download, menu);
return true; //To change body of implemented methods use File | Settings | File Templates.
}
示例15: startActionMode
import com.actionbarsherlock.view.ActionMode; //導入依賴的package包/類
private void startActionMode() {
try {
Activity activity = (Activity) adapterView.getContext();
Method method = activity.getClass().getMethod("startActionMode", ActionMode.Callback.class);
actionMode = (ActionMode) method.invoke(activity, owner);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}