Skip to content

Commit e3a21f0

Browse files
committed
Improvements
1 parent c185d7c commit e3a21f0

File tree

2 files changed

+40
-43
lines changed

2 files changed

+40
-43
lines changed

dynamic-support/src/main/java/com/pranavpandey/android/dynamic/support/theme/DynamicLayoutInflater.java

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -137,57 +137,54 @@ public void run() {
137137

138138
final Drawable icon = ((ListMenuItemView) menuItemView)
139139
.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+
}
149144

150-
DynamicScrollUtils.setEdgeEffectColor(
151-
(ListView) view, tintColor);
145+
if (menuItemView.getParent() != null) {
146+
ViewGroup menu = (ViewGroup) menuItemView.getParent();
147+
ViewGroup group = (ViewGroup) menu.getParent();
152148

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);
171151

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);
174169
}
175170

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);
182173
}
174+
175+
group.removeAllViews();
176+
group.addView(cardView);
177+
cardView.addView(menu);
183178
} 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);
188181
}
182+
} else {
183+
ViewCompat.setBackground(menu, DynamicDrawableUtils
184+
.colorizeDrawable(DynamicResourceUtils.getDrawable(
185+
context, R.drawable.ads_background),
186+
backgroundColor));
189187
}
190-
} catch (Exception ignored) {
191188
}
192189
}
193190
});

dynamic-support/src/main/java/com/pranavpandey/android/dynamic/support/utils/DynamicInputUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public final class DynamicInputUtils {
5353
/**
5454
* Set cursor color for the supplied {@link TextView}.
5555
*
56-
* @param textView The edit text to set the cursor color.
56+
* @param textView The text view to set the cursor color.
5757
* @param color The color for the cursor.
5858
*/
5959
@TargetApi(Build.VERSION_CODES.Q)

0 commit comments

Comments
 (0)