29 lines
1.3 KiB
Java
29 lines
1.3 KiB
Java
package com.google.android.material.datepicker;
|
|
|
|
import android.content.Context;
|
|
import android.util.DisplayMetrics;
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
import androidx.recyclerview.widget.LinearSmoothScroller;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
/* loaded from: classes.dex */
|
|
class SmoothCalendarLayoutManager extends LinearLayoutManager {
|
|
private static final float MILLISECONDS_PER_INCH = 100.0f;
|
|
|
|
SmoothCalendarLayoutManager(Context context, int i, boolean z) {
|
|
super(context, i, z);
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.LinearLayoutManager, androidx.recyclerview.widget.RecyclerView.LayoutManager
|
|
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int i) {
|
|
LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(recyclerView.getContext()) { // from class: com.google.android.material.datepicker.SmoothCalendarLayoutManager.1
|
|
@Override // androidx.recyclerview.widget.LinearSmoothScroller
|
|
protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
|
|
return SmoothCalendarLayoutManager.MILLISECONDS_PER_INCH / displayMetrics.densityDpi;
|
|
}
|
|
};
|
|
linearSmoothScroller.setTargetPosition(i);
|
|
startSmoothScroll(linearSmoothScroller);
|
|
}
|
|
}
|