| | | |
Offset 36, 18 lines modified | Offset 36, 20 lines modified |
36 | import·android.view.View; | 36 | import·android.view.View; |
| |
37 | class·MenuItemRenderer·implements·MenuItem$Listener | 37 | class·MenuItemRenderer·implements·MenuItem$Listener |
38 | { | 38 | { |
39 | ····private·static·final·int[]·RESTRICTED_STATE; | 39 | ····private·static·final·int[]·RESTRICTED_STATE; |
40 | ····private·View·mIconContainer; | 40 | ····private·View·mIconContainer; |
41 | ····private·ImageView·mIconView; | 41 | ····private·ImageView·mIconView; |
| 42 | ····private·boolean·mIsRotaryEnabledLayout; |
42 | ····private·final·MenuItem·mMenuItem; | 43 | ····private·final·MenuItem·mMenuItem; |
43 | ····private·final·int·mMenuItemIconSize; | 44 | ····private·final·int·mMenuItemIconSize; |
44 | ····private·final·ViewGroup·mParentView; | 45 | ····private·final·ViewGroup·mParentView; |
45 | ····private·Switch·mSwitch; | 46 | ····private·Switch·mSwitch; |
| 47 | ····private·View·mTextContainer; |
46 | ····private·TextView·mTextView; | 48 | ····private·TextView·mTextView; |
47 | ····private·TextView·mTextWithIconView; | 49 | ····private·TextView·mTextWithIconView; |
48 | ····private·Toolbar$State·mToolbarState; | 50 | ····private·Toolbar$State·mToolbarState; |
49 | ····private·View·mView; | 51 | ····private·View·mView; |
50 | ···· | 52 | ···· |
51 | ····static·{ | 53 | ····static·{ |
52 | ········RESTRICTED_STATE·=·new·int[]·{·R$attr.state_ux_restricted·}; | 54 | ········RESTRICTED_STATE·=·new·int[]·{·R$attr.state_ux_restricted·}; |
Offset 63, 15 lines modified | Offset 65, 15 lines modified |
63 | ····private·static·MenuItem·readMenuItem(final·Context·context,·final·XmlResourceParser·xmlResourceParser,·final·AttributeSet·set)·{ | 65 | ····private·static·MenuItem·readMenuItem(final·Context·context,·final·XmlResourceParser·xmlResourceParser,·final·AttributeSet·set)·{ |
64 | ········final·XmlResourceParser·xmlResourceParser2·=·xmlResourceParser; | 66 | ········final·XmlResourceParser·xmlResourceParser2·=·xmlResourceParser; |
65 | ········final·int·n·=·2; | 67 | ········final·int·n·=·2; |
66 | ········String·s·=·"MenuItem"; | 68 | ········String·s·=·"MenuItem"; |
67 | ········xmlResourceParser.require(n,·(String)null,·s); | 69 | ········xmlResourceParser.require(n,·(String)null,·s); |
68 | ········Object·displayBehavior·=·context.obtainStyledAttributes(set,·R$styleable.CarUiToolbarMenuItem); | 70 | ········Object·displayBehavior·=·context.obtainStyledAttributes(set,·R$styleable.CarUiToolbarMenuItem); |
69 | ········MenuItem$DisplayBehavior·menuItem$DisplayBehavior·=·null; | 71 | ········MenuItem$DisplayBehavior·menuItem$DisplayBehavior·=·null; |
70 | ········Label_0708:·{ | 72 | ········Label_0709:·{ |
71 | ············try·{ | 73 | ············try·{ |
72 | ················final·int·resourceId·=·((TypedArray)displayBehavior).getResourceId(R$styleable.CarUiToolbarMenuItem_id,·-1); | 74 | ················final·int·resourceId·=·((TypedArray)displayBehavior).getResourceId(R$styleable.CarUiToolbarMenuItem_id,·-1); |
73 | ················final·String·string·=·((TypedArray)displayBehavior).getString(R$styleable.CarUiToolbarMenuItem_title); | 75 | ················final·String·string·=·((TypedArray)displayBehavior).getString(R$styleable.CarUiToolbarMenuItem_title); |
74 | ················final·Drawable·drawable·=·((TypedArray)displayBehavior).getDrawable(R$styleable.CarUiToolbarMenuItem_icon); | 76 | ················final·Drawable·drawable·=·((TypedArray)displayBehavior).getDrawable(R$styleable.CarUiToolbarMenuItem_icon); |
75 | ················final·boolean·boolean1·=·((TypedArray)displayBehavior).getBoolean(R$styleable.CarUiToolbarMenuItem_search,·false); | 77 | ················final·boolean·boolean1·=·((TypedArray)displayBehavior).getBoolean(R$styleable.CarUiToolbarMenuItem_search,·false); |
76 | ················final·boolean·boolean2·=·((TypedArray)displayBehavior).getBoolean(R$styleable.CarUiToolbarMenuItem_settings,·false); | 78 | ················final·boolean·boolean2·=·((TypedArray)displayBehavior).getBoolean(R$styleable.CarUiToolbarMenuItem_settings,·false); |
77 | ················final·int·carUiToolbarMenuItem_tinted·=·R$styleable.CarUiToolbarMenuItem_tinted; | 79 | ················final·int·carUiToolbarMenuItem_tinted·=·R$styleable.CarUiToolbarMenuItem_tinted; |
Offset 119, 15 lines modified | Offset 121, 15 lines modified |
119 | ····························} | 121 | ····························} |
120 | ····························catch·(NoSuchMethodException·ex2)·{} | 122 | ····························catch·(NoSuchMethodException·ex2)·{} |
121 | ························} | 123 | ························} |
122 | ························displayBehavior·=·"Couldn't·find·an·activity·for·the·MenuItem"; | 124 | ························displayBehavior·=·"Couldn't·find·an·activity·for·the·MenuItem"; |
123 | ························throw·new·RuntimeException((String)displayBehavior); | 125 | ························throw·new·RuntimeException((String)displayBehavior); |
124 | ····················} | 126 | ····················} |
125 | ····················finally·{ | 127 | ····················finally·{ |
126 | ························break·Label_0708; | 128 | ························break·Label_0709; |
127 | ····················} | 129 | ····················} |
128 | ················} | 130 | ················} |
129 | ················final·Object·o·=·displayBehavior; | 131 | ················final·Object·o·=·displayBehavior; |
130 | ················final·boolean·b3·=·hasValue; | 132 | ················final·boolean·b3·=·hasValue; |
131 | ················final·boolean·b4·=·boolean6; | 133 | ················final·boolean·b4·=·boolean6; |
132 | ················Object·onClickListener·=·null; | 134 | ················Object·onClickListener·=·null; |
133 | ················if·(int1·==·0)·{ | 135 | ················if·(int1·==·0)·{ |
Offset 231, 53 lines modified | Offset 233, 82 lines modified |
231 | ········final·Drawable·icon·=·this.mMenuItem.getIcon(); | 233 | ········final·Drawable·icon·=·this.mMenuItem.getIcon(); |
232 | ········final·boolean·b·=·true; | 234 | ········final·boolean·b·=·true; |
233 | ········final·boolean·b2·=·icon·!=·null·&&·b; | 235 | ········final·boolean·b2·=·icon·!=·null·&&·b; |
234 | ········final·boolean·b3·=·b·^·TextUtils.isEmpty(this.mMenuItem.getTitle()); | 236 | ········final·boolean·b3·=·b·^·TextUtils.isEmpty(this.mMenuItem.getTitle()); |
235 | ········final·boolean·showingIconAndTitle·=·this.mMenuItem.isShowingIconAndTitle(); | 237 | ········final·boolean·showingIconAndTitle·=·this.mMenuItem.isShowingIconAndTitle(); |
236 | ········final·boolean·checkable·=·this.mMenuItem.isCheckable(); | 238 | ········final·boolean·checkable·=·this.mMenuItem.isCheckable(); |
237 | ········final·boolean·visible·=·this.mMenuItem.isVisible(); | 239 | ········final·boolean·visible·=·this.mMenuItem.isVisible(); |
238 | ········final·int·visibility·=·8; | 240 | ········int·visibility·=·8; |
239 | ········if·(visible·&&·(!this.mMenuItem.isSearch()·||·this.mToolbarState·!=·Toolbar$State.SEARCH)·&&·(checkable·||·b2·||·b3))·{ | 241 | ········if·(visible·&&·(!this.mMenuItem.isSearch()·||·this.mToolbarState·!=·Toolbar$State.SEARCH)·&&·(checkable·||·b2·||·b3))·{ |
240 | ············this.mView.setVisibility(0); | 242 | ············this.mView.setVisibility(0); |
241 | ············this.mView.setContentDescription(this.mMenuItem.getTitle()); | 243 | ············this.mView.setContentDescription(this.mMenuItem.getTitle()); |
242 | ············this.mIconContainer.setVisibility(visibility); | |
243 | ············this.mTextView.setVisibility(visibility); | 244 | ············this.mTextView.setVisibility(visibility); |
244 | ············this.mTextWithIconView.setVisibility(visibility); | 245 | ············this.mTextWithIconView.setVisibility(visibility); |
245 | ············this.mSwitch.setVisibility(visibility); | 246 | ············this.mSwitch.setVisibility(visibility); |
246 | ············if·(checkable)·{ | 247 | ············int·visibility2·=·0; |
247 | ················this.mSwitch.setChecked(this.mMenuItem.isChecked()); | 248 | ············Label_0458:·{ |
248 | ················this.mSwitch.setVisibility(0); | 249 | ················Label_0284:·{ |
249 | ············} | 250 | ····················if·(!checkable)·{ |
250 | ············else·if·(b3·&&·b2·&&·showingIconAndTitle)·{ | 251 | ························if·(b3·&&·b2·&&·showingIconAndTitle)·{ |
251 | ················final·Drawable·icon2·=·this.mMenuItem.getIcon(); | 252 | ····························final·Drawable·icon2·=·this.mMenuItem.getIcon(); |
252 | ················final·int·mMenuItemIconSize·=·this.mMenuItemIconSize; | 253 | ····························final·int·mMenuItemIconSize·=·this.mMenuItemIconSize; |
253 | ················icon2.setBounds(0,·0,·mMenuItemIconSize,·mMenuItemIconSize); | 254 | ····························icon2.setBounds(0,·0,·mMenuItemIconSize,·mMenuItemIconSize); |
254 | ················this.mTextWithIconView.setCompoundDrawables(this.mMenuItem.getIcon(),·(Drawable)null,·(Drawable)null,·(Drawable)null); | 255 | ····························this.mTextWithIconView.setCompoundDrawables(this.mMenuItem.getIcon(),·(Drawable)null,·(Drawable)null,·(Drawable)null); |
255 | ················this.mTextWithIconView.setText(this.mMenuItem.getTitle()); | 256 | ····························this.mTextWithIconView.setText(this.mMenuItem.getTitle()); |
256 | ················this.mTextWithIconView.setVisibility(0); | 257 | ····························this.mTextWithIconView.setVisibility(0); |
257 | ············} | 258 | ························} |
258 | ············else·if·(b2)·{ | 259 | ························else·{ |
259 | ················this.mIconView.setImageDrawable(this.mMenuItem.getIcon()); | 260 | ····························if·(b2)·{ |
260 | ················this.mIconContainer.setVisibility(0); | 261 | ································this.mIconView.setImageDrawable(this.mMenuItem.getIcon()); |
| 262 | ································break·Label_0284; |
| 263 | ····························} |
| 264 | ····························this.mTextView.setText(this.mMenuItem.getTitle()); |
| 265 | ····························this.mTextView.setVisibility(0); |
| 266 | ························} |
| 267 | ························visibility2·=·0; |
| 268 | ························break·Label_0458; |
| 269 | ····················} |
| 270 | ····················this.mSwitch.setChecked(this.mMenuItem.isChecked()); |
| 271 | ····················this.mSwitch.setVisibility(0); |
| 272 | ····················if·(!this.mIsRotaryEnabledLayout)·{ |
| 273 | ························visibility2·=·visibility; |
| 274 | ························break·Label_0458; |
| 275 | ····················} |
| 276 | ················} |
| 277 | ················visibility2·=·visibility; |
| 278 | ················visibility·=·0; |
261 | ············} | 279 | ············} |
262 | ············else·{ | 280 | ············this.mIconContainer.setVisibility(visibility); |
263 | ················this.mTextView.setText(this.mMenuItem.getTitle()); | 281 | ············final·View·mTextContainer·=·this.mTextContainer; |
264 | ················this.mTextView.setVisibility(0); | 282 | ············if·(mTextContainer·!=·null)·{ |
| 283 | ················mTextContainer.setVisibility(visibility2); |
265 | ············} | 284 | ············} |
266 | ············if·(!this.mMenuItem.isTinted()·&&·b2)·{ | 285 | ············if·(!this.mMenuItem.isTinted()·&&·b2)·{ |
267 | ················this.mMenuItem.getIcon().setTintList((ColorStateList)null); | 286 | ················this.mMenuItem.getIcon().setTintList((ColorStateList)null); |
268 | ············} | 287 | ············} |
269 | ············this.recursiveSetEnabledAndDrawableState(this.mView); | 288 | ············this.recursiveSetEnabledAndDrawableState(this.mView); |
270 | ············this.mView.setActivated(this.mMenuItem.isActivated()); | 289 | ············this.mView.setActivated(this.mMenuItem.isActivated()); |
| 290 | ············View·view; |
| 291 | ············if·(this.mIsRotaryEnabledLayout)·{ |
| 292 | ················if·(visibility·==·0)·{ |
| 293 | ····················view·=·this.mIconContainer; |
| 294 | ················} |
| 295 | ················else·{ |
| 296 | ····················view·=·this.mTextContainer; |
| 297 | ················} |
| 298 | ············} |
| 299 | ············else·{ |
| 300 | ················view·=·this.mView; |
| 301 | ············} |
271 | ············if·(this.mMenuItem.getOnClickListener()·==·null·&&·!this.mMenuItem.isCheckable()·&&·!this.mMenuItem.isActivatable())·{ | 302 | ············if·(this.mMenuItem.getOnClickListener()·==·null·&&·!this.mMenuItem.isCheckable()·&&·!this.mMenuItem.isActivatable())·{ |
272 | ················this.mView.setOnClickListener((View$OnClickListener)null); | 303 | ················view.setOnClickListener((View$OnClickListener)null); |
273 | ················this.mView.setClickable(false); | 304 | ················view.setClickable(false); |
274 | ············} | 305 | ············} |
275 | ············else·{ | 306 | ············else·{ |
276 | ················this.mView.setOnClickListener((View$OnClickListener)new·-$$Lambda$MenuItemRenderer$ql8WLabAg_CiY9HcQTI4ML8FsgY(this)); | 307 | ················view.setOnClickListener((View$OnClickListener)new·-$$Lambda$MenuItemRenderer$ql8WLabAg_CiY9HcQTI4ML8FsgY(this)); |
277 | ············} | 308 | ············} |
278 | ············return; | 309 | ············return; |
279 | ········} | 310 | ········} |
280 | ········this.mView.setVisibility(visibility); | 311 | ········this.mView.setVisibility(visibility); |
281 | ····} | 312 | ····} |
282 | ···· | 313 | ···· |
283 | ····void·createView(final·Consumer·consumer)·{ | 314 | ····void·createView(final·Consumer·consumer)·{ |