Cardview item becomes invisible and animation has low fps
zboing opened this issue · 1 comments
zboing commented
Samsung Galaxy S6, OS: 5.1.1, Android Studio 2.3 beta 1
Top cardview is an admob native cardview express (maybe related to #52 )
http://sendvid.com/l77kmmza (in the video recording the issue cannot be noticed...)
class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final Context mContext;
private final List<Object> mRecyclerViewItems;
public RecyclerViewAdapter(Context context, List<Object> recyclerViewItems) {
this.mContext = context;
this.mRecyclerViewItems = recyclerViewItems;
}
public class MenuItemViewHolder extends RecyclerView.ViewHolder {
private CardView myView;
private int cx;
private int cy;
private float finalRadius;
MenuItemViewHolder(final View view) {
super(view);
myView = (CardView) view.findViewById(R.id.menu_item_card_view);
view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(final View v, int left, int top, int right,
int bottom, int oldLeft, int oldTop,
int oldRight, int oldBottom) {
v.removeOnLayoutChangeListener(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cx = (myView.getLeft() + myView.getRight()) / 2;
cy = (myView.getTop() + myView.getBottom()) / 2;
int dx = Math.max(cx, myView.getWidth() - cx);
int dy = Math.max(cy, myView.getHeight() - cy);
finalRadius = (float) Math.hypot(dx, dy);
Log.v("tag","1 "+finalRadius+" "+cx+" "+cy);
} else {
}
}
});
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Android native animator
Animator animator = ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
Log.v("tag","2 "+finalRadius+" "+cx+" "+cy);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(1500);
animator.start();
Xml:
<?xml version="1.0" encoding="utf-8"?>
<io.codetail.widget.RevealFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
xmlns:app="http://schemas.android.com/tools"
style="@style/CardView"
android:id="@+id/menu_item_card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true"
app:cardBackgroundColor="@color/colorAccent"
app:cardCornerRadius="@dimen/cardview_default_radius"
app:cardElevation="@dimen/cardview_default_elevation" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_horizontal_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<TextView
......
zboing commented
issue was caused by using in another xml: com.flaviofaria.kenburnsview.KenBurnsView component