Merge remote-tracking branch 'origin/import_screen' into avoid_roads_export_import

This commit is contained in:
veliymolfar 2020-02-20 18:59:05 +02:00
commit a685cf4637
6 changed files with 39 additions and 23 deletions

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M10.5858,12L3.2929,4.7071L4.7071,3.2929L12,10.5858L19.2929,3.2929L20.7071,4.7071L13.4142,12L20.7071,19.2929L19.2929,20.7071L12,13.4142L4.7071,20.7071L3.2929,19.2929L10.5858,12Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
</vector>

View file

@ -3297,11 +3297,7 @@
<string name="new_route_calculated_dist_dbg">المسار: المسافة%s ، وقت جهاز التوجيه%s <string name="new_route_calculated_dist_dbg">المسار: المسافة%s ، وقت جهاز التوجيه%s
\nالحساب:%.1f ثانية ،%d طرق ،%d تجانب)</string> \nالحساب:%.1f ثانية ،%d طرق ،%d تجانب)</string>
<string name="lang_oc">الأوكيتانية</string> <string name="lang_oc">الأوكيتانية</string>
<string name="get_discount_title">احصل على خصم بمقدار %d %@ at %d%% .</string>
<string name="get_discount_first_part">%1$s للأول %2$s</string>
<string name="get_discount_first_few_part">%1$s للأول %2$s</string>
<string name="get_discount_second_part">ثم %1$s</string> <string name="get_discount_second_part">ثم %1$s</string>
<string name="price_and_discount">%1$s • وفر %2$s</string>
<string name="apply_to_current_profile">تطبيق فقط على \"%1$s\"</string> <string name="apply_to_current_profile">تطبيق فقط على \"%1$s\"</string>
<string name="route_parameters_info">إعدادات التوجيه في ملف التعريف المحدد \"%1$s\".</string> <string name="route_parameters_info">إعدادات التوجيه في ملف التعريف المحدد \"%1$s\".</string>
<string name="routing_attr_width_name">حد العرض</string> <string name="routing_attr_width_name">حد العرض</string>

View file

