本文整理汇总了Java中android.transition.TransitionManager.go方法的典型用法代码示例。如果您正苦于以下问题:Java TransitionManager.go方法的具体用法?Java TransitionManager.go怎么用?Java TransitionManager.go使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.transition.TransitionManager
的用法示例。
在下文中一共展示了TransitionManager.go方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: goToEmptyScene
import android.transition.TransitionManager; //导入方法依赖的package包/类
public void goToEmptyScene(boolean withAnimation) {
if (mCurrentScene == mEmptyScene) {
return;
}
initIfNeeded();
if (withAnimation) {
mEmptyView.setAlpha(1.0f);
transitionTo(mEmptyScene);
} else {
TransitionManager.go(mEmptyScene, null);
// When transition is null, transition got stuck without calling endTransitions.
TransitionManager.endTransitions(mEmptyScene.getSceneRoot());
// Since Fade.OUT transition doesn't run, we need to set alpha manually.
mEmptyView.setAlpha(0);
}
}
示例2: onCreate
import android.transition.TransitionManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mSceneRoot = (ViewGroup) findViewById(R.id.scene_root);
mScene1 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene1, this);
mScene2 = Scene.getSceneForLayout(mSceneRoot, R.layout.scene2, this);
mTransition = new ChangeBounds();
mTransition.setDuration(DateUtils.SECOND_IN_MILLIS);
mTransition.setInterpolator(new AccelerateDecelerateInterpolator());
TransitionManager.go(mScene1);
mCurrentScene = mScene1;
findViewById(R.id.button).setOnClickListener(this);
}
示例3: onCheckedChanged
import android.transition.TransitionManager; //导入方法依赖的package包/类
@Override public void onCheckedChanged(final RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.select_scene_1: {
// You can start an automatic transition with TransitionManager.go().
TransitionManager.go(mScene1);
break;
}
case R.id.select_scene_2: {
TransitionSet set = new TransitionSet();
Slide slide = new Slide(Gravity.LEFT);
slide.addTarget(R.id.transition_title);
set.addTransition(slide);
set.addTransition(new ChangeBounds());
set.setOrdering(TransitionSet.ORDERING_TOGETHER);
set.setDuration(350);
TransitionManager.go(mScene2, set);
break;
}
case R.id.select_scene_3: {
// You can also start a transition with a custom TransitionManager.
mTransitionManagerForScene3.transitionTo(mScene3);
break;
}
}
}
示例4: changeToConfirmScene
import android.transition.TransitionManager; //导入方法依赖的package包/类
/**
* 共享元素
*/
private void changeToConfirmScene() {
final LayoutOrderConfirmationBinding confBinding = prepareConfirmationBinding();
final Scene scene = new Scene(binding.content,
((ViewGroup) confBinding.getRoot()));
scene.setEnterAction(onEnterConfirmScene(confBinding));
final Transition transition = TransitionInflater.from(getContext())
.inflateTransition(R.transition.transition_confirmation_view);
TransitionManager.go(scene, transition);
}
示例5: changeScene
import android.transition.TransitionManager; //导入方法依赖的package包/类
private void changeScene(int scene) {
switch (scene) {
case 2:
scene3TransitionManager.transitionTo(scenes[2]);
break;
default:
TransitionManager.go(scenes[scene]);
break;
}
}
示例6: onViewCreated
import android.transition.TransitionManager; //导入方法依赖的package包/类
@Override
public void onViewCreated(final View view, final Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (savedInstanceState == null) {
mSceneCurrent = mSceneMessage;
TransitionManager.go(mSceneMessage, mDefaultTransition);
}
}
示例7: goToScene
import android.transition.TransitionManager; //导入方法依赖的package包/类
private void goToScene(@NonNull final Scene scene) {
if (mSceneCurrent != scene) {
mSceneCurrent = scene;
if (mListView != null) {
mListView.clearOnScrollListeners();
}
TransitionManager.go(scene, mDefaultTransition);
}
}
示例8: onClick
import android.transition.TransitionManager; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
if (mCurrentScene == mScene1) {
TransitionManager.go(mScene2, mTransition);
mCurrentScene = mScene2;
} else {
TransitionManager.go(mScene1, mTransition);
mCurrentScene = mScene1;
}
}
示例9: animateFinished
import android.transition.TransitionManager; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
void animateFinished() {
Transition slideFromEnd = new Slide(Gravity.END);
TransitionManager.go(sceneComplete, slideFromEnd);
sceneComplete.getSceneRoot()
.findViewById(R.id.tutorial_done)
.setOnClickListener(this);
}
示例10: onClick
import android.transition.TransitionManager; //导入方法依赖的package包/类
@Override public void onClick(View view) {
if(!transitionFlag){
TransitionManager.go(scene2);
} else {
TransitionManager.go(scene1);
}
transitionFlag = !transitionFlag;
}
示例11: onAnimationEnd
import android.transition.TransitionManager; //导入方法依赖的package包/类
@TargetApi(19)
@Override
public void onAnimationEnd(Animation animation) {
// This method is called at the end of the animation for the fragment transaction,
// which is perfect time to start our Transition.
Log.i(TAG, "Fragment animation ended. Starting a Transition.");
final Scene scene = Scene.getSceneForLayout((ViewGroup) getView(),
R.layout.fragment_detail_content, getActivity());
TransitionManager.go(scene);
// Note that we need to bind views with data after we call TransitionManager.go().
bind(scene.getSceneRoot());
}
示例12: onAnimationEnd
import android.transition.TransitionManager; //导入方法依赖的package包/类
@Override
public void onAnimationEnd(Animation animation) {
// This method is called at the end of the animation for the fragment transaction,
// which is perfect time to start our Transition.
Log.i(TAG, "Fragment animation ended. Starting a Transition.");
final Scene scene = Scene.getSceneForLayout((ViewGroup) getView(),
R.layout.fragment_detail_content, getActivity());
TransitionManager.go(scene);
// Note that we need to bind views with data after we call TransitionManager.go().
bind(scene.getSceneRoot());
}
示例13: onCheckedChanged
import android.transition.TransitionManager; //导入方法依赖的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;
}
}
}
示例14: TransitionLayout
import android.transition.TransitionManager; //导入方法依赖的package包/类
public TransitionLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (!isInEditMode()) {
Resources res = getResources();
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.TransitionLayout);
if (res != null && ta != null) {
int transitionManagerId = ta.getResourceId(R.styleable.TransitionLayout_transitionManager, 0);
if (transitionManagerId > 0) {
transitionManager = TransitionInflater.from(context).inflateTransitionManager(transitionManagerId, this);
}
int[] phases = null;
Scene[] scenes = null;
String scenesStr = ta.getString(R.styleable.TransitionLayout_scenes);
if (scenesStr != null) {
String[] layouts = scenesStr.split(",");
scenes = new Scene[layouts.length];
for (int i = 0; i < layouts.length; i++) {
String layout = layouts[i].trim();
int id = res.getIdentifier(layout, "layout", context.getPackageName());
scenes[i] = Scene.getSceneForLayout(this, id, context);
}
}
String phaseStr = ta.getString(R.styleable.TransitionLayout_transitionPhases);
if (phaseStr != null) {
String[] phasesStr = phaseStr.split(",");
phases = new int[phasesStr.length];
for (int i = 0; i < phasesStr.length; i++) {
String phase = phasesStr[i].trim();
phases[i] = Integer.parseInt(phase);
}
}
if (scenes != null && phases != null && scenes.length == phases.length + 1) {
mScenes = new SparseArray<>(scenes.length);
for (int i = 0; i < phases.length; i++) {
mScenes.put(phases[i], scenes[i + 1]);
}
} else {
throw new RuntimeException("Either scenes or phases aren't defined, or the counts do not match");
}
ta.recycle();
if (transitionManager != null) {
TransitionManager.go(scenes[0], TransitionInflater.from(context).inflateTransition(R.transition.none));
}
}
}
}
示例15: changeScene
import android.transition.TransitionManager; //导入方法依赖的package包/类
private void changeScene(int sceneNumber) {
TransitionManager.go(scenes[sceneNumber], new CircleViewTransition());
}