mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 16:42:30 -06:00
60 lines
2.2 KiB
Java
60 lines
2.2 KiB
Java
package androidx.recyclerview.widget;
|
|
|
|
import android.graphics.Canvas;
|
|
import android.view.View;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.recyclerview.R;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public class ItemTouchUIUtilImpl implements ItemTouchUIUtil {
|
|
static final ItemTouchUIUtil INSTANCE = new ItemTouchUIUtilImpl();
|
|
|
|
@Override // androidx.recyclerview.widget.ItemTouchUIUtil
|
|
public void onDrawOver(Canvas canvas, RecyclerView recyclerView, View view, float f, float f2, int i, boolean z) {
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.ItemTouchUIUtil
|
|
public void onSelected(View view) {
|
|
}
|
|
|
|
ItemTouchUIUtilImpl() {
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.ItemTouchUIUtil
|
|
public void onDraw(Canvas canvas, RecyclerView recyclerView, View view, float f, float f2, int i, boolean z) {
|
|
if (z && view.getTag(R.id.item_touch_helper_previous_elevation) == null) {
|
|
Float valueOf = Float.valueOf(ViewCompat.getElevation(view));
|
|
ViewCompat.setElevation(view, findMaxElevation(recyclerView, view) + 1.0f);
|
|
view.setTag(R.id.item_touch_helper_previous_elevation, valueOf);
|
|
}
|
|
view.setTranslationX(f);
|
|
view.setTranslationY(f2);
|
|
}
|
|
|
|
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) {
|
|
Object tag = view.getTag(R.id.item_touch_helper_previous_elevation);
|
|
if (tag instanceof Float) {
|
|
ViewCompat.setElevation(view, ((Float) tag).floatValue());
|
|
}
|
|
view.setTag(R.id.item_touch_helper_previous_elevation, null);
|
|
view.setTranslationX(0.0f);
|
|
view.setTranslationY(0.0f);
|
|
}
|
|
}
|