1 package android
.support
.v4
.widget
;
3 import android
.graphics
.Bitmap
;
4 import android
.graphics
.Canvas
;
5 import android
.graphics
.Paint
;
6 import android
.graphics
.PorterDuff
;
7 import android
.graphics
.PorterDuffColorFilter
;
8 import android
.graphics
.Rect
;
9 import android
.graphics
.drawable
.Drawable
;
10 import android
.os
.Build
;
11 import android
.os
.Parcel
;
12 import android
.os
.Parcelable
;
13 import android
.support
.v4
.view
.ak
;
14 import android
.support
.v4
.view
.av
;
15 import android
.util
.AttributeSet
;
16 import android
.util
.Log
;
17 import android
.view
.MotionEvent
;
18 import android
.view
.View
;
19 import android
.view
.ViewGroup
;
20 import java
.util
.ArrayList
;
22 /* compiled from: MyApp */
23 public class SlidingPaneLayout
extends ViewGroup
{
43 private final ArrayList t
;
46 int i2
= Build
.VERSION
.SDK_INT
;
49 } else if (i2
>= 16) {
56 public void setParallaxDistance(int i2
) {
61 public int getParallaxDistance() {
65 public void setSliderFadeColor(int i2
) {
69 public int getSliderFadeColor() {
73 public void setCoveredFadeColor(int i2
) {
77 public int getCoveredFadeColor() {
81 public void setPanelSlideListener(z zVar
) {
85 /* access modifiers changed from: package-private */
86 public void a(View view
) {
92 int paddingLeft
= getPaddingLeft();
93 int width
= getWidth() - getPaddingRight();
94 int paddingTop
= getPaddingTop();
95 int height
= getHeight() - getPaddingBottom();
96 if (view
== null || !c(view
)) {
103 i4
= view
.getRight();
105 i2
= view
.getBottom();
107 int childCount
= getChildCount();
108 for (int i7
= 0; i7
< childCount
; i7
++) {
109 View childAt
= getChildAt(i7
);
110 if (childAt
!= view
) {
111 int max
= Math
.max(paddingLeft
, childAt
.getLeft());
112 int max2
= Math
.max(paddingTop
, childAt
.getTop());
113 int min
= Math
.min(width
, childAt
.getRight());
114 int min2
= Math
.min(height
, childAt
.getBottom());
115 if (max
< i5
|| max2
< i3
|| min
> i4
|| min2
> i2
) {
120 childAt
.setVisibility(i6
);
127 /* access modifiers changed from: package-private */
129 int childCount
= getChildCount();
130 for (int i2
= 0; i2
< childCount
; i2
++) {
131 View childAt
= getChildAt(i2
);
132 if (childAt
.getVisibility() == 4) {
133 childAt
.setVisibility(0);
138 private static boolean c(View view
) {
142 if (Build
.VERSION
.SDK_INT
>= 18) {
145 Drawable background
= view
.getBackground();
146 if (background
!= null) {
147 return background
.getOpacity() == -1;
152 /* access modifiers changed from: protected */
153 public void onAttachedToWindow() {
154 super.onAttachedToWindow();
158 /* access modifiers changed from: protected */
159 public void onDetachedFromWindow() {
160 super.onDetachedFromWindow();
162 int size
= this.t
.size();
163 for (int i2
= 0; i2
< size
; i2
++) {
164 ((x
) this.t
.get(i2
)).run();
169 /* access modifiers changed from: protected */
170 public void onMeasure(int i2
, int i3
) {
177 int makeMeasureSpec2
;
178 int makeMeasureSpec3
;
179 int makeMeasureSpec4
;
184 int mode
= View
.MeasureSpec
.getMode(i2
);
185 int size
= View
.MeasureSpec
.getSize(i2
);
186 int mode2
= View
.MeasureSpec
.getMode(i3
);
187 int size2
= View
.MeasureSpec
.getSize(i3
);
188 if (mode
== 1073741824) {
190 if (!isInEditMode()) {
191 throw new IllegalStateException("Height must not be UNSPECIFIED");
192 } else if (mode2
== 0) {
193 i4
= Integer
.MIN_VALUE
;
201 } else if (!isInEditMode()) {
202 throw new IllegalStateException("Width must have an exact value or MATCH_PARENT");
203 } else if (mode
== Integer
.MIN_VALUE
) {
218 case Integer
.MIN_VALUE
:
220 paddingTop
= (i6
- getPaddingTop()) - getPaddingBottom();
223 i7
= (i6
- getPaddingTop()) - getPaddingBottom();
232 int paddingLeft
= (i5
- getPaddingLeft()) - getPaddingRight();
233 int childCount
= getChildCount();
234 if (childCount
> 2) {
235 Log
.e("SlidingPaneLayout", "onMeasure: More than two child views are not supported.");
241 while (i10
< childCount
) {
242 View childAt
= getChildAt(i10
);
243 y yVar
= (y
) childAt
.getLayoutParams();
244 if (childAt
.getVisibility() == 8) {
253 if (yVar
.width
== 0) {
260 int i12
= yVar
.leftMargin
+ yVar
.rightMargin
;
261 if (yVar
.width
== -2) {
262 makeMeasureSpec3
= View
.MeasureSpec
.makeMeasureSpec(i5
- i12
, Integer
.MIN_VALUE
);
263 } else if (yVar
.width
== -1) {
264 makeMeasureSpec3
= View
.MeasureSpec
.makeMeasureSpec(i5
- i12
, 1073741824);
266 makeMeasureSpec3
= View
.MeasureSpec
.makeMeasureSpec(yVar
.width
, 1073741824);
268 if (yVar
.height
== -2) {
269 makeMeasureSpec4
= View
.MeasureSpec
.makeMeasureSpec(paddingTop
, Integer
.MIN_VALUE
);
270 } else if (yVar
.height
== -1) {
271 makeMeasureSpec4
= View
.MeasureSpec
.makeMeasureSpec(paddingTop
, 1073741824);
273 makeMeasureSpec4
= View
.MeasureSpec
.makeMeasureSpec(yVar
.height
, 1073741824);
275 childAt
.measure(makeMeasureSpec3
, makeMeasureSpec4
);
276 int measuredWidth
= childAt
.getMeasuredWidth();
277 int measuredHeight
= childAt
.getMeasuredHeight();
278 if (i4
== Integer
.MIN_VALUE
&& measuredHeight
> i11
) {
279 i11
= Math
.min(measuredHeight
, paddingTop
);
281 int i13
= paddingLeft
- measuredWidth
;
282 boolean z3
= i13
< 0;
284 boolean z4
= z3
| z2
;
299 if (z2
|| f3
> 0.0f
) {
300 int i14
= i5
- this.e
;
301 for (int i15
= 0; i15
< childCount
; i15
++) {
302 View childAt2
= getChildAt(i15
);
303 if (childAt2
.getVisibility() != 8) {
304 y yVar2
= (y
) childAt2
.getLayoutParams();
305 if (childAt2
.getVisibility() != 8) {
306 boolean z5
= yVar2
.width
== 0 && yVar2
.a
> 0.0f
;
307 int measuredWidth2
= z5 ?
0 : childAt2
.getMeasuredWidth();
308 if (!z2
|| childAt2
== this.g
) {
309 if (yVar2
.a
> 0.0f
) {
310 if (yVar2
.width
!= 0) {
311 makeMeasureSpec
= View
.MeasureSpec
.makeMeasureSpec(childAt2
.getMeasuredHeight(), 1073741824);
312 } else if (yVar2
.height
== -2) {
313 makeMeasureSpec
= View
.MeasureSpec
.makeMeasureSpec(paddingTop
, Integer
.MIN_VALUE
);
314 } else if (yVar2
.height
== -1) {
315 makeMeasureSpec
= View
.MeasureSpec
.makeMeasureSpec(paddingTop
, 1073741824);
317 makeMeasureSpec
= View
.MeasureSpec
.makeMeasureSpec(yVar2
.height
, 1073741824);
320 int i16
= i5
- (yVar2
.rightMargin
+ yVar2
.leftMargin
);
321 int makeMeasureSpec5
= View
.MeasureSpec
.makeMeasureSpec(i16
, 1073741824);
322 if (measuredWidth2
!= i16
) {
323 childAt2
.measure(makeMeasureSpec5
, makeMeasureSpec
);
326 childAt2
.measure(View
.MeasureSpec
.makeMeasureSpec(((int) ((yVar2
.a
* ((float) Math
.max(0, paddingLeft
))) / f3
)) + measuredWidth2
, 1073741824), makeMeasureSpec
);
329 } else if (yVar2
.width
< 0 && (measuredWidth2
> i14
|| yVar2
.a
> 0.0f
)) {
331 makeMeasureSpec2
= View
.MeasureSpec
.makeMeasureSpec(childAt2
.getMeasuredHeight(), 1073741824);
332 } else if (yVar2
.height
== -2) {
333 makeMeasureSpec2
= View
.MeasureSpec
.makeMeasureSpec(paddingTop
, Integer
.MIN_VALUE
);
334 } else if (yVar2
.height
== -1) {
335 makeMeasureSpec2
= View
.MeasureSpec
.makeMeasureSpec(paddingTop
, 1073741824);
337 makeMeasureSpec2
= View
.MeasureSpec
.makeMeasureSpec(yVar2
.height
, 1073741824);
339 childAt2
.measure(View
.MeasureSpec
.makeMeasureSpec(i14
, 1073741824), makeMeasureSpec2
);
345 setMeasuredDimension(i5
, i11
);
347 if (!(this.p
.a() == 0 || z2
)) {
352 /* access modifiers changed from: protected */
353 public void onLayout(boolean z
, int i2
, int i3
, int i4
, int i5
) {
357 int paddingLeft
= getPaddingLeft();
358 int paddingRight
= getPaddingRight();
359 int paddingTop
= getPaddingTop();
360 int childCount
= getChildCount();
362 this.h
= (!this.f
|| !this.q
) ?
0.0f
: 1.0f
;
365 int i10
= paddingLeft
;
366 while (i9
< childCount
) {
367 View childAt
= getChildAt(i9
);
368 if (childAt
.getVisibility() == 8) {
371 y yVar
= (y
) childAt
.getLayoutParams();
372 int measuredWidth
= childAt
.getMeasuredWidth();
374 int min
= (Math
.min(paddingLeft
, (i8
- paddingRight
) - this.e
) - i10
) - (yVar
.leftMargin
+ yVar
.rightMargin
);
376 yVar
.c
= ((yVar
.leftMargin
+ i10
) + min
) + (measuredWidth
/ 2) > i8
- paddingRight
;
377 i7
= yVar
.leftMargin
+ ((int) (((float) min
) * this.h
)) + i10
;
379 } else if (!this.f
|| this.l
== 0) {
383 i6
= (int) ((1.0f
- this.h
) * ((float) this.l
));
387 childAt
.layout(i11
, paddingTop
, i11
+ measuredWidth
, childAt
.getMeasuredHeight() + paddingTop
);
388 paddingLeft
+= childAt
.getWidth();
398 if (((y
) this.g
.getLayoutParams()).c
) {
399 a(this.g
, this.h
, this.b
);
402 for (int i12
= 0; i12
< childCount
; i12
++) {
403 a(getChildAt(i12
), 0.0f
, this.b
);
411 /* access modifiers changed from: protected */
412 public void onSizeChanged(int i2
, int i3
, int i4
, int i5
) {
413 super.onSizeChanged(i2
, i3
, i4
, i5
);
419 public void requestChildFocus(View view
, View view2
) {
420 super.requestChildFocus(view
, view2
);
421 if (!isInTouchMode() && !this.f
) {
422 this.q
= view
== this.g
;
426 /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
427 public boolean onInterceptTouchEvent(MotionEvent motionEvent
) {
430 int a2
= ak
.a(motionEvent
);
431 if (!this.f
&& a2
== 0 && getChildCount() > 1 && (childAt
= getChildAt(1)) != null) {
432 this.q
= !this.p
.b(childAt
, (int) motionEvent
.getX(), (int) motionEvent
.getY());
434 if (!this.f
|| (this.k
&& a2
!= 0)) {
436 return super.onInterceptTouchEvent(motionEvent
);
437 } else if (a2
== 3 || a2
== 1) {
444 float x
= motionEvent
.getX();
445 float y
= motionEvent
.getY();
448 if (this.p
.b(this.g
, (int) x
, (int) y
) && b(this.g
)) {
459 float x2
= motionEvent
.getX();
460 float y2
= motionEvent
.getY();
461 float abs
= Math
.abs(x2
- this.m
);
462 float abs2
= Math
.abs(y2
- this.n
);
463 if (abs
> ((float) this.p
.d()) && abs2
> abs
) {
471 return this.p
.a(motionEvent
) || z
;
475 public boolean onTouchEvent(MotionEvent motionEvent
) {
477 return super.onTouchEvent(motionEvent
);
479 this.p
.b(motionEvent
);
480 switch (motionEvent
.getAction() & 255) {
482 float x
= motionEvent
.getX();
483 float y
= motionEvent
.getY();
491 float x2
= motionEvent
.getX();
492 float y2
= motionEvent
.getY();
493 float f2
= x2
- this.m
;
494 float f3
= y2
- this.n
;
496 if ((f2
* f2
) + (f3
* f3
) >= ((float) (d2
* d2
)) || !this.p
.b(this.g
, (int) x2
, (int) y2
)) {
506 private boolean a(View view
, int i2
) {
507 if (!this.r
&& !a(0.0f
, i2
)) {
514 private boolean b(View view
, int i2
) {
515 if (!this.r
&& !a(1.0f
, i2
)) {
531 return !this.f
|| this.h
== 1.0f
;
538 private void a(View view
, float f2
, int i2
) {
539 y yVar
= (y
) view
.getLayoutParams();
540 if (f2
> 0.0f
&& i2
!= 0) {
541 int i3
= (((int) (((float) ((-16777216 & i2
) >>> 24)) * f2
)) << 24) | (16777215 & i2
);
542 if (yVar
.d
== null) {
543 yVar
.d
= new Paint();
545 yVar
.d
.setColorFilter(new PorterDuffColorFilter(i3
, PorterDuff
.Mode
.SRC_OVER
));
546 if (av
.d(view
) != 2) {
547 av
.a(view
, 2, yVar
.d
);
550 } else if (av
.d(view
) != 0) {
551 if (yVar
.d
!= null) {
552 yVar
.d
.setColorFilter(null);
554 x xVar
= new x(this, view
);
560 /* access modifiers changed from: protected */
561 public boolean drawChild(Canvas canvas
, View view
, long j2
) {
563 y yVar
= (y
) view
.getLayoutParams();
564 int save
= canvas
.save(2);
565 if (this.f
&& !yVar
.b
&& this.g
!= null) {
566 canvas
.getClipBounds(this.s
);
567 this.s
.right
= Math
.min(this.s
.right
, this.g
.getLeft());
568 canvas
.clipRect(this.s
);
570 if (Build
.VERSION
.SDK_INT
>= 11) {
571 drawChild
= super.drawChild(canvas
, view
, j2
);
572 } else if (!yVar
.c
|| this.h
<= 0.0f
) {
573 if (view
.isDrawingCacheEnabled()) {
574 view
.setDrawingCacheEnabled(false);
576 drawChild
= super.drawChild(canvas
, view
, j2
);
578 if (!view
.isDrawingCacheEnabled()) {
579 view
.setDrawingCacheEnabled(true);
581 Bitmap drawingCache
= view
.getDrawingCache();
582 if (drawingCache
!= null) {
583 canvas
.drawBitmap(drawingCache
, (float) view
.getLeft(), (float) view
.getTop(), yVar
.d
);
586 Log
.e("SlidingPaneLayout", "drawChild: child view " + view
+ " returned null drawing cache");
587 drawChild
= super.drawChild(canvas
, view
, j2
);
590 canvas
.restoreToCount(save
);
594 /* access modifiers changed from: private */
595 public void d(View view
) {
599 /* access modifiers changed from: package-private */
600 public boolean a(float f2
, int i2
) {
604 int paddingLeft
= getPaddingLeft();
605 if (!this.p
.a(this.g
, (int) (((float) (((y
) this.g
.getLayoutParams()).leftMargin
+ paddingLeft
)) + (((float) this.j
) * f2
)), this.g
.getTop())) {
613 public void computeScroll() {
614 if (!this.p
.a(true)) {
624 public void setShadowDrawable(Drawable drawable
) {
628 public void setShadowResource(int i2
) {
629 setShadowDrawable(getResources().getDrawable(i2
));
632 public void draw(Canvas canvas
) {
634 View childAt
= getChildCount() > 1 ?
getChildAt(1) : null;
635 if (childAt
!= null && this.d
!= null) {
636 int intrinsicWidth
= this.d
.getIntrinsicWidth();
637 int left
= childAt
.getLeft();
638 this.d
.setBounds(left
- intrinsicWidth
, childAt
.getTop(), left
, childAt
.getBottom());
643 private void a(float f2
) {
644 y yVar
= (y
) this.g
.getLayoutParams();
645 boolean z
= yVar
.c
&& yVar
.leftMargin
<= 0;
646 int childCount
= getChildCount();
647 for (int i2
= 0; i2
< childCount
; i2
++) {
648 View childAt
= getChildAt(i2
);
649 if (childAt
!= this.g
) {
651 childAt
.offsetLeftAndRight(((int) ((1.0f
- this.i
) * ((float) this.l
))) - ((int) ((1.0f
- f2
) * ((float) this.l
))));
653 a(childAt
, 1.0f
- this.i
, this.c
);
659 /* access modifiers changed from: package-private */
660 public boolean b(View view
) {
664 return this.f
&& ((y
) view
.getLayoutParams()).c
&& this.h
> 0.0f
;
667 /* access modifiers changed from: protected */
668 public ViewGroup
.LayoutParams
generateDefaultLayoutParams() {
672 /* access modifiers changed from: protected */
673 @Override // android.view.ViewGroup
674 public ViewGroup
.LayoutParams
generateLayoutParams(ViewGroup
.LayoutParams layoutParams
) {
675 return layoutParams
instanceof ViewGroup
.MarginLayoutParams ?
new y((ViewGroup
.MarginLayoutParams
) layoutParams
) : new y(layoutParams
);
678 /* access modifiers changed from: protected */
679 public boolean checkLayoutParams(ViewGroup
.LayoutParams layoutParams
) {
680 return (layoutParams
instanceof y
) && super.checkLayoutParams(layoutParams
);
683 @Override // android.view.ViewGroup
684 public ViewGroup
.LayoutParams
generateLayoutParams(AttributeSet attributeSet
) {
685 return new y(getContext(), attributeSet
);
688 /* access modifiers changed from: protected */
689 public Parcelable
onSaveInstanceState() {
690 SavedState savedState
= new SavedState(super.onSaveInstanceState());
691 savedState
.a
= e() ?
d() : this.q
;
695 /* access modifiers changed from: protected */
696 public void onRestoreInstanceState(Parcelable parcelable
) {
697 SavedState savedState
= (SavedState
) parcelable
;
698 super.onRestoreInstanceState(savedState
.getSuperState());
704 this.q
= savedState
.a
;
707 /* access modifiers changed from: package-private */
708 /* compiled from: MyApp */
709 public class SavedState
extends View
.BaseSavedState
{
710 public static final Parcelable
.Creator CREATOR
= new aa();
713 SavedState(Parcelable parcelable
) {
717 private SavedState(Parcel parcel
) {
719 this.a
= parcel
.readInt() != 0;
722 public void writeToParcel(Parcel parcel
, int i
) {
723 super.writeToParcel(parcel
, i
);
724 parcel
.writeInt(this.a ?
1 : 0);