Java Code Examples for com.actionbarsherlock.view.ActionMode#Callback

The following examples show how to use com.actionbarsherlock.view.ActionMode#Callback . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionBarImpl.java    From android-apps with MIT License 6 votes vote down vote up
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;
}
 
Example 2
Source File: ActionBarImpl.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: ActionBarSherlockNative.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@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;
}
 
Example 4
Source File: StandaloneActionMode.java    From android-apps with MIT License 5 votes vote down vote up
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;
}
 
Example 5
Source File: StandaloneActionMode.java    From zen4android with MIT License 5 votes vote down vote up
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;
}
 
Example 6
Source File: StandaloneActionMode.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 7
Source File: SherlockListActivity.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
public ActionMode startActionMode(ActionMode.Callback callback) {
    return getSherlock().startActionMode(callback);
}
 
Example 8
Source File: ActionBarSherlockNative.java    From android-apps with MIT License 4 votes vote down vote up
public ActionModeCallbackWrapper(ActionMode.Callback callback) {
    mCallback = callback;
}
 
Example 9
Source File: ActionBarImpl.java    From android-apps with MIT License 4 votes vote down vote up
public ActionModeImpl(ActionMode.Callback callback) {
    mCallback = callback;
    mMenu = new MenuBuilder(getThemedContext())
            .setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    mMenu.setCallback(this);
}
 
Example 10
Source File: ActionBarSherlockCompat.java    From android-apps with MIT License 4 votes vote down vote up
public ActionModeCallbackWrapper(ActionMode.Callback wrapped) {
    mWrapped = wrapped;
}
 
Example 11
Source File: SherlockListActivity.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
public ActionMode startActionMode(ActionMode.Callback callback) {
    return getSherlock().startActionMode(callback);
}
 
Example 12
Source File: SherlockPreferenceActivity.java    From zen4android with MIT License 4 votes vote down vote up
public ActionMode startActionMode(ActionMode.Callback callback) {
    return getSherlock().startActionMode(callback);
}
 
Example 13
Source File: ActionBarSherlockNative.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
public ActionModeCallbackWrapper(ActionMode.Callback callback) {
    mCallback = callback;
}
 
Example 14
Source File: ActionBarImpl.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
public ActionModeImpl(ActionMode.Callback callback) {
    mCallback = callback;
    mMenu = new MenuBuilder(getThemedContext())
            .setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    mMenu.setCallback(this);
}
 
Example 15
Source File: SherlockFragmentActivity.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
public ActionMode startActionMode(ActionMode.Callback callback) {
    return getSherlock().startActionMode(callback);
}
 
Example 16
Source File: ActionBarSherlockNative.java    From zen4android with MIT License 4 votes vote down vote up
public ActionModeCallbackWrapper(ActionMode.Callback callback) {
    mCallback = callback;
}
 
Example 17
Source File: SherlockPreferenceActivity.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
public ActionMode startActionMode(ActionMode.Callback callback) {
    return getSherlock().startActionMode(callback);
}
 
Example 18
Source File: ActionBarSherlock.java    From Libraries-for-Android-Developers with MIT License 2 votes vote down vote up
/**
 * Start an action mode.
 *
 * @param callback Callback that will manage lifecycle events for this
 *                 context mode.
 * @return The ContextMode that was started, or null if it was canceled.
 * @see ActionMode
 */
public abstract ActionMode startActionMode(ActionMode.Callback callback);
 
Example 19
Source File: ActionBarSherlock.java    From android-apps with MIT License 2 votes vote down vote up
/**
 * Start an action mode.
 *
 * @param callback Callback that will manage lifecycle events for this
 *                 context mode.
 * @return The ContextMode that was started, or null if it was canceled.
 * @see ActionMode
 */
public abstract ActionMode startActionMode(ActionMode.Callback callback);
 
Example 20
Source File: ActionBarSherlock.java    From zhangshangwuda with Apache License 2.0 2 votes vote down vote up
/**
 * Start an action mode.
 *
 * @param callback Callback that will manage lifecycle events for this
 *                 context mode.
 * @return The ContextMode that was started, or null if it was canceled.
 * @see ActionMode
 */
public abstract ActionMode startActionMode(ActionMode.Callback callback);