Support plugin icon

This commit is contained in:
Vitaliy 2020-03-30 19:27:35 +03:00
parent 7b439dd639
commit 4502d56394
3 changed files with 10 additions and 8 deletions

View file

@ -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

View file

@ -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<? extends Activity> getSettingsActivity() {
return null;
}

View file

@ -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) {