本文整理汇总了Java中android.transition.TransitionInflater.inflateTransition方法的典型用法代码示例。如果您正苦于以下问题:Java TransitionInflater.inflateTransition方法的具体用法?Java TransitionInflater.inflateTransition怎么用?Java TransitionInflater.inflateTransition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.transition.TransitionInflater
的用法示例。
在下文中一共展示了TransitionInflater.inflateTransition方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayDetails
import android.transition.TransitionInflater; //导入方法依赖的package包/类
@Override
public void displayDetails(AnnouncementItem announcementItem) {
FullAnnouncement announcement = announcementItem.getAnnouncement();
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
AnnouncementDetailsFragment announcementDetailsFragment = AnnouncementDetailsFragment.newInstance(announcement);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
TransitionInflater transitionInflater = null;
transitionInflater = TransitionInflater.from(getContext());
Transition details_enter = transitionInflater.inflateTransition(R.transition.details_enter);
Transition details_exit = transitionInflater.inflateTransition(R.transition.details_exit);
setSharedElementEnterTransition(details_enter);
setSharedElementReturnTransition(details_exit);
setExitTransition(new Fade());
announcementDetailsFragment.setSharedElementEnterTransition(details_enter);
announcementDetailsFragment.setSharedElementReturnTransition(details_exit);
ft.addSharedElement(announcementItem.getBackgroundView(), announcementItem.getBackgroundView().getTransitionName());
}
ft.replace(R.id.content_main, announcementDetailsFragment, "Announcement details transition");
ft.addToBackStack(null);
ft.commitAllowingStateLoss();
}
示例2: initPushInAnim
import android.transition.TransitionInflater; //导入方法依赖的package包/类
private void initPushInAnim() {
Window window = getWindow();
window.requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
TransitionInflater inflater = TransitionInflater.from(mContext);
Transition pushDownIn = inflater.inflateTransition(R.transition.explode_in);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setEnterTransition(pushDownIn); // 第一次进入时使用
window.setReenterTransition(pushDownIn); // 再次进入时使用
window.setExitTransition(pushDownIn);
}
}
示例3: onCreate
import android.transition.TransitionInflater; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= 21) {
TransitionInflater inflater = TransitionInflater.from(this);
Transition transition = inflater.inflateTransition(R.transition.details_window_return_transition);
getWindow().setExitTransition(transition);
}
// setUpWindowAnimations();
setContentView(R.layout.activity_article_detail);
if (savedInstanceState == null) {
// Create the detail fragment and add it to the activity
// using a fragment transaction.
Bundle extras = getIntent().getExtras();
DetailsFragment fragment = new DetailsFragment();
extras.putBoolean(DetailsFragment.DETAIL_TRANSITION_ANIMATION, true);
fragment.setArguments(extras);
getSupportFragmentManager().beginTransaction()
.add(R.id.container, fragment)
.commit();
// Being here means we are in animation mode
supportPostponeEnterTransition();
}
}
示例4: onCheckedChanged
import android.transition.TransitionInflater; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
View square = sceneRoot.findViewById(R.id.transition_square);
switch (checkedId) {
case R.id.select_scene_1: {
square.setVisibility(View.VISIBLE);
// You can start an automatic transition with TransitionManager.go().
TransitionManager.go(mScene1);
break;
}
case R.id.select_scene_2: {
square.setVisibility(View.VISIBLE);
TransitionManager.go(mScene2);
break;
}
case R.id.select_scene_3: {
square.setVisibility(View.VISIBLE);
// You can also start a transition with a custom TransitionManager.
mTransitionManagerForScene3.transitionTo(mScene3);
break;
}
case R.id.select_scene_4: {
// Alternatively, transition can be invoked dynamically without a Scene.
// For this, we first call TransitionManager.beginDelayedTransition().
TransitionManager.beginDelayedTransition(sceneRoot);
// Then, we can just change view properties as usual.
square.setVisibility(View.VISIBLE);
ViewGroup.LayoutParams params = square.getLayoutParams();
int newSize = getResources().getDimensionPixelSize(R.dimen.square_size_expanded);
params.width = newSize;
params.height = newSize;
square.setLayoutParams(params);
break;
}
case R.id.select_scene_5: {
TransitionInflater transitionInflater = TransitionInflater.from(this);
Transition transition = transitionInflater.inflateTransition(R.transition.changebounds_fadeout_sequential);
TransitionManager.beginDelayedTransition(sceneRoot, transition);
square.setVisibility(View.GONE);
break;
}
}
}
示例5: getTransition
import android.transition.TransitionInflater; //导入方法依赖的package包/类
private Transition getTransition(@TransitionRes int transitionId) {
TransitionInflater inflater=TransitionInflater.from(this);
return inflater.inflateTransition(transitionId);
}
示例6: onCreate
import android.transition.TransitionInflater; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Declare a new thread to do a preference check. Library to invoke Intro slides
Thread t = new Thread(new Runnable() {
@Override
public void run() {
// Initialize SharedPreferences
SharedPreferences getPrefs = PreferenceManager
.getDefaultSharedPreferences(getBaseContext());
// Create a new boolean and preference and set it to true
boolean isFirstStart = getPrefs.getBoolean("firstStart", true);
// If the activity has never started before...
if (isFirstStart) {
// Launch app intro
Intent i = new Intent(HomeActivity.this, IntroActivity.class);
startActivity(i);
// Make a new preferences editor
SharedPreferences.Editor e = getPrefs.edit();
// Edit preference to make it false because we don't want this to run again
e.putBoolean("firstStart", false);
// Apply changes
e.apply();
}
else {
// Launch Mainactivity
// Intent intent = new Intent(getApplicationContext(), MainActivity.class);
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
// startActivity(intent);
// mActivity=true;
}
}
});
// Start the thread
t.start();
if (Build.VERSION.SDK_INT >= 21) {
TransitionInflater inflater = TransitionInflater.from(this);
Transition transition = inflater.inflateTransition(R.transition.details_window_enter_transition);
getWindow().setExitTransition(transition);
}
// setUpWindowAnimations();
setContentView(R.layout.activity_home);
ButterKnife.bind(this);
setupFind();
// Obtain the FirebaseAnalytics instance.
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
//Sets whether analytics collection is enabled for this app on this device.
mFirebaseAnalytics.setAnalyticsCollectionEnabled(true);
if (savedInstanceState == null) {
NewsFragment fragment = new NewsFragment();
fragment.setArguments(null);
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, fragment, "")
.commit();
}
NewsSyncUtils.initialize(this);
}
示例7: initIfNeeded
import android.transition.TransitionInflater; //导入方法依赖的package包/类
public void initIfNeeded() {
if (mInitialized) {
return;
}
mEnterAnimator = AnimatorInflater.loadAnimator(mMainActivity,
R.animator.channel_banner_enter);
mExitAnimator = AnimatorInflater.loadAnimator(mMainActivity,
R.animator.channel_banner_exit);
mEmptyScene = new Scene(mSceneContainer, (View) mEmptyView);
mEmptyScene.setEnterAction(new Runnable() {
@Override
public void run() {
FrameLayout.LayoutParams emptySceneLayoutParams =
(FrameLayout.LayoutParams) mEmptyView.getLayoutParams();
ViewGroup.MarginLayoutParams lp =
(ViewGroup.MarginLayoutParams) mCurrentSceneView.getLayoutParams();
emptySceneLayoutParams.topMargin = mCurrentSceneView.getTop();
emptySceneLayoutParams.setMarginStart(lp.getMarginStart());
emptySceneLayoutParams.height = mCurrentSceneView.getHeight();
emptySceneLayoutParams.width = mCurrentSceneView.getWidth();
mEmptyView.setLayoutParams(emptySceneLayoutParams);
setCurrentScene(mEmptyScene, mEmptyView);
}
});
mEmptyScene.setExitAction(new Runnable() {
@Override
public void run() {
removeAllViewsFromOverlay();
}
});
mChannelBannerScene = buildScene(mSceneContainer, mChannelBannerView);
mInputBannerScene = buildScene(mSceneContainer, mInputBannerView);
mKeypadChannelSwitchScene = buildScene(mSceneContainer, mKeypadChannelSwitchView);
mSelectInputScene = buildScene(mSceneContainer, mSelectInputView);
mCurrentScene = mEmptyScene;
// Enter transitions
TransitionSet enter = new TransitionSet()
.addTransition(new SceneTransition(SceneTransition.ENTER))
.addTransition(new Fade(Fade.IN));
setTransition(mEmptyScene, mChannelBannerScene, enter);
setTransition(mEmptyScene, mInputBannerScene, enter);
setTransition(mEmptyScene, mKeypadChannelSwitchScene, enter);
setTransition(mEmptyScene, mSelectInputScene, enter);
// Exit transitions
TransitionSet exit = new TransitionSet()
.addTransition(new SceneTransition(SceneTransition.EXIT))
.addTransition(new Fade(Fade.OUT));
setTransition(mChannelBannerScene, mEmptyScene, exit);
setTransition(mInputBannerScene, mEmptyScene, exit);
setTransition(mKeypadChannelSwitchScene, mEmptyScene, exit);
setTransition(mSelectInputScene, mEmptyScene, exit);
// All other possible transitions between scenes
TransitionInflater ti = TransitionInflater.from(mMainActivity);
Transition transition = ti.inflateTransition(R.transition.transition_between_scenes);
setTransition(mChannelBannerScene, mKeypadChannelSwitchScene, transition);
setTransition(mChannelBannerScene, mSelectInputScene, transition);
setTransition(mInputBannerScene, mSelectInputScene, transition);
setTransition(mKeypadChannelSwitchScene, mChannelBannerScene, transition);
setTransition(mKeypadChannelSwitchScene, mSelectInputScene, transition);
setTransition(mSelectInputScene, mChannelBannerScene, transition);
setTransition(mSelectInputScene, mInputBannerScene, transition);
mInitialized = true;
}