本文整理汇总了Java中android.transition.ChangeBounds.setDuration方法的典型用法代码示例。如果您正苦于以下问题:Java ChangeBounds.setDuration方法的具体用法?Java ChangeBounds.setDuration怎么用?Java ChangeBounds.setDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.transition.ChangeBounds
的用法示例。
在下文中一共展示了ChangeBounds.setDuration方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addNextFragment
import android.transition.ChangeBounds; //导入方法依赖的package包/类
private void addNextFragment(Sample sample, ImageView squareBlue, boolean overlap) {
SharedElementFragment2 sharedElementFragment2 = SharedElementFragment2.newInstance(sample);
Slide slideTransition = new Slide(Gravity.RIGHT);
slideTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
ChangeBounds changeBoundsTransition = new ChangeBounds();
changeBoundsTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
sharedElementFragment2.setEnterTransition(slideTransition);
sharedElementFragment2.setAllowEnterTransitionOverlap(overlap);
sharedElementFragment2.setAllowReturnTransitionOverlap(overlap);
sharedElementFragment2.setSharedElementEnterTransition(changeBoundsTransition);
getFragmentManager().beginTransaction()
.replace(R.id.sample2_content, sharedElementFragment2)
.addToBackStack(null)
.addSharedElement(squareBlue, getString(R.string.square_blue_name))
.commit();
}
示例2: getNextButtonTransition
import android.transition.ChangeBounds; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private ChangeBounds getNextButtonTransition() {
ChangeBounds arcMoveTransition = new ChangeBounds();
//create "zorro" like path
arcMoveTransition.setPathMotion(new PathMotion() {
@Override
public Path getPath(float startX, float startY, float endX, float endY) {
Path p = new Path();
p.moveTo(startX, startY);
p.lineTo(endX, startY);
p.lineTo(startX, endY);
p.lineTo(endX, endY);
return p;
}
});
arcMoveTransition.setDuration(500);
arcMoveTransition.setInterpolator(new AccelerateDecelerateInterpolator());
return arcMoveTransition;
}
示例3: onCreate
import android.transition.ChangeBounds; //导入方法依赖的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);
}
示例4: addSharedElementTranstion
import android.transition.ChangeBounds; //导入方法依赖的package包/类
private void addSharedElementTranstion(Fragment fragment) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ChangeBounds changeBoundsTransition = new ChangeBounds();
changeBoundsTransition.setDuration(300);
fragment.setSharedElementEnterTransition(changeBoundsTransition);
}
}
示例5: setupTransitions
import android.transition.ChangeBounds; //导入方法依赖的package包/类
private void setupTransitions() {
// Slide slide = new Slide(Gravity.BOTTOM);
// slide.excludeTarget(android.R.id.statusBarBackground, true);
// getWindow().setEnterTransition(slide);
// getWindow().setSharedElementsUseOverlay(false);
mTransitionManager = new TransitionManager();
ViewGroup transitionRoot = detailContainer;
// Expanded scene
mExpandedScene = Scene.getSceneForLayout(transitionRoot,
R.layout.activity_album_detail_expanded, this);
mExpandedScene.setEnterAction(new Runnable() {
@Override
public void run() {
ButterKnife.bind(AlbumDetailActivity.this);
populate();
mCurrentScene = mExpandedScene;
}
});
TransitionSet expandTransitionSet = new TransitionSet();
expandTransitionSet.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
ChangeBounds changeBounds = new ChangeBounds();
changeBounds.setDuration(200);
expandTransitionSet.addTransition(changeBounds);
Fade fadeLyrics = new Fade();
fadeLyrics.addTarget(R.id.lyrics);
fadeLyrics.setDuration(150);
expandTransitionSet.addTransition(fadeLyrics);
// Collapsed scene
mCollapsedScene = Scene.getSceneForLayout(transitionRoot,
R.layout.activity_album_detail, this);
mCollapsedScene.setEnterAction(new Runnable() {
@Override
public void run() {
ButterKnife.bind(AlbumDetailActivity.this);
populate();
mCurrentScene = mCollapsedScene;
}
});
TransitionSet collapseTransitionSet = new TransitionSet();
collapseTransitionSet.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
Fade fadeOutLyrics = new Fade();
fadeOutLyrics.addTarget(R.id.lyrics);
fadeOutLyrics.setDuration(150);
collapseTransitionSet.addTransition(fadeOutLyrics);
ChangeBounds resetBounds = new ChangeBounds();
resetBounds.setDuration(200);
collapseTransitionSet.addTransition(resetBounds);
mTransitionManager.setTransition(mExpandedScene, mCollapsedScene, collapseTransitionSet);
mTransitionManager.setTransition(mCollapsedScene, mExpandedScene, expandTransitionSet);
mCollapsedScene.enter();
// postponeEnterTransition();
}
示例6: setUpTransitions
import android.transition.ChangeBounds; //导入方法依赖的package包/类
private void setUpTransitions() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setSharedElementsUseOverlay(true);
final float[] buttonLocation = getIntent().getFloatArrayExtra(EXTRA_REVEAL_ANIM_LOCATION);
final float x = buttonLocation[0];
final float y = buttonLocation[1];
CircularRevealTransition circularRevealTransition = new CircularRevealTransition(x, y);
circularRevealTransition.addTarget(getString(R.string.transition_name_circular_reveal));
circularRevealTransition.setInterpolator(new FastOutSlowInInterpolator());
Slide enterSlide = new Slide();
enterSlide.setDuration(300);
enterSlide.setStartDelay(400);
enterSlide.setInterpolator(new FastOutSlowInInterpolator());
enterSlide.excludeTarget(getString(R.string.transition_name_circular_reveal), true);
enterSlide.excludeTarget(Window.STATUS_BAR_BACKGROUND_TRANSITION_NAME, true);
Slide returnSide = new Slide();
returnSide.setDuration(300);
returnSide.setInterpolator(new FastOutSlowInInterpolator());
returnSide.excludeTarget(getString(R.string.transition_name_circular_reveal), true);
returnSide.excludeTarget(Window.STATUS_BAR_BACKGROUND_TRANSITION_NAME, true);
TransitionSet set =
new TransitionSet().addTransition(circularRevealTransition).addTransition(enterSlide);
TransitionSet set2 =
new TransitionSet().addTransition(returnSide).addTransition(circularRevealTransition);
getWindow().setEnterTransition(set);
getWindow().setReturnTransition(set2);
ChangeBounds enterBounds = new ChangeBounds();
enterBounds.setDuration(300);
enterBounds.setStartDelay(400);
enterBounds.setInterpolator(new FastOutSlowInInterpolator());
ChangeBounds returnBounds = new ChangeBounds();
returnBounds.setDuration(300);
returnBounds.setInterpolator(new FastOutSlowInInterpolator());
getWindow().setSharedElementEnterTransition(enterBounds);
getWindow().setSharedElementReturnTransition(returnBounds);
}
}
示例7: getTransition
import android.transition.ChangeBounds; //导入方法依赖的package包/类
/**
* Get Transition between MainActivity and ChooseLocationActivity
*
* @param duration specified duration of transition
* @return transition
*/
private Transition getTransition(int duration) {
ChangeBounds bounds = new ChangeBounds();
bounds.setDuration(duration);
return bounds;
}