This commit is contained in:
androiddevkotlin 2021-03-10 17:49:32 +02:00
parent e30e2e1034
commit edb4dc19e0
2 changed files with 6 additions and 7 deletions

View file

@ -6,7 +6,6 @@ import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -23,7 +22,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
@ -228,7 +226,6 @@ public class PluginsFragment extends BaseOsmAndFragment implements PluginStateLi
int color = AndroidUtils.getColorFromAttr(context, R.attr.list_background_color);
Drawable pluginIcon = plugin.getLogoResource();
pluginIcon.clearColorFilter();
pluginLogo.setImageDrawable(UiUtilities.tintDrawable(pluginIcon, color));
pluginLogo.setOnClickListener(new View.OnClickListener() {
@Override
@ -253,7 +250,7 @@ public class PluginsFragment extends BaseOsmAndFragment implements PluginStateLi
if (active) {
pluginLogo.setBackgroundResource(nightMode ? R.drawable.bg_plugin_logo_enabled_dark : R.drawable.bg_plugin_logo_enabled_light);
} else {
TypedArray attributes = context.getTheme().obtainStyledAttributes(new int[] {R.attr.bg_plugin_logo_disabled});
TypedArray attributes = context.getTheme().obtainStyledAttributes(new int[]{R.attr.bg_plugin_logo_disabled});
pluginLogo.setBackgroundDrawable(attributes.getDrawable(0));
attributes.recycle();
}

View file

@ -2,7 +2,6 @@ package net.osmand.plus.dialogs;
import android.app.Activity;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@ -91,8 +90,11 @@ public class PluginInstalledBottomSheetDialog extends MenuBottomSheetDialogFragm
SpannableString pluginTitleSpan = new SpannableString(plugin.getName());
pluginTitleSpan.setSpan(new CustomTypefaceSpan(typeface), 0, pluginTitleSpan.length(), 0);
Drawable pluginIcon = plugin.getLogoResource();
pluginIcon.setColorFilter(ContextCompat.getColor(
context, nightMode ? R.color.icon_color_default_light : R.color.icon_color_default_dark), PorterDuff.Mode.MULTIPLY);
if (pluginIcon.getConstantState() != null) {
pluginIcon = pluginIcon.getConstantState().newDrawable().mutate();
}
pluginIcon = UiUtilities.tintDrawable(pluginIcon, ContextCompat.getColor(
context, nightMode ? R.color.icon_color_default_light : R.color.icon_color_default_dark));
BaseBottomSheetItem pluginTitle = new SimpleBottomSheetItem.Builder()
.setTitle(pluginTitleSpan)