com.actionbarsherlock.ActionBarSherlock Java Examples

The following examples show how to use com.actionbarsherlock.ActionBarSherlock. 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: ActionBarSherlockNative.java    From zen4android with MIT License 6 votes vote down vote up
@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;
}
 
Example #2
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean requestFeature(int featureId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
        case Window.FEATURE_ACTION_BAR:
        case Window.FEATURE_ACTION_BAR_OVERLAY:
        case Window.FEATURE_ACTION_MODE_OVERLAY:
        case Window.FEATURE_INDETERMINATE_PROGRESS:
        case Window.FEATURE_NO_TITLE:
        case Window.FEATURE_PROGRESS:
            mFeatures |= (1 << featureId);
            return true;

        default:
            return false;
    }
}
 
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: Watson.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item);

    if (featureId == Window.FEATURE_OPTIONS_PANEL) {
        if (onOptionsItemSelected(item)) {
            return true;
        }

        if (mFragments.mAdded != null) {
            for (int i = 0; i < mFragments.mAdded.size(); i++) {
                Fragment f = mFragments.mAdded.get(i);
                if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnOptionsItemSelectedListener) {
                    if (((OnOptionsItemSelectedListener)f).onOptionsItemSelected(item)) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
 
Example #5
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 6 votes vote down vote up
@Override
public boolean requestFeature(int featureId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[requestFeature] featureId: " + featureId);

    if (mContentParent != null) {
        throw new AndroidRuntimeException("requestFeature() must be called before adding content");
    }

    switch (featureId) {
        case Window.FEATURE_ACTION_BAR:
        case Window.FEATURE_ACTION_BAR_OVERLAY:
        case Window.FEATURE_ACTION_MODE_OVERLAY:
        case Window.FEATURE_INDETERMINATE_PROGRESS:
        case Window.FEATURE_NO_TITLE:
        case Window.FEATURE_PROGRESS:
            mFeatures |= (1 << featureId);
            return true;

        default:
            return false;
    }
}
 
Example #6
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public boolean hasFeature(int featureId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] featureId: " + featureId);

    boolean result = (mFeatures & (1 << featureId)) != 0;
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] returning " + result);
    return result;
}
 
Example #7
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public void setProgressBarIndeterminateVisibility(boolean visible) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setProgressBarIndeterminateVisibility] visible: " + visible);

    setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
            visible ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF);
}
 
Example #8
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean hasFeature(int featureId) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] featureId: " + featureId);

    boolean result = (mFeatures & (1 << featureId)) != 0;
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] returning " + result);
    return result;
}
 
Example #9
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public void setSecondaryProgress(int secondaryProgress) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setSecondaryProgress] secondaryProgress: " + secondaryProgress);

    setFeatureInt(Window.FEATURE_PROGRESS,
            secondaryProgress + Window.PROGRESS_SECONDARY_START);
}
 
Example #10
Source File: Watson.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);

    if (featureId == Window.FEATURE_OPTIONS_PANEL) {
        boolean result = onPrepareOptionsMenu(menu);
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);

        boolean show = false;
        if (mFragments.mAdded != null) {
            for (int i = 0; i < mFragments.mAdded.size(); i++) {
                Fragment f = mFragments.mAdded.get(i);
                if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnPrepareOptionsMenuListener) {
                    show = true;
                    ((OnPrepareOptionsMenuListener)f).onPrepareOptionsMenu(menu);
                }
            }
        }

        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + show);
        result |= show;

        result &= menu.hasVisibleItems();
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
        return result;
    }
    return false;
}
 
Example #11
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public void dispatchPause() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPause]");

    if (wActionBar != null && wActionBar.isOverflowMenuShowing()) {
        wActionBar.hideOverflowMenu();
    }
}
 
Example #12
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setProgressBarIndeterminateVisibility(boolean visible) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setProgressBarIndeterminateVisibility] visible: " + visible);

    setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
            visible ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF);
}
 
Example #13
Source File: ActionBarSherlockNative.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public boolean hasFeature(int feature) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] feature: " + feature);

    final boolean result = mActivity.getWindow().hasFeature(feature);
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] returning " + result);
    return result;
}
 
Example #14
Source File: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public void dispatchPostResume() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPostResume]");

    if (aActionBar != null) {
        aActionBar.setShowHideAnimationEnabled(true);
    }
}
 
Example #15
Source File: SherlockFragmentActivity.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public final boolean onPreparePanel(int featureId, View view, android.view.Menu menu) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + ", menu: " + menu);

    if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativePrepare) {
        mIgnoreNativePrepare = true;
        boolean result = getSherlock().dispatchPrepareOptionsMenu(menu);
        mIgnoreNativePrepare = false;

        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
        return result;
    }
    return super.onPreparePanel(featureId, view, menu);
}
 
