当前位置: 首页>>代码示例>>Java>>正文


Java ArcMotion类代码示例

本文整理汇总了Java中android.transition.ArcMotion的典型用法代码示例。如果您正苦于以下问题:Java ArcMotion类的具体用法?Java ArcMotion怎么用?Java ArcMotion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ArcMotion类属于android.transition包,在下文中一共展示了ArcMotion类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setMotion

import android.transition.ArcMotion; //导入依赖的package包/类
/**
 * 设置自定义 Shared Element切换动画
 * 默认不开启曲线路径切换动画,
 * 开启需要重写setHeaderPicView(),和调用此方法并将isShow值设为true
 *
 * @param imageView 共享的图片
 * @param isShow    是否显示曲线动画
 */
protected void setMotion(ImageView imageView, boolean isShow) {
    if (!isShow) {
        return;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        //定义ArcMotion
        ArcMotion arcMotion = new ArcMotion();
        arcMotion.setMinimumHorizontalAngle(50f);
        arcMotion.setMinimumVerticalAngle(50f);
        //插值器,控制速度
        Interpolator interpolator = AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in);

        //实例化自定义的ChangeBounds
        CustomChangeBounds changeBounds = new CustomChangeBounds();
        changeBounds.setPathMotion(arcMotion);
        changeBounds.setInterpolator(interpolator);
        changeBounds.addTarget(imageView);
        //将切换动画应用到当前的Activity的进入和返回
        getWindow().setSharedElementEnterTransition(changeBounds);
        getWindow().setSharedElementReturnTransition(changeBounds);
    }
}
 
开发者ID:joelan,项目名称:ClouldReader,代码行数:31,代码来源:BaseHeaderActivity.java

示例2: setMotion

import android.transition.ArcMotion; //导入依赖的package包/类
/**
 * 设置自定义 Shared Element切换动画
 */
private void setMotion() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        //定义ArcMotion
        ArcMotion arcMotion = new ArcMotion();
        arcMotion.setMinimumHorizontalAngle(50f);
        arcMotion.setMinimumVerticalAngle(50f);
        //插值器,控制速度
        Interpolator interpolator = AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in);

        //实例化自定义的ChangeBounds
        CustomChangeBounds changeBounds = new CustomChangeBounds();
        changeBounds.setPathMotion(arcMotion);
        changeBounds.setInterpolator(interpolator);
        changeBounds.addTarget(binding.include.ivOnePhoto);
        //将切换动画应用到当前的Activity的进入和返回
        getWindow().setSharedElementEnterTransition(changeBounds);
        getWindow().setSharedElementReturnTransition(changeBounds);
    }
}
 
开发者ID:youlookwhat,项目名称:ScrollShapeUI,代码行数:23,代码来源:NeteasePlaylistActivity.java

示例3: setupSharedEelementTransitions

import android.transition.ArcMotion; //导入依赖的package包/类
public void setupSharedEelementTransitions() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
        return; //Show dialog normally if below Lollipop
    ArcMotion arcMotion = new ArcMotion();
    arcMotion.setMinimumHorizontalAngle(50f);
    arcMotion.setMinimumVerticalAngle(50f);

    Interpolator easeInOut = AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in);

    MorphFabToDialog sharedEnter = new MorphFabToDialog(getBackgroundColor());
    sharedEnter.setPathMotion(arcMotion);
    sharedEnter.setInterpolator(easeInOut);

    MorphDialogToFab sharedReturn = new MorphDialogToFab(getBackgroundColor());
    sharedReturn.setPathMotion(arcMotion);
    sharedReturn.setInterpolator(easeInOut);

    if (ui.container != null) {
        sharedEnter.addTarget(ui.container);
        sharedReturn.addTarget(ui.container);
    }
    getWindow().setSharedElementEnterTransition(sharedEnter);
    getWindow().setSharedElementReturnTransition(sharedReturn);
}
 
开发者ID:AdityaAnand1,项目名称:Morphing-Material-Dialogs,代码行数:25,代码来源:DialogActivity.java

示例4: onClick

import android.transition.ArcMotion; //导入依赖的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();
}
 
开发者ID:zawadz88,项目名称:AnimationShowcase,代码行数:25,代码来源:FragmentSharedElementTransitionSource.java

示例5: setupSharedEelementTransitions1

