1 package android
.support
.v7
.internal
.widget
;
3 import android
.content
.Context
;
4 import android
.content
.res
.TypedArray
;
5 import android
.graphics
.drawable
.Drawable
;
6 import android
.support
.v7
.b
.c
;
7 import android
.support
.v7
.b
.f
;
8 import android
.support
.v7
.b
.h
;
9 import android
.support
.v7
.b
.k
;
10 import android
.support
.v7
.c
.a
;
11 import android
.support
.v7
.internal
.view
.menu
.ActionMenuPresenter
;
12 import android
.support
.v7
.internal
.view
.menu
.ActionMenuView
;
13 import android
.support
.v7
.internal
.view
.menu
.q
;
14 import android
.text
.TextUtils
;
15 import android
.util
.AttributeSet
;
16 import android
.view
.LayoutInflater
;
17 import android
.view
.View
;
18 import android
.view
.ViewGroup
;
19 import android
.widget
.LinearLayout
;
20 import android
.widget
.TextView
;
22 /* compiled from: MyApp */
23 public class ActionBarContextView
extends a
{
24 private CharSequence g
;
25 private CharSequence h
;
28 private LinearLayout k
;
36 @Override // android.support.v7.internal.widget.a
37 public /* bridge */ /* synthetic */ void a(int i2
) {
41 @Override // android.support.v7.internal.widget.a
42 public /* bridge */ /* synthetic */ void b() {
46 @Override // android.support.v7.internal.widget.a
47 public /* bridge */ /* synthetic */ boolean e() {
51 @Override // android.support.v7.internal.widget.a
52 public /* bridge */ /* synthetic */ void f() {
56 @Override // android.support.v7.internal.widget.a
57 public /* bridge */ /* synthetic */ int getAnimatedVisibility() {
58 return super.getAnimatedVisibility();
61 @Override // android.support.v7.internal.widget.a
62 public /* bridge */ /* synthetic */ int getContentHeight() {
63 return super.getContentHeight();
66 @Override // android.support.v7.internal.widget.a
67 public /* bridge */ /* synthetic */ void setSplitView(ActionBarContainer actionBarContainer
) {
68 super.setSplitView(actionBarContainer
);
71 @Override // android.support.v7.internal.widget.a
72 public /* bridge */ /* synthetic */ void setSplitWhenNarrow(boolean z
) {
73 super.setSplitWhenNarrow(z
);
76 @Override // android.support.v7.internal.widget.a
77 public /* bridge */ /* synthetic */ void setVisibility(int i2
) {
78 super.setVisibility(i2
);
81 public ActionBarContextView(Context context
) {
85 public ActionBarContextView(Context context
, AttributeSet attributeSet
) {
86 this(context
, attributeSet
, c
.actionModeStyle
);
89 public ActionBarContextView(Context context
, AttributeSet attributeSet
, int i2
) {
90 super(context
, attributeSet
, i2
);
91 TypedArray obtainStyledAttributes
= context
.obtainStyledAttributes(attributeSet
, k
.ActionMode
, i2
, 0);
92 setBackgroundDrawable(obtainStyledAttributes
.getDrawable(3));
93 this.n
= obtainStyledAttributes
.getResourceId(1, 0);
94 this.o
= obtainStyledAttributes
.getResourceId(2, 0);
95 this.f
= obtainStyledAttributes
.getLayoutDimension(0, 0);
96 this.p
= obtainStyledAttributes
.getDrawable(4);
97 obtainStyledAttributes
.recycle();
100 public void onDetachedFromWindow() {
101 super.onDetachedFromWindow();
102 if (this.b
!= null) {
108 @Override // android.support.v7.internal.widget.a
109 public void setSplitActionBar(boolean z
) {
111 if (this.b
!= null) {
112 ViewGroup
.LayoutParams layoutParams
= new ViewGroup
.LayoutParams(-2, -1);
114 this.a
= (ActionMenuView
) this.b
.a(this);
115 this.a
.setBackgroundDrawable(null);
116 ViewGroup viewGroup
= (ViewGroup
) this.a
.getParent();
117 if (viewGroup
!= null) {
118 viewGroup
.removeView(this.a
);
120 addView(this.a
, layoutParams
);
122 this.b
.a(getContext().getResources().getDisplayMetrics().widthPixels
, true);
123 this.b
.a(Integer
.MAX_VALUE
);
124 layoutParams
.width
= -1;
125 layoutParams
.height
= this.f
;
126 this.a
= (ActionMenuView
) this.b
.a(this);
127 this.a
.setBackgroundDrawable(this.p
);
128 ViewGroup viewGroup2
= (ViewGroup
) this.a
.getParent();
129 if (viewGroup2
!= null) {
130 viewGroup2
.removeView(this.a
);
132 this.c
.addView(this.a
, layoutParams
);
135 super.setSplitActionBar(z
);
139 @Override // android.support.v7.internal.widget.a
140 public void setContentHeight(int i2
) {
144 public void setCustomView(View view
) {
145 if (this.j
!= null) {
149 if (this.k
!= null) {
159 public void setTitle(CharSequence charSequence
) {
160 this.g
= charSequence
;
164 public void setSubtitle(CharSequence charSequence
) {
165 this.h
= charSequence
;
169 public CharSequence
getTitle() {
173 public CharSequence
getSubtitle() {
181 if (this.k
== null) {
182 LayoutInflater
.from(getContext()).inflate(h
.abc_action_bar_title_item
, this);
183 this.k
= (LinearLayout
) getChildAt(getChildCount() - 1);
184 this.l
= (TextView
) this.k
.findViewById(f
.action_bar_title
);
185 this.m
= (TextView
) this.k
.findViewById(f
.action_bar_subtitle
);
187 this.l
.setTextAppearance(getContext(), this.n
);
190 this.m
.setTextAppearance(getContext(), this.o
);
193 this.l
.setText(this.g
);
194 this.m
.setText(this.h
);
195 boolean z2
= !TextUtils
.isEmpty(this.g
);
196 if (TextUtils
.isEmpty(this.h
)) {
199 TextView textView
= this.m
;
205 textView
.setVisibility(i2
);
206 LinearLayout linearLayout
= this.k
;
210 linearLayout
.setVisibility(i3
);
211 if (this.k
.getParent() == null) {
216 public void a(a aVar
) {
217 if (this.i
== null) {
218 this.i
= LayoutInflater
.from(getContext()).inflate(h
.abc_action_mode_close_item
, (ViewGroup
) this, false);
220 } else if (this.i
.getParent() == null) {
223 this.i
.findViewById(f
.action_mode_close_button
).setOnClickListener(new f(this, aVar
));
224 q qVar
= (q
) aVar
.a();
225 if (this.b
!= null) {
228 this.b
= new ActionMenuPresenter(getContext());
230 ViewGroup
.LayoutParams layoutParams
= new ViewGroup
.LayoutParams(-2, -1);
233 this.a
= (ActionMenuView
) this.b
.a(this);
234 this.a
.setBackgroundDrawable(null);
235 addView(this.a
, layoutParams
);
238 this.b
.a(getContext().getResources().getDisplayMetrics().widthPixels
, true);
239 this.b
.a(Integer
.MAX_VALUE
);
240 layoutParams
.width
= -1;
241 layoutParams
.height
= this.f
;
243 this.a
= (ActionMenuView
) this.b
.a(this);
244 this.a
.setBackgroundDrawable(this.p
);
245 this.c
.addView(this.a
, layoutParams
);
249 if (this.i
== null) {
256 if (this.c
!= null) {
257 this.c
.removeView(this.a
);
263 @Override // android.support.v7.internal.widget.a
265 if (this.b
!= null) {
271 @Override // android.support.v7.internal.widget.a
273 if (this.b
!= null) {
279 @Override // android.support.v7.internal.widget.a
281 if (this.b
!= null) {
287 /* access modifiers changed from: protected */
288 public ViewGroup
.LayoutParams
generateDefaultLayoutParams() {
289 return new ViewGroup
.MarginLayoutParams(-1, -2);
292 @Override // android.view.ViewGroup
293 public ViewGroup
.LayoutParams
generateLayoutParams(AttributeSet attributeSet
) {
294 return new ViewGroup
.MarginLayoutParams(getContext(), attributeSet
);
297 /* access modifiers changed from: protected */
298 public void onMeasure(int i2
, int i3
) {
303 if (View
.MeasureSpec
.getMode(i2
) != 1073741824) {
304 throw new IllegalStateException(getClass().getSimpleName() + " can only be used " + "with android:layout_width=\"FILL_PARENT\" (or fill_parent)");
305 } else if (View
.MeasureSpec
.getMode(i3
) == 0) {
306 throw new IllegalStateException(getClass().getSimpleName() + " can only be used " + "with android:layout_height=\"wrap_content\"");
308 int size
= View
.MeasureSpec
.getSize(i2
);
309 int size2
= this.f
> 0 ?
this.f
: View
.MeasureSpec
.getSize(i3
);
310 int paddingTop
= getPaddingTop() + getPaddingBottom();
311 int paddingLeft
= (size
- getPaddingLeft()) - getPaddingRight();
312 int i8
= size2
- paddingTop
;
313 int makeMeasureSpec
= View
.MeasureSpec
.makeMeasureSpec(i8
, Integer
.MIN_VALUE
);
314 if (this.i
!= null) {
315 int a
= a(this.i
, paddingLeft
, makeMeasureSpec
, 0);
316 ViewGroup
.MarginLayoutParams marginLayoutParams
= (ViewGroup
.MarginLayoutParams
) this.i
.getLayoutParams();
317 paddingLeft
= a
- (marginLayoutParams
.rightMargin
+ marginLayoutParams
.leftMargin
);
319 if (this.a
!= null && this.a
.getParent() == this) {
320 paddingLeft
= a(this.a
, paddingLeft
, makeMeasureSpec
, 0);
322 if (this.k
!= null && this.j
== null) {
324 this.k
.measure(View
.MeasureSpec
.makeMeasureSpec(0, 0), makeMeasureSpec
);
325 int measuredWidth
= this.k
.getMeasuredWidth();
326 boolean z
= measuredWidth
<= paddingLeft
;
328 paddingLeft
-= measuredWidth
;
330 this.k
.setVisibility(z ?
0 : 8);
332 paddingLeft
= a(this.k
, paddingLeft
, makeMeasureSpec
, 0);
335 if (this.j
!= null) {
336 ViewGroup
.LayoutParams layoutParams
= this.j
.getLayoutParams();
337 if (layoutParams
.width
!= -2) {
340 i4
= Integer
.MIN_VALUE
;
342 if (layoutParams
.width
>= 0) {
343 paddingLeft
= Math
.min(layoutParams
.width
, paddingLeft
);
345 if (layoutParams
.height
== -2) {
346 i6
= Integer
.MIN_VALUE
;
348 if (layoutParams
.height
>= 0) {
349 i5
= Math
.min(layoutParams
.height
, i8
);
353 this.j
.measure(View
.MeasureSpec
.makeMeasureSpec(paddingLeft
, i4
), View
.MeasureSpec
.makeMeasureSpec(i5
, i6
));
356 int childCount
= getChildCount();
358 while (i7
< childCount
) {
359 int measuredHeight
= getChildAt(i7
).getMeasuredHeight() + paddingTop
;
360 if (measuredHeight
<= i9
) {
366 setMeasuredDimension(size
, i9
);
369 setMeasuredDimension(size
, size2
);
373 /* access modifiers changed from: protected */
374 public void onLayout(boolean z
, int i2
, int i3
, int i4
, int i5
) {
376 int paddingLeft
= getPaddingLeft();
377 int paddingTop
= getPaddingTop();
378 int paddingTop2
= ((i5
- i3
) - getPaddingTop()) - getPaddingBottom();
379 if (this.i
== null || this.i
.getVisibility() == 8) {
382 ViewGroup
.MarginLayoutParams marginLayoutParams
= (ViewGroup
.MarginLayoutParams
) this.i
.getLayoutParams();
383 int i7
= paddingLeft
+ marginLayoutParams
.leftMargin
;
384 i6
= marginLayoutParams
.rightMargin
+ i7
+ b(this.i
, i7
, paddingTop
, paddingTop2
);
386 if (!(this.k
== null || this.j
!= null || this.k
.getVisibility() == 8)) {
387 i6
+= b(this.k
, i6
, paddingTop
, paddingTop2
);
389 if (this.j
!= null) {
390 int b
= i6
+ b(this.j
, i6
, paddingTop
, paddingTop2
);
392 int paddingRight
= (i4
- i2
) - getPaddingRight();
393 if (this.a
!= null) {
394 int c
= paddingRight
- c(this.a
, paddingRight
, paddingTop
, paddingTop2
);
398 public void setTitleOptional(boolean z
) {