Search in sources :

Example 1 with SystemUiHelper

use of me.zhanghai.android.systemuihelper.SystemUiHelper in project Douya by DreaminginCodeZH.

the class GalleryActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gallery_activity);
    ButterKnife.bind(this);
    setSupportActionBar(mToolbar);
    mSystemUiHelper = new SystemUiHelper(this, SystemUiHelper.LEVEL_IMMERSIVE, SystemUiHelper.FLAG_IMMERSIVE_STICKY, new SystemUiHelper.OnVisibilityChangeListener() {

        @Override
        public void onVisibilityChange(boolean visible) {
            if (visible) {
                mToolbar.animate().alpha(1).translationY(0).setDuration(mToolbarHideDuration).setInterpolator(new FastOutSlowInInterpolator()).start();
            } else {
                mToolbar.animate().alpha(0).translationY(-mToolbar.getBottom()).setDuration(mToolbarHideDuration).setInterpolator(new FastOutSlowInInterpolator()).start();
            }
        }
    });
    // This will set up window flags.
    mSystemUiHelper.show();
    ArrayList<String> imageList = getIntent().getStringArrayListExtra(EXTRA_IMAGE_LIST);
    mViewPager.setAdapter(new GalleryAdapter(imageList, new GalleryAdapter.OnTapListener() {

        @Override
        public void onTap() {
            mSystemUiHelper.toggle();
        }
    }));
    int position = getIntent().getIntExtra(EXTRA_POSITION, 0);
    mViewPager.setCurrentItem(position);
    mViewPager.setPageTransformer(true, new ViewPagerTransformers.Depth());
}
Also used : SystemUiHelper(me.zhanghai.android.systemuihelper.SystemUiHelper) FastOutSlowInInterpolator(android.support.v4.view.animation.FastOutSlowInInterpolator)

Aggregations

FastOutSlowInInterpolator (android.support.v4.view.animation.FastOutSlowInInterpolator)1 SystemUiHelper (me.zhanghai.android.systemuihelper.SystemUiHelper)1