@@ -137,57 +137,54 @@ public void run() {
137
137
138
138
final Drawable icon = ((ListMenuItemView ) menuItemView )
139
139
.getItemData ().getIcon ();
140
- try {
141
- if (icon != null ) {
142
- ((ListMenuItemView ) menuItemView ).setIcon (
143
- DynamicDrawableUtils .colorizeDrawable (icon , tintColor ));
144
- }
145
-
146
- if (menuItemView .getParent () != null ) {
147
- ViewGroup view = (ViewGroup ) menuItemView .getParent ();
148
- ViewGroup parent = (ViewGroup ) view .getParent ();
140
+ if (icon != null ) {
141
+ ((ListMenuItemView ) menuItemView ).setIcon (
142
+ DynamicDrawableUtils .colorizeDrawable (icon , tintColor ));
143
+ }
149
144
150
- DynamicScrollUtils .setEdgeEffectColor (
151
- (ListView ) view , tintColor );
145
+ if (menuItemView .getParent () != null ) {
146
+ ViewGroup menu = (ViewGroup ) menuItemView .getParent ();
147
+ ViewGroup group = (ViewGroup ) menu .getParent ();
152
148
153
- if (DynamicSdkUtils .is21 ()) {
154
- if (!(parent instanceof CardView )) {
155
- if (parent .getBackground () != null ) {
156
- if (parent .getBackground ()
157
- instanceof GradientDrawable ) {
158
- GradientDrawable background =
159
- (GradientDrawable ) parent .getBackground ();
160
- background .setCornerRadius (DynamicTheme
161
- .getInstance ().get ().getCornerRadius ());
162
- } else if (parent .getBackground ()
163
- instanceof LayerDrawable ) {
164
- GradientDrawable background = (GradientDrawable )
165
- ((LayerDrawable ) parent .getBackground ())
166
- .getDrawable (0 );
167
- background .setCornerRadius (DynamicTheme
168
- .getInstance ().get ().getCornerRadius ());
169
- ViewCompat .setBackground (parent , background );
170
- }
149
+ DynamicScrollUtils .setEdgeEffectColor (
150
+ (ListView ) menu , tintColor );
171
151
172
- DynamicDrawableUtils .colorizeDrawable (
173
- parent .getBackground (), backgroundColor );
152
+ if (DynamicSdkUtils .is21 ()) {
153
+ if (!(group instanceof CardView )) {
154
+ if (group .getBackground () != null ) {
155
+ if (group .getBackground ()
156
+ instanceof GradientDrawable ) {
157
+ GradientDrawable background =
158
+ (GradientDrawable ) group .getBackground ();
159
+ background .setCornerRadius (DynamicTheme
160
+ .getInstance ().get ().getCornerRadius ());
161
+ } else if (group .getBackground ()
162
+ instanceof LayerDrawable ) {
163
+ GradientDrawable background = (GradientDrawable )
164
+ ((LayerDrawable ) group .getBackground ())
165
+ .getDrawable (0 );
166
+ background .setCornerRadius (DynamicTheme
167
+ .getInstance ().get ().getCornerRadius ());
168
+ ViewCompat .setBackground (group , background );
174
169
}
175
170
176
- parent .removeAllViews ();
177
- parent .addView (cardView );
178
- cardView .addView (view );
179
- } else {
180
- parent .removeAllViews ();
181
- parent .addView (view );
171
+ DynamicDrawableUtils .colorizeDrawable (
172
+ group .getBackground (), backgroundColor );
182
173
}
174
+
175
+ group .removeAllViews ();
176
+ group .addView (cardView );
177
+ cardView .addView (menu );
183
178
} else {
184
- ViewCompat .setBackground (view , DynamicDrawableUtils
185
- .colorizeDrawable (DynamicResourceUtils .getDrawable (
186
- context , R .drawable .ads_background ),
187
- backgroundColor ));
179
+ group .removeAllViews ();
180
+ group .addView (menu );
188
181
}
182
+ } else {
183
+ ViewCompat .setBackground (menu , DynamicDrawableUtils
184
+ .colorizeDrawable (DynamicResourceUtils .getDrawable (
185
+ context , R .drawable .ads_background ),
186
+ backgroundColor ));
189
187
}
190
- } catch (Exception ignored ) {
191
188
}
192
189
}
193
190
});
0 commit comments