导航语音的bugs
卡片切换
This commit is contained in:
@@ -18,6 +18,8 @@ import androidx.core.view.accessibility.AccessibilityRecordCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearSmoothScroller;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.alibaba.idst.nls.internal.utils.L;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.yarolegovich.discretescrollview.transform.DiscreteScrollItemTransformer;
|
||||
|
||||
import java.util.Locale;
|
||||
@@ -25,7 +27,7 @@ import java.util.Locale;
|
||||
/**
|
||||
* Created by yarolegovich on 17.02.2017.
|
||||
*/
|
||||
class DiscreteScrollLayoutManager extends LinearLayoutManager {
|
||||
public class DiscreteScrollLayoutManager extends LinearLayoutManager {
|
||||
|
||||
static final int NO_POSITION = -1;
|
||||
|
||||
@@ -73,6 +75,7 @@ class DiscreteScrollLayoutManager extends LinearLayoutManager {
|
||||
|
||||
private float ratio=0.5F;
|
||||
|
||||
private static final String TAG = "DiscreteScrollLayoutMan";
|
||||
@NonNull
|
||||
private final ScrollStateListener scrollStateListener;
|
||||
private DiscreteScrollItemTransformer itemTransformer;
|
||||
@@ -323,8 +326,9 @@ class DiscreteScrollLayoutManager extends LinearLayoutManager {
|
||||
if (leftToScroll <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int delta = direction.applyTo(Math.min(leftToScroll, Math.abs(amount)));
|
||||
Logger.d(TAG,"leftToScroll--》"+leftToScroll+"---amount--》"+amount);
|
||||
|
||||
scrolled += delta;
|
||||
if (pendingScroll != 0) {
|
||||
pendingScroll -= delta;
|
||||
@@ -492,6 +496,8 @@ class DiscreteScrollLayoutManager extends LinearLayoutManager {
|
||||
} else {
|
||||
returnToCurrentPosition();
|
||||
}
|
||||
|
||||
Logger.d(TAG,"onFling"+newPosition);
|
||||
}
|
||||
|
||||
public void returnToCurrentPosition() {
|
||||
@@ -532,7 +538,7 @@ class DiscreteScrollLayoutManager extends LinearLayoutManager {
|
||||
recyclerViewProxy.startSmoothScroll(scroller);
|
||||
}
|
||||
|
||||
private void startSmoothPendingScroll(int position) {
|
||||
public void startSmoothPendingScroll(int position) {
|
||||
if (currentPosition == position) return;
|
||||
pendingScroll = -scrolled;
|
||||
Direction direction = Direction.fromDelta(position - currentPosition);
|
||||
@@ -752,6 +758,11 @@ class DiscreteScrollLayoutManager extends LinearLayoutManager {
|
||||
endBound, extraLayoutSpace);
|
||||
}
|
||||
|
||||
|
||||
public void setPendingScroll(int pendingScroll){
|
||||
this.pendingScroll=pendingScroll;
|
||||
}
|
||||
|
||||
private void checkTargetPosition(RecyclerView.State state, int targetPosition) {
|
||||
if (targetPosition < 0 || targetPosition >= state.getItemCount()) {
|
||||
throw new IllegalArgumentException(String.format(Locale.US,
|
||||
|
||||
@@ -202,6 +202,10 @@ public class DiscreteScrollView extends RecyclerView {
|
||||
notifyCurrentItemChanged(currentHolder, current);
|
||||
}
|
||||
|
||||
public void setPendingScroll(int PendingScroll ) {
|
||||
layoutManager.setPendingScroll(PendingScroll);
|
||||
}
|
||||
|
||||
private class ScrollStateListener implements DiscreteScrollLayoutManager.ScrollStateListener {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user