From 796808246153af4c58384f7e61210b162b5ee14a Mon Sep 17 00:00:00 2001 From: Josef Kufner Date: Wed, 16 May 2018 03:48:40 +0200 Subject: [PATCH 01/21] Fix #5358: Do not intercept media button Currently Osmand intercepts media button and then ignores it. This change allows a music player to keep the media button focus. --- OsmAnd/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index 6eaa64d670..703034e5fa 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -172,7 +172,7 @@ - + From 191f14c754a574037daf66adee1a80474236dc25 Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Wed, 16 May 2018 19:04:31 +0300 Subject: [PATCH 02/21] Remove unused fields --- .../osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java index 5fbc18ba4c..e17c31b794 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java @@ -260,10 +260,6 @@ public class RouteInfoWidgetsFactory { public TextInfoWidget createTimeControl(final MapActivity map, final boolean intermediate){ final RoutingHelper routingHelper = map.getRoutingHelper(); - final int time = R.drawable.widget_time_day; - final int timeN = R.drawable.widget_time_night; - final int timeToGo = R.drawable.widget_time_to_distance_day; - final int timeToGoN = R.drawable.widget_time_to_distance_night; final OsmandApplication ctx = map.getMyApplication(); final OsmandPreference showArrival = intermediate ? ctx.getSettings().SHOW_INTERMEDIATE_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME From 574c1192a7b3befa486318b1ac1530bfe019ce24 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 16 May 2018 20:01:42 +0300 Subject: [PATCH 03/21] Fix inapp cancel dialog --- OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java index 9a60d06d75..428627128f 100644 --- a/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java +++ b/OsmAnd/src/net/osmand/plus/inapp/InAppPurchaseHelper.java @@ -361,19 +361,18 @@ public class InAppPurchaseHelper { Purchase liveUpdatesPurchase = inventory.getPurchase(SKU_LIVE_UPDATES); boolean subscribedToLiveUpdates = (liveUpdatesPurchase != null && liveUpdatesPurchase.getPurchaseState() == 0); OsmandPreference subscriptionCancelledTime = ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_TIME; - if (!subscribedToLiveUpdates) { + if (!subscribedToLiveUpdates && ctx.getSettings().LIVE_UPDATES_PURCHASED.get()) { if (subscriptionCancelledTime.get() == 0) { subscriptionCancelledTime.set(System.currentTimeMillis()); ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_FIRST_DLG_SHOWN.set(false); ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_SECOND_DLG_SHOWN.set(false); - } else if (System.currentTimeMillis() - subscriptionCancelledTime.get() > SUBSCRIPTION_HOLDING_TIME_MSEC - && ctx.getSettings().LIVE_UPDATES_PURCHASED.get()) { + } else if (System.currentTimeMillis() - subscriptionCancelledTime.get() > SUBSCRIPTION_HOLDING_TIME_MSEC) { ctx.getSettings().LIVE_UPDATES_PURCHASED.set(false); if (!isDepthContoursPurchased(ctx)) { ctx.getSettings().getCustomRenderBooleanProperty("depthContours").set(false); } } - } else { + } else if (subscribedToLiveUpdates) { subscriptionCancelledTime.set(0L); ctx.getSettings().LIVE_UPDATES_PURCHASED.set(true); } From ed1a0f7d8dc11330536034c3bc78209eed34b4d5 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 16 May 2018 19:18:17 +0200 Subject: [PATCH 04/21] Delete column article id --- .../plus/wikivoyage/data/TravelArticle.java | 4 --- .../plus/wikivoyage/data/TravelDbHelper.java | 27 +++++++++---------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java index 4f04fd2abc..e84b41be28 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelArticle.java @@ -19,7 +19,6 @@ public class TravelArticle { private static final String THUMB_PREFIX = "320px-"; private static final String REGULAR_PREFIX = "1280px-";//1280, 1024, 800 - String id; String title; String content; String isPartOf; @@ -33,9 +32,6 @@ public class TravelArticle { String contentsJson; String aggregatedPartOf; - public String getId() { - return id; - } public String getTitle() { return title; diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java index fe47082723..f1fd2e6046 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelDbHelper.java @@ -48,7 +48,6 @@ public class TravelDbHelper { private static final String ARTICLES_TABLE_NAME = "travel_articles"; private static final String POPULAR_TABLE_NAME = "popular_articles"; - private static final String ARTICLES_COL_ID = "article_id"; private static final String ARTICLES_POP_INDEX = "popularity_index"; private static final String ARTICLES_POP_ORDER = "order_index"; private static final String ARTICLES_COL_TITLE = "title"; @@ -65,7 +64,6 @@ public class TravelDbHelper { private static final String ARTICLES_COL_AGGREGATED_PART_OF = "aggregated_part_of"; private static final String ARTICLES_TABLE_SELECT = "SELECT " + - ARTICLES_COL_ID + ", " + ARTICLES_COL_TITLE + ", " + ARTICLES_COL_CONTENT + ", " + ARTICLES_COL_IS_PART_OF + ", " + @@ -568,24 +566,23 @@ public class TravelDbHelper { private TravelArticle readArticle(SQLiteCursor cursor) { TravelArticle res = new TravelArticle(); - res.id = cursor.getString(0); - res.title = cursor.getString(1); + res.title = cursor.getString(0); try { - res.content = Algorithms.gzipToString(cursor.getBlob(2)); + res.content = Algorithms.gzipToString(cursor.getBlob(1)); } catch (IOException e) { LOG.error(e.getMessage(), e); } - res.isPartOf = cursor.getString(3); - res.lat = cursor.isNull(4) ? Double.NaN : cursor.getDouble(4); - res.lon = cursor.isNull(5) ? Double.NaN : cursor.getDouble(5); - res.imageTitle = cursor.getString(6); - res.tripId = cursor.getLong(8); - res.originalId = cursor.isNull(9) ? 0 : cursor.getLong(9); - res.lang = cursor.getString(10); - res.contentsJson = cursor.getString(11); - res.aggregatedPartOf = cursor.getString(12); + res.isPartOf = cursor.getString(2); + res.lat = cursor.isNull(3) ? Double.NaN : cursor.getDouble(3); + res.lon = cursor.isNull(4) ? Double.NaN : cursor.getDouble(4); + res.imageTitle = cursor.getString(5); + res.tripId = cursor.getLong(7); + res.originalId = cursor.isNull(8) ? 0 : cursor.getLong(8); + res.lang = cursor.getString(9); + res.contentsJson = cursor.getString(10); + res.aggregatedPartOf = cursor.getString(11); try { - String gpxContent = Algorithms.gzipToString(cursor.getBlob(7)); + String gpxContent = Algorithms.gzipToString(cursor.getBlob(6)); res.gpxFile = GPXUtilities.loadGPXFile(application, new ByteArrayInputStream(gpxContent.getBytes("UTF-8"))); } catch (IOException e) { LOG.error(e.getMessage(), e); From 9573f7457e0c134f50744680ca27c4f26fece87e Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 16 May 2018 21:19:51 +0300 Subject: [PATCH 05/21] Close cursor at getAllHistoryMap --- .../net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java index cdba65ad8f..eefa4c44a2 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java @@ -286,6 +286,7 @@ public class TravelLocalDataHelper { res.put(item.cityId, item); } while (cursor.moveToNext()); } + cursor.close(); } finally { conn.close(); } From a7b07f3ce0e2bae68d4c05346f1be299124889ef Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Wed, 16 May 2018 22:46:03 +0300 Subject: [PATCH 06/21] Do not use hardcoded indexes --- OsmAnd/src/net/osmand/plus/api/SQLiteAPI.java | 2 ++ .../net/osmand/plus/api/SQLiteAPIImpl.java | 8 +++++- .../data/TravelLocalDataHelper.java | 26 +++++++++---------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/api/SQLiteAPI.java b/OsmAnd/src/net/osmand/plus/api/SQLiteAPI.java index c0d2a2a974..98aa5cfd1b 100644 --- a/OsmAnd/src/net/osmand/plus/api/SQLiteAPI.java +++ b/OsmAnd/src/net/osmand/plus/api/SQLiteAPI.java @@ -50,6 +50,8 @@ public interface SQLiteAPI { byte[] getBlob(int ind); boolean isNull(int ind); + + int getColumnIndex(String columnName); void close(); diff --git a/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java b/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java index e30033785e..8ed2827e6b 100644 --- a/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java +++ b/OsmAnd/src/net/osmand/plus/api/SQLiteAPIImpl.java @@ -1,11 +1,12 @@ package net.osmand.plus.api; -import net.osmand.plus.OsmandApplication; import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; +import net.osmand.plus.OsmandApplication; + public class SQLiteAPIImpl implements SQLiteAPI { private OsmandApplication app; @@ -84,6 +85,11 @@ public class SQLiteAPIImpl implements SQLiteAPI { return c.isNull(ind); } + @Override + public int getColumnIndex(String columnName) { + return c.getColumnIndex(columnName); + } + @Override public double getDouble(int ind) { diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java index eefa4c44a2..866a36cca0 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelLocalDataHelper.java @@ -443,11 +443,11 @@ public class TravelLocalDataHelper { private WikivoyageSearchHistoryItem readHistoryItem(SQLiteCursor cursor) { WikivoyageSearchHistoryItem res = new WikivoyageSearchHistoryItem(); - res.cityId = cursor.getLong(0); - res.articleTitle = cursor.getString(1); - res.lang = cursor.getString(2); - res.isPartOf = cursor.getString(3); - res.lastAccessed = cursor.getLong(4); + res.cityId = cursor.getLong(cursor.getColumnIndex(HISTORY_COL_CITY_ID)); + res.articleTitle = cursor.getString(cursor.getColumnIndex(HISTORY_COL_ARTICLE_TITLE)); + res.lang = cursor.getString(cursor.getColumnIndex(HISTORY_COL_LANG)); + res.isPartOf = cursor.getString(cursor.getColumnIndex(HISTORY_COL_IS_PART_OF)); + res.lastAccessed = cursor.getLong(cursor.getColumnIndex(HISTORY_COL_LAST_ACCESSED)); return res; } @@ -455,14 +455,14 @@ public class TravelLocalDataHelper { private TravelArticle readSavedArticle(SQLiteCursor cursor) { TravelArticle res = new TravelArticle(); - res.tripId = cursor.getLong(0); - res.title = cursor.getString(1); - res.lang = cursor.getString(2); - res.aggregatedPartOf = cursor.getString(3); - res.imageTitle = cursor.getString(4); - res.content = cursor.getString(5); - res.lat = cursor.getDouble(6); - res.lon = cursor.getDouble(7); + res.tripId = cursor.getLong(cursor.getColumnIndex(BOOKMARKS_COL_CITY_ID)); + res.title = cursor.getString(cursor.getColumnIndex(BOOKMARKS_COL_ARTICLE_TITLE)); + res.lang = cursor.getString(cursor.getColumnIndex(BOOKMARKS_COL_LANG)); + res.aggregatedPartOf = cursor.getString(cursor.getColumnIndex(BOOKMARKS_COL_IS_PART_OF)); + res.imageTitle = cursor.getString(cursor.getColumnIndex(BOOKMARKS_COL_IMAGE_TITLE)); + res.content = cursor.getString(cursor.getColumnIndex(BOOKMARKS_COL_PARTIAL_CONTENT)); + res.lat = cursor.getDouble(cursor.getColumnIndex(BOOKMARKS_COL_LAT)); + res.lon = cursor.getDouble(cursor.getColumnIndex(BOOKMARKS_COL_LON)); return res; } From 277b51bceee5f1ad52d2b060016ceef28d65a40a Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 16 May 2018 21:57:16 +0200 Subject: [PATCH 07/21] Fix issue with picasso --- OsmAnd/src/net/osmand/PicassoUtils.java | 51 ++++++++++--------- .../explore/SavedArticlesRvAdapter.java | 13 ++--- .../WikivoyageExploreDialogFragment.java | 14 ++--- ...oyageOptionsBottomSheetDialogFragment.java | 2 +- .../travelcards/ArticleTravelCard.java | 11 ++-- 5 files changed, 46 insertions(+), 45 deletions(-) diff --git a/OsmAnd/src/net/osmand/PicassoUtils.java b/OsmAnd/src/net/osmand/PicassoUtils.java index 3f8fb836ce..1389c2dcfe 100644 --- a/OsmAnd/src/net/osmand/PicassoUtils.java +++ b/OsmAnd/src/net/osmand/PicassoUtils.java @@ -13,9 +13,9 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; +import net.osmand.plus.OsmandApplication; import okhttp3.Cache; import okhttp3.OkHttpClient; - import static android.os.Build.VERSION.SDK_INT; import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR2; @@ -24,33 +24,36 @@ public class PicassoUtils { private static final String PICASSO_CACHE = "picasso-cache"; private static final int MIN_DISK_CACHE_SIZE = 5 * 1024 * 1024; // 5MB private static final int MAX_DISK_CACHE_SIZE = 50 * 1024 * 1024; // 50MB + private static PicassoUtils INSTANCE; - private static Cache diskCache; - private static LruCache memoryCache; + private Cache diskCache; + private LruCache memoryCache; - private static boolean initialized; + private Map cached = new HashMap<>(); + + private PicassoUtils(OsmandApplication app){ + File cacheDir = createDefaultCacheDir(app); - private static Map cached = new HashMap<>(); + diskCache = new Cache(cacheDir, calculateDiskCacheSize(cacheDir)); + memoryCache = new LruCache(app); - public static void setupPicasso(@NonNull Context context) { - if (!initialized) { - File cacheDir = createDefaultCacheDir(context); + Picasso picasso = new Picasso.Builder(app) + .downloader(new OkHttp3Downloader(new OkHttpClient.Builder().cache(diskCache).build())) + .memoryCache(memoryCache) + .build(); - diskCache = new Cache(cacheDir, calculateDiskCacheSize(cacheDir)); - memoryCache = new LruCache(context); + Picasso.setSingletonInstance(picasso); - Picasso picasso = new Picasso.Builder(context) - .downloader(new OkHttp3Downloader(new OkHttpClient.Builder().cache(diskCache).build())) - .memoryCache(memoryCache) - .build(); - - Picasso.setSingletonInstance(picasso); - - initialized = true; - } } - public static void clearAllPicassoCache() { + public static PicassoUtils getPicasso(@NonNull OsmandApplication app) { + if(INSTANCE == null) { + INSTANCE = new PicassoUtils(app); + } + return INSTANCE; + } + + public void clearAllPicassoCache() { if (memoryCache != null) { memoryCache.clear(); } @@ -64,19 +67,19 @@ public class PicassoUtils { cached.clear(); } - public static Boolean isCached(@NonNull String key) { + public Boolean isURLLoaded(@NonNull String key) { return cached.get(key); } - public static void setCached(@NonNull String key, boolean val) { + public void setResultLoaded(@NonNull String key, boolean val) { cached.put(key, val); } - public static void clearCachedMap() { + public void clearCachedMap() { cached.clear(); } - public static long getDiskCacheSizeBytes() throws IOException { + public long getDiskCacheSizeBytes() throws IOException { return diskCache.size(); } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java index 2e490d6eb2..9c0c0ed779 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java @@ -43,6 +43,7 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter Date: Wed, 16 May 2018 23:25:37 +0300 Subject: [PATCH 08/21] Use title instead of city id for saved articles --- .../adapters/MapMarkersGroupsAdapter.java | 2 +- .../WikivoyageArticleDialogFragment.java | 8 +++++ .../data/TravelLocalDataHelper.java | 34 +++++++++++-------- .../explore/SavedArticlesTabFragment.java | 2 +- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java index ead498bb4d..75f3e9c747 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java @@ -447,7 +447,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter Date: Wed, 16 May 2018 22:45:47 +0200 Subject: [PATCH 09/21] Fix issue with blinking in recycler view --- .../wikivoyage/explore/ExploreRvAdapter.java | 8 +- .../explore/ExploreTabFragment.java | 18 +-- .../travelcards/TravelDownloadUpdateCard.java | 27 +++-- .../travelcards/TravelNeededMapsCard.java | 112 ++++++++++-------- 4 files changed, 95 insertions(+), 70 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java index 9af1da3336..8052ca49fa 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java @@ -137,13 +137,13 @@ public class ExploreRvAdapter extends RecyclerView.Adapter position && items.get(position).getCardType() == TravelNeededMapsCard.TYPE; } - public void setDownloadUpdateCard(TravelDownloadUpdateCard card) { + public void addDownloadUpdateCard(TravelDownloadUpdateCard card) { if (addItem(getDownloadUpdateCardPosition(), card)) { notifyDataSetChanged(); } } - public void updateDownloadUpdateCard() { + public void updateDownloadUpdateCard(boolean onlyProgress) { int pos = getDownloadUpdateCardPosition(); if (downloadUpdateCardExists(pos)) { notifyItemChanged(pos); diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java index 46492fd3ee..96ea159263 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java @@ -90,8 +90,8 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn currentDownloadingIndexItem = current; removeRedundantCards(); } - adapter.updateDownloadUpdateCard(); - adapter.updateNeededMapsCard(); + adapter.updateDownloadUpdateCard(true); + adapter.updateNeededMapsCard(true); } @Override @@ -194,7 +194,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn public void onPrimaryButtonClick() { if (mainIndexItem != null) { downloadManager.startDownload(getMyActivity(), mainIndexItem); - adapter.updateDownloadUpdateCard(); + adapter.updateDownloadUpdateCard(false); } } @@ -202,7 +202,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn public void onSecondaryButtonClick() { if (downloadUpdateCard.isLoading()) { downloadThread.cancelDownload(mainIndexItem); - adapter.updateDownloadUpdateCard(); + adapter.updateDownloadUpdateCard(false); } else if (!downloadUpdateCard.isDownload()) { removeDownloadUpdateCard(); } else if (downloadUpdateCard.isShowOtherMapsBtn()) { @@ -217,7 +217,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn } }); downloadUpdateCard.setIndexItem(mainIndexItem); - adapter.setDownloadUpdateCard(downloadUpdateCard); + adapter.addDownloadUpdateCard(downloadUpdateCard); } } @@ -230,14 +230,14 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn @Override public void onPrimaryButtonClick() { downloadManager.startDownload(getMyActivity(), getAllItemsForDownload()); - adapter.updateNeededMapsCard(); + adapter.updateNeededMapsCard(false); } @Override public void onSecondaryButtonClick() { if (neededMapsCard.isDownloading()) { app.getDownloadThread().cancelDownload(neededIndexItems); - adapter.updateNeededMapsCard(); + adapter.updateNeededMapsCard(false); } else { removeNeededMapsCard(); } @@ -257,11 +257,11 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadIn } else if (!item.isDownloaded()) { downloadManager.startDownload(getMyActivity(), item); } - adapter.updateNeededMapsCard(); + adapter.updateNeededMapsCard(false); } } }); - adapter.setNeededMapsCard(neededMapsCard); + adapter.addNeededMapsCard(neededMapsCard); } } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelDownloadUpdateCard.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelDownloadUpdateCard.java index 58555ce002..78afb435c6 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelDownloadUpdateCard.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelDownloadUpdateCard.java @@ -10,11 +10,11 @@ import android.view.View; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; - import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.download.IndexItem; +import java.lang.ref.WeakReference; import java.text.DateFormat; public class TravelDownloadUpdateCard extends BaseTravelCard { @@ -23,6 +23,7 @@ public class TravelDownloadUpdateCard extends BaseTravelCard { private boolean download; private boolean showOtherMapsBtn; + private WeakReference ref; private ClickListener listener; @@ -62,6 +63,7 @@ public class TravelDownloadUpdateCard extends BaseTravelCard { if (viewHolder instanceof DownloadUpdateVH) { boolean loading = isLoading(); DownloadUpdateVH holder = (DownloadUpdateVH) viewHolder; + this.ref = new WeakReference(holder); holder.title.setText(getTitle(loading)); holder.icon.setImageDrawable(getIcon()); holder.description.setText(getDescription()); @@ -73,18 +75,29 @@ public class TravelDownloadUpdateCard extends BaseTravelCard { holder.fileTitle.setText(getFileTitle()); holder.fileDescription.setText(getFileDescription()); holder.progressBar.setVisibility(loading ? View.VISIBLE : View.GONE); - if (isLoadingInProgress()) { - int progress = app.getDownloadThread().getCurrentDownloadingItemProgress(); - holder.progressBar.setProgress(progress < 0 ? 0 : progress); - } else { - holder.progressBar.setProgress(0); - } + updateProgressBar(holder); } boolean primaryBtnVisible = updatePrimaryButton(holder, loading); boolean secondaryBtnVisible = updateSecondaryButton(holder, loading); holder.buttonsDivider.setVisibility(primaryBtnVisible && secondaryBtnVisible ? View.VISIBLE : View.GONE); } } + + public void updateProgresBar() { + DownloadUpdateVH holder = ref.get(); + if (holder != null && holder.itemView.isShown()) { + updateProgressBar(holder); + } + } + + private void updateProgressBar(DownloadUpdateVH holder) { + if (isLoadingInProgress()) { + int progress = app.getDownloadThread().getCurrentDownloadingItemProgress(); + holder.progressBar.setProgress(progress < 0 ? 0 : progress); + } else { + holder.progressBar.setProgress(0); + } + } @Override public int getCardType() { diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelNeededMapsCard.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelNeededMapsCard.java index 0b722b7e5d..28636655bf 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelNeededMapsCard.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelNeededMapsCard.java @@ -10,14 +10,15 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; - import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.Version; import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.IndexItem; +import net.osmand.plus.wikivoyage.explore.travelcards.TravelDownloadUpdateCard.DownloadUpdateVH; +import java.lang.ref.WeakReference; import java.util.List; public class TravelNeededMapsCard extends BaseTravelCard { @@ -29,7 +30,7 @@ public class TravelNeededMapsCard extends BaseTravelCard { private Drawable downloadIcon; private Drawable cancelIcon; - + private WeakReference ref; private CardListener listener; private View.OnClickListener onItemClickListener; @@ -57,64 +58,75 @@ public class TravelNeededMapsCard extends BaseTravelCard { public void bindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder) { if (viewHolder instanceof NeededMapsVH) { NeededMapsVH holder = (NeededMapsVH) viewHolder; - + ref = new WeakReference(holder); holder.description.setText(isInternetAvailable() ? R.string.maps_you_need_descr : R.string.no_index_file_to_download); adjustChildCount(holder.itemsContainer); - boolean paidVersion = Version.isPaidVersion(app); - - for (int i = 0; i < items.size(); i++) { - IndexItem item = items.get(i); - boolean downloading = downloadThread.isDownloading(item); - boolean currentDownloading = downloading && downloadThread.getCurrentDownloadingItem() == item; - boolean lastItem = i == items.size() - 1; - View view = holder.itemsContainer.getChildAt(i); - - if (item.isDownloaded()) { - view.setOnClickListener(null); - } else { - view.setTag(item); - view.setOnClickListener(onItemClickListener); - } - - ((ImageView) view.findViewById(R.id.icon)) - .setImageDrawable(getActiveIcon(item.getType().getIconResource())); - ((TextView) view.findViewById(R.id.title)) - .setText(item.getVisibleName(app, app.getRegions(), false)); - ((TextView) view.findViewById(R.id.description)).setText(getItemDescription(item)); - - ImageView iconAction = (ImageView) view.findViewById(R.id.icon_action); - Button buttonAction = (Button) view.findViewById(R.id.button_action); - if (item.isDownloaded()) { - iconAction.setVisibility(View.GONE); - buttonAction.setVisibility(View.GONE); - } else { - boolean showBtn = !paidVersion && item.getType() == DownloadActivityType.WIKIPEDIA_FILE; - iconAction.setVisibility(showBtn ? View.GONE : View.VISIBLE); - buttonAction.setVisibility(showBtn ? View.VISIBLE : View.GONE); - if (!showBtn) { - iconAction.setImageDrawable(downloading ? cancelIcon : downloadIcon); - } - } - - ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progress_bar); - progressBar.setVisibility(downloading ? View.VISIBLE : View.GONE); - if (currentDownloading) { - int progress = downloadThread.getCurrentDownloadingItemProgress(); - progressBar.setProgress(progress < 0 ? 0 : progress); - } else { - progressBar.setProgress(0); - } - - view.findViewById(R.id.divider).setVisibility(lastItem ? View.GONE : View.VISIBLE); - } + updateView(holder); boolean primaryBtnVisible = updatePrimaryButton(holder); boolean secondaryBtnVisible = updateSecondaryButton(holder); holder.buttonsDivider.setVisibility(primaryBtnVisible && secondaryBtnVisible ? View.VISIBLE : View.GONE); } } + + public void updateView() { + NeededMapsVH holder = ref.get(); + if (holder != null && holder.itemView.isShown()) { + updateView(holder); + } + } + + private void updateView(NeededMapsVH holder) { + boolean paidVersion = Version.isPaidVersion(app); + + for (int i = 0; i < items.size(); i++) { + IndexItem item = items.get(i); + boolean downloading = downloadThread.isDownloading(item); + boolean currentDownloading = downloading && downloadThread.getCurrentDownloadingItem() == item; + boolean lastItem = i == items.size() - 1; + View view = holder.itemsContainer.getChildAt(i); + + if (item.isDownloaded()) { + view.setOnClickListener(null); + } else { + view.setTag(item); + view.setOnClickListener(onItemClickListener); + } + + ((ImageView) view.findViewById(R.id.icon)) + .setImageDrawable(getActiveIcon(item.getType().getIconResource())); + ((TextView) view.findViewById(R.id.title)) + .setText(item.getVisibleName(app, app.getRegions(), false)); + ((TextView) view.findViewById(R.id.description)).setText(getItemDescription(item)); + + ImageView iconAction = (ImageView) view.findViewById(R.id.icon_action); + Button buttonAction = (Button) view.findViewById(R.id.button_action); + if (item.isDownloaded()) { + iconAction.setVisibility(View.GONE); + buttonAction.setVisibility(View.GONE); + } else { + boolean showBtn = !paidVersion && item.getType() == DownloadActivityType.WIKIPEDIA_FILE; + iconAction.setVisibility(showBtn ? View.GONE : View.VISIBLE); + buttonAction.setVisibility(showBtn ? View.VISIBLE : View.GONE); + if (!showBtn) { + iconAction.setImageDrawable(downloading ? cancelIcon : downloadIcon); + } + } + + ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progress_bar); + progressBar.setVisibility(downloading ? View.VISIBLE : View.GONE); + if (currentDownloading) { + int progress = downloadThread.getCurrentDownloadingItemProgress(); + progressBar.setProgress(progress < 0 ? 0 : progress); + } else { + progressBar.setProgress(0); + } + + view.findViewById(R.id.divider).setVisibility(lastItem ? View.GONE : View.VISIBLE); + } + } @Override public int getCardType() { From 6c0aa4abf5f7d5083c5a22d84cb3620a76e8c641 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 16 May 2018 22:47:35 +0200 Subject: [PATCH 10/21] Fix issue with blinking in recycler view --- .../wikivoyage/explore/ExploreRvAdapter.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java index 8052ca49fa..4a148ce654 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java @@ -31,6 +31,8 @@ public class ExploreRvAdapter extends RecyclerView.Adapter items = new ArrayList<>(); + private TravelDownloadUpdateCard downloadCard; + private TravelNeededMapsCard neededMapsCard; @NonNull @Override @@ -138,12 +140,19 @@ public class ExploreRvAdapter extends RecyclerView.Adapter Date: Wed, 16 May 2018 22:50:18 +0200 Subject: [PATCH 11/21] Fix issue with blinking in recycler view --- .../net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java index 4a148ce654..a6892c847b 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java @@ -152,6 +152,7 @@ public class ExploreRvAdapter extends RecyclerView.Adapter Date: Wed, 16 May 2018 23:27:44 +0200 Subject: [PATCH 12/21] Fix translation for 3.0 --- OsmAnd/res/values-az/strings.xml | 2 -- OsmAnd/res/values-b+ast/strings.xml | 14 +++++-------- OsmAnd/res/values-be-rBY/strings.xml | 3 --- OsmAnd/res/values-be/strings.xml | 8 -------- OsmAnd/res/values-bg/strings.xml | 2 -- OsmAnd/res/values-ca/strings.xml | 2 +- OsmAnd/res/values-cs/strings.xml | 3 --- OsmAnd/res/values-de/strings.xml | 3 --- OsmAnd/res/values-el/strings.xml | 2 +- OsmAnd/res/values-eu/strings.xml | 3 --- OsmAnd/res/values-fr/strings.xml | 2 +- OsmAnd/res/values-he/strings.xml | 2 +- OsmAnd/res/values-hu/strings.xml | 3 --- OsmAnd/res/values-hy/strings.xml | 3 +-- OsmAnd/res/values-id/strings.xml | 2 +- OsmAnd/res/values-is/strings.xml | 2 +- OsmAnd/res/values-it/strings.xml | 3 --- OsmAnd/res/values-ku/strings.xml | 3 --- OsmAnd/res/values-lt/strings.xml | 2 +- OsmAnd/res/values-nb/strings.xml | 3 --- OsmAnd/res/values-pl/strings.xml | 3 --- OsmAnd/res/values-ro/strings.xml | 1 - OsmAnd/res/values-sc/strings.xml | 2 +- OsmAnd/res/values-sk/strings.xml | 2 +- OsmAnd/res/values-sl/strings.xml | 3 --- OsmAnd/res/values-sr/strings.xml | 2 +- OsmAnd/res/values-sv/strings.xml | 3 --- OsmAnd/res/values-uk/strings.xml | 1 - OsmAnd/res/values-zh-rCN/strings.xml | 3 --- OsmAnd/res/values-zh-rTW/strings.xml | 2 +- .../WikivoyageArticleDialogFragment.java | 20 +++++++++---------- .../WikivoyageArticleNavigationFragment.java | 10 +++++----- 32 files changed, 32 insertions(+), 87 deletions(-) diff --git a/OsmAnd/res/values-az/strings.xml b/OsmAnd/res/values-az/strings.xml index 8b90c759a1..8091df0ac8 100644 --- a/OsmAnd/res/values-az/strings.xml +++ b/OsmAnd/res/values-az/strings.xml @@ -1966,8 +1966,6 @@ İzlər əlavə et və qeyd et Baxmaq üçün izləri qeyd edin və ya idxal edin. Fayl adını daxil edin. - • -\n Aktiv işarələrə qədər məsafənin necə göstəriləcəyini seçin. İrəlidə tunel Mövqeyinizdən aktiv işarə məkanlarına bələdçi xətlərini göstər. diff --git a/OsmAnd/res/values-b+ast/strings.xml b/OsmAnd/res/values-b+ast/strings.xml index 98a6112fbd..a0eb50f084 100644 --- a/OsmAnd/res/values-b+ast/strings.xml +++ b/OsmAnd/res/values-b+ast/strings.xml @@ -1050,15 +1050,11 @@ Puntos Más aiciones Ficheru GPX con coordenaes y datos de les notes esbillaes. Ficheru GPX con coordenaes y datos de toles notes. - \\022 Nuevu menú Viaxe : consultar los artículos de WikiVoyage ensin conexón -\n -\n • Wikipedia : nuevu aspeutu, imaxes -\n -\n • Interfazd\'apertura de traces : ver grupos de puntos de ruta -\n -\n • Marcadores del mapa : importar grupos seleicionaos dende ficheros GPX, nuevu aspeutu de la entrada de coordenaes -\n -\n • La suscripción a OsmAnd Live agora incluye toles funciones d\'OsmAnd + Nuevu menú Viaxe : consultar los artículos de WikiVoyage ensin conexón +\u2022 Wikipedia, Wikivoyage : nuevu aspeutu, imaxes +\u2022 Interfazd\'apertura de traces : ver grupos de puntos de ruta +\u2022 Marcadores del mapa : importar grupos seleicionaos dende ficheros GPX, nuevu aspeutu de la entrada de coordenaes +\u2022 La suscripción a OsmAnd Live agora incluye toles funciones d\'OsmAnd \n Cambiar la consulta de la gueta. Aiciones diff --git a/OsmAnd/res/values-be-rBY/strings.xml b/OsmAnd/res/values-be-rBY/strings.xml index 65b8e852f6..67ccd60ebf 100644 --- a/OsmAnd/res/values-be-rBY/strings.xml +++ b/OsmAnd/res/values-be-rBY/strings.xml @@ -2918,9 +2918,6 @@ U vypadku, kali vy lubіcie OsmAnd і OSM і chočacie padtrymać jaho, heta іd Rabi natatki! Dadajcie aŭdyjo-, videa- ci fotanatatku na lubuju kropku na mapie, vykarystoŭvajučy vidžet ci kantekstnaje mieniu. Źmianicie pošukavy zapyt. - \\022 -\n -\n Što tut: pryparkavany na Uziać da diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml index 0b23874b6c..1d814f8106 100644 --- a/OsmAnd/res/values-be/strings.xml +++ b/OsmAnd/res/values-be/strings.xml @@ -3004,9 +3004,6 @@ Рабі нататкі! Дадайце аўдыё-, відэа- ці фотанататку на любую кропку на мапе, выкарыстоўваючы віджэт ці кантэкстнае меню. Зьмяніце пошукавы запыт. - \\022 -\n -\n Што тут: прыпаркаваны на Узяць да @@ -3014,11 +3011,6 @@ Чытаць увесь артыкул Чытаць артыкул Усе кропкі групы - - - - - Дадатковыя дзеяньні GPX-файл з каардынатамі і данымі выбраных нататак. GPX-файл з каардынатамі і данымі ўсіх нататак. diff --git a/OsmAnd/res/values-bg/strings.xml b/OsmAnd/res/values-bg/strings.xml index c664e054b4..ce94ae343e 100644 --- a/OsmAnd/res/values-bg/strings.xml +++ b/OsmAnd/res/values-bg/strings.xml @@ -2204,8 +2204,6 @@ Допълнителни действия GPX файл с координати и данни от избрани бележки. GPX файл с координати и данни от всички бележки. - \\022 -\n Променете заявката за търсене. Действия Маркер diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml index 8f1360febc..8eb6a0b938 100644 --- a/OsmAnd/res/values-ca/strings.xml +++ b/OsmAnd/res/values-ca/strings.xml @@ -2724,7 +2724,7 @@ Abasta l\'àrea: %1$s x %2$s Per data Per tipus Modifica la consulta de cerca. - \\022 Nou menú Viatge: consulta articles de Viquiviatges sense internet + Nou menú Viatge: consulta articles de Viquiviatges sense internet \n \n• Viquipèdia: nova imatge, enllaços actius, imatges \n diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml index 8baee63e98..ff920da30a 100644 --- a/OsmAnd/res/values-cs/strings.xml +++ b/OsmAnd/res/values-cs/strings.xml @@ -2725,9 +2725,6 @@ Zobrazená oblast: %1$s x %2$s Klepnutím nebo přidržením označte \'Místa\', pak klepněte na tlačítko značky s vlajkou. Upravit vyhledávací dotaz. Jedním klepnutím aktivní - \\022 -\n -\n Popisky bodů Bez názvu Co je zde: diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 6e4eb0b826..9678e9bc2b 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -2974,9 +2974,6 @@ Abgedeckte Fläche: %1$s x %2$s Audio-, Video- oder Fotonotizen zu jedem Punkt auf der Karte über Bedienelement oder Kontextmenü hinzufügen. Notizen nach Datum Ein Tippen auf die Karte schaltet die Steuerschaltflächen und Bedienelemente um. - • -\n -\n Mit einem Tippen aktiv Was ist hier: Ohne Zeitbegrenzung diff --git a/OsmAnd/res/values-el/strings.xml b/OsmAnd/res/values-el/strings.xml index 0881824788..b5f1d7b444 100644 --- a/OsmAnd/res/values-el/strings.xml +++ b/OsmAnd/res/values-el/strings.xml @@ -1814,7 +1814,7 @@ Πρόσθετες ενέργειες Αρχείο GPX με συντεταγμένες και δεδομένα από τις επιλεγμένες σημειώσεις. Αρχείο GPX με συντεταγμένες και δεδομένα από όλες τις σημειώσεις. - \\022 Νέο ταξιδιωτικό μενού: προβολή άρθρων βικιταξίδια χωρίς χρήση διαδικτύου + Νέο ταξιδιωτικό μενού: προβολή άρθρων βικιταξίδια χωρίς χρήση διαδικτύου \n \n • Βικιπαίδεια: νέα όψη, ενεργοί σύνδεσμοι, εικόνες \n diff --git a/OsmAnd/res/values-eu/strings.xml b/OsmAnd/res/values-eu/strings.xml index 15e887d5de..941d549716 100644 --- a/OsmAnd/res/values-eu/strings.xml +++ b/OsmAnd/res/values-eu/strings.xml @@ -2945,9 +2945,6 @@ Area honi dagokio: %1$s x %2$s Izenik gabe Hautatutako oharren koordenatuak eta datuak dituen GPX fitxategia. Ohar guztien koordenatuak eta datuak dituen GPX fitxategia. - \\022 -\n -\n Aldatu bilaketaren galdera. Ekintzak Markatzailea diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index f89391279a..6d2e23ae3a 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -3038,7 +3038,7 @@ représentant la zone : %1$s x %2$s Par date Par type Modifier la recherche. - \\022 Nouveau Menu Voyage : consulter les articles WikiVoyage hors connexion + Nouveau Menu Voyage : consulter les articles WikiVoyage hors connexion \n \n • Wikipedia : nouvelle apparence, images \n diff --git a/OsmAnd/res/values-he/strings.xml b/OsmAnd/res/values-he/strings.xml index 958064829b..0e331c19a2 100644 --- a/OsmAnd/res/values-he/strings.xml +++ b/OsmAnd/res/values-he/strings.xml @@ -2536,7 +2536,7 @@ הפעלת הנפשת גלישת מפה של ה‚מיקום שלי’ במהלך ניווט. ב־%1$s ניתן לגעת בסמן על המפה כדי להעביר אותו לראש הסמנים הפעילים מבלי לפתוח את תפריט ההקשר. - \\022 תפריט טיולים חדש: הצגת ערכים מוויקימסע ללא שימוש באינטרנט + תפריט טיולים חדש: הצגת ערכים מוויקימסע ללא שימוש באינטרנט \n \n • ויקיפדיה: מראה חדש, קישורים פעילים, תמונות \n diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index 37916f25d7..7c38273ebb 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -2882,9 +2882,6 @@ Kérlek adj meg egy teljes kódot További műveletek GPX fájl a kijelölt megjegyzések koordinátáival és adataival. GPX fájl az összes megjegyzés koordinátáival és adataival. - \\022 -\n -\n Keresési kifejezés módosítása. Műveletek Jelölő diff --git a/OsmAnd/res/values-hy/strings.xml b/OsmAnd/res/values-hy/strings.xml index b8fa420f17..0b6ffa39c3 100644 --- a/OsmAnd/res/values-hy/strings.xml +++ b/OsmAnd/res/values-hy/strings.xml @@ -2632,8 +2632,7 @@ Լրացուցիչ գործողություններ GPX ֆայլը կոորդինատներով և ընտրված գրառումների տվյալներով: GPX ֆայլը կոորդինատներով և բոլոր նշումների տվյալները։ - \\022 -\n + \nՆոր Ճամփորդության մենյու. Դիտեք WikiVoyage- ի հոդվածները առանց ինտերնետի օգտագործման \n \n • Wikipedia՝ նոր տեսք, ակտիվ հղումներ, պատկերներ diff --git a/OsmAnd/res/values-id/strings.xml b/OsmAnd/res/values-id/strings.xml index 3598bfdf34..cb9e8bbb91 100644 --- a/OsmAnd/res/values-id/strings.xml +++ b/OsmAnd/res/values-id/strings.xml @@ -73,7 +73,7 @@ Harap beli berlangganan OSM Live terlebih dahulu Urutkan dengan - \\022 mendeteksi tanda Berhenti sekarang dan beranggapan itu arah mengemudi. + mendeteksi tanda Berhenti sekarang dan beranggapan itu arah mengemudi. \n \n• algoritma baru memberikan nilai pendakian/turunan yang bermakna trek GPX. \n diff --git a/OsmAnd/res/values-is/strings.xml b/OsmAnd/res/values-is/strings.xml index 1a649316ee..13d0ede602 100644 --- a/OsmAnd/res/values-is/strings.xml +++ b/OsmAnd/res/values-is/strings.xml @@ -2567,7 +2567,7 @@ Stendur fyrir svæði: %1$s x %2$s Reikna leiðir yfir langar fjarlægðir sem hugsanlega eru ekki þær bestu GPX-skrá með hnitum og gögnum valinna minnispunkta. GPX-skrá með hnitum og gögnum allra minnispunkta. - \\022 Ný ferðavalmynd: skoða WikiVoyage-greinar án internet-tengingar + Ný ferðavalmynd: skoða WikiVoyage-greinar án internet-tengingar \n \n • Wikipedia: nýtt útlit, virkir tenglar, myndir \n diff --git a/OsmAnd/res/values-it/strings.xml b/OsmAnd/res/values-it/strings.xml index 57187968c4..2ed0963bbb 100644 --- a/OsmAnd/res/values-it/strings.xml +++ b/OsmAnd/res/values-it/strings.xml @@ -2980,9 +2980,6 @@ Rappresenta l\'area: %1$s x %2$s Note ordinate per data Per data Per tipo - \\022 -\n -\n Modifica la richiesta di ricerca. Pedone, escursionismo, visita della città • La mappa mostra i percorsi pedonali ed escursionistici • Wikipedia nel tuo linguaggio preferito può dirti molto nelle visite alle città • Fermate dei trasporti pubblici (bus, tram, treni), inclusi i nomi delle linee, aiuta a navigare in una nuova città • Nella navigazione GPS nella modalità pedone costruisce il tuo percorso usando i sentieri • Puoi caricare e seguire un percorso GPX o registrarne uno e condividerlo Cosa c\'è qui: diff --git a/OsmAnd/res/values-ku/strings.xml b/OsmAnd/res/values-ku/strings.xml index ed149d6d6b..4828d836c3 100644 --- a/OsmAnd/res/values-ku/strings.xml +++ b/OsmAnd/res/values-ku/strings.xml @@ -141,9 +141,6 @@ Bk Hemû daneyan "Gotarê bixwîne " - \\022 -\n -\n Jêbirî "Guhertî " Bêhtir diff --git a/OsmAnd/res/values-lt/strings.xml b/OsmAnd/res/values-lt/strings.xml index d6f5428c7b..de0b723a49 100644 --- a/OsmAnd/res/values-lt/strings.xml +++ b/OsmAnd/res/values-lt/strings.xml @@ -2801,7 +2801,7 @@ Tai yra puikus būdas paremti OsmAnd ir OSM, jei jie jums patinka. Papildomi veiksmai GPX failas su koordinačių ir pasirinktų pastabų duomenimis. GPX failas su koordinačių ir visų pastabų duomenimis. - \\022 Stop ženklo nutatymas atliekamas atsižvelgiant į judėjimo kryptį + Stop ženklo nutatymas atliekamas atsižvelgiant į judėjimo kryptį \n \n• Naujas algoritmas, pateikiantis prasmingas pakilimo/nusileidimo vertes GPX trekams \n diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml index 3814ca0ea5..73c90c9966 100644 --- a/OsmAnd/res/values-nb/strings.xml +++ b/OsmAnd/res/values-nb/strings.xml @@ -2604,9 +2604,6 @@ Velg hvordan avstanden til aktive markører skal vises. Velg antall aktive markører som skal vises. Et trykk på kartet skjuler/viser kontrollknappene og miniprogrammene. - \\022 -\n -\n Marker som passert Kunne ikke endre notatet Trykking på denne handlingsknappen slår av/på automatisk kartforstørrelse i henhold til hastigheten din. diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index 090f8f3e00..4a487fd716 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -2922,9 +2922,6 @@ Reprezentuje obszar: %1$s x %2$s Zostanie otwarty o Zostanie otwarty o Dodatkowe czynności - \\022 -\n -\n Czynności Znacznik Uaktywniono znacznik %s. diff --git a/OsmAnd/res/values-ro/strings.xml b/OsmAnd/res/values-ro/strings.xml index 472de26241..6353786034 100644 --- a/OsmAnd/res/values-ro/strings.xml +++ b/OsmAnd/res/values-ro/strings.xml @@ -1912,7 +1912,6 @@ Acțiuni adiționale Fișier GPX cu datele și coordonatele notelor selectate. Fișier GPX cu datele și coordonatele tuturor notelor. - \\022 Modifică criteriul de căutare. Acțiuni Marcaj diff --git a/OsmAnd/res/values-sc/strings.xml b/OsmAnd/res/values-sc/strings.xml index 2caa3b36a7..c523069192 100644 --- a/OsmAnd/res/values-sc/strings.xml +++ b/OsmAnd/res/values-sc/strings.xml @@ -3017,7 +3017,7 @@ Pro praghere iscrie su còdighe intreu Pro data Pro casta Modìfica sa rechesta de chirca. - \\022 Menù de biàgiu nou: abbàida sos artìculos de WikiVoyage chene impreare sa connessione a ìnternet + Menù de biàgiu nou: abbàida sos artìculos de WikiVoyage chene impreare sa connessione a ìnternet \n \n • Wikipedia: aspetu nou, ligàmenes ativos, immàgines \n diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index 1ec67aa686..83a7170b8e 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -2859,7 +2859,7 @@ Zodpovedá oblasti: %1$s x %2$s Podľa typu Jedno stlačenie aktívne Upraviť vyhľadávacie kritériá. - \\022 Nové menu Cestovanie: zobrazte si články WikiVoyage bez použitia Internetu + Nové menu Cestovanie: zobrazte si články WikiVoyage bez použitia Internetu \n \n • Wikipédia: nový vzhľad, aktívne linky, obrázky \n diff --git a/OsmAnd/res/values-sl/strings.xml b/OsmAnd/res/values-sl/strings.xml index c348461886..563fd19c1f 100644 --- a/OsmAnd/res/values-sl/strings.xml +++ b/OsmAnd/res/values-sl/strings.xml @@ -2924,9 +2924,6 @@ Koda predstavlja območje: %1$s x %2$s \n • Orodje za merjenje razdalje sedaj omogoča prilagajanje potem in shranjevanje točk kot sledi \n \n • OsmAnd Live: razrešeni hrošči in posodobitve, ki so samodejno vključene v navigacijo, se objavljajo vsakih 30 minut -\n - \\022 -\n \n Ustvari ali spremeni točke POI, ureja opombe OSM in omogoča objavljanje zabeleženih sledi GPX. Samodejno preklopi na naslednje polje, ko je vpisana %1$d decimalka. diff --git a/OsmAnd/res/values-sr/strings.xml b/OsmAnd/res/values-sr/strings.xml index 0f45acc177..83693179cd 100644 --- a/OsmAnd/res/values-sr/strings.xml +++ b/OsmAnd/res/values-sr/strings.xml @@ -1749,7 +1749,7 @@ Додаје прво стајање Прикажи/Сакриј ОСМ белешке на карти. GPX фајл - \\022 Нови турустички мени: гледајте WikiVoyage чланке без коришћења интернета + Нови турустички мени: гледајте WikiVoyage чланке без коришћења интернета \n \n • Википедија: нови изглед, активне везе, слике \n diff --git a/OsmAnd/res/values-sv/strings.xml b/OsmAnd/res/values-sv/strings.xml index 9c2afcb0ec..cc3e3c567f 100644 --- a/OsmAnd/res/values-sv/strings.xml +++ b/OsmAnd/res/values-sv/strings.xml @@ -2729,9 +2729,6 @@ Vänligen tillhandahåll fullständig kod Ytterligare åtgärder GPX-fil med koordinater och data för valda anteckningar. GPX-fil med koordinater och data för alla anteckningar. - \\022 -\n -\n Åtgärder Markör Tryck på en markör på kartan för att flytta den till toppen av de aktiva markörerna utan att öppna sammanhangsmenyn. diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index 0bb32db523..2dc5706dcc 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -3095,7 +3095,6 @@ За датою За типом Змінити пошуковий запит. - "• " Що тут: припаркований біля Забрати до diff --git a/OsmAnd/res/values-zh-rCN/strings.xml b/OsmAnd/res/values-zh-rCN/strings.xml index 92b9ed32f4..5725bfca5d 100644 --- a/OsmAnd/res/values-zh-rCN/strings.xml +++ b/OsmAnd/res/values-zh-rCN/strings.xml @@ -2668,9 +2668,6 @@ 额外的活动 GPX文件,包含所选笔记的坐标和数据。 GPX文件,包含所有注释的坐标和数据。 - \\022 -\n -\n 修改搜索查询。 操作 标记 diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index 528f07ac70..07f554c080 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -3019,7 +3019,7 @@ 按照類型 輕點在地圖上的標記,將其移動到活動標記的頂端,而不用打開內容選單。 變更搜尋的查詢。 - \\022 新的旅行選單:檢視不用網路的維基導遊文章 + 新的旅行選單:檢視不用網路的維基導遊文章 \n \n• 維基百科:嶄新的面貌、活動連結、圖片 \n diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java index 35b92ad8c3..2579405f86 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleDialogFragment.java @@ -61,7 +61,7 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme private static final String EMPTY_URL = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d4//"; - private long cityId = NO_VALUE; + private long tripId = NO_VALUE; private ArrayList langs; private String selectedLang; private TravelArticle article; @@ -187,10 +187,10 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme updateWebSettings(); populateArticle(); } else if (requestCode == WikivoyageArticleNavigationFragment.OPEN_ARTICLE_REQUEST_CODE) { - long cityId = data.getLongExtra(WikivoyageArticleNavigationFragment.CITY_ID_KEY, -1); + long tripId = data.getLongExtra(WikivoyageArticleNavigationFragment.TRIP_ID_KEY, -1); String selectedLang = data.getStringExtra(WikivoyageArticleNavigationFragment.SELECTED_LANG_KEY); - if (cityId != -1 && !TextUtils.isEmpty(selectedLang)) { - this.cityId = cityId; + if (tripId != -1 && !TextUtils.isEmpty(selectedLang)) { + this.tripId = tripId; this.selectedLang = selectedLang; populateArticle(); } @@ -275,26 +275,26 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme } protected void populateArticle() { - if (cityId == NO_VALUE || langs == null) { + if (tripId == NO_VALUE || langs == null) { Bundle args = getArguments(); if (args != null) { - cityId = args.getLong(CITY_ID_KEY); + tripId = args.getLong(CITY_ID_KEY); langs = args.getStringArrayList(LANGS_KEY); } } - if (cityId == NO_VALUE || langs == null || langs.isEmpty()) { + if (tripId == NO_VALUE || langs == null || langs.isEmpty()) { return; } if (selectedLang == null) { selectedLang = langs.get(0); } articleToolbarText.setText(""); - article = getMyApplication().getTravelDbHelper().getArticle(cityId, selectedLang); + article = getMyApplication().getTravelDbHelper().getArticle(tripId, selectedLang); if (article == null) { return; } articleToolbarText.setText(article.getTitle()); - if (article.getGpxFile() != null) { + if (article.getGpxFile() != null && article.getGpxFile().getPointsSize() > 0) { trackButton.setText(getString(R.string.points) + " (" + article.getGpxFile().getPointsSize() + ")"); webViewClient.setArticle(article); } @@ -401,7 +401,7 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme return; } WikivoyageArticleNavigationFragment.showInstance(fm, - WikivoyageArticleDialogFragment.this, cityId, selectedLang); + WikivoyageArticleDialogFragment.this, tripId, selectedLang); } } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleNavigationFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleNavigationFragment.java index 13b807e514..a827a103a8 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleNavigationFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/article/WikivoyageArticleNavigationFragment.java @@ -36,7 +36,7 @@ public class WikivoyageArticleNavigationFragment extends MenuBottomSheetDialogFr public static final String TAG = WikivoyageArticleNavigationFragment.class.getSimpleName(); - public static final String CITY_ID_KEY = "city_id_key"; + public static final String TRIP_ID_KEY = "trip_id_key"; public static final String SELECTED_LANG_KEY = "selected_lang_key"; public static final int OPEN_ARTICLE_REQUEST_CODE = 2; @@ -59,12 +59,12 @@ public class WikivoyageArticleNavigationFragment extends MenuBottomSheetDialogFr if (savedInstanceState != null) { selectedLang = savedInstanceState.getString(SELECTED_LANG_KEY); - cityId = savedInstanceState.getLong(CITY_ID_KEY); + cityId = savedInstanceState.getLong(TRIP_ID_KEY); } else { Bundle args = getArguments(); if (args != null) { selectedLang = args.getString(SELECTED_LANG_KEY); - cityId = args.getLong(CITY_ID_KEY); + cityId = args.getLong(TRIP_ID_KEY); } } @@ -132,7 +132,7 @@ public class WikivoyageArticleNavigationFragment extends MenuBottomSheetDialogFr @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); - outState.putLong(CITY_ID_KEY, cityId); + outState.putLong(TRIP_ID_KEY, cityId); outState.putString(SELECTED_LANG_KEY, selectedLang); } @@ -156,7 +156,7 @@ public class WikivoyageArticleNavigationFragment extends MenuBottomSheetDialogFr @NonNull String selectedLang) { try { Bundle args = new Bundle(); - args.putLong(CITY_ID_KEY, cityId); + args.putLong(TRIP_ID_KEY, cityId); args.putString(SELECTED_LANG_KEY, selectedLang); WikivoyageArticleNavigationFragment fragment = new WikivoyageArticleNavigationFragment(); if (targetFragment != null) { From 9ea3c852d7868a4976c3407d3c438eff4b75340f Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 17 May 2018 00:19:40 +0200 Subject: [PATCH 13/21] Fix issue #5350 --- .../src/net/osmand/osm/MapPoiTypes.java | 3 ++ OsmAnd-java/src/net/osmand/osm/PoiType.java | 28 +++++++++++++++++++ .../plus/osmedit/AdvancedEditPoiFragment.java | 14 +++++----- .../net/osmand/plus/osmedit/EditPoiData.java | 6 ++-- .../plus/osmedit/EditPoiDialogFragment.java | 4 +-- .../plus/osmedit/OpenstreetmapLocalUtil.java | 4 +-- .../plus/osmedit/OpenstreetmapRemoteUtil.java | 4 +-- .../quickaction/actions/AddPOIAction.java | 2 +- 8 files changed, 48 insertions(+), 17 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java index 2ad32c681f..edad4ed693 100644 --- a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java +++ b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java @@ -584,6 +584,9 @@ public class MapPoiTypes { tp.setLang(lang); tp.setOsmTag(otag); tp.setOsmValue(parser.getAttributeValue("", "value")); + tp.setOsmEditTagValue(parser.getAttributeValue("", "edit_tag"), + parser.getAttributeValue("", "edit_value")); + tp.setOsmTag2(parser.getAttributeValue("", "tag2")); tp.setOsmValue2(parser.getAttributeValue("", "value2")); tp.setText("text".equals(parser.getAttributeValue("", "type"))); diff --git a/OsmAnd-java/src/net/osmand/osm/PoiType.java b/OsmAnd-java/src/net/osmand/osm/PoiType.java index 42b48042fc..b19747fdf8 100644 --- a/OsmAnd-java/src/net/osmand/osm/PoiType.java +++ b/OsmAnd-java/src/net/osmand/osm/PoiType.java @@ -13,6 +13,9 @@ public class PoiType extends AbstractPoiType { private String osmTag2; private String osmValue; private String osmValue2; + + private String editTag; + private String editValue; private boolean filterOnly; @@ -57,6 +60,31 @@ public class PoiType extends AbstractPoiType { } return osmTag; } + + public void setOsmEditTagValue(String osmTag, String editValue) { + this.editTag = osmTag; + this.editValue = editValue; + } + + public String getEditOsmTag() { + if(isReference()) { + return referenceType.getEditOsmTag(); + } + if(editTag == null) { + return getOsmTag(); + } + return editTag; + } + + public String getEditOsmValue() { + if(isReference()) { + return referenceType.getEditOsmValue(); + } + if(editValue == null) { + return getOsmValue(); + } + return editValue; + } public void setOsmTag(String osmTag) { this.osmTag = osmTag; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java index 75c9eed04d..554c9a9af8 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java @@ -140,8 +140,8 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment private void updatePoiType() { PoiType pt = getData().getPoiTypeDefined(); if (pt != null) { - amenityTagTextView.setText(pt.getOsmTag()); - amenityTextView.setText(pt.getOsmValue()); + amenityTagTextView.setText(pt.getEditOsmTag()); + amenityTextView.setText(pt.getEditOsmValue()); } else { amenityTagTextView.setText(getData().getPoiCategory().getDefaultTag()); amenityTextView.setText(getData().getPoiTypeString()); @@ -277,16 +277,16 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment if (poiType.isNotEditableOsm() || poiType.getBaseLangType() != null) { return; } - if (poiType.getOsmTag() != null && - !poiType.getOsmTag().equals(OSMSettings.OSMTagKey.NAME.getValue())) { - stringSet.add(poiType.getOsmTag()); + if (poiType.getEditOsmTag() != null && + !poiType.getEditOsmTag().equals(OSMSettings.OSMTagKey.NAME.getValue())) { + stringSet.add(poiType.getEditOsmTag()); if (poiType.getOsmTag2() != null) { stringSet.add(poiType.getOsmTag2()); } } - if (poiType.getOsmValue() != null) { - values.add(poiType.getOsmValue()); + if (poiType.getEditOsmValue() != null) { + values.add(poiType.getEditOsmValue()); } if (poiType.getOsmValue2() != null) { values.add(poiType.getOsmValue2()); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java index df1b6971b1..d64264c9eb 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java @@ -204,11 +204,11 @@ public class EditPoiData { retrieveType(); PoiType pt = getPoiTypeDefined(); if(pt != null) { - tagValues.put(REMOVE_TAG_PREFIX+pt.getOsmTag(), REMOVE_TAG_VALUE); + tagValues.put(REMOVE_TAG_PREFIX+pt.getEditOsmTag(), REMOVE_TAG_VALUE); tagValues.put(REMOVE_TAG_PREFIX+pt.getOsmTag2(), REMOVE_TAG_VALUE); - tagValues.remove(pt.getOsmTag()); + tagValues.remove(pt.getEditOsmTag()); tagValues.remove(pt.getOsmTag2()); - changedTags.removeAll(Arrays.asList(pt.getOsmTag(), pt.getOsmTag2())); + changedTags.removeAll(Arrays.asList(pt.getEditOsmTag(), pt.getOsmTag2())); category = pt.getCategory(); } notifyDatasetChanged(POI_TYPE_TAG); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index ede31841a7..3d137243e6 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -459,8 +459,8 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { if (poiTypeTag != null) { final PoiType poiType = editPoiData.getAllTranslatedSubTypes().get(poiTypeTag.trim().toLowerCase()); if (poiType != null) { - node.putTagNoLC(poiType.getOsmTag(), poiType.getOsmValue()); - node.removeTag(EditPoiData.REMOVE_TAG_PREFIX + poiType.getOsmTag()); + node.putTagNoLC(poiType.getEditOsmTag(), poiType.getEditOsmValue()); + node.removeTag(EditPoiData.REMOVE_TAG_PREFIX + poiType.getEditOsmTag()); if (poiType.getOsmTag2() != null) { node.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2()); node.removeTag(EditPoiData.REMOVE_TAG_PREFIX + poiType.getOsmTag2()); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java index a168788001..5b3143da5e 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java @@ -96,8 +96,8 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil { AbstractPoiType abstractPoi = MapPoiTypes.getDefault().getAnyPoiAdditionalTypeByKey(entry.getKey()); if (abstractPoi != null && abstractPoi instanceof PoiType) { PoiType p = (PoiType) abstractPoi; - if (!p.isNotEditableOsm() && !Algorithms.isEmpty(p.getOsmTag())) { - entity.putTagNoLC(p.getOsmTag(), entry.getValue()); + if (!p.isNotEditableOsm() && !Algorithms.isEmpty(p.getEditOsmTag())) { + entity.putTagNoLC(p.getEditOsmTag(), entry.getValue()); } } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java index fa8a086283..901d8f2ec1 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapRemoteUtil.java @@ -394,8 +394,8 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil { // check whether this is node (because id of node could be the same as relation) if (entity != null && MapUtils.getDistance(entity.getLatLon(), n.getLocation()) < 50) { PoiType poiType = n.getType().getPoiTypeByKeyName(n.getSubType()); - if(poiType.getOsmValue().equals(entity.getTag(poiType.getOsmTag()))) { - entity.removeTag(poiType.getOsmTag()); + if(poiType.getEditOsmValue().equals(entity.getTag(poiType.getEditOsmTag()))) { + entity.removeTag(poiType.getEditOsmTag()); entity.putTagNoLC(EditPoiData.POI_TYPE_TAG, poiType.getTranslation()); } else { // later we could try to determine tags diff --git a/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java b/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java index 75f02de5cd..d264656730 100644 --- a/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java +++ b/OsmAnd/src/net/osmand/plus/quickaction/actions/AddPOIAction.java @@ -112,7 +112,7 @@ public class AddPOIAction extends QuickAction { if (tag.getKey().equals(EditPoiData.POI_TYPE_TAG)) { final PoiType poiType = editPoiData.getAllTranslatedSubTypes().get(tag.getValue().trim().toLowerCase()); if (poiType != null) { - newNode.putTagNoLC(poiType.getOsmTag(), poiType.getOsmValue()); + newNode.putTagNoLC(poiType.getEditOsmTag(), poiType.getEditOsmValue()); if (poiType.getOsmTag2() != null) { newNode.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2()); } From f4f1b694211a241bcce403b18587f824816a0dda Mon Sep 17 00:00:00 2001 From: sonora Date: Thu, 17 May 2018 01:07:04 +0200 Subject: [PATCH 14/21] string rework: Use 'GPX file' where 'track' now needs generalization --- OsmAnd/res/values/strings.xml | 60 +++++++++++++++++------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 2b5fd1c8d7..a534d6308b 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -175,19 +175,19 @@ Notes by date By date By type - Looking for tracks with waypoints + Looking for GPX files with waypoints More Appearance on the map - Waypoints can be added to markers by selecting one of these tracks that has them. + Select a GPX file to add its waypoints to the markers. Select a favorite category to add to the markers. - Track waypoints + GPX waypoints Favorites category Add a group - Import groups from favorites or track waypoints. + Import groups from favorites or GPX waypoints. Create map markers! Long or short tap \'Places\', then tap the marker flag button. Import groups - Import favorite groups or track waypoints as markers. + Import favorite groups or GPX waypoints as markers. Markers marked as passed will appear on this screen. Two One @@ -207,7 +207,7 @@ A tap on the map toggles the control buttons and widgets. Fullscreen mode Mark passed - can be imported as favorite, or track file. + can be imported as favorite or GPX file. Import as GPX file Import as favorite Import file @@ -243,8 +243,8 @@ Sort Coordinate input is saved - Export your markers to a file you can specify here: - Save as track + Export your markers to the following GPX file: + Save as GPX file Move to history The group will be gone the next time you start the app. Show directional lines @@ -417,7 +417,7 @@ You are going to delete %1$d point(s). Are you sure? Turns to pass on this route Waypoints, points of interest, named features - Track + GPX file Maximum speed Average speed Time moving @@ -426,10 +426,10 @@ Departure Arrival Color - Select track folder + Select GPX file folder File can not be moved. Move - Tracks + GPX files Driving style Route elevation Descent @@ -501,9 +501,9 @@ Take %1$d exit and go Upload POI Route calculation - You do not have any tracks yet - You may also add tracks to the folder - Add track + You do not have any GPX files yet + You may also add GPX files to the folder + Add GPX file Appearance Enable recording quick start Display a system notification allowing to start trip recording. @@ -572,7 +572,7 @@ Required to download maps. Searching for location… Free space - OsmAnd\'s data storage (for maps, tracks, etc.): %1$s. + OsmAnd\'s data storage (for maps, GPX files, etc.): %1$s. Grant permission Allow location access Get directions and discover new places without a connection to the Internet @@ -1064,7 +1064,7 @@ Clear Clear all Save - Save as new GPX track + Save as new GPX file Rename Delete Delete all @@ -1100,7 +1100,7 @@ My Position My Places Favorites - Tracks + GPX files Currently recording track Audio Video @@ -1278,8 +1278,8 @@ Log track to GPX file On demand track logging General position logging to a GPX file can be turned on or off using the GPX logging widget on the map screen. - Save current track to memory card now. - Save current GPX track + Save current track as GPX file now. + Save current track Auto-record track during navigation A GPX track is automatically saved to the tracks folder during navigation. Logging interval @@ -1346,7 +1346,7 @@ Show cycle routes Downloads not found, please check your connection to the Internet. Nothing was found. If you can\'t find your region, you can make it yourself (see https://osmand.net). - No GPX files selected. To select one long-tap an available track. + No GPX files selected. Select one by long-tapping. Select to show Split interval Sort by distance @@ -1381,7 +1381,7 @@ %1$s \nRoute points %2$s %1$s \nPoints %1$s \nTrack %2$s - Empty GPX track + Empty GPX file Display color Connect Description @@ -1591,7 +1591,7 @@ Finish editing Begin a new subtrack Clear all points - Open existing GPX track + Open existing GPX file Please wait until current task is finished Reduces noise in compass readings but adds inertia. Use Kalman filter @@ -2421,7 +2421,7 @@ Vector maps were not loaded No GPX files found in the tracks folder - GPX track… + GPX files… Could not read GPX data Offline vector maps Search transport at stop @@ -2567,7 +2567,7 @@ Loading streets… Loading cities… POI - Could not save GPX track + Could not save GPX file Could not calculate route Could not calculate route Calculated route is empty @@ -2578,7 +2578,7 @@ Loading data… Reading local data… Last OsmAnd run crashed. Log file is at {0}. Please report the issue and attach the log file. - Saving GPX tracks to SD… + Saving GPX files… Finished Use the Internet to calculate a route. Use online navigation @@ -2880,14 +2880,14 @@ Save Route Point Waypoint 1 Route Point 1 - Add and Record Tracks - Record or import tracks to view. + Add GPX Files + Import GPX files, or record tracks. Add Favorites - Import or mark favorites on the map. - Import track + Import favorites, or add via marking points on the map. + Import GPX file File %1$s does not contain waypoints, import it as a track? Move Point - Add to a GPX track + Add to a GPX file OSM recipients Total donations off From 9752fb70cd7c4851ca7a133cdaa5405921897a22 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 17 May 2018 01:21:17 +0200 Subject: [PATCH 15/21] Fix issue #5350 --- .../src/net/osmand/osm/MapPoiTypes.java | 33 ++++++++++++------- .../plus/osmedit/AdvancedEditPoiFragment.java | 5 ++- .../plus/osmedit/EditPoiDialogFragment.java | 7 +++- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java index edad4ed693..1d170ce7e9 100644 --- a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java +++ b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java @@ -179,23 +179,34 @@ public class MapPoiTypes { if (skipNonEditable && pc.isNotEditableOsm()) { continue; } - for (PoiType pt : pc.getPoiTypes()) { - if (pt.isReference()) { + for (PoiFilter pf : pc.getPoiFilters()) { + if (skipNonEditable && pf.isNotEditableOsm()) { continue; - } - if (pt.getBaseLangType() != null) { - continue; - } - if (skipNonEditable && pt.isNotEditableOsm()) { - continue; - } - translation.put(pt.getKeyName().replace('_', ' ').toLowerCase(), pt); - translation.put(pt.getTranslation().toLowerCase(), pt); + } + addPoiTypesTranslation(skipNonEditable, translation, pf); } + addPoiTypesTranslation(skipNonEditable, translation, pc); } return translation; } + + private void addPoiTypesTranslation(boolean skipNonEditable, Map translation, PoiFilter pf) { + for (PoiType pt : pf.getPoiTypes()) { + if (pt.isReference()) { + continue; + } + if (pt.getBaseLangType() != null) { + continue; + } + if (skipNonEditable && pt.isNotEditableOsm()) { + continue; + } + translation.put(pt.getKeyName().replace('_', ' ').toLowerCase(), pt); + translation.put(pt.getTranslation().toLowerCase(), pt); + } + } + public List getAllTypesTranslatedNames(StringMatcher matcher) { List tm = new ArrayList(); for (PoiCategory pc : categories) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java index 554c9a9af8..64fd505d75 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java @@ -215,6 +215,8 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment }); valueEditText.setText(vl); + valueEditText.setAdapter(valueAdapter); + valueEditText.setThreshold(3); valueEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -279,7 +281,8 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment } if (poiType.getEditOsmTag() != null && !poiType.getEditOsmTag().equals(OSMSettings.OSMTagKey.NAME.getValue())) { - stringSet.add(poiType.getEditOsmTag()); + String editOsmTag = poiType.getEditOsmTag(); + stringSet.add(editOsmTag); if (poiType.getOsmTag2() != null) { stringSet.add(poiType.getOsmTag2()); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index 3d137243e6..4532a1349f 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -580,11 +580,16 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { if(!s.getKeyName().contains("osmand")) { addMapEntryAdapter(subCategories, s.getKeyName().replace('_', ' '), s); } + if(!Algorithms.isEmpty(s.getEditOsmValue())) { + addMapEntryAdapter(subCategories, s.getEditOsmValue().replace('_', ' '), s); + } } } } for (Map.Entry s : editPoiData.getAllTranslatedSubTypes().entrySet()) { - addMapEntryAdapter(subCategories, s.getKey(), s.getValue()); + if(!s.getKey().contains("osmand")) { + addMapEntryAdapter(subCategories, s.getKey(), s.getValue()); + } } final ArrayAdapter adapter; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { From 8dd7e62060326bc33490c9294dbd52398369580a Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 17 May 2018 01:28:28 +0200 Subject: [PATCH 16/21] Revert unnecessary change --- OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java index 1d170ce7e9..86fb413d21 100644 --- a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java +++ b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java @@ -179,12 +179,6 @@ public class MapPoiTypes { if (skipNonEditable && pc.isNotEditableOsm()) { continue; } - for (PoiFilter pf : pc.getPoiFilters()) { - if (skipNonEditable && pf.isNotEditableOsm()) { - continue; - } - addPoiTypesTranslation(skipNonEditable, translation, pf); - } addPoiTypesTranslation(skipNonEditable, translation, pc); } return translation; From b99c6b3552dff0df52677e0e49b83af15f185f9d Mon Sep 17 00:00:00 2001 From: sonora Date: Thu, 17 May 2018 01:34:17 +0200 Subject: [PATCH 17/21] string improvement --- OsmAnd/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index a534d6308b..a9fc163242 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -440,7 +440,7 @@ Total distance Select elevation fluctuation Use elevation data - Use terrain elevation data provided by SRTM, ASTER, and EU-DEM. + Factor in terrain elevation (via SRTM, ASTER, and EU-DEM data). Show depth contours and points. Nautical depth contours From e9b9f5fcec58427dc67b81653057b814aec59b7f Mon Sep 17 00:00:00 2001 From: sonora Date: Thu, 17 May 2018 01:59:16 +0200 Subject: [PATCH 18/21] string improvement --- OsmAnd/res/values/strings.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index a9fc163242..9e5264af67 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -153,11 +153,11 @@ GPX file with coordinates and data of the selected notes. GPX file with coordinates and data of all notes. - \u2022 New Travel menu: view WikiVoyage articles without using the internet\n\n - \u2022 Wikipedia: new look, active links, images\n\n - \u2022 Open Track UI: display waypoint groups\n\n - \u2022 Map markers: import of selected groups from GPX files, coordinate input new look\n\n - \u2022 OsmAnd Live subscription now includes all OsmAnd features\n\n + \u2022 New travel guide functionality: Global offline WikiVoyage articles\n\n + \u2022 Wikipedia: New look, active links, images\n\n + \u2022 Open Track UI: Support for waypoint groups\n\n + \u2022 Map markers: Import of selected groups from GPX files, coordinate input, new look\n\n + \u2022 OsmAnd Live data (subscription) now supports all OsmAnd features\n\n Modify the search query. Actions From a25b011e49566089a29c0fc37b7dbc6f05043628 Mon Sep 17 00:00:00 2001 From: Hardy Date: Thu, 17 May 2018 02:39:28 +0200 Subject: [PATCH 19/21] string improvement --- OsmAnd/res/values/strings.xml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 9e5264af67..28aa36848c 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -57,30 +57,27 @@ Once purchased, it will be permanently available to you. Buy - %1$s Subscribe - %1$s - Wikivoyage offline - Unlimited downloads Wikipedia offline Contour lines & Hillshade maps Unlock all OsmAnd features - Choose plan Purchase one of the following to read travel articles offline: Choose suitable item: Don\'t Do Only on Wi-Fi - Download Pictures - Images from articles can be downloaded for offline use.\n + Download images + Images for articles can be downloaded for offline use.\n You can always change the setting in \'Explore\' → \'Options\'. Only on Wi-Fi Select travel book Travel book Page only available online. Open in web browser? - Images cache + Image cache Delete search history - Show images + Download images Travel guides Wikivoyage Article removed @@ -153,8 +150,8 @@ GPX file with coordinates and data of the selected notes. GPX file with coordinates and data of all notes. - \u2022 New travel guide functionality: Global offline WikiVoyage articles\n\n - \u2022 Wikipedia: New look, active links, images\n\n + \u2022 New travel guide functionality: Global offline Wikivoyage articles\n\n + \u2022 Wikipedia: New look, active links, images now supported\n\n \u2022 Open Track UI: Support for waypoint groups\n\n \u2022 Map markers: Import of selected groups from GPX files, coordinate input, new look\n\n \u2022 OsmAnd Live data (subscription) now supports all OsmAnd features\n\n From 99765eb9784de76a47d4c9390e44d8cf5869e2b3 Mon Sep 17 00:00:00 2001 From: sonora Date: Thu, 17 May 2018 08:50:22 +0200 Subject: [PATCH 20/21] string correction --- OsmAnd/res/values/strings.xml | 4 ++-- OsmAnd/src/net/osmand/plus/activities/TrackActivity.java | 2 +- .../osmand/plus/mapmarkers/adapters/TracksGroupsAdapter.java | 2 +- OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 28aa36848c..e51d42d890 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -426,7 +426,7 @@ Select GPX file folder File can not be moved. Move - GPX files + Tracks Driving style Route elevation Descent @@ -2575,7 +2575,7 @@ Loading data… Reading local data… Last OsmAnd run crashed. Log file is at {0}. Please report the issue and attach the log file. - Saving GPX files… + Saving GPX file… Finished Use the Internet to calculate a route. Use online navigation diff --git a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java index c8ba9f2dcc..9f6403fdcc 100644 --- a/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/TrackActivity.java @@ -396,7 +396,7 @@ public class TrackActivity extends TabActivity { } OsmandFragmentPagerAdapter pagerAdapter = (OsmandFragmentPagerAdapter) viewPager.getAdapter(); if (pagerAdapter != null && pagerAdapter.getCount() == 0) { - pagerAdapter.addTab(getTabIndicator(R.string.gpx_track, TrackSegmentFragment.class)); + pagerAdapter.addTab(getTabIndicator(R.string.shared_string_tracks, TrackSegmentFragment.class)); pagerAdapter.addTab(getTabIndicator(R.string.points, TrackPointFragment.class)); if (openPointsTab || !hasTrackPoints()) { viewPager.setCurrentItem(1, false); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/TracksGroupsAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/TracksGroupsAdapter.java index 154a96ea8a..d0a1ed8031 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/TracksGroupsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/TracksGroupsAdapter.java @@ -25,7 +25,7 @@ public class TracksGroupsAdapter extends GroupsAdapter { public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (holder instanceof MapMarkersGroupHeaderViewHolder) { MapMarkersGroupHeaderViewHolder markersGroupHeaderViewHolder = (MapMarkersGroupHeaderViewHolder) holder; - markersGroupHeaderViewHolder.title.setText(app.getText(R.string.shared_string_tracks)); + markersGroupHeaderViewHolder.title.setText(app.getText(R.string.shared_string_my_tracks)); markersGroupHeaderViewHolder.description.setText(app.getText(R.string.add_track_to_markers_descr)); } else if (holder instanceof MapMarkersGroupViewHolder) { GpxDataItem gpx = getItem(position); diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java index 65a68ff3b1..0fa3767f98 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java @@ -1147,7 +1147,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { StringBuilder t = new StringBuilder(); String groupName = group.replaceAll("_", " ").replace(".gpx", ""); if (groupName.length() == 0) { - groupName = getString(R.string.shared_string_tracks); + groupName = getString(R.string.shared_string_my_tracks); } t.append(Algorithms.capitalizeFirstLetter(groupName)); boolean light = app.getSettings().isLightContent(); From 66ad63ae0ac0f4fc1757d51308a3ce606096026f Mon Sep 17 00:00:00 2001 From: sonora Date: Thu, 17 May 2018 08:55:31 +0200 Subject: [PATCH 21/21] headline correction --- OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java index 6e78b2f0fb..f47ebc9f2d 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java @@ -878,7 +878,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements row.findViewById(R.id.list_divider).setVisibility(View.GONE); row.setOnClickListener(null); if (group.getType() == GpxDisplayItemType.TRACK_POINTS) { - groupTitle.setText(getString(R.string.waypoints)); + groupTitle.setText(getString(R.string.points)); description.setText(getString(R.string.track_points_category_name)); } else { groupTitle.setText(getString(R.string.route_points));