60 lines
2.1 KiB
Java
60 lines
2.1 KiB
Java
package androidx.recyclerview.widget;
|
|
|
|
import android.graphics.Canvas;
|
|
import android.view.View;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.recyclerview.R;
|
|
/* loaded from: classes.dex */
|
|
public class ItemTouchUIUtilImpl implements ItemTouchUIUtil {
|
|
public static final ItemTouchUIUtil INSTANCE = new ItemTouchUIUtilImpl();
|
|
|
|
private static float findMaxElevation(RecyclerView recyclerView, View view) {
|
|
int childCount = recyclerView.getChildCount();
|
|
float f = 0.0f;
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = recyclerView.getChildAt(i);
|
|
if (childAt != view) {
|
|
float elevation = ViewCompat.getElevation(childAt);
|
|
if (elevation > f) {
|
|
f = elevation;
|
|
}
|
|
}
|
|
}
|
|
return f;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.ItemTouchUIUtil
|
|
public void clearView(View view) {
|
|
int i = R.id.item_touch_helper_previous_elevation;
|
|
Object tag = view.getTag(i);
|
|
if (tag instanceof Float) {
|
|
ViewCompat.setElevation(view, ((Float) tag).floatValue());
|
|
}
|
|
view.setTag(i, null);
|
|
view.setTranslationX(0.0f);
|
|
view.setTranslationY(0.0f);
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.ItemTouchUIUtil
|
|
public void onDraw(Canvas canvas, RecyclerView recyclerView, View view, float f, float f2, int i, boolean z2) {
|
|
if (z2) {
|
|
int i2 = R.id.item_touch_helper_previous_elevation;
|
|
if (view.getTag(i2) == null) {
|
|
Float valueOf = Float.valueOf(ViewCompat.getElevation(view));
|
|
ViewCompat.setElevation(view, findMaxElevation(recyclerView, view) + 1.0f);
|
|
view.setTag(i2, valueOf);
|
|
}
|
|
}
|
|
view.setTranslationX(f);
|
|
view.setTranslationY(f2);
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.ItemTouchUIUtil
|
|
public void onDrawOver(Canvas canvas, RecyclerView recyclerView, View view, float f, float f2, int i, boolean z2) {
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.ItemTouchUIUtil
|
|
public void onSelected(View view) {
|
|
}
|
|
}
|