Java Code Examples for android.support.v4.app.ActivityCompat.postponeEnterTransition()

The following are Jave code examples for showing how to use postponeEnterTransition() of the android.support.v4.app.ActivityCompat class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Botanist   File: PlantActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profile);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    mController = new PlantController(this);
    ActivityCompat.postponeEnterTransition(this);
    // Setting OnClickListeners
    findViewById(R.id.camera_fab).setOnClickListener(this);
    findViewById(R.id.height_button).setOnClickListener(this);
    findViewById(R.id.poop_button).setOnClickListener(this);
    findViewById(R.id.water_button).setOnClickListener(this);
    findViewById(R.id.calendar_button).setOnClickListener(this);
    findViewById(R.id.care_tips_expand_collapse).setOnClickListener(this);
    findViewById(R.id.toxic_warning_expand_collapse).setOnClickListener(this);
    findViewById(R.id.noxious_warning_expand_collapse).setOnClickListener(this);
    overridePendingTransition(R.anim.slide_up, R.anim.hold);
}
 
Example 2
Project: Avengers   File: ComicDetailsActivity.java   Source Code and License Vote up 6 votes
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ActivityCompat.postponeEnterTransition(this);
    }
    component().inject(this);
    setToolbarInitialisation();
    comicDetailsPresenter.setView(this);
    if (getIntent() != null) {
        setIntentParameters();
        if (comic != null) {
            setInitialTitle();
            comicDetailsPresenter.setInfo(comic, this);
        } else {
            comicDetailsPresenter.errorGettingInfo(this);
        }
    } else {
        comicDetailsPresenter.errorGettingInfo(this);
    }
}
 
Example 3
Project: mvvm-template   File: BaseActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setupLayoutStableFullscreen();

    restoreState(savedInstanceState);

    if (!shouldUseDataBinding()) {
        // set contentView if child activity not use dataBinding
        setContentView(getLayout());
        initViews();
    }

    if (shouldPostponeTransition()) {
        ActivityCompat.postponeEnterTransition(this);
    }

    CommonUtils.hideSoftKeyboard(this);
}
 
Example 4
Project: Instincts-2k17   File: GalleryViewPagerActivity.java   Source Code and License Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActivityCompat.postponeEnterTransition(this);
    ActivityCompat.setEnterSharedElementCallback(this, enterTransitionCallback);

    int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    getWindow().getDecorView().setSystemUiVisibility(mUIFlag);

    setContentView(R.layout.activity_view_pager_gallery);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("Gallery");
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    galleryViewPagerAdapter = new GalleryViewPagerAdapter(this);

    viewPager = (ViewPager) findViewById(R.id.container);
    viewPager.setAdapter(galleryViewPagerAdapter);

    int position = selectedIndex = getIntent().getIntExtra(EXTRA_POSITION, 0);
    viewPager.setCurrentItem(position);
    viewPager.setOnPageChangeListener(pageChangeListener);
    viewPager.getViewTreeObserver().addOnGlobalLayoutListener(pagerLayoutListener);
}
 
Example 5
Project: Monolith   File: ImageDetailActivity.java   Source Code and License Vote up 4 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_image_detail);

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
            WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

    getSupportLoaderManager().initLoader(0, null, this);

    //Postpone transition here
    ActivityCompat.postponeEnterTransition(this);

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setPageTransformer(false, new ParallaxPagerTransformer(R.id.image));
    mPagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
    mPager.setAdapter(mPagerAdapter);
    mPager.setPageMargin((int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
    mPager.setPageMarginDrawable(new ColorDrawable(0x22000000));

    mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageScrollStateChanged(int state) {
            super.onPageScrollStateChanged(state);
        }

        @Override
        public void onPageSelected(int position) {
            if (mCursor != null) {
                mCursor.moveToPosition(position);
            }
            mSelectedItemId = mCursor.getLong(GalleryLoader.Query.COLUMN_IMAGE_ID);
        }
    });

    if (savedInstanceState == null) {
        if (getIntent() != null && getIntent().getData() != null) {
            mStartId = GalleryContract.GalleryEntry.getItemId(getIntent().getData());
            mSelectedItemId = mStartId;
        }
    }
}
 
Example 6
Project: Monolith   File: ArticleDetailActivity.java   Source Code and License Vote up 4 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_article_detail);

    getSupportLoaderManager().initLoader(0, null, this);

    getWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
                    | View.SYSTEM_UI_FLAG_IMMERSIVE);

    //Postpone transition here
    ActivityCompat.postponeEnterTransition(this);

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setPageTransformer(false, new ParallaxPagerTransformer(R.id.photo));
    mPagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
    mPager.setAdapter(mPagerAdapter);
    mPager.setPageMargin((int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
    mPager.setPageMarginDrawable(new ColorDrawable(0x22000000));

    mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageScrollStateChanged(int state) {
            super.onPageScrollStateChanged(state);
        }

        @Override
        public void onPageSelected(int position) {
            if (mCursor != null) {
                mCursor.moveToPosition(position);
            }
            mSelectedItemId = mCursor.getLong(ArticleLoader.Query.COLUMN_ARTICLE_ID);
        }
    });

    if (savedInstanceState == null) {
        if (getIntent() != null && getIntent().getData() != null) {
            mStartId = ArticleContract.ArticleEntry.getItemId(getIntent().getData());
            mSelectedItemId = mStartId;
        }
    }
}
 
Example 7
Project: AndroidOpen   File: TransitionHelper.java   Source Code and License Vote up 4 votes
private void postponeEnterTransition() {
    if (isAfterEnter) return;
    ActivityCompat.postponeEnterTransition(activity);
    isPostponeEnterTransition = true;
}