1125 lines
46 KiB
Java
1125 lines
46 KiB
Java
package androidx.slidingpanelayout.widget;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Paint;
|
|
import android.graphics.PorterDuff;
|
|
import android.graphics.PorterDuffColorFilter;
|
|
import android.graphics.Rect;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import android.util.AttributeSet;
|
|
import android.util.Log;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewParent;
|
|
import android.view.accessibility.AccessibilityEvent;
|
|
import androidx.annotation.ColorInt;
|
|
import androidx.annotation.DrawableRes;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.Px;
|
|
import androidx.core.content.ContextCompat;
|
|
import androidx.core.view.AccessibilityDelegateCompat;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
|
import androidx.customview.view.AbsSavedState;
|
|
import androidx.customview.widget.ViewDragHelper;
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Method;
|
|
import java.util.ArrayList;
|
|
public class SlidingPaneLayout extends ViewGroup {
|
|
private static final int DEFAULT_FADE_COLOR = -858993460;
|
|
private static final int DEFAULT_OVERHANG_SIZE = 32;
|
|
private static final int MIN_FLING_VELOCITY = 400;
|
|
private static final String TAG = "SlidingPaneLayout";
|
|
private boolean mCanSlide;
|
|
private int mCoveredFadeColor;
|
|
private boolean mDisplayListReflectionLoaded;
|
|
public final ViewDragHelper mDragHelper;
|
|
private boolean mFirstLayout;
|
|
private Method mGetDisplayList;
|
|
private float mInitialMotionX;
|
|
private float mInitialMotionY;
|
|
public boolean mIsUnableToDrag;
|
|
private final int mOverhangSize;
|
|
private PanelSlideListener mPanelSlideListener;
|
|
private int mParallaxBy;
|
|
private float mParallaxOffset;
|
|
public final ArrayList<DisableLayerRunnable> mPostedRunnables;
|
|
public boolean mPreservedOpenState;
|
|
private Field mRecreateDisplayList;
|
|
private Drawable mShadowDrawableLeft;
|
|
private Drawable mShadowDrawableRight;
|
|
public float mSlideOffset;
|
|
public int mSlideRange;
|
|
public View mSlideableView;
|
|
private int mSliderFadeColor;
|
|
private final Rect mTmpRect;
|
|
|
|
public class AccessibilityDelegate extends AccessibilityDelegateCompat {
|
|
private final Rect mTmpRect = new Rect();
|
|
|
|
public AccessibilityDelegate() {
|
|
}
|
|
|
|
private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat accessibilityNodeInfoCompat, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat2) {
|
|
Rect rect = this.mTmpRect;
|
|
accessibilityNodeInfoCompat2.getBoundsInParent(rect);
|
|
accessibilityNodeInfoCompat.setBoundsInParent(rect);
|
|
accessibilityNodeInfoCompat2.getBoundsInScreen(rect);
|
|
accessibilityNodeInfoCompat.setBoundsInScreen(rect);
|
|
accessibilityNodeInfoCompat.setVisibleToUser(accessibilityNodeInfoCompat2.isVisibleToUser());
|
|
accessibilityNodeInfoCompat.setPackageName(accessibilityNodeInfoCompat2.getPackageName());
|
|
accessibilityNodeInfoCompat.setClassName(accessibilityNodeInfoCompat2.getClassName());
|
|
accessibilityNodeInfoCompat.setContentDescription(accessibilityNodeInfoCompat2.getContentDescription());
|
|
accessibilityNodeInfoCompat.setEnabled(accessibilityNodeInfoCompat2.isEnabled());
|
|
accessibilityNodeInfoCompat.setClickable(accessibilityNodeInfoCompat2.isClickable());
|
|
accessibilityNodeInfoCompat.setFocusable(accessibilityNodeInfoCompat2.isFocusable());
|
|
accessibilityNodeInfoCompat.setFocused(accessibilityNodeInfoCompat2.isFocused());
|
|
accessibilityNodeInfoCompat.setAccessibilityFocused(accessibilityNodeInfoCompat2.isAccessibilityFocused());
|
|
accessibilityNodeInfoCompat.setSelected(accessibilityNodeInfoCompat2.isSelected());
|
|
accessibilityNodeInfoCompat.setLongClickable(accessibilityNodeInfoCompat2.isLongClickable());
|
|
accessibilityNodeInfoCompat.addAction(accessibilityNodeInfoCompat2.getActions());
|
|
accessibilityNodeInfoCompat.setMovementGranularities(accessibilityNodeInfoCompat2.getMovementGranularities());
|
|
}
|
|
|
|
public boolean filter(View view) {
|
|
return SlidingPaneLayout.this.isDimmed(view);
|
|
}
|
|
|
|
@Override // androidx.core.view.AccessibilityDelegateCompat
|
|
public void onInitializeAccessibilityEvent(View view, AccessibilityEvent accessibilityEvent) {
|
|
super.onInitializeAccessibilityEvent(view, accessibilityEvent);
|
|
accessibilityEvent.setClassName(SlidingPaneLayout.class.getName());
|
|
}
|
|
|
|
@Override // androidx.core.view.AccessibilityDelegateCompat
|
|
public void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
|
|
AccessibilityNodeInfoCompat obtain = AccessibilityNodeInfoCompat.obtain(accessibilityNodeInfoCompat);
|
|
super.onInitializeAccessibilityNodeInfo(view, obtain);
|
|
copyNodeInfoNoChildren(accessibilityNodeInfoCompat, obtain);
|
|
obtain.recycle();
|
|
accessibilityNodeInfoCompat.setClassName(SlidingPaneLayout.class.getName());
|
|
accessibilityNodeInfoCompat.setSource(view);
|
|
ViewParent parentForAccessibility = ViewCompat.getParentForAccessibility(view);
|
|
if (parentForAccessibility instanceof View) {
|
|
accessibilityNodeInfoCompat.setParent((View) parentForAccessibility);
|
|
}
|
|
int childCount = SlidingPaneLayout.this.getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = SlidingPaneLayout.this.getChildAt(i);
|
|
if (!filter(childAt) && childAt.getVisibility() == 0) {
|
|
ViewCompat.setImportantForAccessibility(childAt, 1);
|
|
accessibilityNodeInfoCompat.addChild(childAt);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // androidx.core.view.AccessibilityDelegateCompat
|
|
public boolean onRequestSendAccessibilityEvent(ViewGroup viewGroup, View view, AccessibilityEvent accessibilityEvent) {
|
|
if (!filter(view)) {
|
|
return super.onRequestSendAccessibilityEvent(viewGroup, view, accessibilityEvent);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public class DisableLayerRunnable implements Runnable {
|
|
public final View mChildView;
|
|
|
|
public DisableLayerRunnable(View view) {
|
|
this.mChildView = view;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (this.mChildView.getParent() == SlidingPaneLayout.this) {
|
|
this.mChildView.setLayerType(0, null);
|
|
SlidingPaneLayout.this.invalidateChildRegion(this.mChildView);
|
|
}
|
|
SlidingPaneLayout.this.mPostedRunnables.remove(this);
|
|
}
|
|
}
|
|
|
|
public class DragHelperCallback extends ViewDragHelper.Callback {
|
|
public DragHelperCallback() {
|
|
}
|
|
|
|
@Override // androidx.customview.widget.ViewDragHelper.Callback
|
|
public int clampViewPositionHorizontal(View view, int i, int i2) {
|
|
LayoutParams layoutParams = (LayoutParams) SlidingPaneLayout.this.mSlideableView.getLayoutParams();
|
|
if (SlidingPaneLayout.this.isLayoutRtlSupport()) {
|
|
int width = SlidingPaneLayout.this.getWidth() - (SlidingPaneLayout.this.mSlideableView.getWidth() + (SlidingPaneLayout.this.getPaddingRight() + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin));
|
|
return Math.max(Math.min(i, width), width - SlidingPaneLayout.this.mSlideRange);
|
|
}
|
|
int paddingLeft = SlidingPaneLayout.this.getPaddingLeft() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin;
|
|
return Math.min(Math.max(i, paddingLeft), SlidingPaneLayout.this.mSlideRange + paddingLeft);
|
|
}
|
|
|
|
@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 int getViewHorizontalDragRange(View view) {
|
|
return SlidingPaneLayout.this.mSlideRange;
|
|
}
|
|
|
|
@Override // androidx.customview.widget.ViewDragHelper.Callback
|
|
public void onEdgeDragStarted(int i, int i2) {
|
|
SlidingPaneLayout slidingPaneLayout = SlidingPaneLayout.this;
|
|
slidingPaneLayout.mDragHelper.captureChildView(slidingPaneLayout.mSlideableView, i2);
|
|
}
|
|
|
|
@Override // androidx.customview.widget.ViewDragHelper.Callback
|
|
public void onViewCaptured(View view, int i) {
|
|
SlidingPaneLayout.this.setAllChildrenVisible();
|
|
}
|
|
|
|
@Override // androidx.customview.widget.ViewDragHelper.Callback
|
|
public void onViewDragStateChanged(int i) {
|
|
if (SlidingPaneLayout.this.mDragHelper.getViewDragState() == 0) {
|
|
SlidingPaneLayout slidingPaneLayout = SlidingPaneLayout.this;
|
|
if (slidingPaneLayout.mSlideOffset == 0.0f) {
|
|
slidingPaneLayout.updateObscuredViewsVisibility(slidingPaneLayout.mSlideableView);
|
|
SlidingPaneLayout slidingPaneLayout2 = SlidingPaneLayout.this;
|
|
slidingPaneLayout2.dispatchOnPanelClosed(slidingPaneLayout2.mSlideableView);
|
|
SlidingPaneLayout.this.mPreservedOpenState = false;
|
|
return;
|
|
}
|
|
slidingPaneLayout.dispatchOnPanelOpened(slidingPaneLayout.mSlideableView);
|
|
SlidingPaneLayout.this.mPreservedOpenState = true;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.customview.widget.ViewDragHelper.Callback
|
|
public void onViewPositionChanged(View view, int i, int i2, int i3, int i4) {
|
|
SlidingPaneLayout.this.onPanelDragged(i);
|
|
SlidingPaneLayout.this.invalidate();
|
|
}
|
|
|
|
@Override // androidx.customview.widget.ViewDragHelper.Callback
|
|
public void onViewReleased(View view, float f, float f2) {
|
|
int i;
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
if (SlidingPaneLayout.this.isLayoutRtlSupport()) {
|
|
int paddingRight = SlidingPaneLayout.this.getPaddingRight() + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
|
|
if (f < 0.0f || (f == 0.0f && SlidingPaneLayout.this.mSlideOffset > 0.5f)) {
|
|
paddingRight += SlidingPaneLayout.this.mSlideRange;
|
|
}
|
|
i = (SlidingPaneLayout.this.getWidth() - paddingRight) - SlidingPaneLayout.this.mSlideableView.getWidth();
|
|
} else {
|
|
i = ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + SlidingPaneLayout.this.getPaddingLeft();
|
|
int i2 = (f > 0.0f ? 1 : (f == 0.0f ? 0 : -1));
|
|
if (i2 > 0 || (i2 == 0 && SlidingPaneLayout.this.mSlideOffset > 0.5f)) {
|
|
i += SlidingPaneLayout.this.mSlideRange;
|
|
}
|
|
}
|
|
SlidingPaneLayout.this.mDragHelper.settleCapturedViewAt(i, view.getTop());
|
|
SlidingPaneLayout.this.invalidate();
|
|
}
|
|
|
|
@Override // androidx.customview.widget.ViewDragHelper.Callback
|
|
public boolean tryCaptureView(View view, int i) {
|
|
if (SlidingPaneLayout.this.mIsUnableToDrag) {
|
|
return false;
|
|
}
|
|
return ((LayoutParams) view.getLayoutParams()).slideable;
|
|
}
|
|
}
|
|
|
|
public static class LayoutParams extends ViewGroup.MarginLayoutParams {
|
|
private static final int[] ATTRS = {16843137};
|
|
public Paint dimPaint;
|
|
public boolean dimWhenOffset;
|
|
public boolean slideable;
|
|
public float weight = 0.0f;
|
|
|
|
public LayoutParams() {
|
|
super(-1, -1);
|
|
}
|
|
|
|
public LayoutParams(int i, int i2) {
|
|
super(i, i2);
|
|
}
|
|
|
|
public LayoutParams(@NonNull Context context, @Nullable AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, ATTRS);
|
|
this.weight = obtainStyledAttributes.getFloat(0, 0.0f);
|
|
obtainStyledAttributes.recycle();
|
|
}
|
|
|
|
public LayoutParams(@NonNull ViewGroup.LayoutParams layoutParams) {
|
|
super(layoutParams);
|
|
}
|
|
|
|
public LayoutParams(@NonNull ViewGroup.MarginLayoutParams marginLayoutParams) {
|
|
super(marginLayoutParams);
|
|
}
|
|
|
|
public LayoutParams(@NonNull LayoutParams layoutParams) {
|
|
super((ViewGroup.MarginLayoutParams) layoutParams);
|
|
this.weight = layoutParams.weight;
|
|
}
|
|
}
|
|
|
|
public interface PanelSlideListener {
|
|
void onPanelClosed(@NonNull View view);
|
|
|
|
void onPanelOpened(@NonNull View view);
|
|
|
|
void onPanelSlide(@NonNull View view, float f);
|
|
}
|
|
|
|
public static class SavedState extends AbsSavedState {
|
|
public static final Parcelable.Creator<SavedState> CREATOR = new AnonymousClass1();
|
|
public boolean isOpen;
|
|
|
|
/* renamed from: androidx.slidingpanelayout.widget.SlidingPaneLayout$SavedState$1 reason: invalid class name */
|
|
public static class AnonymousClass1 implements Parcelable.ClassLoaderCreator<SavedState> {
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState createFromParcel(Parcel parcel) {
|
|
return new SavedState(parcel, null);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.ClassLoaderCreator
|
|
public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) {
|
|
return new SavedState(parcel, null);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState[] newArray(int i) {
|
|
return new SavedState[i];
|
|
}
|
|
}
|
|
|
|
public SavedState(Parcel parcel, ClassLoader classLoader) {
|
|
super(parcel, classLoader);
|
|
this.isOpen = parcel.readInt() != 0;
|
|
}
|
|
|
|
public SavedState(Parcelable parcelable) {
|
|
super(parcelable);
|
|
}
|
|
|
|
@Override // androidx.customview.view.AbsSavedState, android.os.Parcelable
|
|
public void writeToParcel(Parcel parcel, int i) {
|
|
super.writeToParcel(parcel, i);
|
|
parcel.writeInt(this.isOpen ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
public static class SimplePanelSlideListener implements PanelSlideListener {
|
|
@Override // androidx.slidingpanelayout.widget.SlidingPaneLayout.PanelSlideListener
|
|
public void onPanelClosed(View view) {
|
|
}
|
|
|
|
@Override // androidx.slidingpanelayout.widget.SlidingPaneLayout.PanelSlideListener
|
|
public void onPanelOpened(View view) {
|
|
}
|
|
|
|
@Override // androidx.slidingpanelayout.widget.SlidingPaneLayout.PanelSlideListener
|
|
public void onPanelSlide(View view, float f) {
|
|
}
|
|
}
|
|
|
|
public SlidingPaneLayout(@NonNull Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public SlidingPaneLayout(@NonNull Context context, @Nullable AttributeSet attributeSet) {
|
|
this(context, attributeSet, 0);
|
|
}
|
|
|
|
public SlidingPaneLayout(@NonNull Context context, @Nullable AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
this.mSliderFadeColor = -858993460;
|
|
this.mFirstLayout = true;
|
|
this.mTmpRect = new Rect();
|
|
this.mPostedRunnables = new ArrayList<>();
|
|
float f = context.getResources().getDisplayMetrics().density;
|
|
this.mOverhangSize = (int) ((32.0f * f) + 0.5f);
|
|
setWillNotDraw(false);
|
|
ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
|
|
ViewCompat.setImportantForAccessibility(this, 1);
|
|
ViewDragHelper create = ViewDragHelper.create(this, 0.5f, new DragHelperCallback());
|
|
this.mDragHelper = create;
|
|
create.setMinVelocity(f * 400.0f);
|
|
}
|
|
|
|
private boolean closePane(View view, int i) {
|
|
if (!this.mFirstLayout && !smoothSlideTo(0.0f, i)) {
|
|
return false;
|
|
}
|
|
this.mPreservedOpenState = false;
|
|
return true;
|
|
}
|
|
|
|
private void dimChildView(View view, float f, int i) {
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
if (f > 0.0f && i != 0) {
|
|
int i2 = (((int) (((float) ((-16777216 & i) >>> 24)) * f)) << 24) | (i & 16777215);
|
|
if (layoutParams.dimPaint == null) {
|
|
layoutParams.dimPaint = new Paint();
|
|
}
|
|
layoutParams.dimPaint.setColorFilter(new PorterDuffColorFilter(i2, PorterDuff.Mode.SRC_OVER));
|
|
if (view.getLayerType() != 2) {
|
|
view.setLayerType(2, layoutParams.dimPaint);
|
|
}
|
|
invalidateChildRegion(view);
|
|
} else if (view.getLayerType() != 0) {
|
|
Paint paint = layoutParams.dimPaint;
|
|
if (paint != null) {
|
|
paint.setColorFilter(null);
|
|
}
|
|
DisableLayerRunnable disableLayerRunnable = new DisableLayerRunnable(view);
|
|
this.mPostedRunnables.add(disableLayerRunnable);
|
|
ViewCompat.postOnAnimation(this, disableLayerRunnable);
|
|
}
|
|
}
|
|
|
|
private boolean openPane(View view, int i) {
|
|
if (!this.mFirstLayout && !smoothSlideTo(1.0f, i)) {
|
|
return false;
|
|
}
|
|
this.mPreservedOpenState = true;
|
|
return true;
|
|
}
|
|
|
|
/* JADX WARNING: Removed duplicated region for block: B:10:0x0023 */
|
|
private void parallaxOtherViews(float f) {
|
|
boolean z2;
|
|
int childCount;
|
|
boolean isLayoutRtlSupport = isLayoutRtlSupport();
|
|
LayoutParams layoutParams = (LayoutParams) this.mSlideableView.getLayoutParams();
|
|
if (layoutParams.dimWhenOffset) {
|
|
if ((isLayoutRtlSupport ? ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin : ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin) <= 0) {
|
|
z2 = true;
|
|
childCount = getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = getChildAt(i);
|
|
if (childAt != this.mSlideableView) {
|
|
int i2 = this.mParallaxBy;
|
|
this.mParallaxOffset = f;
|
|
int i3 = ((int) ((1.0f - this.mParallaxOffset) * ((float) i2))) - ((int) ((1.0f - f) * ((float) i2)));
|
|
if (isLayoutRtlSupport) {
|
|
i3 = -i3;
|
|
}
|
|
childAt.offsetLeftAndRight(i3);
|
|
if (z2) {
|
|
float f2 = this.mParallaxOffset;
|
|
dimChildView(childAt, isLayoutRtlSupport ? f2 - 1.0f : 1.0f - f2, this.mCoveredFadeColor);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
z2 = false;
|
|
childCount = getChildCount();
|
|
while (i < childCount) {
|
|
}
|
|
}
|
|
|
|
private static boolean viewIsOpaque(View view) {
|
|
return view.isOpaque();
|
|
}
|
|
|
|
public boolean canScroll(View view, boolean z2, int i, int i2, int i3) {
|
|
int i4;
|
|
if (view instanceof ViewGroup) {
|
|
ViewGroup viewGroup = (ViewGroup) view;
|
|
int scrollX = view.getScrollX();
|
|
int scrollY = view.getScrollY();
|
|
for (int childCount = viewGroup.getChildCount() - 1; childCount >= 0; childCount--) {
|
|
View childAt = viewGroup.getChildAt(childCount);
|
|
int i5 = i2 + scrollX;
|
|
if (i5 >= childAt.getLeft() && i5 < childAt.getRight() && (i4 = i3 + scrollY) >= childAt.getTop() && i4 < childAt.getBottom() && canScroll(childAt, true, i, i5 - childAt.getLeft(), i4 - childAt.getTop())) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
if (z2) {
|
|
if (view.canScrollHorizontally(isLayoutRtlSupport() ? i : -i)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Deprecated
|
|
public boolean canSlide() {
|
|
return this.mCanSlide;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
return (layoutParams instanceof LayoutParams) && super.checkLayoutParams(layoutParams);
|
|
}
|
|
|
|
public boolean closePane() {
|
|
return closePane(this.mSlideableView, 0);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void computeScroll() {
|
|
if (!this.mDragHelper.continueSettling(true)) {
|
|
return;
|
|
}
|
|
if (!this.mCanSlide) {
|
|
this.mDragHelper.abort();
|
|
} else {
|
|
ViewCompat.postInvalidateOnAnimation(this);
|
|
}
|
|
}
|
|
|
|
public void dispatchOnPanelClosed(View view) {
|
|
PanelSlideListener panelSlideListener = this.mPanelSlideListener;
|
|
if (panelSlideListener != null) {
|
|
panelSlideListener.onPanelClosed(view);
|
|
}
|
|
sendAccessibilityEvent(32);
|
|
}
|
|
|
|
public void dispatchOnPanelOpened(View view) {
|
|
PanelSlideListener panelSlideListener = this.mPanelSlideListener;
|
|
if (panelSlideListener != null) {
|
|
panelSlideListener.onPanelOpened(view);
|
|
}
|
|
sendAccessibilityEvent(32);
|
|
}
|
|
|
|
public void dispatchOnPanelSlide(View view) {
|
|
PanelSlideListener panelSlideListener = this.mPanelSlideListener;
|
|
if (panelSlideListener != null) {
|
|
panelSlideListener.onPanelSlide(view, this.mSlideOffset);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void draw(Canvas canvas) {
|
|
int i;
|
|
int i2;
|
|
super.draw(canvas);
|
|
Drawable drawable = isLayoutRtlSupport() ? this.mShadowDrawableRight : this.mShadowDrawableLeft;
|
|
View childAt = getChildCount() > 1 ? getChildAt(1) : null;
|
|
if (childAt != null && drawable != null) {
|
|
int top = childAt.getTop();
|
|
int bottom = childAt.getBottom();
|
|
int intrinsicWidth = drawable.getIntrinsicWidth();
|
|
if (isLayoutRtlSupport()) {
|
|
i2 = childAt.getRight();
|
|
i = intrinsicWidth + i2;
|
|
} else {
|
|
int left = childAt.getLeft();
|
|
int i3 = left - intrinsicWidth;
|
|
i = left;
|
|
i2 = i3;
|
|
}
|
|
drawable.setBounds(i2, top, i, bottom);
|
|
drawable.draw(canvas);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean drawChild(Canvas canvas, View view, long j) {
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
int save = canvas.save();
|
|
if (this.mCanSlide && !layoutParams.slideable && this.mSlideableView != null) {
|
|
canvas.getClipBounds(this.mTmpRect);
|
|
if (isLayoutRtlSupport()) {
|
|
Rect rect = this.mTmpRect;
|
|
rect.left = Math.max(rect.left, this.mSlideableView.getRight());
|
|
} else {
|
|
Rect rect2 = this.mTmpRect;
|
|
rect2.right = Math.min(rect2.right, this.mSlideableView.getLeft());
|
|
}
|
|
canvas.clipRect(this.mTmpRect);
|
|
}
|
|
boolean drawChild = super.drawChild(canvas, view, j);
|
|
canvas.restoreToCount(save);
|
|
return drawChild;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public ViewGroup.LayoutParams generateDefaultLayoutParams() {
|
|
return new LayoutParams();
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
|
return new LayoutParams(getContext(), attributeSet);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
return layoutParams instanceof ViewGroup.MarginLayoutParams ? new LayoutParams((ViewGroup.MarginLayoutParams) layoutParams) : new LayoutParams(layoutParams);
|
|
}
|
|
|
|
@ColorInt
|
|
public int getCoveredFadeColor() {
|
|
return this.mCoveredFadeColor;
|
|
}
|
|
|
|
@Px
|
|
public int getParallaxDistance() {
|
|
return this.mParallaxBy;
|
|
}
|
|
|
|
@ColorInt
|
|
public int getSliderFadeColor() {
|
|
return this.mSliderFadeColor;
|
|
}
|
|
|
|
public void invalidateChildRegion(View view) {
|
|
ViewCompat.setLayerPaint(view, ((LayoutParams) view.getLayoutParams()).dimPaint);
|
|
}
|
|
|
|
public boolean isDimmed(View view) {
|
|
if (view == null) {
|
|
return false;
|
|
}
|
|
return this.mCanSlide && ((LayoutParams) view.getLayoutParams()).dimWhenOffset && this.mSlideOffset > 0.0f;
|
|
}
|
|
|
|
public boolean isLayoutRtlSupport() {
|
|
return ViewCompat.getLayoutDirection(this) == 1;
|
|
}
|
|
|
|
public boolean isOpen() {
|
|
return !this.mCanSlide || this.mSlideOffset == 1.0f;
|
|
}
|
|
|
|
public boolean isSlideable() {
|
|
return this.mCanSlide;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
this.mFirstLayout = true;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onDetachedFromWindow() {
|
|
super.onDetachedFromWindow();
|
|
this.mFirstLayout = true;
|
|
int size = this.mPostedRunnables.size();
|
|
for (int i = 0; i < size; i++) {
|
|
this.mPostedRunnables.get(i).run();
|
|
}
|
|
this.mPostedRunnables.clear();
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
|
boolean z2;
|
|
View childAt;
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
if (!this.mCanSlide && actionMasked == 0 && getChildCount() > 1 && (childAt = getChildAt(1)) != null) {
|
|
this.mPreservedOpenState = !this.mDragHelper.isViewUnder(childAt, (int) motionEvent.getX(), (int) motionEvent.getY());
|
|
}
|
|
if (!this.mCanSlide || (this.mIsUnableToDrag && actionMasked != 0)) {
|
|
this.mDragHelper.cancel();
|
|
return super.onInterceptTouchEvent(motionEvent);
|
|
} else if (actionMasked == 3 || actionMasked == 1) {
|
|
this.mDragHelper.cancel();
|
|
return false;
|
|
} else {
|
|
if (actionMasked == 0) {
|
|
this.mIsUnableToDrag = false;
|
|
float x2 = motionEvent.getX();
|
|
float y2 = motionEvent.getY();
|
|
this.mInitialMotionX = x2;
|
|
this.mInitialMotionY = y2;
|
|
if (this.mDragHelper.isViewUnder(this.mSlideableView, (int) x2, (int) y2) && isDimmed(this.mSlideableView)) {
|
|
z2 = true;
|
|
return this.mDragHelper.shouldInterceptTouchEvent(motionEvent) || z2;
|
|
}
|
|
} else if (actionMasked == 2) {
|
|
float x3 = motionEvent.getX();
|
|
float y3 = motionEvent.getY();
|
|
float abs = Math.abs(x3 - this.mInitialMotionX);
|
|
float abs2 = Math.abs(y3 - this.mInitialMotionY);
|
|
if (abs > ((float) this.mDragHelper.getTouchSlop()) && abs2 > abs) {
|
|
this.mDragHelper.cancel();
|
|
this.mIsUnableToDrag = true;
|
|
return false;
|
|
}
|
|
}
|
|
z2 = false;
|
|
if (this.mDragHelper.shouldInterceptTouchEvent(motionEvent)) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onLayout(boolean z2, int i, int i2, int i3, int i4) {
|
|
int i5;
|
|
int i6;
|
|
int i7;
|
|
int i8;
|
|
int i9;
|
|
boolean isLayoutRtlSupport = isLayoutRtlSupport();
|
|
if (isLayoutRtlSupport) {
|
|
this.mDragHelper.setEdgeTrackingEnabled(2);
|
|
} else {
|
|
this.mDragHelper.setEdgeTrackingEnabled(1);
|
|
}
|
|
int i10 = i3 - i;
|
|
int paddingRight = isLayoutRtlSupport ? getPaddingRight() : getPaddingLeft();
|
|
int paddingLeft = isLayoutRtlSupport ? getPaddingLeft() : getPaddingRight();
|
|
int paddingTop = getPaddingTop();
|
|
int childCount = getChildCount();
|
|
if (this.mFirstLayout) {
|
|
this.mSlideOffset = (!this.mCanSlide || !this.mPreservedOpenState) ? 0.0f : 1.0f;
|
|
}
|
|
int i11 = paddingRight;
|
|
for (int i12 = 0; i12 < childCount; i12++) {
|
|
View childAt = getChildAt(i12);
|
|
if (childAt.getVisibility() != 8) {
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
int measuredWidth = childAt.getMeasuredWidth();
|
|
if (layoutParams.slideable) {
|
|
int i13 = i10 - paddingLeft;
|
|
int min = (Math.min(paddingRight, i13 - this.mOverhangSize) - i11) - (((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin);
|
|
this.mSlideRange = min;
|
|
int i14 = isLayoutRtlSupport ? ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin : ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin;
|
|
layoutParams.dimWhenOffset = (measuredWidth / 2) + ((i11 + i14) + min) > i13;
|
|
int i15 = (int) (((float) min) * this.mSlideOffset);
|
|
i6 = i14 + i15 + i11;
|
|
this.mSlideOffset = ((float) i15) / ((float) min);
|
|
i5 = 0;
|
|
} else if (!this.mCanSlide || (i9 = this.mParallaxBy) == 0) {
|
|
i6 = paddingRight;
|
|
i5 = 0;
|
|
} else {
|
|
i5 = (int) ((1.0f - this.mSlideOffset) * ((float) i9));
|
|
i6 = paddingRight;
|
|
}
|
|
if (isLayoutRtlSupport) {
|
|
i7 = (i10 - i6) + i5;
|
|
i8 = i7 - measuredWidth;
|
|
} else {
|
|
i8 = i6 - i5;
|
|
i7 = i8 + measuredWidth;
|
|
}
|
|
childAt.layout(i8, paddingTop, i7, childAt.getMeasuredHeight() + paddingTop);
|
|
i11 = i6;
|
|
paddingRight = childAt.getWidth() + paddingRight;
|
|
}
|
|
}
|
|
if (this.mFirstLayout) {
|
|
if (this.mCanSlide) {
|
|
if (this.mParallaxBy != 0) {
|
|
parallaxOtherViews(this.mSlideOffset);
|
|
}
|
|
if (((LayoutParams) this.mSlideableView.getLayoutParams()).dimWhenOffset) {
|
|
dimChildView(this.mSlideableView, this.mSlideOffset, this.mSliderFadeColor);
|
|
}
|
|
} else {
|
|
for (int i16 = 0; i16 < childCount; i16++) {
|
|
dimChildView(getChildAt(i16), 0.0f, this.mSliderFadeColor);
|
|
}
|
|
}
|
|
updateObscuredViewsVisibility(this.mSlideableView);
|
|
}
|
|
this.mFirstLayout = false;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onMeasure(int i, int i2) {
|
|
int i3;
|
|
int i4;
|
|
int i5;
|
|
int i6;
|
|
int i7;
|
|
int i8;
|
|
int i9;
|
|
float f;
|
|
int i10;
|
|
int i11;
|
|
int i12;
|
|
int mode = View.MeasureSpec.getMode(i);
|
|
int size = View.MeasureSpec.getSize(i);
|
|
int mode2 = View.MeasureSpec.getMode(i2);
|
|
int size2 = View.MeasureSpec.getSize(i2);
|
|
if (mode != 1073741824) {
|
|
if (!isInEditMode()) {
|
|
throw new IllegalStateException("Width must have an exact value or MATCH_PARENT");
|
|
} else if (mode != Integer.MIN_VALUE && mode == 0) {
|
|
size = 300;
|
|
}
|
|
} else if (mode2 == 0) {
|
|
if (!isInEditMode()) {
|
|
throw new IllegalStateException("Height must not be UNSPECIFIED");
|
|
} else if (mode2 == 0) {
|
|
mode2 = Integer.MIN_VALUE;
|
|
size2 = 300;
|
|
}
|
|
}
|
|
boolean z2 = false;
|
|
if (mode2 == Integer.MIN_VALUE) {
|
|
i3 = (size2 - getPaddingTop()) - getPaddingBottom();
|
|
i4 = 0;
|
|
} else if (mode2 != 1073741824) {
|
|
i4 = 0;
|
|
i3 = 0;
|
|
} else {
|
|
i4 = (size2 - getPaddingTop()) - getPaddingBottom();
|
|
i3 = i4;
|
|
}
|
|
int paddingLeft = (size - getPaddingLeft()) - getPaddingRight();
|
|
int childCount = getChildCount();
|
|
if (childCount > 2) {
|
|
Log.e("SlidingPaneLayout", "onMeasure: More than two child views are not supported.");
|
|
}
|
|
this.mSlideableView = null;
|
|
int i13 = paddingLeft;
|
|
int i14 = 0;
|
|
boolean z3 = false;
|
|
float f2 = 0.0f;
|
|
while (true) {
|
|
i5 = 8;
|
|
if (i14 >= childCount) {
|
|
break;
|
|
}
|
|
View childAt = getChildAt(i14);
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
if (childAt.getVisibility() == 8) {
|
|
layoutParams.dimWhenOffset = z2;
|
|
} else {
|
|
float f3 = layoutParams.weight;
|
|
if (f3 > 0.0f) {
|
|
f2 += f3;
|
|
if (((ViewGroup.MarginLayoutParams) layoutParams).width == 0) {
|
|
}
|
|
}
|
|
int i15 = ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
|
|
int i16 = ((ViewGroup.MarginLayoutParams) layoutParams).width;
|
|
if (i16 == -2) {
|
|
i10 = View.MeasureSpec.makeMeasureSpec(paddingLeft - i15, Integer.MIN_VALUE);
|
|
f = f2;
|
|
i11 = Integer.MIN_VALUE;
|
|
} else {
|
|
f = f2;
|
|
i11 = Integer.MIN_VALUE;
|
|
i10 = i16 == -1 ? View.MeasureSpec.makeMeasureSpec(paddingLeft - i15, 1073741824) : View.MeasureSpec.makeMeasureSpec(i16, 1073741824);
|
|
}
|
|
int i17 = ((ViewGroup.MarginLayoutParams) layoutParams).height;
|
|
if (i17 == -2) {
|
|
i12 = View.MeasureSpec.makeMeasureSpec(i3, i11);
|
|
} else {
|
|
i12 = i17 == -1 ? View.MeasureSpec.makeMeasureSpec(i3, 1073741824) : View.MeasureSpec.makeMeasureSpec(i17, 1073741824);
|
|
}
|
|
childAt.measure(i10, i12);
|
|
int measuredWidth = childAt.getMeasuredWidth();
|
|
int measuredHeight = childAt.getMeasuredHeight();
|
|
if (mode2 == i11 && measuredHeight > i4) {
|
|
i4 = Math.min(measuredHeight, i3);
|
|
}
|
|
i13 -= measuredWidth;
|
|
boolean z4 = i13 < 0;
|
|
layoutParams.slideable = z4;
|
|
z3 |= z4;
|
|
if (z4) {
|
|
this.mSlideableView = childAt;
|
|
}
|
|
f2 = f;
|
|
}
|
|
i14++;
|
|
z2 = false;
|
|
}
|
|
if (z3 || f2 > 0.0f) {
|
|
int i18 = paddingLeft - this.mOverhangSize;
|
|
int i19 = 0;
|
|
while (i19 < childCount) {
|
|
View childAt2 = getChildAt(i19);
|
|
if (childAt2.getVisibility() != i5) {
|
|
LayoutParams layoutParams2 = (LayoutParams) childAt2.getLayoutParams();
|
|
if (childAt2.getVisibility() != i5) {
|
|
boolean z5 = ((ViewGroup.MarginLayoutParams) layoutParams2).width == 0 && layoutParams2.weight > 0.0f;
|
|
int measuredWidth2 = z5 ? 0 : childAt2.getMeasuredWidth();
|
|
if (!z3 || childAt2 == this.mSlideableView) {
|
|
if (layoutParams2.weight > 0.0f) {
|
|
if (((ViewGroup.MarginLayoutParams) layoutParams2).width == 0) {
|
|
int i20 = ((ViewGroup.MarginLayoutParams) layoutParams2).height;
|
|
i7 = i20 == -2 ? View.MeasureSpec.makeMeasureSpec(i3, Integer.MIN_VALUE) : i20 == -1 ? View.MeasureSpec.makeMeasureSpec(i3, 1073741824) : View.MeasureSpec.makeMeasureSpec(i20, 1073741824);
|
|
} else {
|
|
i7 = View.MeasureSpec.makeMeasureSpec(childAt2.getMeasuredHeight(), 1073741824);
|
|
}
|
|
if (z3) {
|
|
int i21 = paddingLeft - (((ViewGroup.MarginLayoutParams) layoutParams2).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams2).rightMargin);
|
|
i6 = i18;
|
|
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i21, 1073741824);
|
|
if (measuredWidth2 != i21) {
|
|
childAt2.measure(makeMeasureSpec, i7);
|
|
}
|
|
i19++;
|
|
i18 = i6;
|
|
i5 = 8;
|
|
} else {
|
|
i6 = i18;
|
|
childAt2.measure(View.MeasureSpec.makeMeasureSpec(measuredWidth2 + ((int) ((layoutParams2.weight * ((float) Math.max(0, i13))) / f2)), 1073741824), i7);
|
|
i19++;
|
|
i18 = i6;
|
|
i5 = 8;
|
|
}
|
|
}
|
|
} else if (((ViewGroup.MarginLayoutParams) layoutParams2).width < 0 && (measuredWidth2 > i18 || layoutParams2.weight > 0.0f)) {
|
|
if (z5) {
|
|
int i22 = ((ViewGroup.MarginLayoutParams) layoutParams2).height;
|
|
if (i22 == -2) {
|
|
i9 = View.MeasureSpec.makeMeasureSpec(i3, Integer.MIN_VALUE);
|
|
i8 = 1073741824;
|
|
} else if (i22 == -1) {
|
|
i8 = 1073741824;
|
|
i9 = View.MeasureSpec.makeMeasureSpec(i3, 1073741824);
|
|
} else {
|
|
i8 = 1073741824;
|
|
i9 = View.MeasureSpec.makeMeasureSpec(i22, 1073741824);
|
|
}
|
|
} else {
|
|
i8 = 1073741824;
|
|
i9 = View.MeasureSpec.makeMeasureSpec(childAt2.getMeasuredHeight(), 1073741824);
|
|
}
|
|
childAt2.measure(View.MeasureSpec.makeMeasureSpec(i18, i8), i9);
|
|
}
|
|
}
|
|
}
|
|
i6 = i18;
|
|
i19++;
|
|
i18 = i6;
|
|
i5 = 8;
|
|
}
|
|
}
|
|
setMeasuredDimension(size, getPaddingBottom() + getPaddingTop() + i4);
|
|
this.mCanSlide = z3;
|
|
if (this.mDragHelper.getViewDragState() != 0 && !z3) {
|
|
this.mDragHelper.abort();
|
|
}
|
|
}
|
|
|
|
public void onPanelDragged(int i) {
|
|
if (this.mSlideableView == null) {
|
|
this.mSlideOffset = 0.0f;
|
|
return;
|
|
}
|
|
boolean isLayoutRtlSupport = isLayoutRtlSupport();
|
|
LayoutParams layoutParams = (LayoutParams) this.mSlideableView.getLayoutParams();
|
|
int width = this.mSlideableView.getWidth();
|
|
if (isLayoutRtlSupport) {
|
|
i = (getWidth() - i) - width;
|
|
}
|
|
float paddingRight = ((float) (i - ((isLayoutRtlSupport ? getPaddingRight() : getPaddingLeft()) + (isLayoutRtlSupport ? ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin : ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin)))) / ((float) this.mSlideRange);
|
|
this.mSlideOffset = paddingRight;
|
|
if (this.mParallaxBy != 0) {
|
|
parallaxOtherViews(paddingRight);
|
|
}
|
|
if (layoutParams.dimWhenOffset) {
|
|
dimChildView(this.mSlideableView, this.mSlideOffset, this.mSliderFadeColor);
|
|
}
|
|
dispatchOnPanelSlide(this.mSlideableView);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onRestoreInstanceState(Parcelable parcelable) {
|
|
if (!(parcelable instanceof SavedState)) {
|
|
super.onRestoreInstanceState(parcelable);
|
|
return;
|
|
}
|
|
SavedState savedState = (SavedState) parcelable;
|
|
super.onRestoreInstanceState(savedState.getSuperState());
|
|
if (savedState.isOpen) {
|
|
openPane();
|
|
} else {
|
|
closePane();
|
|
}
|
|
this.mPreservedOpenState = savedState.isOpen;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public Parcelable onSaveInstanceState() {
|
|
SavedState savedState = new SavedState(super.onSaveInstanceState());
|
|
savedState.isOpen = isSlideable() ? isOpen() : this.mPreservedOpenState;
|
|
return savedState;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onSizeChanged(int i, int i2, int i3, int i4) {
|
|
super.onSizeChanged(i, i2, i3, i4);
|
|
if (i != i3) {
|
|
this.mFirstLayout = true;
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean onTouchEvent(MotionEvent motionEvent) {
|
|
if (!this.mCanSlide) {
|
|
return super.onTouchEvent(motionEvent);
|
|
}
|
|
this.mDragHelper.processTouchEvent(motionEvent);
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
if (actionMasked == 0) {
|
|
float x2 = motionEvent.getX();
|
|
float y2 = motionEvent.getY();
|
|
this.mInitialMotionX = x2;
|
|
this.mInitialMotionY = y2;
|
|
} else if (actionMasked == 1 && isDimmed(this.mSlideableView)) {
|
|
float x3 = motionEvent.getX();
|
|
float y3 = motionEvent.getY();
|
|
float f = x3 - this.mInitialMotionX;
|
|
float f2 = y3 - this.mInitialMotionY;
|
|
int touchSlop = this.mDragHelper.getTouchSlop();
|
|
if ((f2 * f2) + (f * f) < ((float) (touchSlop * touchSlop)) && this.mDragHelper.isViewUnder(this.mSlideableView, (int) x3, (int) y3)) {
|
|
closePane(this.mSlideableView, 0);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public boolean openPane() {
|
|
return openPane(this.mSlideableView, 0);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public void requestChildFocus(View view, View view2) {
|
|
super.requestChildFocus(view, view2);
|
|
if (!isInTouchMode() && !this.mCanSlide) {
|
|
this.mPreservedOpenState = view == this.mSlideableView;
|
|
}
|
|
}
|
|
|
|
public void setAllChildrenVisible() {
|
|
int childCount = getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = getChildAt(i);
|
|
if (childAt.getVisibility() == 4) {
|
|
childAt.setVisibility(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void setCoveredFadeColor(@ColorInt int i) {
|
|
this.mCoveredFadeColor = i;
|
|
}
|
|
|
|
public void setPanelSlideListener(@Nullable PanelSlideListener panelSlideListener) {
|
|
this.mPanelSlideListener = panelSlideListener;
|
|
}
|
|
|
|
public void setParallaxDistance(@Px int i) {
|
|
this.mParallaxBy = i;
|
|
requestLayout();
|
|
}
|
|
|
|
@Deprecated
|
|
public void setShadowDrawable(Drawable drawable) {
|
|
setShadowDrawableLeft(drawable);
|
|
}
|
|
|
|
public void setShadowDrawableLeft(@Nullable Drawable drawable) {
|
|
this.mShadowDrawableLeft = drawable;
|
|
}
|
|
|
|
public void setShadowDrawableRight(@Nullable Drawable drawable) {
|
|
this.mShadowDrawableRight = drawable;
|
|
}
|
|
|
|
@Deprecated
|
|
public void setShadowResource(@DrawableRes int i) {
|
|
setShadowDrawable(getResources().getDrawable(i));
|
|
}
|
|
|
|
public void setShadowResourceLeft(int i) {
|
|
setShadowDrawableLeft(ContextCompat.getDrawable(getContext(), i));
|
|
}
|
|
|
|
public void setShadowResourceRight(int i) {
|
|
setShadowDrawableRight(ContextCompat.getDrawable(getContext(), i));
|
|
}
|
|
|
|
public void setSliderFadeColor(@ColorInt int i) {
|
|
this.mSliderFadeColor = i;
|
|
}
|
|
|
|
@Deprecated
|
|
public void smoothSlideClosed() {
|
|
closePane();
|
|
}
|
|
|
|
@Deprecated
|
|
public void smoothSlideOpen() {
|
|
openPane();
|
|
}
|
|
|
|
public boolean smoothSlideTo(float f, int i) {
|
|
int i2;
|
|
if (!this.mCanSlide) {
|
|
return false;
|
|
}
|
|
boolean isLayoutRtlSupport = isLayoutRtlSupport();
|
|
LayoutParams layoutParams = (LayoutParams) this.mSlideableView.getLayoutParams();
|
|
if (isLayoutRtlSupport) {
|
|
int paddingRight = getPaddingRight() + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
|
|
int width = this.mSlideableView.getWidth();
|
|
i2 = (int) (((float) getWidth()) - (((f * ((float) this.mSlideRange)) + ((float) paddingRight)) + ((float) width)));
|
|
} else {
|
|
i2 = (int) ((f * ((float) this.mSlideRange)) + ((float) (getPaddingLeft() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin)));
|
|
}
|
|
ViewDragHelper viewDragHelper = this.mDragHelper;
|
|
View view = this.mSlideableView;
|
|
if (!viewDragHelper.smoothSlideViewTo(view, i2, view.getTop())) {
|
|
return false;
|
|
}
|
|
setAllChildrenVisible();
|
|
ViewCompat.postInvalidateOnAnimation(this);
|
|
return true;
|
|
}
|
|
|
|
public void updateObscuredViewsVisibility(View view) {
|
|
int i;
|
|
int i2;
|
|
int i3;
|
|
int i4;
|
|
View childAt;
|
|
boolean z2;
|
|
View view2 = view;
|
|
boolean isLayoutRtlSupport = isLayoutRtlSupport();
|
|
int width = isLayoutRtlSupport ? getWidth() - getPaddingRight() : getPaddingLeft();
|
|
int paddingLeft = isLayoutRtlSupport ? getPaddingLeft() : getWidth() - getPaddingRight();
|
|
int paddingTop = getPaddingTop();
|
|
int height = getHeight() - getPaddingBottom();
|
|
if (view2 == null || !viewIsOpaque(view)) {
|
|
i4 = 0;
|
|
i3 = 0;
|
|
i2 = 0;
|
|
i = 0;
|
|
} else {
|
|
i4 = view.getLeft();
|
|
i3 = view.getRight();
|
|
i2 = view.getTop();
|
|
i = view.getBottom();
|
|
}
|
|
int childCount = getChildCount();
|
|
int i5 = 0;
|
|
while (i5 < childCount && (childAt = getChildAt(i5)) != view2) {
|
|
if (childAt.getVisibility() == 8) {
|
|
z2 = isLayoutRtlSupport;
|
|
} else {
|
|
z2 = isLayoutRtlSupport;
|
|
childAt.setVisibility((Math.max(isLayoutRtlSupport ? paddingLeft : width, childAt.getLeft()) < i4 || Math.max(paddingTop, childAt.getTop()) < i2 || Math.min(isLayoutRtlSupport ? width : paddingLeft, childAt.getRight()) > i3 || Math.min(height, childAt.getBottom()) > i) ? 0 : 4);
|
|
}
|
|
i5++;
|
|
view2 = view;
|
|
isLayoutRtlSupport = z2;
|
|
}
|
|
}
|
|
}
|