本文整理汇总了Java中android.transition.ChangeBounds类的典型用法代码示例。如果您正苦于以下问题:Java ChangeBounds类的具体用法?Java ChangeBounds怎么用?Java ChangeBounds使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChangeBounds类属于android.transition包,在下文中一共展示了ChangeBounds类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
import android.transition.ChangeBounds; //导入依赖的package包/类
@OnClick(R.id.square2)
public void onClick() {
FragmentSharedElementTransitionTarget targetFragment = new FragmentSharedElementTransitionTarget();
// FIXME: 08/02/2017 the shared element transitions to the next fragment below other views while it should be on top as in Activity transitions
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(new ChangeBounds());
transitionSet.setPathMotion(new ArcMotion());
targetFragment.setSharedElementEnterTransition(transitionSet);
targetFragment.setSharedElementReturnTransition(transitionSet);
targetFragment.setEnterTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.slide_bottom));
targetFragment.setExitTransition(TransitionInflater.from(getActivity()).inflateTransition(R.transition.slide_top_and_fade));
setExitTransition(new Explode());
setReenterTransition(new Explode());
setAllowReturnTransitionOverlap(false);
}
getActivity().getSupportFragmentManager()
.beginTransaction()
.addSharedElement(square2, getString(R.string.custom_element_transition_name))
.replace(R.id.fragmentContainer, targetFragment)
.addToBackStack(null)
.commit();
}
示例2: handleTransitions
import android.transition.ChangeBounds; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void handleTransitions() {
useSysTransition = getIntent().getBooleanExtra(KEY_USE_SYS_TRANSITION, false);
if(useSysTransition) {
ivDetail.setVisibility(View.VISIBLE);
Fade fade = new Fade();
fade.setDuration(500);
getWindow().setEnterTransition(fade);
getWindow().setExitTransition(fade);
ChangeBounds changeBounds = new ChangeBounds();
getWindow().setSharedElementEnterTransition(changeBounds);
}
entity = (TransitionsEntity) getIntent().getSerializableExtra(KEY_ENTITY);
KLog.d(entity);
GlideUtils.displayImage(this, ivDetail, entity.getUrl(), R.drawable.def_placeholder);
}
示例3: 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();
}
示例4: 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;
}
示例5: startTransition
import android.transition.ChangeBounds; //导入依赖的package包/类
private void startTransition(){
lifeGridFragment = LifeGridFragment.newInstance();
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
if(Build.VERSION.SDK_INT >= 21) {
TransitionSet gridTransition = new TransitionSet();
gridTransition.setDuration(600);
gridTransition.addTransition(new ChangeBounds());
gridTransition.addTransition((new ChangeTransform()));
lifeGridFragment.setSharedElementEnterTransition(gridTransition);
}
fragmentTransaction.addSharedElement(findViewById(R.id.intro_card_view), getString(R.string.card_view_transition_name));
fragmentTransaction.replace(R.id.container, lifeGridFragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
appBarLayout.setExpanded(false, true);
}
示例6: startToolbarAnimation
import android.transition.ChangeBounds; //导入依赖的package包/类
public static void startToolbarAnimation(
Context context,
ViewGroup v
) {
if (new UpdaterOptions(context).disableAnimations()) {
return;
}
if (Build.VERSION.SDK_INT >= 21) {
TransitionManager.beginDelayedTransition(v, new TransitionSet()
.addTransition(new Fade(Fade.IN))
.addTransition(new Slide(Gravity.LEFT))
.addTransition(new ChangeBounds())
);
} else if (Build.VERSION.SDK_INT >= 14){
android.support.transition.TransitionManager.beginDelayedTransition(v, new AutoTransition().setDuration(250));
} {
// No animation
}
}
示例7: createTransition
import android.transition.ChangeBounds; //导入依赖的package包/类
@NonNull
@Override
protected Transition createTransition(@NonNull ViewGroup container, @NonNull View entering, @Nullable View leaving, boolean push) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
return new TransitionSet()
.setOrdering(ORDERING_TOGETHER)
.addTransition(new Fade(Fade.OUT))
.addTransition(new Fade(Fade.IN));
}
final TransitionSet transition = new TransitionSet()
.addTransition(new ChangeBounds())
.addTransition(new ChangeClipBounds())
.addTransition(new ChangeTransform());
transition.setPathMotion(new ArcMotion());
return transition;
}
示例8: 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);
}
示例9: onCheckedChanged
import android.transition.ChangeBounds; //导入依赖的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;
}
}
}
示例10: makeSharedElementEnterTransition
import android.transition.ChangeBounds; //导入依赖的package包/类
public static Transition makeSharedElementEnterTransition(List<String> textTransitionNames) {
TransitionSet set = new TransitionSet();
set.setOrdering(TransitionSet.ORDERING_TOGETHER);
Transition recolor = new Recolor();
Transition changeBounds = new ChangeBounds();
Transition textSize = new TextSizeTransition();
for (String textTName : textTransitionNames) {
changeBounds.addTarget(textTName);
textSize.addTarget(textTName);
recolor.addTarget(textTName);
}
set.addTransition(recolor);
set.addTransition(changeBounds);
set.addTransition(textSize);
///set.setDuration(3000);
return set;
}
示例11: setPitchBarPosition
import android.transition.ChangeBounds; //导入依赖的package包/类
private void setPitchBarPosition(double frequency) {
View pitchBar = (View)findViewById(R.id.tune_view_current_pitch);
int margin = 20;
double leftDP = NoteCalculator.getPitchBarPosition(frequency, 560);
Transition moveTransition = new ChangeBounds();
moveTransition.setDuration(300);
moveTransition.setInterpolator(new LinearInterpolator());
TransitionManager.beginDelayedTransition((ViewGroup) pitchBar.getRootView(), moveTransition);
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams)(pitchBar.getLayoutParams());
Log.d(TAG, String.format("Current: %d New: %f", params.leftMargin, leftDP));
params.setMargins((int)leftDP,0,0,0);
pitchBar.setLayoutParams(params);
}
示例12: onTextClick
import android.transition.ChangeBounds; //导入依赖的package包/类
@OnClick({ R.id.text1 })
public void onTextClick() {
// Create a TransitionSet that will animated ChangeBounds and Fade
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(new ChangeBounds());
transitionSet.addTransition(new Fade());
TransitionManager.beginDelayedTransition(mLayout, transitionSet);
// Remove text1 from the Layout
mLayout.removeView(mText1);
// Increase the height of Text1 and set a top margin
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mText1.getLayoutParams();
params.height *= 2;
params.topMargin = 100;
mText1.setLayoutParams(params);
// Add text1 back to the layout
// TransitionManager will automagically apply animations
mLayout.addView(mText1, 1);
}
示例13: createTransitionSet
import android.transition.ChangeBounds; //导入依赖的package包/类
public static TransitionSet createTransitionSet(
ScalingUtils.ScaleType fromScale,
ScalingUtils.ScaleType toScale) {
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(new ChangeBounds());
transitionSet.addTransition(new DraweeTransition(fromScale, toScale));
return transitionSet;
}
示例14: prepare
import android.transition.ChangeBounds; //导入依赖的package包/类
public void prepare(Fragment toFragment) {
final Bundle transitionBundle = TransitionBundleFactory.createTransitionBundle(context, fromView, bitmap);
if (Build.VERSION.SDK_INT >= 21) {
toFragment.setSharedElementEnterTransition(new ChangeBounds());
toFragment.setSharedElementReturnTransition(new ChangeBounds());
}
toFragment.setArguments(transitionBundle);
}
示例15: getTransition
import android.transition.ChangeBounds; //导入依赖的package包/类
@Override
@NonNull
protected Transition getTransition(@NonNull ViewGroup container, View from, View to, boolean isPush) {
TransitionSet transition = new TransitionSet()
.setOrdering(TransitionSet.ORDERING_SEQUENTIAL)
.addTransition(new Fade(Fade.OUT))
.addTransition(new TransitionSet().addTransition(new ChangeBounds()).addTransition(new ChangeClipBounds()).addTransition(new ChangeTransform()))
.addTransition(new Fade(Fade.IN));
transition.setPathMotion(new ArcMotion());
return transition;
}