@ -107,9 +107,9 @@ public class SQLiteTileSource implements ITileSource {
this.inversiveZoom = inversiveZoom; this.inversiveZoom = inversiveZoom;
} }
public SQLiteTileSource(SQLiteTileSource tileSource, int suffixNum, OsmandApplication ctx) { public SQLiteTileSource(SQLiteTileSource tileSource, String name, OsmandApplication ctx) {
this.ctx = ctx; this.ctx = ctx;
this.name = tileSource.getName() + "_" + suffixNum; this.name = name;
this.urlTemplate = tileSource.getUrlTemplate(); this.urlTemplate = tileSource.getUrlTemplate();
this.maxZoom = tileSource.getMaximumZoomSupported(); this.maxZoom = tileSource.getMaximumZoomSupported();
this.minZoom = tileSource.getMinimumZoomSupported(); this.minZoom = tileSource.getMinimumZoomSupported();

View file

@ -264,10 +264,10 @@ public class SettingsHelper {
@NonNull @NonNull
public abstract List<T> excludeDuplicateItems(); public abstract List<T> excludeDuplicateItems();
public abstract boolean isDuplicate(T item); public abstract boolean isDuplicate(@NonNull T item);
@NonNull @NonNull
public abstract T renameItem(T item); public abstract T renameItem(@NonNull T item);
} }
public abstract static class SettingsItemReader<T extends SettingsItem> { public abstract static class SettingsItemReader<T extends SettingsItem> {
@ -858,13 +858,13 @@ public class SettingsHelper {
} }
@Override @Override
public boolean isDuplicate(QuickAction item) { public boolean isDuplicate(@NonNull QuickAction item) {
return !actionRegistry.isNameUnique(item, app); return !actionRegistry.isNameUnique(item, app);
} }
@NonNull @NonNull
@Override @Override
public QuickAction renameItem(QuickAction item) { public QuickAction renameItem(@NonNull QuickAction item) {
return actionRegistry.generateUniqueName(item, app); return actionRegistry.generateUniqueName(item, app);
} }
@ -902,7 +902,7 @@ public class SettingsHelper {
newActions.addAll(duplicateItems); newActions.addAll(duplicateItems);
} }
newActions.addAll(items); newActions.addAll(items);
app.getQuickActionRegistry().updateQuickActions(newActions); actionRegistry.updateQuickActions(newActions);
} }
} }
@ -1048,7 +1048,7 @@ public class SettingsHelper {
} }
@Override @Override
public boolean isDuplicate(PoiUIFilter item) { public boolean isDuplicate(@NonNull PoiUIFilter item) {
String savedName = item.getName(); String savedName = item.getName();
for (PoiUIFilter filter : existingItems) { for (PoiUIFilter filter : existingItems) {
if (filter.getName().equals(savedName)) { if (filter.getName().equals(savedName)) {
@ -1076,11 +1076,13 @@ public class SettingsHelper {
@NonNull @NonNull
@Override @Override
public PoiUIFilter renameItem(PoiUIFilter item) { public PoiUIFilter renameItem(@NonNull PoiUIFilter item) {
int number = 0; int number = 0;
while (true) { while (true) {
number++; number++;
PoiUIFilter renamedItem = new PoiUIFilter(item, number, app); PoiUIFilter renamedItem = new PoiUIFilter(item,
item.getName() + "_" + number,
item.getFilterId() + "_" + number);
if (!isDuplicate(renamedItem)) { if (!isDuplicate(renamedItem)) {
return renamedItem; return renamedItem;
} }
@ -1273,13 +1275,16 @@ public class SettingsHelper {
@NonNull @NonNull
@Override @Override
public ITileSource renameItem(ITileSource item) { public ITileSource renameItem(@NonNull ITileSource item) {
int number = 0; int number = 0;
while (true) { while (true) {
number++; number++;
if (item instanceof SQLiteTileSource) { if (item instanceof SQLiteTileSource) {
SQLiteTileSource oldItem = (SQLiteTileSource) item; SQLiteTileSource oldItem = (SQLiteTileSource) item;
SQLiteTileSource renamedItem = new SQLiteTileSource(oldItem, number, app); SQLiteTileSource renamedItem = new SQLiteTileSource(
oldItem,
oldItem.getName() + "_" + number,
app);
if (!isDuplicate(renamedItem)) { if (!isDuplicate(renamedItem)) {
return renamedItem; return renamedItem;
} }
@ -1294,7 +1299,7 @@ public class SettingsHelper {
} }
@Override @Override
public boolean isDuplicate(ITileSource item) { public boolean isDuplicate(@NonNull ITileSource item) {
for (String name : existingItemsNames) { for (String name : existingItemsNames) {
if (name.equals(item.getName())) { if (name.equals(item.getName())) {
return true; return true;

View file

@ -9,6 +9,7 @@ import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.plus.AppInitializer; import net.osmand.plus.AppInitializer;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -36,7 +37,9 @@ public class WhatsNewDialogFragment extends DialogFragment {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Intent i = new Intent(Intent.ACTION_VIEW); Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(AppInitializer.LATEST_CHANGES_URL)); i.setData(Uri.parse(AppInitializer.LATEST_CHANGES_URL));
startActivity(i); if (AndroidUtils.isIntentSafe(osmandApplication, i)) {
startActivity(i);
}
dismiss(); dismiss();
} }
}); });

View file

@ -125,14 +125,16 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
name = app.getPoiFilters().getFiltersName(filtersToMerge); name = app.getPoiFilters().getFiltersName(filtersToMerge);
} }
public PoiUIFilter(PoiUIFilter filter, int suffixNum, OsmandApplication app) { public PoiUIFilter(PoiUIFilter filter, String name, String filterId) {
this.app = app; this.app = filter.app;
name = filter.getName() + "_" + suffixNum; this.name = name;
filterId = filter.getFilterId() + "_" + suffixNum; this.filterId = filterId;
isStandardFilter = false; isStandardFilter = false;
poiTypes = app.getPoiTypes(); poiTypes = filter.poiTypes;
acceptedTypes = filter.getAcceptedTypes(); acceptedTypes = filter.getAcceptedTypes();
poiAdditionals = filter.getPoiAdditionals(); poiAdditionals = filter.getPoiAdditionals();
filterByName = filter.filterByName;
savedFilterByName = filter.savedFilterByName;
} }
public boolean isDeleted() { public boolean isDeleted() {