39 lines
1.9 KiB
Java
39 lines
1.9 KiB
Java
package androidx.recyclerview.widget;
|
|
|
|
import android.view.View;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
/* loaded from: classes.dex */
|
|
class ScrollbarHelper {
|
|
static int a(RecyclerView.State state, OrientationHelper orientationHelper, View view, View view2, RecyclerView.LayoutManager layoutManager, boolean z, boolean z2) {
|
|
if (layoutManager.e() == 0 || state.a() == 0 || view == null || view2 == null) {
|
|
return 0;
|
|
}
|
|
int max = z2 ? Math.max(0, (state.a() - Math.max(layoutManager.l(view), layoutManager.l(view2))) - 1) : Math.max(0, Math.min(layoutManager.l(view), layoutManager.l(view2)));
|
|
if (z) {
|
|
return Math.round((max * (Math.abs(orientationHelper.a(view2) - orientationHelper.d(view)) / (Math.abs(layoutManager.l(view) - layoutManager.l(view2)) + 1))) + (orientationHelper.f() - orientationHelper.d(view)));
|
|
}
|
|
return max;
|
|
}
|
|
|
|
static int b(RecyclerView.State state, OrientationHelper orientationHelper, View view, View view2, RecyclerView.LayoutManager layoutManager, boolean z) {
|
|
if (layoutManager.e() == 0 || state.a() == 0 || view == null || view2 == null) {
|
|
return 0;
|
|
}
|
|
if (!z) {
|
|
return state.a();
|
|
}
|
|
return (int) (((orientationHelper.a(view2) - orientationHelper.d(view)) / (Math.abs(layoutManager.l(view) - layoutManager.l(view2)) + 1)) * state.a());
|
|
}
|
|
|
|
static int a(RecyclerView.State state, OrientationHelper orientationHelper, View view, View view2, RecyclerView.LayoutManager layoutManager, boolean z) {
|
|
if (layoutManager.e() == 0 || state.a() == 0 || view == null || view2 == null) {
|
|
return 0;
|
|
}
|
|
if (!z) {
|
|
return Math.abs(layoutManager.l(view) - layoutManager.l(view2)) + 1;
|
|
}
|
|
return Math.min(orientationHelper.g(), orientationHelper.a(view2) - orientationHelper.d(view));
|
|
}
|
|
}
|