import android.transition.ArcMotion; //导入依赖的package包/类
/**
 * 使用方式一:调用setupSharedEelementTransitions1方法
 * 使用这种方式的话需要的类是 MorphDrawable, MorphFabToDialog, MorphDialogToFab
 */
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void setupSharedEelementTransitions1() {
    ArcMotion arcMotion = new ArcMotion();
    arcMotion.setMinimumHorizontalAngle(50f);
    arcMotion.setMinimumVerticalAngle(50f);

    Interpolator easeInOut = AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in);

    MorphFabToDialog sharedEnter = new MorphFabToDialog();
    sharedEnter.setPathMotion(arcMotion);
    sharedEnter.setInterpolator(easeInOut);

    MorphDialogToFab sharedReturn = new MorphDialogToFab();
    sharedReturn.setPathMotion(arcMotion);
    sharedReturn.setInterpolator(easeInOut);

    if (container != null) {
        sharedEnter.addTarget(container);
        sharedReturn.addTarget(container);
    }
    getWindow().setSharedElementEnterTransition(sharedEnter);
    getWindow().setSharedElementReturnTransition(sharedReturn);
}
 
开发者ID:li-yu,项目名称:Huahui-Android,代码行数:28,代码来源:QueryActivity.java

示例6: createTransition

import android.transition.ArcMotion; //导入依赖的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;
}
 
开发者ID:SiimKinks,项目名称:unicorn,代码行数:19,代码来源:ArcMoveTransitionHandler.java

示例7: setMotion

import android.transition.ArcMotion; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setMotion() {
    // Activity设置自定义 Shared Element切换动画
    //定义ArcMotion
    ArcMotion arcMotion = new ArcMotion();
    arcMotion.setMinimumHorizontalAngle(50f);
    arcMotion.setMinimumVerticalAngle(50f);
    //插值器,控制速度
    Interpolator interpolator = AnimationUtils
            .loadInterpolator(this, android.R.interpolator.fast_out_slow_in);
    //实例化自定义的ChangeBounds
    CustomChangeBounds changeBounds = new CustomChangeBounds();
    changeBounds.setPathMotion(arcMotion);
    changeBounds.setInterpolator(interpolator);
    changeBounds.addTarget(mBinding.comicThumbnailComicDetails);
    //将切换动画应用到当前的Activity的进入和返回
    getWindow().setSharedElementEnterTransition(changeBounds);
    getWindow().setSharedElementReturnTransition(changeBounds);
}
 
开发者ID:huxizhijian,项目名称:HHComicViewer,代码行数:20,代码来源:ComicDetailsActivity.java

示例8: onCreate

import android.transition.ArcMotion; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_custom_transition_second);
    ViewGroup container = (ViewGroup) findViewById(R.id.container);
    getSupportActionBar().setTitle("第二个Activity");

    /*  自定义 Shared Element切换动画 */

    //定义ArcMotion
    ArcMotion arcMotion = new ArcMotion();
    arcMotion.setMinimumHorizontalAngle(50f);
    arcMotion.setMinimumVerticalAngle(50f);

    // 设置插值器 - 慢进快出
    Interpolator interpolator = AnimationUtils
            .loadInterpolator(this, android.R.interpolator.fast_out_slow_in);

    //实例化自定义的ChangeBounds
    CustomChangeBounds changeBounds = new CustomChangeBounds();
    changeBounds.setPathMotion(arcMotion);
    changeBounds.setInterpolator(interpolator);
    changeBounds.addTarget(container);

    //将切换动画应用到当前的Activity的进入和返回
    getWindow().setSharedElementEnterTransition(changeBounds);
    getWindow().setSharedElementReturnTransition(changeBounds);

}
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:30,代码来源:CustomTransitionSecondActivity.java

示例9: getTransition

import android.transition.ArcMotion; //导入依赖的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;
}
 
开发者ID:zawadz88,项目名称:Conductor-TransitionsEverywhere,代码行数:14,代码来源:ArcFadeMoveChangeHandler.java

示例10: setupSharedEelementTransitions2

