Issue #7224 Show POI category icons for Add POI quick action
This commit is contained in:
parent
58923c1072
commit
5402d8f938
1 changed files with 25 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.quickaction.actions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -36,7 +37,6 @@ import net.osmand.osm.edit.Entity;
|
|||
import net.osmand.osm.edit.Node;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.osmedit.EditPoiData;
|
||||
|
@ -49,6 +49,7 @@ import net.osmand.plus.osmedit.OsmPoint;
|
|||
import net.osmand.plus.osmedit.dialogs.PoiSubTypeDialogFragment;
|
||||
import net.osmand.plus.quickaction.CreateEditActionDialog;
|
||||
import net.osmand.plus.quickaction.QuickAction;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
@ -79,6 +80,29 @@ public class AddPOIAction extends QuickAction {
|
|||
super(quickAction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconRes(Context context) {
|
||||
if (context instanceof MapActivity) {
|
||||
final OsmandApplication application = (OsmandApplication) (context).getApplicationContext();
|
||||
final MapPoiTypes poiTypes = application.getPoiTypes();
|
||||
final Map<String, PoiType> allTranslatedNames = poiTypes.getAllTranslatedNames(true);
|
||||
PoiCategory category = getCategory(allTranslatedNames);
|
||||
|
||||
if (category != null) {
|
||||
|
||||
category.getIconKeyName();
|
||||
|
||||
String res = category.getIconKeyName();
|
||||
if (res instanceof String && RenderingIcons.containsBigIcon(res)) {
|
||||
return RenderingIcons.getBigIconResourceId(res);
|
||||
} else {
|
||||
return super.getIconRes();
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.getIconRes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final MapActivity activity) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue