Ejemplo n.º 1
0
    @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());
    }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
  @Override
  public ActionMode startActionMode(ActionMode.Callback callback) {
    if (DEBUG) Log.d(TAG, "[startActionMode] callback: " + callback);

    if (mActionMode != null) {
      mActionMode.finish();
    }

    final ActionMode.Callback wrappedCallback = new ActionModeCallbackWrapper(callback);
    ActionMode mode = null;

    // Emulate Activity's onWindowStartingActionMode:
    initActionBar();
    if (aActionBar != null) {
      mode = aActionBar.startActionMode(wrappedCallback);
    }

    if (mode != null) {
      mActionMode = mode;
    } else {
      if (mActionModeView == null) {
        ViewStub stub = (ViewStub) mDecor.findViewById(R.id.abs__action_mode_bar_stub);
        if (stub != null) {
          mActionModeView = (ActionBarContextView) stub.inflate();
        }
      }
      if (mActionModeView != null) {
        mActionModeView.killMode();
        mode = new StandaloneActionMode(mActivity, mActionModeView, wrappedCallback, true);
        if (callback.onCreateActionMode(mode, mode.getMenu())) {
          mode.invalidate();
          mActionModeView.initForMode(mode);
          mActionModeView.setVisibility(View.VISIBLE);
          mActionMode = mode;
          mActionModeView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
        } else {
          mActionMode = null;
        }
      }
    }
    if (mActionMode != null && mActivity instanceof OnActionModeStartedListener) {
      ((OnActionModeStartedListener) mActivity).onActionModeStarted(mActionMode);
    }
    return mActionMode;
  }
Ejemplo n.º 4
0
 public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
   return mWrapped.onActionItemClicked(mode, item);
 }
Ejemplo n.º 5
0
 public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
   return mWrapped.onPrepareActionMode(mode, menu);
 }
Ejemplo n.º 6
0
 @Override
 public void onDestroyActionMode(android.view.ActionMode mode) {
   mCallback.onDestroyActionMode(mActionMode);
 }
Ejemplo n.º 7
0
 @Override
 public boolean onActionItemClicked(android.view.ActionMode mode, android.view.MenuItem item) {
   return mCallback.onActionItemClicked(mActionMode, mActionMode.getMenu().findItem(item));
 }
Ejemplo n.º 8
0
 @Override
 public boolean onPrepareActionMode(android.view.ActionMode mode, android.view.Menu menu) {
   return mCallback.onPrepareActionMode(mActionMode, mActionMode.getMenu());
 }