import android.transition.ArcMotion; //导入依赖的package包/类
/**
 * 使用方式二:调用setupSharedEelementTransitions2方法
 * 使用这种方式的话需要的类是 MorphDrawable, MorphTransition
 */
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void setupSharedEelementTransitions2() {
    ArcMotion arcMotion = new ArcMotion();
    arcMotion.setMinimumHorizontalAngle(50f);
    arcMotion.setMinimumVerticalAngle(50f);

    Interpolator easeInOut = AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in);

    //hujiawei 100是随意给的一个数字,可以修改,需要注意的是这里调用container.getHeight()结果为0
    MorphTransition sharedEnter = new MorphTransition(ContextCompat.getColor(this, R.color.colorPrimary),
            ContextCompat.getColor(this, R.color.white), 100, getResources().getDimensionPixelSize(R.dimen.dialog_corners), true);
    sharedEnter.setPathMotion(arcMotion);
    sharedEnter.setInterpolator(easeInOut);

    MorphTransition sharedReturn = new MorphTransition(ContextCompat.getColor(this, R.color.colorPrimary),
            ContextCompat.getColor(this, R.color.white), getResources().getDimensionPixelSize(R.dimen.dialog_corners), 100, false);
    sharedReturn.setPathMotion(arcMotion);
    sharedReturn.setInterpolator(easeInOut);

    if (container != null) {
        sharedEnter.addTarget(container);
        sharedReturn.addTarget(container);
    }
    getWindow().setSharedElementEnterTransition(sharedEnter);
    getWindow().setSharedElementReturnTransition(sharedReturn);
}
 
开发者ID:li-yu,项目名称:Huahui-Android,代码行数:31,代码来源:QueryActivity.java

示例11: ImageTransition

import android.transition.ArcMotion; //导入依赖的package包/类
public ImageTransition() {
    setOrdering(ORDERING_TOGETHER);
    addTransition(new ChangeBounds());
    addTransition(new ChangeTransform());
    addTransition(new ChangeImageTransform());
    setPathMotion(new ArcMotion());
}
 
开发者ID:fzymek,项目名称:FunWithAndroid,代码行数:8,代码来源:ImageTransition.java

示例12: ArcMotion

import android.transition.ArcMotion; //导入依赖的package包/类
public ArcMotion()
{ }
 
开发者ID:MSay2,项目名称:Mire,代码行数:3,代码来源:ArcMotion.java

示例13: setupSharedElementTransitions

import android.transition.ArcMotion; //导入依赖的package包/类
/**
 * Configure the shared element transitions for morphin from a fab <-> dialog. We need to do
 * this in code rather than declaratively as we need to supply the color to transition from/to
 * and the dialog corner radius which is dynamically supplied depending upon where this screen
 * is launched from.
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void setupSharedElementTransitions(@NonNull Activity activity,
                                                 @Nullable View mockFab,
                                                 int dialogCornerRadius) {
    if (!activity.getIntent().hasExtra(EXTRA_SHARED_ELEMENT_START_COLOR)) return;

    int startCornerRadius = activity.getIntent()
            .getIntExtra(EXTRA_SHARED_ELEMENT_START_CORNER_RADIUS, -1);

    ArcMotion arcMotion = new ArcMotion();
    arcMotion.setMinimumHorizontalAngle(5f);
    arcMotion.setMinimumVerticalAngle(10f);
    arcMotion.setMaximumAngle(10f);
    int color = activity.getIntent().getIntExtra(EXTRA_SHARED_ELEMENT_START_COLOR, Color.TRANSPARENT);
    Interpolator easeInOut =
            AnimationUtils.loadInterpolator(activity, android.R.interpolator.fast_out_slow_in);
    MorphFabToDialog sharedEnter =
            new MorphFabToDialog(color, dialogCornerRadius, startCornerRadius);
    sharedEnter.setPathMotion(arcMotion);
    sharedEnter.setInterpolator(easeInOut);
    MorphDialogToFab sharedReturn = new MorphDialogToFab(color, startCornerRadius);
    sharedReturn.setPathMotion(arcMotion);
    sharedReturn.setInterpolator(easeInOut);
    if (mockFab != null) {
        sharedEnter.addTarget(mockFab);
        sharedReturn.addTarget(mockFab);
    }

    TransitionSet set = new TransitionSet();
    set.addTransition(sharedEnter);

    //TODO: Elevation flicker is due to FAB still visible
    set.addTransition(new ChangeElevation());

    TransitionSet set2 = new TransitionSet();
    set2.addTransition(sharedReturn);
    set2.addTransition(new ChangeElevation());

    activity.getWindow().setSharedElementEnterTransition(set);
    activity.getWindow().setSharedElementReturnTransition(set2);
}
 
开发者ID:plusCubed,项目名称:anticipate,代码行数:48,代码来源:FabDialogMorphSetup.java

示例14: createTransition

import android.transition.ArcMotion; //导入依赖的package包/类
@Override protected Transition createTransition() {
    final Transition transition = new ChangeBounds();
    transition.setPathMotion(new ArcMotion());
    transition.setDuration(500);
    return transition;
}
 
开发者ID:xu6148152,项目名称:binea_project_for_android,代码行数:7,代码来源:PathMotionSample.java


注:本文中的android.transition.ArcMotion类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。