Example #16
Source File: SherlockFragmentActivity.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public final boolean onMenuItemSelected(int featureId, android.view.MenuItem item) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item.getTitle());

    if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeSelected) {
        mIgnoreNativeSelected = true;
        boolean result = getSherlock().dispatchOptionsItemSelected(item);
        mIgnoreNativeSelected = false;

        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onMenuItemSelected] returning " + result);
        return result;
    }
    return super.onMenuItemSelected(featureId, item);
}
 
Example #17
Source File: SherlockFragmentActivity.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public final boolean onCreatePanelMenu(int featureId, android.view.Menu menu) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);

    if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeCreate) {
        mIgnoreNativeCreate = true;
        boolean result = getSherlock().dispatchCreateOptionsMenu(menu);
        mIgnoreNativeCreate = false;

        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
        return result;
    }
    return super.onCreatePanelMenu(featureId, menu);
}
 
Example #18
Source File: ActionBarSherlockNative.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public boolean hasFeature(int feature) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] feature: " + feature);

    final boolean result = mActivity.getWindow().hasFeature(feature);
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] returning " + result);
    return result;
}
 
Example #19
Source File: SherlockFragmentActivity.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public final boolean onMenuItemSelected(int featureId, android.view.MenuItem item) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item.getTitle());

    if (featureId == Window.FEATURE_OPTIONS_PANEL && !mIgnoreNativeSelected) {
        mIgnoreNativeSelected = true;
        boolean result = getSherlock().dispatchOptionsItemSelected(item);
        mIgnoreNativeSelected = false;

        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onMenuItemSelected] returning " + result);
        return result;
    }
    return super.onMenuItemSelected(featureId, item);
}
 
Example #20
Source File: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public void dispatchConfigurationChanged(Configuration newConfig) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchConfigurationChanged] newConfig: " + newConfig);

    if (aActionBar != null) {
        aActionBar.onConfigurationChanged(newConfig);
    }
}
 
Example #21
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public void dispatchStop() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchStop]");

    if (aActionBar != null) {
        aActionBar.setShowHideAnimationEnabled(false);
    }
}
 
Example #22
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public boolean dispatchOpenOptionsMenu() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchOpenOptionsMenu]");

    if (!isReservingOverflow()) {
        return false;
    }

    return wActionBar.showOverflowMenu();
}
 
Example #23
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void ensureActionBar() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[ensureActionBar]");

    if (mDecor == null) {
        initActionBar();
    }
}
 
Example #24
Source File: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public void dispatchPause() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchPause]");

    if (wActionBar != null && wActionBar.isOverflowMenuShowing()) {
        wActionBar.hideOverflowMenu();
    }
}
 
Example #25
Source File: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public void addContentView(View view, ViewGroup.LayoutParams params) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[addContentView] view: " + view + ", params: " + params);

    if (mContentParent == null) {
        installDecor();
    }
    mContentParent.addView(view, params);

    initActionBar();
}
 
Example #26
Source File: ActionBarSherlockNative.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void dispatchInvalidateOptionsMenu() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchInvalidateOptionsMenu]");

    mActivity.getWindow().invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL);

    if (mMenu != null) mMenu.invalidate();
}
 
Example #27
Source File: ActionBarSherlockCompat.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public void dispatchTitleChanged(CharSequence title, int color) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchTitleChanged] title: " + title + ", color: " + color);

    if ((!mIsDelegate || mIsTitleReady) && (wActionBar != null)) {
        wActionBar.setWindowTitle(title);
    }
}
 
Example #28
Source File: ActionBarSherlockNative.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean hasFeature(int feature) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] feature: " + feature);

    final boolean result = mActivity.getWindow().hasFeature(feature);
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[hasFeature] returning " + result);
    return result;
}
 
Example #29
Source File: ActionBarSherlockCompat.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public void dispatchTitleChanged(CharSequence title, int color) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[dispatchTitleChanged] title: " + title + ", color: " + color);

    if ((!mIsDelegate || mIsTitleReady) && (wActionBar != null)) {
        wActionBar.setWindowTitle(title);
    }
}
 
Example #30
Source File: Watson.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] featureId: " + featureId + ", view: " + view + " menu: " + menu);

    if (featureId == Window.FEATURE_OPTIONS_PANEL) {
        boolean result = onPrepareOptionsMenu(menu);
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] activity prepare result: " + result);

        boolean show = false;
        if (mFragments.mAdded != null) {
            for (int i = 0; i < mFragments.mAdded.size(); i++) {
                Fragment f = mFragments.mAdded.get(i);
                if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnPrepareOptionsMenuListener) {
                    show = true;
                    ((OnPrepareOptionsMenuListener)f).onPrepareOptionsMenu(menu);
                }
            }
        }

        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] fragments prepare result: " + show);
        result |= show;

        result &= menu.hasVisibleItems();
        if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onPreparePanel] returning " + result);
        return result;
    }
    return false;
}