I'm using makeclipRevealAnimation of actvityOptionComapat to open new activity but I want circular to reveal effect but I am getting in the square.
Is it possible to get it circular effect?
button.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this,SecActivity.class);
ActivityOptionsCompat activityOptionsCompat=
ActivityOptionsCompat.makeClipRevealAnimation(button,
button.getMeasuredWidth(),button.getMeasuredWidth(),
relativeLayout.getWidth(),relativeLayout.getHeight());
startActivity(intent,activityOptionsCompat.toBundle());
}
});
}
I am using this and it works correctly. It is written in Kotlin but you will not have problems to do it in Java.
//Start an activity from a specific point with reveal animation.
fun revealBundle(v: View): Bundle? {
var opts: ActivityOptions? = null
when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> {
val left = 0
val top = 0
val width = v.measuredWidth
val height = v.measuredHeight
opts = ActivityOptions.makeClipRevealAnimation(v, left, top, width, height)
}
Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP -> opts = ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.measuredWidth, v.measuredHeight)
}
return opts?.toBundle()
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With