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

The following examples show how to use android.support.v4.app.ActivityCompat#postponeEnterTransition() . 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: BaseActivity.java    From mvvm-template with GNU General Public License v3.0 6 votes vote down vote up
@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 2
Source File: TeamDetailsActivity.java    From android with Apache License 2.0 6 votes vote down vote up
@Override public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  // See setupViewPager() below for why this exists
  ActivityCompat.postponeEnterTransition(this);
  AnimationUtil.setupActivityTransition(this);
  setContentView(R.layout.app_bar_team_details);
  ButterKnife.bind(this);
  setSupportActionBar(toolbar);

  if (savedInstanceState == null) {
    club = getIntent().getParcelableExtra(EXTRA_CLUB);
    nation = userPreferences.nation();
    league = userPreferences.league();
  }

  ActionBar actionBar = checkNotNull(getSupportActionBar());
  actionBar.setDisplayShowHomeEnabled(true);
  actionBar.setDisplayHomeAsUpEnabled(true);
  actionBar.setTitle(club.shortName());
  setupViewPager();
}
 
Example 3
Source File: DetailsOverviewSharedElementHelper.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
void setSharedElementEnterTransition(Activity activity, String sharedElementName,
        long timeoutMs) {
    if (activity == null && !TextUtils.isEmpty(sharedElementName) ||
            activity != null && TextUtils.isEmpty(sharedElementName)) {
        throw new IllegalArgumentException();
    }
    if (activity == mActivityToRunTransition &&
            TextUtils.equals(sharedElementName, mSharedElementName)) {
        return;
    }
    if (mActivityToRunTransition != null) {
        ActivityCompat.setEnterSharedElementCallback(mActivityToRunTransition, null);
    }
    mActivityToRunTransition = activity;
    mSharedElementName = sharedElementName;
    if (DEBUG) {
        Log.d(TAG, "postponeEnterTransition " + mActivityToRunTransition);
    }
    ActivityCompat.setEnterSharedElementCallback(mActivityToRunTransition, this);
    ActivityCompat.postponeEnterTransition(mActivityToRunTransition);
    if (timeoutMs > 0) {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                if (mStartedPostpone) {
                    return;
                }
                if (DEBUG) {
                    Log.d(TAG, "timeout " + mActivityToRunTransition);
                }
                startPostponedEnterTransition();
            }
        }, timeoutMs);
    }
}