ADD week 5
This commit is contained in:
		| @@ -0,0 +1,171 @@ | ||||
| package com.google.android.material.behavior; | ||||
|  | ||||
| import android.animation.Animator; | ||||
| import android.animation.AnimatorListenerAdapter; | ||||
| import android.animation.TimeInterpolator; | ||||
| import android.content.Context; | ||||
| import android.util.AttributeSet; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.view.ViewPropertyAnimator; | ||||
| import androidx.coordinatorlayout.widget.CoordinatorLayout; | ||||
| import com.google.android.material.R; | ||||
| import com.google.android.material.animation.AnimationUtils; | ||||
| import com.google.android.material.motion.MotionUtils; | ||||
| import java.util.Iterator; | ||||
| import java.util.LinkedHashSet; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class HideBottomViewOnScrollBehavior<V extends View> extends CoordinatorLayout.Behavior<V> { | ||||
|     private static final int DEFAULT_ENTER_ANIMATION_DURATION_MS = 225; | ||||
|     private static final int DEFAULT_EXIT_ANIMATION_DURATION_MS = 175; | ||||
|     public static final int STATE_SCROLLED_DOWN = 1; | ||||
|     public static final int STATE_SCROLLED_UP = 2; | ||||
|     private int additionalHiddenOffsetY; | ||||
|     private ViewPropertyAnimator currentAnimator; | ||||
|     private int currentState; | ||||
|     private int enterAnimDuration; | ||||
|     private TimeInterpolator enterAnimInterpolator; | ||||
|     private int exitAnimDuration; | ||||
|     private TimeInterpolator exitAnimInterpolator; | ||||
|     private int height; | ||||
|     private final LinkedHashSet<OnScrollStateChangedListener> onScrollStateChangedListeners; | ||||
|     private static final int ENTER_ANIM_DURATION_ATTR = R.attr.motionDurationLong2; | ||||
|     private static final int EXIT_ANIM_DURATION_ATTR = R.attr.motionDurationMedium4; | ||||
|     private static final int ENTER_EXIT_ANIM_EASING_ATTR = R.attr.motionEasingEmphasizedInterpolator; | ||||
|  | ||||
|     public interface OnScrollStateChangedListener { | ||||
|         void onStateChanged(View view, int i); | ||||
|     } | ||||
|  | ||||
|     public @interface ScrollState { | ||||
|     } | ||||
|  | ||||
|     public boolean isScrolledDown() { | ||||
|         return this.currentState == 1; | ||||
|     } | ||||
|  | ||||
|     public boolean isScrolledUp() { | ||||
|         return this.currentState == 2; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|     public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, V v, View view, View view2, int i, int i2) { | ||||
|         return i == 2; | ||||
|     } | ||||
|  | ||||
|     public HideBottomViewOnScrollBehavior() { | ||||
|         this.onScrollStateChangedListeners = new LinkedHashSet<>(); | ||||
|         this.height = 0; | ||||
|         this.currentState = 2; | ||||
|         this.additionalHiddenOffsetY = 0; | ||||
|     } | ||||
|  | ||||
|     public HideBottomViewOnScrollBehavior(Context context, AttributeSet attributeSet) { | ||||
|         super(context, attributeSet); | ||||
|         this.onScrollStateChangedListeners = new LinkedHashSet<>(); | ||||
|         this.height = 0; | ||||
|         this.currentState = 2; | ||||
|         this.additionalHiddenOffsetY = 0; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|     public boolean onLayoutChild(CoordinatorLayout coordinatorLayout, V v, int i) { | ||||
|         this.height = v.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) v.getLayoutParams()).bottomMargin; | ||||
|         this.enterAnimDuration = MotionUtils.resolveThemeDuration(v.getContext(), ENTER_ANIM_DURATION_ATTR, DEFAULT_ENTER_ANIMATION_DURATION_MS); | ||||
|         this.exitAnimDuration = MotionUtils.resolveThemeDuration(v.getContext(), EXIT_ANIM_DURATION_ATTR, DEFAULT_EXIT_ANIMATION_DURATION_MS); | ||||
|         Context context = v.getContext(); | ||||
|         int i2 = ENTER_EXIT_ANIM_EASING_ATTR; | ||||
|         this.enterAnimInterpolator = MotionUtils.resolveThemeInterpolator(context, i2, AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR); | ||||
|         this.exitAnimInterpolator = MotionUtils.resolveThemeInterpolator(v.getContext(), i2, AnimationUtils.FAST_OUT_LINEAR_IN_INTERPOLATOR); | ||||
|         return super.onLayoutChild(coordinatorLayout, v, i); | ||||
|     } | ||||
|  | ||||
|     public void setAdditionalHiddenOffsetY(V v, int i) { | ||||
|         this.additionalHiddenOffsetY = i; | ||||
|         if (this.currentState == 1) { | ||||
|             v.setTranslationY(this.height + i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|     public void onNestedScroll(CoordinatorLayout coordinatorLayout, V v, View view, int i, int i2, int i3, int i4, int i5, int[] iArr) { | ||||
|         if (i2 > 0) { | ||||
|             slideDown(v); | ||||
|         } else if (i2 < 0) { | ||||
|             slideUp(v); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void slideUp(V v) { | ||||
|         slideUp(v, true); | ||||
|     } | ||||
|  | ||||
|     public void slideUp(V v, boolean z) { | ||||
|         if (isScrolledUp()) { | ||||
|             return; | ||||
|         } | ||||
|         ViewPropertyAnimator viewPropertyAnimator = this.currentAnimator; | ||||
|         if (viewPropertyAnimator != null) { | ||||
|             viewPropertyAnimator.cancel(); | ||||
|             v.clearAnimation(); | ||||
|         } | ||||
|         updateCurrentState(v, 2); | ||||
|         if (z) { | ||||
|             animateChildTo(v, 0, this.enterAnimDuration, this.enterAnimInterpolator); | ||||
|         } else { | ||||
|             v.setTranslationY(0); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void slideDown(V v) { | ||||
|         slideDown(v, true); | ||||
|     } | ||||
|  | ||||
|     public void slideDown(V v, boolean z) { | ||||
|         if (isScrolledDown()) { | ||||
|             return; | ||||
|         } | ||||
|         ViewPropertyAnimator viewPropertyAnimator = this.currentAnimator; | ||||
|         if (viewPropertyAnimator != null) { | ||||
|             viewPropertyAnimator.cancel(); | ||||
|             v.clearAnimation(); | ||||
|         } | ||||
|         updateCurrentState(v, 1); | ||||
|         int i = this.height + this.additionalHiddenOffsetY; | ||||
|         if (z) { | ||||
|             animateChildTo(v, i, this.exitAnimDuration, this.exitAnimInterpolator); | ||||
|         } else { | ||||
|             v.setTranslationY(i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void updateCurrentState(V v, int i) { | ||||
|         this.currentState = i; | ||||
|         Iterator<OnScrollStateChangedListener> it = this.onScrollStateChangedListeners.iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             it.next().onStateChanged(v, this.currentState); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void animateChildTo(V v, int i, long j, TimeInterpolator timeInterpolator) { | ||||
|         this.currentAnimator = v.animate().translationY(i).setInterpolator(timeInterpolator).setDuration(j).setListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.behavior.HideBottomViewOnScrollBehavior.1 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 HideBottomViewOnScrollBehavior.this.currentAnimator = null; | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     public void addOnScrollStateChangedListener(OnScrollStateChangedListener onScrollStateChangedListener) { | ||||
|         this.onScrollStateChangedListeners.add(onScrollStateChangedListener); | ||||
|     } | ||||
|  | ||||
|     public void removeOnScrollStateChangedListener(OnScrollStateChangedListener onScrollStateChangedListener) { | ||||
|         this.onScrollStateChangedListeners.remove(onScrollStateChangedListener); | ||||
|     } | ||||
|  | ||||
|     public void clearOnScrollStateChangedListeners() { | ||||
|         this.onScrollStateChangedListeners.clear(); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,332 @@ | ||||
| package com.google.android.material.behavior; | ||||
|  | ||||
| import android.view.MotionEvent; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.view.ViewParent; | ||||
| import androidx.coordinatorlayout.widget.CoordinatorLayout; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; | ||||
| import androidx.core.view.accessibility.AccessibilityViewCommand; | ||||
| import androidx.customview.widget.ViewDragHelper; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class SwipeDismissBehavior<V extends View> extends CoordinatorLayout.Behavior<V> { | ||||
|     private static final float DEFAULT_ALPHA_END_DISTANCE = 0.5f; | ||||
|     private static final float DEFAULT_ALPHA_START_DISTANCE = 0.0f; | ||||
|     private static final float DEFAULT_DRAG_DISMISS_THRESHOLD = 0.5f; | ||||
|     public static final int STATE_DRAGGING = 1; | ||||
|     public static final int STATE_IDLE = 0; | ||||
|     public static final int STATE_SETTLING = 2; | ||||
|     public static final int SWIPE_DIRECTION_ANY = 2; | ||||
|     public static final int SWIPE_DIRECTION_END_TO_START = 1; | ||||
|     public static final int SWIPE_DIRECTION_START_TO_END = 0; | ||||
|     private boolean interceptingEvents; | ||||
|     OnDismissListener listener; | ||||
|     private boolean requestingDisallowInterceptTouchEvent; | ||||
|     private boolean sensitivitySet; | ||||
|     ViewDragHelper viewDragHelper; | ||||
|     private float sensitivity = 0.0f; | ||||
|     int swipeDirection = 2; | ||||
|     float dragDismissThreshold = 0.5f; | ||||
|     float alphaStartSwipeDistance = 0.0f; | ||||
|     float alphaEndSwipeDistance = 0.5f; | ||||
|     private final ViewDragHelper.Callback dragCallback = new ViewDragHelper.Callback() { // from class: com.google.android.material.behavior.SwipeDismissBehavior.1 | ||||
|         private static final int INVALID_POINTER_ID = -1; | ||||
|         private int activePointerId = -1; | ||||
|         private int originalCapturedViewLeft; | ||||
|  | ||||
|         @Override // androidx.customview.widget.ViewDragHelper.Callback | ||||
|         public boolean tryCaptureView(View view, int i) { | ||||
|             int i2 = this.activePointerId; | ||||
|             return (i2 == -1 || i2 == i) && SwipeDismissBehavior.this.canSwipeDismissView(view); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.widget.ViewDragHelper.Callback | ||||
|         public void onViewCaptured(View view, int i) { | ||||
|             this.activePointerId = i; | ||||
|             this.originalCapturedViewLeft = view.getLeft(); | ||||
|             ViewParent parent = view.getParent(); | ||||
|             if (parent != null) { | ||||
|                 SwipeDismissBehavior.this.requestingDisallowInterceptTouchEvent = true; | ||||
|                 parent.requestDisallowInterceptTouchEvent(true); | ||||
|                 SwipeDismissBehavior.this.requestingDisallowInterceptTouchEvent = false; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.widget.ViewDragHelper.Callback | ||||
|         public void onViewDragStateChanged(int i) { | ||||
|             if (SwipeDismissBehavior.this.listener != null) { | ||||
|                 SwipeDismissBehavior.this.listener.onDragStateChanged(i); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.widget.ViewDragHelper.Callback | ||||
|         public void onViewReleased(View view, float f, float f2) { | ||||
|             int i; | ||||
|             boolean z; | ||||
|             this.activePointerId = -1; | ||||
|             int width = view.getWidth(); | ||||
|             if (shouldDismiss(view, f)) { | ||||
|                 if (f >= 0.0f) { | ||||
|                     int left = view.getLeft(); | ||||
|                     int i2 = this.originalCapturedViewLeft; | ||||
|                     if (left >= i2) { | ||||
|                         i = i2 + width; | ||||
|                         z = true; | ||||
|                     } | ||||
|                 } | ||||
|                 i = this.originalCapturedViewLeft - width; | ||||
|                 z = true; | ||||
|             } else { | ||||
|                 i = this.originalCapturedViewLeft; | ||||
|                 z = false; | ||||
|             } | ||||
|             if (SwipeDismissBehavior.this.viewDragHelper.settleCapturedViewAt(i, view.getTop())) { | ||||
|                 ViewCompat.postOnAnimation(view, new SettleRunnable(view, z)); | ||||
|             } else { | ||||
|                 if (!z || SwipeDismissBehavior.this.listener == null) { | ||||
|                     return; | ||||
|                 } | ||||
|                 SwipeDismissBehavior.this.listener.onDismiss(view); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         private boolean shouldDismiss(View view, float f) { | ||||
|             if (f == 0.0f) { | ||||
|                 return Math.abs(view.getLeft() - this.originalCapturedViewLeft) >= Math.round(((float) view.getWidth()) * SwipeDismissBehavior.this.dragDismissThreshold); | ||||
|             } | ||||
|             boolean z = ViewCompat.getLayoutDirection(view) == 1; | ||||
|             if (SwipeDismissBehavior.this.swipeDirection == 2) { | ||||
|                 return true; | ||||
|             } | ||||
|             if (SwipeDismissBehavior.this.swipeDirection == 0) { | ||||
|                 if (z) { | ||||
|                     if (f >= 0.0f) { | ||||
|                         return false; | ||||
|                     } | ||||
|                 } else if (f <= 0.0f) { | ||||
|                     return false; | ||||
|                 } | ||||
|                 return true; | ||||
|             } | ||||
|             if (SwipeDismissBehavior.this.swipeDirection != 1) { | ||||
|                 return false; | ||||
|             } | ||||
|             if (z) { | ||||
|                 if (f <= 0.0f) { | ||||
|                     return false; | ||||
|                 } | ||||
|             } else if (f >= 0.0f) { | ||||
|                 return false; | ||||
|             } | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.widget.ViewDragHelper.Callback | ||||
|         public int getViewHorizontalDragRange(View view) { | ||||
|             return view.getWidth(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.widget.ViewDragHelper.Callback | ||||
|         public int clampViewPositionHorizontal(View view, int i, int i2) { | ||||
|             int width; | ||||
|             int width2; | ||||
|             int width3; | ||||
|             boolean z = ViewCompat.getLayoutDirection(view) == 1; | ||||
|             if (SwipeDismissBehavior.this.swipeDirection == 0) { | ||||
|                 if (z) { | ||||
|                     width = this.originalCapturedViewLeft - view.getWidth(); | ||||
|                     width2 = this.originalCapturedViewLeft; | ||||
|                 } else { | ||||
|                     width = this.originalCapturedViewLeft; | ||||
|                     width3 = view.getWidth(); | ||||
|                     width2 = width3 + width; | ||||
|                 } | ||||
|             } else if (SwipeDismissBehavior.this.swipeDirection != 1) { | ||||
|                 width = this.originalCapturedViewLeft - view.getWidth(); | ||||
|                 width2 = view.getWidth() + this.originalCapturedViewLeft; | ||||
|             } else if (z) { | ||||
|                 width = this.originalCapturedViewLeft; | ||||
|                 width3 = view.getWidth(); | ||||
|                 width2 = width3 + width; | ||||
|             } else { | ||||
|                 width = this.originalCapturedViewLeft - view.getWidth(); | ||||
|                 width2 = this.originalCapturedViewLeft; | ||||
|             } | ||||
|             return SwipeDismissBehavior.clamp(width, i, width2); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.widget.ViewDragHelper.Callback | ||||
|         public int clampViewPositionVertical(View view, int i, int i2) { | ||||
|             return view.getTop(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.widget.ViewDragHelper.Callback | ||||
|         public void onViewPositionChanged(View view, int i, int i2, int i3, int i4) { | ||||
|             float width = view.getWidth() * SwipeDismissBehavior.this.alphaStartSwipeDistance; | ||||
|             float width2 = view.getWidth() * SwipeDismissBehavior.this.alphaEndSwipeDistance; | ||||
|             float abs = Math.abs(i - this.originalCapturedViewLeft); | ||||
|             if (abs <= width) { | ||||
|                 view.setAlpha(1.0f); | ||||
|             } else if (abs >= width2) { | ||||
|                 view.setAlpha(0.0f); | ||||
|             } else { | ||||
|                 view.setAlpha(SwipeDismissBehavior.clamp(0.0f, 1.0f - SwipeDismissBehavior.fraction(width, width2, abs), 1.0f)); | ||||
|             } | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     public interface OnDismissListener { | ||||
|         void onDismiss(View view); | ||||
|  | ||||
|         void onDragStateChanged(int i); | ||||
|     } | ||||
|  | ||||
|     static float fraction(float f, float f2, float f3) { | ||||
|         return (f3 - f) / (f2 - f); | ||||
|     } | ||||
|  | ||||
|     public boolean canSwipeDismissView(View view) { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public OnDismissListener getListener() { | ||||
|         return this.listener; | ||||
|     } | ||||
|  | ||||
|     public void setListener(OnDismissListener onDismissListener) { | ||||
|         this.listener = onDismissListener; | ||||
|     } | ||||
|  | ||||
|     public void setSensitivity(float f) { | ||||
|         this.sensitivity = f; | ||||
|         this.sensitivitySet = true; | ||||
|     } | ||||
|  | ||||
|     public void setSwipeDirection(int i) { | ||||
|         this.swipeDirection = i; | ||||
|     } | ||||
|  | ||||
|     public void setDragDismissDistance(float f) { | ||||
|         this.dragDismissThreshold = clamp(0.0f, f, 1.0f); | ||||
|     } | ||||
|  | ||||
|     public void setStartAlphaSwipeDistance(float f) { | ||||
|         this.alphaStartSwipeDistance = clamp(0.0f, f, 1.0f); | ||||
|     } | ||||
|  | ||||
|     public void setEndAlphaSwipeDistance(float f) { | ||||
|         this.alphaEndSwipeDistance = clamp(0.0f, f, 1.0f); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|     public boolean onLayoutChild(CoordinatorLayout coordinatorLayout, V v, int i) { | ||||
|         boolean onLayoutChild = super.onLayoutChild(coordinatorLayout, v, i); | ||||
|         if (ViewCompat.getImportantForAccessibility(v) == 0) { | ||||
|             ViewCompat.setImportantForAccessibility(v, 1); | ||||
|             updateAccessibilityActions(v); | ||||
|         } | ||||
|         return onLayoutChild; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|     public boolean onInterceptTouchEvent(CoordinatorLayout coordinatorLayout, V v, MotionEvent motionEvent) { | ||||
|         boolean z = this.interceptingEvents; | ||||
|         int actionMasked = motionEvent.getActionMasked(); | ||||
|         if (actionMasked == 0) { | ||||
|             z = coordinatorLayout.isPointInChildBounds(v, (int) motionEvent.getX(), (int) motionEvent.getY()); | ||||
|             this.interceptingEvents = z; | ||||
|         } else if (actionMasked == 1 || actionMasked == 3) { | ||||
|             this.interceptingEvents = false; | ||||
|         } | ||||
|         if (!z) { | ||||
|             return false; | ||||
|         } | ||||
|         ensureViewDragHelper(coordinatorLayout); | ||||
|         return !this.requestingDisallowInterceptTouchEvent && this.viewDragHelper.shouldInterceptTouchEvent(motionEvent); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|     public boolean onTouchEvent(CoordinatorLayout coordinatorLayout, V v, MotionEvent motionEvent) { | ||||
|         if (this.viewDragHelper == null) { | ||||
|             return false; | ||||
|         } | ||||
|         if (this.requestingDisallowInterceptTouchEvent && motionEvent.getActionMasked() == 3) { | ||||
|             return true; | ||||
|         } | ||||
|         this.viewDragHelper.processTouchEvent(motionEvent); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     private void ensureViewDragHelper(ViewGroup viewGroup) { | ||||
|         ViewDragHelper create; | ||||
|         if (this.viewDragHelper == null) { | ||||
|             if (this.sensitivitySet) { | ||||
|                 create = ViewDragHelper.create(viewGroup, this.sensitivity, this.dragCallback); | ||||
|             } else { | ||||
|                 create = ViewDragHelper.create(viewGroup, this.dragCallback); | ||||
|             } | ||||
|             this.viewDragHelper = create; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private class SettleRunnable implements Runnable { | ||||
|         private final boolean dismiss; | ||||
|         private final View view; | ||||
|  | ||||
|         SettleRunnable(View view, boolean z) { | ||||
|             this.view = view; | ||||
|             this.dismiss = z; | ||||
|         } | ||||
|  | ||||
|         @Override // java.lang.Runnable | ||||
|         public void run() { | ||||
|             if (SwipeDismissBehavior.this.viewDragHelper != null && SwipeDismissBehavior.this.viewDragHelper.continueSettling(true)) { | ||||
|                 ViewCompat.postOnAnimation(this.view, this); | ||||
|             } else { | ||||
|                 if (!this.dismiss || SwipeDismissBehavior.this.listener == null) { | ||||
|                     return; | ||||
|                 } | ||||
|                 SwipeDismissBehavior.this.listener.onDismiss(this.view); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void updateAccessibilityActions(View view) { | ||||
|         ViewCompat.removeAccessibilityAction(view, 1048576); | ||||
|         if (canSwipeDismissView(view)) { | ||||
|             ViewCompat.replaceAccessibilityAction(view, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_DISMISS, null, new AccessibilityViewCommand() { // from class: com.google.android.material.behavior.SwipeDismissBehavior.2 | ||||
|                 @Override // androidx.core.view.accessibility.AccessibilityViewCommand | ||||
|                 public boolean perform(View view2, AccessibilityViewCommand.CommandArguments commandArguments) { | ||||
|                     if (!SwipeDismissBehavior.this.canSwipeDismissView(view2)) { | ||||
|                         return false; | ||||
|                     } | ||||
|                     boolean z = ViewCompat.getLayoutDirection(view2) == 1; | ||||
|                     ViewCompat.offsetLeftAndRight(view2, (!(SwipeDismissBehavior.this.swipeDirection == 0 && z) && (SwipeDismissBehavior.this.swipeDirection != 1 || z)) ? view2.getWidth() : -view2.getWidth()); | ||||
|                     view2.setAlpha(0.0f); | ||||
|                     if (SwipeDismissBehavior.this.listener != null) { | ||||
|                         SwipeDismissBehavior.this.listener.onDismiss(view2); | ||||
|                     } | ||||
|                     return true; | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     static float clamp(float f, float f2, float f3) { | ||||
|         return Math.min(Math.max(f, f2), f3); | ||||
|     } | ||||
|  | ||||
|     static int clamp(int i, int i2, int i3) { | ||||
|         return Math.min(Math.max(i, i2), i3); | ||||
|     } | ||||
|  | ||||
|     public int getDragState() { | ||||
|         ViewDragHelper viewDragHelper = this.viewDragHelper; | ||||
|         if (viewDragHelper != null) { | ||||
|             return viewDragHelper.getViewDragState(); | ||||
|         } | ||||
|         return 0; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user