Add support for icons in custom regions
This commit is contained in:
parent
077e12a1a9
commit
c9f963bb85
7 changed files with 201 additions and 235 deletions
|
@ -14,6 +14,8 @@ import android.content.res.Resources;
|
|||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
|
@ -617,7 +619,7 @@ public class AppInitializer implements IProgress {
|
|||
});
|
||||
}
|
||||
|
||||
public static void loadRoutingFiles(final OsmandApplication app, final LoadRoutingFilesCallback callback) {
|
||||
public static void loadRoutingFiles(@NonNull final OsmandApplication app, @Nullable final LoadRoutingFilesCallback callback) {
|
||||
new AsyncTask<Void, Void, Map<String, RoutingConfiguration.Builder>>() {
|
||||
|
||||
@Override
|
||||
|
@ -653,7 +655,9 @@ public class AppInitializer implements IProgress {
|
|||
app.getCustomRoutingConfigs().putAll(customConfigs);
|
||||
}
|
||||
app.avoidSpecificRoads.initRouteObjects(false);
|
||||
callback.onRoutingFilesLoaded();
|
||||
if (callback != null) {
|
||||
callback.onRoutingFilesLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, String> getDefaultAttributes() {
|
||||
|
|
|
@ -83,6 +83,10 @@ public class CustomRegion extends WorldRegion {
|
|||
return descriptionInfo;
|
||||
}
|
||||
|
||||
public String getIconName(Context ctx) {
|
||||
return JsonUtils.getLocalizedResFromMap(ctx, icons, null);
|
||||
}
|
||||
|
||||
public static CustomRegion fromJson(@NonNull Context ctx, JSONObject object) throws JSONException {
|
||||
String scopeId = object.optString("scope-id", null);
|
||||
String path = object.optString("path", null);
|
||||
|
@ -216,6 +220,7 @@ public class CustomRegion extends WorldRegion {
|
|||
if ("json".equalsIgnoreCase(dynamicDownloadItems.format)) {
|
||||
dynamicItemsJson = mapJsonItems(result);
|
||||
}
|
||||
app.getDownloadThread().runReloadIndexFilesSilent();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5,17 +5,22 @@ import android.view.View;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.CustomRegion;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivityType;
|
||||
import net.osmand.plus.download.DownloadResourceGroup;
|
||||
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
|
||||
public class DownloadGroupViewHolder {
|
||||
TextView textView;
|
||||
|
||||
private DownloadActivity ctx;
|
||||
|
||||
private TextView textView;
|
||||
|
||||
public DownloadGroupViewHolder(DownloadActivity ctx, View v) {
|
||||
this.ctx = ctx;
|
||||
textView = (TextView) v.findViewById(R.id.title);
|
||||
|
@ -23,23 +28,30 @@ public class DownloadGroupViewHolder {
|
|||
|
||||
private boolean isParentWorld(DownloadResourceGroup group) {
|
||||
return group.getParentGroup() == null
|
||||
|| group.getParentGroup().getType() == DownloadResourceGroup.DownloadResourceGroupType.WORLD;
|
||||
|| group.getParentGroup().getType() == DownloadResourceGroupType.WORLD;
|
||||
}
|
||||
|
||||
private Drawable getIconForGroup(DownloadResourceGroup group) {
|
||||
Drawable iconStart;
|
||||
if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_REC
|
||||
|| group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_TTS) {
|
||||
iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
|
||||
} else if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.FONTS) {
|
||||
iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
|
||||
OsmandApplication app = ctx.getMyApplication();
|
||||
UiUtilities cache = app.getUIUtilities();
|
||||
if (group.getType() == DownloadResourceGroupType.VOICE_REC
|
||||
|| group.getType() == DownloadResourceGroupType.VOICE_TTS) {
|
||||
iconStart = cache.getThemedIcon(R.drawable.ic_action_volume_up);
|
||||
} else if (group.getType() == DownloadResourceGroupType.FONTS) {
|
||||
iconStart = cache.getThemedIcon(R.drawable.ic_action_map_language);
|
||||
} else {
|
||||
UiUtilities cache = ctx.getMyApplication().getUIUtilities();
|
||||
if (group.getRegion() instanceof CustomRegion) {
|
||||
String iconName = ((CustomRegion) group.getRegion()).getIconName(ctx);
|
||||
int iconId = AndroidUtils.getDrawableId(app, iconName);
|
||||
if (iconId != 0) {
|
||||
return cache.getThemedIcon(iconId);
|
||||
}
|
||||
}
|
||||
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
|
||||
iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
|
||||
} else {
|
||||
DownloadResourceGroup ggr = group
|
||||
.getSubGroupById(DownloadResourceGroup.DownloadResourceGroupType.REGION_MAPS.getDefaultId());
|
||||
DownloadResourceGroup ggr = group.getSubGroupById(DownloadResourceGroupType.REGION_MAPS.getDefaultId());
|
||||
iconStart = cache.getThemedIcon(R.drawable.ic_map);
|
||||
if (ggr != null && ggr.getIndividualResources() != null) {
|
||||
IndexItem item = null;
|
||||
|
@ -53,11 +65,8 @@ public class DownloadGroupViewHolder {
|
|||
}
|
||||
}
|
||||
if (item != null) {
|
||||
if (item.isOutdated()) {
|
||||
iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_distance);
|
||||
} else {
|
||||
iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_ok);
|
||||
}
|
||||
int color = item.isOutdated() ? R.color.color_distance : R.color.color_ok;
|
||||
iconStart = cache.getIcon(R.drawable.ic_map, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,4 +80,4 @@ public class DownloadGroupViewHolder {
|
|||
Drawable iconStart = getIconForGroup(group);
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(textView, iconStart, null, null, null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
package net.osmand.plus.download.ui;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||
import net.osmand.plus.download.CustomIndexItem;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadResourceGroup;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DownloadResourceGroupAdapter extends OsmandBaseExpandableListAdapter {
|
||||
|
||||
private List<DownloadResourceGroup> data = new ArrayList<DownloadResourceGroup>();
|
||||
private DownloadActivity ctx;
|
||||
private DownloadResourceGroup mainGroup;
|
||||
|
||||
|
||||
public DownloadResourceGroupAdapter(DownloadActivity ctx) {
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public void update(DownloadResourceGroup mainGroup) {
|
||||
this.mainGroup = mainGroup;
|
||||
data = mainGroup.getGroups();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getChild(int groupPosition, int childPosition) {
|
||||
DownloadResourceGroup drg = data.get(groupPosition);
|
||||
if (drg.getType().containsIndexItem()) {
|
||||
return drg.getItemByIndex(childPosition);
|
||||
}
|
||||
return drg.getGroupByIndex(childPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getChildId(int groupPosition, int childPosition) {
|
||||
return groupPosition * 10000 + childPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild,
|
||||
View convertView, ViewGroup parent) {
|
||||
final Object child = getChild(groupPosition, childPosition);
|
||||
if (child instanceof IndexItem) {
|
||||
|
||||
IndexItem item = (IndexItem) child;
|
||||
DownloadResourceGroup group = getGroupObj(groupPosition);
|
||||
ItemViewHolder viewHolder;
|
||||
if (convertView != null && convertView.getTag() instanceof ItemViewHolder) {
|
||||
viewHolder = (ItemViewHolder) convertView.getTag();
|
||||
} else {
|
||||
convertView = LayoutInflater.from(parent.getContext()).inflate(
|
||||
R.layout.two_line_with_images_list_item, parent, false);
|
||||
viewHolder = new ItemViewHolder(convertView, ctx);
|
||||
viewHolder.setShowRemoteDate(true);
|
||||
convertView.setTag(viewHolder);
|
||||
}
|
||||
if (mainGroup.getType() == DownloadResourceGroup.DownloadResourceGroupType.REGION &&
|
||||
group != null && group.getType() == DownloadResourceGroup.DownloadResourceGroupType.REGION_MAPS
|
||||
&& !(item instanceof CustomIndexItem)) {
|
||||
viewHolder.setShowTypeInName(true);
|
||||
viewHolder.setShowTypeInDesc(false);
|
||||
} else if (group != null && (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.SRTM_HEADER
|
||||
|| group.getType() == DownloadResourceGroup.DownloadResourceGroupType.HILLSHADE_HEADER)) {
|
||||
viewHolder.setShowTypeInName(false);
|
||||
viewHolder.setShowTypeInDesc(false);
|
||||
} else {
|
||||
viewHolder.setShowTypeInDesc(true);
|
||||
}
|
||||
viewHolder.bindIndexItem(item);
|
||||
} else {
|
||||
DownloadResourceGroup group = (DownloadResourceGroup) child;
|
||||
DownloadGroupViewHolder viewHolder;
|
||||
if (convertView != null && convertView.getTag() instanceof DownloadGroupViewHolder) {
|
||||
viewHolder = (DownloadGroupViewHolder) convertView.getTag();
|
||||
} else {
|
||||
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.simple_list_menu_item,
|
||||
parent, false);
|
||||
viewHolder = new DownloadGroupViewHolder(ctx, convertView);
|
||||
convertView.setTag(viewHolder);
|
||||
}
|
||||
viewHolder.bindItem(group);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View getGroupView(int groupPosition, boolean isExpanded, final View convertView, final ViewGroup parent) {
|
||||
View v = convertView;
|
||||
String section = getGroup(groupPosition);
|
||||
if (v == null) {
|
||||
LayoutInflater inflater = LayoutInflater.from(ctx);
|
||||
v = inflater.inflate(R.layout.download_item_list_section, parent, false);
|
||||
}
|
||||
TextView nameView = ((TextView) v.findViewById(R.id.title));
|
||||
nameView.setText(section);
|
||||
v.setOnClickListener(null);
|
||||
TypedValue typedValue = new TypedValue();
|
||||
Resources.Theme theme = ctx.getTheme();
|
||||
theme.resolveAttribute(R.attr.activity_background_color, typedValue, true);
|
||||
v.setBackgroundColor(typedValue.data);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildrenCount(int groupPosition) {
|
||||
return data.get(groupPosition).size();
|
||||
}
|
||||
|
||||
public DownloadResourceGroup getGroupObj(int groupPosition) {
|
||||
return data.get(groupPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(int groupPosition) {
|
||||
DownloadResourceGroup drg = data.get(groupPosition);
|
||||
int rid = drg.getType().getResourceId();
|
||||
if (rid != -1) {
|
||||
return ctx.getString(rid);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupCount() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getGroupId(int groupPosition) {
|
||||
return groupPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChildSelectable(int groupPosition, int childPosition) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -3,11 +3,9 @@ package net.osmand.plus.download.ui;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -32,15 +30,12 @@ import net.osmand.plus.CustomRegion;
|
|||
import net.osmand.plus.LockableViewPager;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||
import net.osmand.plus.download.CustomIndexItem;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivity.BannerAndDownloadFreeVersion;
|
||||
import net.osmand.plus.download.DownloadActivityType;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
import net.osmand.plus.download.DownloadResourceGroup;
|
||||
import net.osmand.plus.download.DownloadResourceGroup.DownloadResourceGroupType;
|
||||
import net.osmand.plus.download.DownloadResources;
|
||||
import net.osmand.plus.download.DownloadValidationManager;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
|
@ -53,9 +48,7 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static net.osmand.plus.download.ui.DownloadItemFragment.updateActionButtons;
|
||||
|
@ -565,208 +558,4 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class DownloadGroupViewHolder {
|
||||
TextView textView;
|
||||
private DownloadActivity ctx;
|
||||
|
||||
public DownloadGroupViewHolder(DownloadActivity ctx, View v) {
|
||||
this.ctx = ctx;
|
||||
textView = (TextView) v.findViewById(R.id.title);
|
||||
}
|
||||
|
||||
private boolean isParentWorld(DownloadResourceGroup group) {
|
||||
return group.getParentGroup() == null
|
||||
|| group.getParentGroup().getType() == DownloadResourceGroupType.WORLD;
|
||||
}
|
||||
|
||||
private Drawable getIconForGroup(DownloadResourceGroup group) {
|
||||
Drawable iconStart;
|
||||
if (group.getType() == DownloadResourceGroupType.VOICE_REC
|
||||
|| group.getType() == DownloadResourceGroupType.VOICE_TTS) {
|
||||
iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
|
||||
} else if (group.getType() == DownloadResourceGroupType.FONTS) {
|
||||
iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
|
||||
} else {
|
||||
UiUtilities cache = ctx.getMyApplication().getUIUtilities();
|
||||
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
|
||||
iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
|
||||
} else {
|
||||
DownloadResourceGroup ggr = group
|
||||
.getSubGroupById(DownloadResourceGroupType.REGION_MAPS.getDefaultId());
|
||||
iconStart = cache.getThemedIcon(R.drawable.ic_map);
|
||||
if (ggr != null && ggr.getIndividualResources() != null) {
|
||||
IndexItem item = null;
|
||||
for (IndexItem ii : ggr.getIndividualResources()) {
|
||||
if (ii.getType() == DownloadActivityType.NORMAL_FILE
|
||||
|| ii.getType() == DownloadActivityType.ROADS_FILE) {
|
||||
if (ii.isDownloaded() || ii.isOutdated()) {
|
||||
item = ii;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item != null) {
|
||||
if (item.isOutdated()) {
|
||||
iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_distance);
|
||||
} else {
|
||||
iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_ok);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return iconStart;
|
||||
}
|
||||
|
||||
public void bindItem(DownloadResourceGroup group) {
|
||||
String name = group.getName(ctx);
|
||||
textView.setText(name);
|
||||
Drawable iconStart = getIconForGroup(group);
|
||||
AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(textView, iconStart, null, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
public static class DownloadResourceGroupAdapter extends OsmandBaseExpandableListAdapter {
|
||||
|
||||
private List<DownloadResourceGroup> data = new ArrayList<DownloadResourceGroup>();
|
||||
private DownloadActivity ctx;
|
||||
private DownloadResourceGroup mainGroup;
|
||||
|
||||
|
||||
|
||||
public DownloadResourceGroupAdapter(DownloadActivity ctx) {
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
public void update(DownloadResourceGroup mainGroup) {
|
||||
this.mainGroup = mainGroup;
|
||||
data = mainGroup.getGroups();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getChild(int groupPosition, int childPosition) {
|
||||
DownloadResourceGroup drg = data.get(groupPosition);
|
||||
if (drg.getType().containsIndexItem()) {
|
||||
return drg.getItemByIndex(childPosition);
|
||||
}
|
||||
return drg.getGroupByIndex(childPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getChildId(int groupPosition, int childPosition) {
|
||||
return groupPosition * 10000 + childPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild,
|
||||
View convertView, ViewGroup parent) {
|
||||
final Object child = getChild(groupPosition, childPosition);
|
||||
if (child instanceof IndexItem) {
|
||||
|
||||
IndexItem item = (IndexItem) child;
|
||||
DownloadResourceGroup group = getGroupObj(groupPosition);
|
||||
ItemViewHolder viewHolder;
|
||||
if (convertView != null && convertView.getTag() instanceof ItemViewHolder) {
|
||||
viewHolder = (ItemViewHolder) convertView.getTag();
|
||||
} else {
|
||||
convertView = LayoutInflater.from(parent.getContext()).inflate(
|
||||
R.layout.two_line_with_images_list_item, parent, false);
|
||||
viewHolder = new ItemViewHolder(convertView, ctx);
|
||||
viewHolder.setShowRemoteDate(true);
|
||||
convertView.setTag(viewHolder);
|
||||
}
|
||||
if (mainGroup.getType() == DownloadResourceGroupType.REGION &&
|
||||
group != null && group.getType() == DownloadResourceGroupType.REGION_MAPS
|
||||
&& !(item instanceof CustomIndexItem)) {
|
||||
viewHolder.setShowTypeInName(true);
|
||||
viewHolder.setShowTypeInDesc(false);
|
||||
} else if (group != null && (group.getType() == DownloadResourceGroupType.SRTM_HEADER
|
||||
|| group.getType() == DownloadResourceGroupType.HILLSHADE_HEADER)) {
|
||||
viewHolder.setShowTypeInName(false);
|
||||
viewHolder.setShowTypeInDesc(false);
|
||||
} else {
|
||||
viewHolder.setShowTypeInDesc(true);
|
||||
}
|
||||
viewHolder.bindIndexItem(item);
|
||||
} else {
|
||||
DownloadResourceGroup group = (DownloadResourceGroup) child;
|
||||
DownloadGroupViewHolder viewHolder;
|
||||
if (convertView != null && convertView.getTag() instanceof DownloadGroupViewHolder) {
|
||||
viewHolder = (DownloadGroupViewHolder) convertView.getTag();
|
||||
} else {
|
||||
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.simple_list_menu_item,
|
||||
parent, false);
|
||||
viewHolder = new DownloadGroupViewHolder(ctx, convertView);
|
||||
convertView.setTag(viewHolder);
|
||||
}
|
||||
viewHolder.bindItem(group);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public View getGroupView(int groupPosition, boolean isExpanded, final View convertView, final ViewGroup parent) {
|
||||
View v = convertView;
|
||||
String section = getGroup(groupPosition);
|
||||
if (v == null) {
|
||||
LayoutInflater inflater = LayoutInflater.from(ctx);
|
||||
v = inflater.inflate(R.layout.download_item_list_section, parent, false);
|
||||
}
|
||||
TextView nameView = ((TextView) v.findViewById(R.id.title));
|
||||
nameView.setText(section);
|
||||
v.setOnClickListener(null);
|
||||
TypedValue typedValue = new TypedValue();
|
||||
Resources.Theme theme = ctx.getTheme();
|
||||
theme.resolveAttribute(R.attr.activity_background_color, typedValue, true);
|
||||
v.setBackgroundColor(typedValue.data);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildrenCount(int groupPosition) {
|
||||
return data.get(groupPosition).size();
|
||||
}
|
||||
|
||||
public DownloadResourceGroup getGroupObj(int groupPosition) {
|
||||
return data.get(groupPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(int groupPosition) {
|
||||
DownloadResourceGroup drg = data.get(groupPosition);
|
||||
int rid = drg.getType().getResourceId();
|
||||
if (rid != -1) {
|
||||
return ctx.getString(rid);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroupCount() {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getGroupId(int groupPosition) {
|
||||
return groupPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChildSelectable(int groupPosition, int childPosition) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -854,6 +854,12 @@ public class ImportHelper {
|
|||
if (!Algorithms.isEmpty(plugin.getDownloadMaps())) {
|
||||
app.getDownloadThread().runReloadIndexFilesSilent();
|
||||
}
|
||||
if (!Algorithms.isEmpty(plugin.getRendererNames())) {
|
||||
app.getRendererRegistry().updateExternalRenderers();
|
||||
}
|
||||
if (!Algorithms.isEmpty(plugin.getRouterNames())) {
|
||||
loadRoutingFiles(app, null);
|
||||
}
|
||||
if (activity != null) {
|
||||
plugin.onInstall(app, activity);
|
||||
}
|
||||
|
|
|
@ -271,11 +271,7 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment implements View
|
|||
public void onSettingsImportFinished(boolean succeed, @NonNull List<SettingsItem> items) {
|
||||
if (succeed) {
|
||||
app.getRendererRegistry().updateExternalRenderers();
|
||||
AppInitializer.loadRoutingFiles(app, new AppInitializer.LoadRoutingFilesCallback() {
|
||||
@Override
|
||||
public void onRoutingFilesLoaded() {
|
||||
}
|
||||
});
|
||||
AppInitializer.loadRoutingFiles(app, null);
|
||||
FragmentManager fm = getFragmentManager();
|
||||
if (fm != null && file != null) {
|
||||
ImportCompleteFragment.showInstance(fm, items, file.getName());
|
||||
|
|
Loading…
Reference in a new issue