UI滑动效果
This commit is contained in:
@@ -352,8 +352,10 @@ public class DiscreteScrollLayoutManager extends LinearLayoutManager {
|
||||
int clampAfterDistance = scrollToChangeCurrent * transformClampItemCount;
|
||||
for (int i = 0; i < recyclerViewProxy.getChildCount(); i++) {
|
||||
View child = recyclerViewProxy.getChildAt(i);
|
||||
|
||||
//RecyclerView.ViewHolder childViewHolder = recyclerView.getChildViewHolder(child);
|
||||
float position = getCenterRelativePositionOf(child, clampAfterDistance);
|
||||
itemTransformer.transformItem(child, position);
|
||||
itemTransformer.transformItem(child,null, position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.yarolegovich.discretescrollview.transform;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* Created by yarolegovich on 02.03.2017.
|
||||
*/
|
||||
|
||||
public interface DiscreteScrollItemTransformer {
|
||||
void transformItem(View item, float position);
|
||||
void transformItem(View item, RecyclerView.ViewHolder childViewHolder,float position);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.yarolegovich.discretescrollview.transform;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.annotation.FloatRange;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* Created by yarolegovich on 03.03.2017.
|
||||
@@ -21,7 +22,7 @@ public class ScaleTransformer implements DiscreteScrollItemTransformer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformItem(View item, float position) {
|
||||
public void transformItem(View item, RecyclerView.ViewHolder childViewHolder, float position) {
|
||||
pivotX.setOn(item);
|
||||
pivotY.setOn(item);
|
||||
float closenessToCenter = 1f - Math.abs(position);
|
||||
|
||||
Reference in New Issue
Block a user