Java Code Examples for android.app.ActionBar#DISPLAY_HOME_AS_UP

The following examples show how to use android.app.ActionBar#DISPLAY_HOME_AS_UP . 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: DuoDrawerToggle.java    From duo-navigation-drawer with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isNavigationVisible() {
    final ActionBar actionBar = mActivity.getActionBar();
    return actionBar != null
            && (actionBar.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0;
}
 
Example 2
Source File: DuoDrawerToggle.java    From duo-navigation-drawer with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isNavigationVisible() {
    final ActionBar actionBar = mActivity.getActionBar();
    return actionBar != null &&
            (actionBar.getDisplayOptions() & ActionBar.DISPLAY_HOME_AS_UP) != 0;
}
 
Example 3
Source File: ActionBarDisplayOptions.java    From codeexamples-android with Eclipse Public License 1.0 4 votes vote down vote up
public void onClick(View v) {
    final ActionBar bar = getActionBar();
    int flags = 0;
    switch (v.getId()) {
        case R.id.toggle_home_as_up:
            flags = ActionBar.DISPLAY_HOME_AS_UP;
            break;
        case R.id.toggle_show_home:
            flags = ActionBar.DISPLAY_SHOW_HOME;
            break;
        case R.id.toggle_use_logo:
            flags = ActionBar.DISPLAY_USE_LOGO;
            break;
        case R.id.toggle_show_title:
            flags = ActionBar.DISPLAY_SHOW_TITLE;
            break;
        case R.id.toggle_show_custom:
            flags = ActionBar.DISPLAY_SHOW_CUSTOM;
            break;

        case R.id.toggle_navigation:
            bar.setNavigationMode(
                    bar.getNavigationMode() == ActionBar.NAVIGATION_MODE_STANDARD
                            ? ActionBar.NAVIGATION_MODE_TABS
                            : ActionBar.NAVIGATION_MODE_STANDARD);
            return;
        case R.id.cycle_custom_gravity:
            ActionBar.LayoutParams lp = (ActionBar.LayoutParams) mCustomView.getLayoutParams();
            int newGravity = 0;
            switch (lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
                case Gravity.LEFT:
                    newGravity = Gravity.CENTER_HORIZONTAL;
                    break;
                case Gravity.CENTER_HORIZONTAL:
                    newGravity = Gravity.RIGHT;
                    break;
                case Gravity.RIGHT:
                    newGravity = Gravity.LEFT;
                    break;
            }
            lp.gravity = lp.gravity & ~Gravity.HORIZONTAL_GRAVITY_MASK | newGravity;
            bar.setCustomView(mCustomView, lp);
            return;
    }

    int change = bar.getDisplayOptions() ^ flags;
    bar.setDisplayOptions(change, flags);
}