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


Java ActivityOptionsCompat.makeClipRevealAnimation方法代码示例

本文整理汇总了Java中android.support.v4.app.ActivityOptionsCompat.makeClipRevealAnimation方法的典型用法代码示例。如果您正苦于以下问题:Java ActivityOptionsCompat.makeClipRevealAnimation方法的具体用法?Java ActivityOptionsCompat.makeClipRevealAnimation怎么用?Java ActivityOptionsCompat.makeClipRevealAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.ActivityOptionsCompat的用法示例。


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

示例1: goToMain

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
public static void goToMain(AppCompatActivity activity, View view) {
    ActivityOptionsCompat aoc;
    if (AndroidVersions.isLollipop() && view != null) {
        aoc = ActivityOptionsCompat.makeClipRevealAnimation(view,
                0,
                0,
                view.getWidth(),
                view.getHeight());
    } else {
        aoc = ActivityOptionsCompat.makeBasic();
    }
    Intent intent = new Intent(activity, MainActivity.class);
    ActivityCompat.startActivity(activity, intent, aoc.toBundle());
    ActivityCompat.finishAffinity(activity);
}
 
开发者ID:maddog05,项目名称:whatanime-android,代码行数:16,代码来源:Navigator.java

示例2: startReveal

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
public static void startReveal(@NonNull Activity activity, Intent intent, @NonNull View sharedElement, int requestCode) {
    if (!PrefGetter.isAppAnimationDisabled()) {
        ActivityOptionsCompat options = ActivityOptionsCompat.makeClipRevealAnimation(sharedElement, sharedElement.getWidth() / 2,
                sharedElement.getHeight() / 2,
                sharedElement.getWidth(), sharedElement.getHeight());
        activity.startActivityForResult(intent, requestCode, options.toBundle());
    } else {
        activity.startActivityForResult(intent, requestCode);
    }
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:11,代码来源:ActivityHelper.java

示例3: startActivity

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
public void startActivity(Intent intent) {
    ActivityOptionsCompat options =  ActivityOptionsCompat.makeClipRevealAnimation(view, pivotX, pivotY, view.getWidth(), view.getHeight());
    view.getContext().startActivity(intent, options.toBundle());
}
 
开发者ID:Mindjet,项目名称:LiteReader,代码行数:5,代码来源:TransManager.java

示例4: navigateWithRippleCompat

import android.support.v4.app.ActivityOptionsCompat; //导入方法依赖的package包/类
/**
 * 带水波动画的Activity跳转
 */
@SuppressLint("NewApi")
protected void navigateWithRippleCompat(final Activity activity, final Intent intent,
                                        final View triggerView, @ColorRes int color) {

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        ActivityOptionsCompat option = ActivityOptionsCompat.makeClipRevealAnimation(triggerView, 0, 0,
                triggerView.getMeasuredWidth(), triggerView.getMeasuredHeight());
        ActivityCompat.startActivity(activity, intent, option.toBundle());

        return;
    }

    int[] location = new int[2];
    triggerView.getLocationInWindow(location);
    final int cx = location[0] + triggerView.getWidth() / 2;
    final int cy = location[1] + triggerView.getHeight() / 2;
    final ImageView view = new ImageView(activity);
    view.setImageResource(color);
    final ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
    int w = decorView.getWidth();
    int h = decorView.getHeight();
    decorView.addView(view, w, h);
    int finalRadius = (int) Math.sqrt(w * w + h * h) + 1;
    Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius);
    anim.setDuration(500);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);

            activity.startActivity(intent);
            activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            decorView.postDelayed(new Runnable() {
                @Override
                public void run() {
                    decorView.removeView(view);
                }
            }, 500);
        }
    });
    anim.start();
}
 
开发者ID:woxingxiao,项目名称:GracefulMovies,代码行数:46,代码来源:BaseActivity.java


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