Search in sources :

Example 1 with StandaloneActionMode

use of com.actionbarsherlock.internal.view.StandaloneActionMode in project Libraries-for-Android-Developers by eoecn.

the class ActionBarSherlockCompat method startActionMode.

@Override
public ActionMode startActionMode(ActionMode.Callback callback) {
    if (ActionBarSherlock.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;
}
Also used : StandaloneActionMode(com.actionbarsherlock.internal.view.StandaloneActionMode) ViewStub(android.view.ViewStub) StandaloneActionMode(com.actionbarsherlock.internal.view.StandaloneActionMode) ActionMode(com.actionbarsherlock.view.ActionMode)

Example 2 with StandaloneActionMode

use of com.actionbarsherlock.internal.view.StandaloneActionMode in project cw-omnibus by commonsguy.

the class ActionBarSherlockCompat method startActionMode.

@Override
public ActionMode startActionMode(ActionMode.Callback callback) {
    if (BuildConfig.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;
}
Also used : StandaloneActionMode(com.actionbarsherlock.internal.view.StandaloneActionMode) ViewStub(android.view.ViewStub) StandaloneActionMode(com.actionbarsherlock.internal.view.StandaloneActionMode) ActionMode(com.actionbarsherlock.view.ActionMode)

Example 3 with StandaloneActionMode

use of com.actionbarsherlock.internal.view.StandaloneActionMode in project httpclient by pixmob.

the class ActionBarSherlockCompat method startActionMode.

@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;
}
Also used : StandaloneActionMode(com.actionbarsherlock.internal.view.StandaloneActionMode) ViewStub(android.view.ViewStub) StandaloneActionMode(com.actionbarsherlock.internal.view.StandaloneActionMode) ActionMode(com.actionbarsherlock.view.ActionMode)

Example 4 with StandaloneActionMode

use of com.actionbarsherlock.internal.view.StandaloneActionMode in project ActionBarSherlock by JakeWharton.

the class ActionBarSherlockCompat method startActionMode.

@Override
public ActionMode startActionMode(ActionMode.Callback callback) {
    if (ActionBarSherlock.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;
}
Also used : StandaloneActionMode(com.actionbarsherlock.internal.view.StandaloneActionMode) ViewStub(android.view.ViewStub) StandaloneActionMode(com.actionbarsherlock.internal.view.StandaloneActionMode) ActionMode(com.actionbarsherlock.view.ActionMode)

Example 5 with StandaloneActionMode

use of com.actionbarsherlock.internal.view.StandaloneActionMode in project Ushahidi_Android by ushahidi.

the class ActionBarSherlockCompat method startActionMode.

@Override
public ActionMode startActionMode(ActionMode.Callback callback) {
    if (ActionBarSherlock.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;
}
Also used : StandaloneActionMode(com.actionbarsherlock.internal.view.StandaloneActionMode) ViewStub(android.view.ViewStub) StandaloneActionMode(com.actionbarsherlock.internal.view.StandaloneActionMode) ActionMode(com.actionbarsherlock.view.ActionMode)

Aggregations

ViewStub (android.view.ViewStub)7 StandaloneActionMode (com.actionbarsherlock.internal.view.StandaloneActionMode)7 ActionMode (com.actionbarsherlock.view.ActionMode)7