本文整理汇总了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);
}
示例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);
}
}
示例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());
}
示例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();
}