Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavpandey committed Jan 31, 2020
1 parent c185d7c commit e3a21f0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,57 +137,54 @@ public void run() {

final Drawable icon = ((ListMenuItemView) menuItemView)
.getItemData().getIcon();
try {
if (icon != null) {
((ListMenuItemView) menuItemView).setIcon(
DynamicDrawableUtils.colorizeDrawable(icon, tintColor));
}

if (menuItemView.getParent() != null) {
ViewGroup view = (ViewGroup) menuItemView.getParent();
ViewGroup parent = (ViewGroup) view.getParent();
if (icon != null) {
((ListMenuItemView) menuItemView).setIcon(
DynamicDrawableUtils.colorizeDrawable(icon, tintColor));
}

DynamicScrollUtils.setEdgeEffectColor(
(ListView) view, tintColor);
if (menuItemView.getParent() != null) {
ViewGroup menu = (ViewGroup) menuItemView.getParent();
ViewGroup group = (ViewGroup) menu.getParent();

if (DynamicSdkUtils.is21()) {
if (!(parent instanceof CardView)) {
if (parent.getBackground() != null) {
if (parent.getBackground()
instanceof GradientDrawable) {
GradientDrawable background =
(GradientDrawable) parent.getBackground();
background.setCornerRadius(DynamicTheme
.getInstance().get().getCornerRadius());
} else if (parent.getBackground()
instanceof LayerDrawable) {
GradientDrawable background = (GradientDrawable)
((LayerDrawable) parent.getBackground())
.getDrawable(0);
background.setCornerRadius(DynamicTheme
.getInstance().get().getCornerRadius());
ViewCompat.setBackground(parent, background);
}
DynamicScrollUtils.setEdgeEffectColor(
(ListView) menu, tintColor);

DynamicDrawableUtils.colorizeDrawable(
parent.getBackground(), backgroundColor);
if (DynamicSdkUtils.is21()) {
if (!(group instanceof CardView)) {
if (group.getBackground() != null) {
if (group.getBackground()
instanceof GradientDrawable) {
GradientDrawable background =
(GradientDrawable) group.getBackground();
background.setCornerRadius(DynamicTheme
.getInstance().get().getCornerRadius());
} else if (group.getBackground()
instanceof LayerDrawable) {
GradientDrawable background = (GradientDrawable)
((LayerDrawable) group.getBackground())
.getDrawable(0);
background.setCornerRadius(DynamicTheme
.getInstance().get().getCornerRadius());
ViewCompat.setBackground(group, background);
}

parent.removeAllViews();
parent.addView(cardView);
cardView.addView(view);
} else {
parent.removeAllViews();
parent.addView(view);
DynamicDrawableUtils.colorizeDrawable(
group.getBackground(), backgroundColor);
}

group.removeAllViews();
group.addView(cardView);
cardView.addView(menu);
} else {
ViewCompat.setBackground(view, DynamicDrawableUtils
.colorizeDrawable(DynamicResourceUtils.getDrawable(
context, R.drawable.ads_background),
backgroundColor));
group.removeAllViews();
group.addView(menu);
}
} else {
ViewCompat.setBackground(menu, DynamicDrawableUtils
.colorizeDrawable(DynamicResourceUtils.getDrawable(
context, R.drawable.ads_background),
backgroundColor));
}
} catch (Exception ignored) {
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public final class DynamicInputUtils {
/**
* Set cursor color for the supplied {@link TextView}.
*
* @param textView The edit text to set the cursor color.
* @param textView The text view to set the cursor color.
* @param color The color for the cursor.
*/
@TargetApi(Build.VERSION_CODES.Q)
Expand Down

0 comments on commit e3a21f0

Please sign in to comment.