From 4502d563949a489916aefed540488a9198de2236 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 30 Mar 2020 19:27:35 +0300 Subject: [PATCH] Support plugin icon --- OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java | 5 +++-- OsmAnd/src/net/osmand/plus/OsmandPlugin.java | 10 +++++----- .../net/osmand/plus/activities/PluginsActivity.java | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java b/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java index ece7d3b2b1..b35e158253 100644 --- a/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/CustomOsmandPlugin.java @@ -354,9 +354,10 @@ public class CustomOsmandPlugin extends OsmandPlugin { } } + @NonNull @Override - public int getLogoResourceId() { - return super.getLogoResourceId(); + public Drawable getLogoResource() { + return icon != null ? icon : super.getLogoResource(); } @Override diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index 713ca74eb3..d3df587776 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -91,16 +91,16 @@ public abstract class OsmandPlugin { return null; } - @Nullable - public Drawable getLogoResource() { - return app.getUIUtilities().getIcon(getLogoResourceId()); - } - @DrawableRes public int getLogoResourceId() { return R.drawable.ic_extension_dark; } + @NonNull + public Drawable getLogoResource() { + return app.getUIUtilities().getIcon(getLogoResourceId()); + } + public Class getSettingsActivity() { return null; } diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java b/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java index 8fea70c2fa..60bbda509b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/PluginsActivity.java @@ -22,6 +22,7 @@ import net.osmand.aidl.ConnectedApp; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; +import net.osmand.plus.UiUtilities; import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog; import net.osmand.plus.download.DownloadIndexesThread; @@ -180,7 +181,7 @@ public class PluginsActivity extends OsmandListActivity implements DownloadIndex OsmandApplication app = getMyApplication(); int color = AndroidUtils.getColorFromAttr(app, R.attr.list_background_color); - pluginLogo.setImageDrawable(app.getUIUtilities().getPaintedIcon(plugin.getLogoResourceId(), color)); + pluginLogo.setImageDrawable(UiUtilities.tintDrawable(plugin.getLogoResource(), color)); pluginLogo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) {