下面列出了android.support.v4.app.ActivityCompat#postponeEnterTransition ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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);
}
@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();
}
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);
}
}