Java Code Examples for android.support.v7.app.ActionBar#isShowing()

The following examples show how to use android.support.v7.app.ActionBar#isShowing() . 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: ActionBarControlListViewActivity.java    From Android-ObservableScrollView with Apache License 2.0 6 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getSupportActionBar();
    if (ab == null) {
        return;
    }
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}
 
Example 2
Source File: ActionBarControlRecyclerViewActivity.java    From Android-ObservableScrollView with Apache License 2.0 6 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getSupportActionBar();
    if (ab == null) {
        return;
    }
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}
 
Example 3
Source File: ActionBarControlWebViewActivity.java    From Android-ObservableScrollView with Apache License 2.0 6 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getSupportActionBar();
    if (ab == null) {
        return;
    }
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}
 
Example 4
Source File: ActionBarControlGridViewActivity.java    From Android-ObservableScrollView with Apache License 2.0 6 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getSupportActionBar();
    if (ab == null) {
        return;
    }
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}
 
Example 5
Source File: FragmentActionBarControlListViewFragment.java    From Android-ObservableScrollView with Apache License 2.0 6 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    if (activity == null) {
        return;
    }
    ActionBar ab = activity.getSupportActionBar();
    if (ab == null) {
        return;
    }
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}
 
Example 6
Source File: ActionBarControlScrollViewActivity.java    From Android-ObservableScrollView with Apache License 2.0 6 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getSupportActionBar();
    if (ab == null) {
        return;
    }
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}
 
Example 7
Source File: ActionBarControlListViewActivity.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getSupportActionBar();
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}
 
Example 8
Source File: ImageViewerActivity.java    From android-imageviewer with Apache License 2.0 5 votes vote down vote up
public void onViewTap(View view, float x, float y) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar.isShowing()) {
        actionBar.hide();
    } else {
        actionBar.show();
    }
}
 
Example 9
Source File: Term.java    From Ansole with GNU General Public License v2.0 5 votes vote down vote up
private void doToggleActionBar() {
    ActionBar bar = mActionBar;
    if (bar == null) {
        return;
    }
    if (bar.isShowing()) {
        bar.hide();
    } else {
        bar.show();
    }
}
 
Example 10
Source File: WXTitleBar.java    From incubator-weex-playground with Apache License 2.0 5 votes vote down vote up
@JSMethod
public void showTitleBar(String isShow) {
  ActionBar actionBar = getActionBar();
  if (actionBar != null) {
    if ("true".equals(isShow) && !actionBar.isShowing()) {
      actionBar.show();
    }

    if ("false".equals(isShow) && actionBar.isShowing()) {
      actionBar.hide();
    }
  }
}
 
Example 11
Source File: ActionBarControlWebViewActivity.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getSupportActionBar();
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}
 
Example 12
Source File: ActionBarControlGridViewActivity.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getSupportActionBar();
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}
 
Example 13
Source File: ActionBarControlScrollViewActivity.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar ab = getSupportActionBar();
    if (scrollState == ScrollState.UP) {
        if (ab.isShowing()) {
            ab.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!ab.isShowing()) {
            ab.show();
        }
    }
}
 
Example 14
Source File: GalleryActivity.java    From meizhi with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar actionBar = getSupportActionBar();
    if (scrollState == ScrollState.UP) {
        if (actionBar.isShowing()) {
            actionBar.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!actionBar.isShowing()) {
            actionBar.show();
        }
    }
}
 
Example 15
Source File: AlbumFragment.java    From meizhi with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
    ActionBar actionBar = activity.getSupportActionBar();
    if (scrollState == ScrollState.UP) {
        if (actionBar.isShowing()) {
            actionBar.hide();
        }
    } else if (scrollState == ScrollState.DOWN) {
        if (!actionBar.isShowing()) {
            actionBar.show();
        }
    }
}
 
Example 16
Source File: WindowUtil.java    From youqu_master with Apache License 2.0 5 votes vote down vote up
/**
 * 显示ActionBar,StatusBar,NavigationBar
 */
@SuppressLint("RestrictedApi")
public static void showSystemBar(final Context context) {
    showNavigationBar(context);
    AppCompatActivity appCompatActivity = getAppCompActivity(context);
    if (appCompatActivity != null) {
        ActionBar ab = appCompatActivity.getSupportActionBar();
        if (ab != null && !ab.isShowing()) {
            ab.setShowHideAnimationEnabled(false);
            ab.show();
        }
    }
}
 
Example 17
Source File: WindowUtil.java    From youqu_master with Apache License 2.0 5 votes vote down vote up
/**
 * 隐藏ActionBar,StatusBar,NavigationBar
 */
@SuppressLint("RestrictedApi")
public static void hideSystemBar(Context context) {
    AppCompatActivity appCompatActivity = getAppCompActivity(context);
    if (appCompatActivity != null) {
        ActionBar ab = appCompatActivity.getSupportActionBar();
        if (ab != null && ab.isShowing()) {
            ab.setShowHideAnimationEnabled(false);
            ab.hide();
        }
    }
    hideNavigationBar(context);
}
 
Example 18
Source File: UIManagerAppCompat.java    From document-viewer with GNU General Public License v3.0 4 votes vote down vote up
public static boolean isToolbarVisible(AppCompatActivity activity) {
    ActionBar bar = activity.getSupportActionBar();
    return bar.isShowing();
}
 
Example 19
Source File: ActionBarDisplayOptions.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
@Override
public void onClick(View v) {
    final ActionBar bar = getSupportActionBar();
    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 = mCustomViewLayoutParams;
            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;
        }
        case R.id.toggle_visibility:
            if (bar.isShowing()) {
                bar.hide();
            } else {
                bar.show();
            }
            return;
    }

    int change = bar.getDisplayOptions() ^ flags;
    bar.setDisplayOptions(change, flags);
}
 
Example 20
Source File: BaseActivityHelper.java    From android-base-mvp with Apache License 2.0 4 votes vote down vote up
public static boolean isToolbarVisible(BaseActivity baseActivity) {
    ActionBar actionBar = baseActivity.getSupportActionBar();
    return actionBar != null && actionBar.isShowing();
}