From ad281d44456d68f361fa2040f61b0e8bfee08731 Mon Sep 17 00:00:00 2001 From: androiddevkkotlin Date: Fri, 27 Nov 2020 20:27:29 +0200 Subject: [PATCH 01/24] Make yes/no buttons larger and farther apart --- OsmAnd/res/values/strings.xml | 2 +- .../plus/activities/MapActivityActions.java | 24 +--- .../base/MenuBottomSheetDialogFragment.java | 2 +- .../DismissRouteBottomSheetFragment.java | 127 ++++++++++++++++++ 4 files changed, 133 insertions(+), 22 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 9da2ac6d86..9c4708f0dc 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -2652,7 +2652,7 @@ %1$d files left %1$d files left to download Full version - Dismiss route + Dismiss route? Stop navigation Clear destination Not connected to Wi-Fi. Use current connection to the Internet to download? diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 00bd656b63..acc122f560 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -61,6 +61,7 @@ import net.osmand.plus.mapmarkers.MarkersPlanRouteContext; import net.osmand.plus.measurementtool.MeasurementToolFragment; import net.osmand.plus.measurementtool.StartPlanRouteBottomSheet; import net.osmand.plus.monitoring.OsmandMonitoringPlugin; +import net.osmand.plus.osmedit.dialogs.DismissRouteBottomSheetFragment; import net.osmand.plus.profiles.RoutingProfileDataObject; import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu; import net.osmand.plus.routepreparationmenu.WaypointsFragment; @@ -157,6 +158,7 @@ public class MapActivityActions implements DialogProvider { private final MapActivity mapActivity; private OsmandSettings settings; + private DialogInterface.OnDismissListener dismissListener; @NonNull private ImageView drawerLogoHeader; @@ -1122,26 +1124,8 @@ public class MapActivityActions implements DialogProvider { } } - public AlertDialog stopNavigationActionConfirm() { - return stopNavigationActionConfirm(null); - } - - public AlertDialog stopNavigationActionConfirm(final Runnable onStopAction) { - AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity); - // Stop the navigation - builder.setTitle(getString(R.string.cancel_route)); - builder.setMessage(getString(R.string.stop_routing_confirm)); - builder.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - stopNavigationWithoutConfirm(); - if (onStopAction != null) { - onStopAction.run(); - } - } - }); - builder.setNegativeButton(R.string.shared_string_no, null); - return builder.show(); + public void stopNavigationActionConfirm() { + DismissRouteBottomSheetFragment.showInstance(mapActivity.getSupportFragmentManager(), null, dismissListener); } public void whereAmIDialog() { diff --git a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java index 84bd292aa5..1b07ab16ae 100644 --- a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java @@ -306,7 +306,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra } } - boolean useVerticalButtons() { + protected boolean useVerticalButtons() { Activity activity = requireActivity(); int rightBottomButtonTextId = getRightBottomButtonTextId(); if (getDismissButtonTextId() != DEFAULT_VALUE && rightBottomButtonTextId != DEFAULT_VALUE) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java new file mode 100644 index 0000000000..1780151c4b --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java @@ -0,0 +1,127 @@ +package net.osmand.plus.osmedit.dialogs; + +import android.app.Activity; +import android.content.DialogInterface; +import android.os.Bundle; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; + +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.UiUtilities; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.base.MenuBottomSheetDialogFragment; +import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem; +import net.osmand.plus.base.bottomsheetmenu.simpleitems.ShortDescriptionItem; +import net.osmand.plus.settings.backend.ApplicationMode; +import net.osmand.plus.settings.backend.OsmandSettings; +import net.osmand.router.GeneralRouter; + +import java.util.List; + +public class DismissRouteBottomSheetFragment extends MenuBottomSheetDialogFragment { + + private OsmandApplication app; + private OsmandSettings settings; + + public static final int REQUEST_CODE = 1001; + + public static final String TAG = DismissRouteBottomSheetFragment.class.getSimpleName(); + private DialogInterface.OnDismissListener dismissListener; + + public DismissRouteBottomSheetFragment() { + } + + @Override + public void createMenuItems(Bundle savedInstanceState) { + app = getMyApplication(); + if (app != null) { + settings = app.getSettings(); + } + + items.add(new ShortDescriptionItem.Builder() + .setDescription(getString(R.string.stop_routing_confirm)) + .setTitle(getString(R.string.cancel_route)) + .setLayoutId(R.layout.bottom_sheet_item_list_title_with_descr) + .create()); + + items.add(new DividerSpaceItem(getContext(), + getResources().getDimensionPixelSize(R.dimen.content_padding_small))); + + } + + @Override + protected boolean useVerticalButtons() { + return false; + } + + @Override + protected int getDismissButtonTextId() { + return R.string.shared_string_cancel; + } + + @Override + protected int getRightBottomButtonTextId() { + return R.string.shared_string_dismiss; + } + + @Override + protected UiUtilities.DialogButtonType getRightBottomButtonType() { + return (UiUtilities.DialogButtonType.PRIMARY); + } + + @Override + public int getSecondDividerHeight() { + return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_icon_margin); + } + + @Override + protected void onRightBottomButtonClick() { + stopNavigationWithoutConfirm(); + dismiss(); + } + + public void stopNavigationWithoutConfirm() { + app.stopNavigation(); + getMapActivity().updateApplicationModeSettings(); + getMapActivity().getDashboard().clearDeletedPoints(); + List modes = ApplicationMode.values(app); + for (ApplicationMode mode : modes) { + if (settings.FORCE_PRIVATE_ACCESS_ROUTING_ASKED.getModeValue(mode)) { + settings.FORCE_PRIVATE_ACCESS_ROUTING_ASKED.setModeValue(mode, false); + settings.getCustomRoutingBooleanProperty(GeneralRouter.ALLOW_PRIVATE, false).setModeValue(mode, false); + } + } + } + + @Override + public void onDismiss(@NonNull DialogInterface dialog) { + super.onDismiss(dialog); + if (dismissListener != null) { + dismissListener.onDismiss(dialog); + } + } + + @Nullable + public MapActivity getMapActivity() { + Activity activity = getActivity(); + if (activity instanceof MapActivity) { + return (MapActivity) activity; + } + return null; + + } + + public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable Fragment targetFragment, DialogInterface.OnDismissListener dismissListener) { + if (!fragmentManager.isStateSaved()) { + DismissRouteBottomSheetFragment fragment = new DismissRouteBottomSheetFragment(); + fragment.dismissListener = dismissListener; + fragment.setTargetFragment(targetFragment, REQUEST_CODE); + fragment.show(fragmentManager, TAG); + } + } +} + From bb1f7cdd71cb955ee5c39d1396ca21b1b79432a9 Mon Sep 17 00:00:00 2001 From: androiddevkkotlin Date: Sun, 29 Nov 2020 11:44:40 +0200 Subject: [PATCH 02/24] Dismiss listener --- .../plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java index 1780151c4b..a14e811b2d 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java @@ -115,6 +115,10 @@ public class DismissRouteBottomSheetFragment extends MenuBottomSheetDialogFragme } + public void setOnDismissListener(DialogInterface.OnDismissListener dismissListener) { + this.dismissListener = dismissListener; + } + public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable Fragment targetFragment, DialogInterface.OnDismissListener dismissListener) { if (!fragmentManager.isStateSaved()) { DismissRouteBottomSheetFragment fragment = new DismissRouteBottomSheetFragment(); From 580ec79ce1548f917bbfc323af9e313438b0718b Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 3 Dec 2020 18:06:10 +0200 Subject: [PATCH 03/24] search by title started --- .../plus/wikivoyage/data/TravelObfHelper.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java index 0b9398a908..d469b5125d 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java @@ -34,7 +34,7 @@ import gnu.trove.map.TLongObjectMap; import gnu.trove.map.hash.TLongObjectHashMap; -public class TravelObfHelper implements TravelHelper{ +public class TravelObfHelper implements TravelHelper { private static final Log LOG = PlatformUtil.getLog(TravelObfHelper.class); @@ -76,7 +76,8 @@ public class TravelObfHelper implements TravelHelper{ return localDataHelper; } - /** TODO + /** + * TODO * 1. implement regional travelbooks * 2. check settings for default? */ @@ -97,7 +98,7 @@ public class TravelObfHelper implements TravelHelper{ } else { selectedTravelBook = null; } - + } /** @@ -143,7 +144,19 @@ public class TravelObfHelper implements TravelHelper{ @NonNull @Override public List search(String searchQuery) { - return null; + List res = new ArrayList<>(); + for (TravelArticle article : popularArticles) { + if (article.title.toLowerCase().contains(searchQuery.toLowerCase())) { + WikivoyageSearchResult searchResult = new WikivoyageSearchResult(); + searchResult.articleTitles = Collections.singletonList(article.title); + searchResult.isPartOf = Collections.singletonList(article.isPartOf); + searchResult.imageTitle = article.imageTitle; + searchResult.langs = Collections.singletonList(article.lang); + searchResult.tripId = article.tripId; + res.add(searchResult); + } + } + return res; } @NonNull @@ -281,14 +294,14 @@ public class TravelObfHelper implements TravelHelper{ // if (aa != null) { // article = readArticle(aa, lang); // } - return article; + return article; } @Override public TravelArticle getArticle(long resId, String lang) { TravelArticle article = getArticleFromCache(resId, lang); if (article != null) { - return article; + return article; } String name = ""; //??? return getArticle(name, lang); @@ -344,7 +357,7 @@ public class TravelObfHelper implements TravelHelper{ } - //TODO finish stub + //TODO finish stub @Override public ArrayList getArticleLangs(long cityId) { ArrayList res = new ArrayList<>(); From f5713f7a132b8e035d8ea74a89a75e2e3aec828c Mon Sep 17 00:00:00 2001 From: androiddevkkotlin Date: Thu, 3 Dec 2020 18:21:19 +0200 Subject: [PATCH 04/24] Export UI Items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bottom sheet, the title is jumping, when the quantity of items or size is changing. Bottom sheet, title: Check font size, letter space for quantity/size text. Show size for "Audio/Video" notes Maps: use "•" instead of "*". --- OsmAnd/res/layout/settings_group_title.xml | 22 ++++++++++++++----- .../fragments/ExportItemsBottomSheet.java | 4 +++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/OsmAnd/res/layout/settings_group_title.xml b/OsmAnd/res/layout/settings_group_title.xml index 269d018021..ba41cd14b5 100644 --- a/OsmAnd/res/layout/settings_group_title.xml +++ b/OsmAnd/res/layout/settings_group_title.xml @@ -6,7 +6,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + android:orientation="horizontal"> + + + - + Date: Thu, 3 Dec 2020 18:32:06 +0200 Subject: [PATCH 05/24] RTL fix --- OsmAnd/res/layout/settings_group_title.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/layout/settings_group_title.xml b/OsmAnd/res/layout/settings_group_title.xml index ba41cd14b5..73a580b1c5 100644 --- a/OsmAnd/res/layout/settings_group_title.xml +++ b/OsmAnd/res/layout/settings_group_title.xml @@ -13,7 +13,9 @@ android:paddingLeft="@dimen/content_padding" android:paddingTop="@dimen/content_padding" android:paddingRight="@dimen/wikilink_bottom_sheet_padding" - android:paddingBottom="@dimen/wikilink_bottom_sheet_padding"> + android:paddingBottom="@dimen/wikilink_bottom_sheet_padding" + android:paddingStart="@dimen/content_padding" + android:paddingEnd="@dimen/wikilink_bottom_sheet_padding"> + tools:text="5/6" + android:layout_alignParentEnd="true" /> From 64e95f7cd579769a6e1c7e61ddf6aa8dd00a8a5a Mon Sep 17 00:00:00 2001 From: androiddevkkotlin Date: Fri, 4 Dec 2020 11:39:18 +0200 Subject: [PATCH 06/24] Make yes/no buttons larger --- OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 13 ++- .../plus/activities/MapActivityActions.java | 15 ++-- .../dashboard/DashNavigationFragment.java | 8 +- .../plus/helpers/ExternalApiHelper.java | 10 +-- .../MeasurementToolFragment.java | 2 +- .../DismissRouteBottomSheetFragment.java | 81 +++++++------------ .../plus/views/layers/MapControlsLayer.java | 2 +- 7 files changed, 50 insertions(+), 81 deletions(-) diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index f319a878be..467ad76a0f 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -19,7 +19,6 @@ import android.view.KeyEvent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; @@ -55,8 +54,6 @@ import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.GPXDatabase.GpxDataItem; import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; -import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.SQLiteTileSource; @@ -68,6 +65,8 @@ import net.osmand.plus.helpers.ExternalApiHelper; import net.osmand.plus.helpers.LockHelper; import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.other.IContextMenuButtonListener; +import net.osmand.plus.mapmarkers.MapMarker; +import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.myplaces.TrackBitmapDrawer; import net.osmand.plus.quickaction.QuickAction; @@ -79,11 +78,11 @@ import net.osmand.plus.routing.RouteDirectionInfo; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.VoiceRouter; import net.osmand.plus.settings.backend.ApplicationMode; +import net.osmand.plus.settings.backend.ExportSettingsType; import net.osmand.plus.settings.backend.OsmAndAppCustomization; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.backend.backup.ProfileSettingsItem; import net.osmand.plus.settings.backend.backup.SettingsHelper; -import net.osmand.plus.settings.backend.ExportSettingsType; import net.osmand.plus.settings.backend.backup.SettingsItem; import net.osmand.plus.views.OsmandMapLayer; import net.osmand.plus.views.OsmandMapTileView; @@ -598,8 +597,7 @@ public class OsmandAidlApi { final RoutingHelper routingHelper = app.getRoutingHelper(); boolean force = intent.getBooleanExtra(AIDL_FORCE, true); if (routingHelper.isFollowingMode() && !force) { - AlertDialog dlg = mapActivity.getMapActions().stopNavigationActionConfirm(); - dlg.setOnDismissListener(new DialogInterface.OnDismissListener() { + mapActivity.getMapActions().stopNavigationActionConfirm(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { @@ -665,8 +663,7 @@ public class OsmandAidlApi { final RoutingHelper routingHelper = app.getRoutingHelper(); boolean force = intent.getBooleanExtra(AIDL_FORCE, true); if (routingHelper.isFollowingMode() && !force) { - AlertDialog dlg = mapActivity.getMapActions().stopNavigationActionConfirm(); - dlg.setOnDismissListener(new DialogInterface.OnDismissListener() { + mapActivity.getMapActions().stopNavigationActionConfirm(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index acc122f560..0213268a05 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -3,6 +3,7 @@ package net.osmand.plus.activities; import android.app.Activity; import android.app.Dialog; import android.content.DialogInterface; +import android.content.DialogInterface.OnDismissListener; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; @@ -39,8 +40,6 @@ import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuAdapter.ItemClickListener; import net.osmand.plus.ContextMenuItem; import net.osmand.plus.ContextMenuItem.ItemBuilder; -import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.OsmAndLocationProvider; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; @@ -56,7 +55,9 @@ import net.osmand.plus.download.IndexItem; import net.osmand.plus.liveupdates.OsmLiveActivity; import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment; import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment.ContextMenuItemClickListener; +import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; +import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.mapmarkers.MarkersPlanRouteContext; import net.osmand.plus.measurementtool.MeasurementToolFragment; import net.osmand.plus.measurementtool.StartPlanRouteBottomSheet; @@ -76,7 +77,6 @@ import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.layers.MapControlsLayer; import net.osmand.plus.wikipedia.WikipediaDialogFragment; import net.osmand.plus.wikivoyage.WikivoyageWelcomeDialogFragment; -import net.osmand.plus.wikivoyage.data.TravelDbHelper; import net.osmand.plus.wikivoyage.data.TravelHelper; import net.osmand.plus.wikivoyage.explore.WikivoyageExploreActivity; import net.osmand.router.GeneralRouter; @@ -158,7 +158,6 @@ public class MapActivityActions implements DialogProvider { private final MapActivity mapActivity; private OsmandSettings settings; - private DialogInterface.OnDismissListener dismissListener; @NonNull private ImageView drawerLogoHeader; @@ -1124,8 +1123,12 @@ public class MapActivityActions implements DialogProvider { } } - public void stopNavigationActionConfirm() { - DismissRouteBottomSheetFragment.showInstance(mapActivity.getSupportFragmentManager(), null, dismissListener); + public void stopNavigationActionConfirm(@Nullable OnDismissListener listener) { + stopNavigationActionConfirm(listener, null); + } + + public void stopNavigationActionConfirm(@Nullable OnDismissListener listener, @Nullable Runnable onStopAction) { + DismissRouteBottomSheetFragment.showInstance(mapActivity.getSupportFragmentManager(), listener, onStopAction); } public void whereAmIDialog() { diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashNavigationFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashNavigationFragment.java index db4ab19884..b7f359a3e4 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashNavigationFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashNavigationFragment.java @@ -11,7 +11,6 @@ import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.FragmentActivity; import net.osmand.plus.R; @@ -85,14 +84,13 @@ public class DashNavigationFragment extends DashBaseFragment { @Override public void onClick(View v) { - AlertDialog dlg = map.getMapActions().stopNavigationActionConfirm(); - dlg.setOnDismissListener(new DialogInterface.OnDismissListener() { - + map.getMapActions().stopNavigationActionConfirm(new DialogInterface.OnDismissListener() { + @Override public void onDismiss(DialogInterface dialog) { setupNavigation(); DashWaypointsFragment f = dashboard.getFragmentByClass(DashWaypointsFragment.class); - if(f != null) { + if (f != null) { f.onOpenDash(); } } diff --git a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java index c2b1c25591..c92438e850 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java @@ -11,7 +11,6 @@ import android.os.ParcelFileDescriptor; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; @@ -293,8 +292,7 @@ public class ExternalApiHelper { final RoutingHelper routingHelper = app.getRoutingHelper(); if (routingHelper.isFollowingMode() && !force) { - AlertDialog dlg = mapActivity.getMapActions().stopNavigationActionConfirm(); - dlg.setOnDismissListener(new DialogInterface.OnDismissListener() { + mapActivity.getMapActions().stopNavigationActionConfirm(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { @@ -353,8 +351,7 @@ public class ExternalApiHelper { final RoutingHelper routingHelper = app.getRoutingHelper(); if (routingHelper.isFollowingMode() && !force) { - AlertDialog dlg = mapActivity.getMapActions().stopNavigationActionConfirm(); - dlg.setOnDismissListener(new DialogInterface.OnDismissListener() { + mapActivity.getMapActions().stopNavigationActionConfirm(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { @@ -667,8 +664,7 @@ public class ExternalApiHelper { } final RoutingHelper routingHelper = app.getRoutingHelper(); if (routingHelper.isFollowingMode() && !force) { - AlertDialog dlg = mapActivity.getMapActions().stopNavigationActionConfirm(); - dlg.setOnDismissListener(new DialogInterface.OnDismissListener() { + mapActivity.getMapActions().stopNavigationActionConfirm(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index a441c7607a..db5a66cdce 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -886,7 +886,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route app.getTargetPointsHelper().updateRouteAndRefresh(true); app.getRoutingHelper().recalculateRouteDueToSettingsChange(); } else { - mapActivity.getMapActions().stopNavigationActionConfirm(new Runnable() { + mapActivity.getMapActions().stopNavigationActionConfirm(null , new Runnable() { @Override public void run() { MapActivity mapActivity = getMapActivity(); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java index a14e811b2d..641cee51cc 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/DismissRouteBottomSheetFragment.java @@ -2,55 +2,41 @@ package net.osmand.plus.osmedit.dialogs; import android.app.Activity; import android.content.DialogInterface; +import android.content.DialogInterface.OnDismissListener; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; -import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; -import net.osmand.plus.UiUtilities; +import net.osmand.plus.UiUtilities.DialogButtonType; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.MenuBottomSheetDialogFragment; +import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; +import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription; import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem; -import net.osmand.plus.base.bottomsheetmenu.simpleitems.ShortDescriptionItem; -import net.osmand.plus.settings.backend.ApplicationMode; -import net.osmand.plus.settings.backend.OsmandSettings; -import net.osmand.router.GeneralRouter; - -import java.util.List; public class DismissRouteBottomSheetFragment extends MenuBottomSheetDialogFragment { - private OsmandApplication app; - private OsmandSettings settings; - - public static final int REQUEST_CODE = 1001; - public static final String TAG = DismissRouteBottomSheetFragment.class.getSimpleName(); - private DialogInterface.OnDismissListener dismissListener; - public DismissRouteBottomSheetFragment() { - } + private Runnable onStopAction; + private OnDismissListener dismissListener; @Override public void createMenuItems(Bundle savedInstanceState) { - app = getMyApplication(); - if (app != null) { - settings = app.getSettings(); - } - - items.add(new ShortDescriptionItem.Builder() + BaseBottomSheetItem descriptionItem = new BottomSheetItemWithDescription.Builder() .setDescription(getString(R.string.stop_routing_confirm)) .setTitle(getString(R.string.cancel_route)) .setLayoutId(R.layout.bottom_sheet_item_list_title_with_descr) - .create()); + .create(); - items.add(new DividerSpaceItem(getContext(), - getResources().getDimensionPixelSize(R.dimen.content_padding_small))); + items.add(descriptionItem); + int padding = getResources().getDimensionPixelSize(R.dimen.content_padding_small); + items.add(new DividerSpaceItem(requireContext(), padding)); } @Override @@ -69,8 +55,8 @@ public class DismissRouteBottomSheetFragment extends MenuBottomSheetDialogFragme } @Override - protected UiUtilities.DialogButtonType getRightBottomButtonType() { - return (UiUtilities.DialogButtonType.PRIMARY); + protected DialogButtonType getRightBottomButtonType() { + return DialogButtonType.PRIMARY; } @Override @@ -80,27 +66,21 @@ public class DismissRouteBottomSheetFragment extends MenuBottomSheetDialogFragme @Override protected void onRightBottomButtonClick() { - stopNavigationWithoutConfirm(); - dismiss(); - } - - public void stopNavigationWithoutConfirm() { - app.stopNavigation(); - getMapActivity().updateApplicationModeSettings(); - getMapActivity().getDashboard().clearDeletedPoints(); - List modes = ApplicationMode.values(app); - for (ApplicationMode mode : modes) { - if (settings.FORCE_PRIVATE_ACCESS_ROUTING_ASKED.getModeValue(mode)) { - settings.FORCE_PRIVATE_ACCESS_ROUTING_ASKED.setModeValue(mode, false); - settings.getCustomRoutingBooleanProperty(GeneralRouter.ALLOW_PRIVATE, false).setModeValue(mode, false); - } + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + mapActivity.getMapActions().stopNavigationWithoutConfirm(); } + if (onStopAction != null) { + onStopAction.run(); + } + dismiss(); } @Override public void onDismiss(@NonNull DialogInterface dialog) { super.onDismiss(dialog); - if (dismissListener != null) { + FragmentActivity activity = getActivity(); + if (activity != null && !activity.isChangingConfigurations() && dismissListener != null) { dismissListener.onDismiss(dialog); } } @@ -112,20 +92,15 @@ public class DismissRouteBottomSheetFragment extends MenuBottomSheetDialogFragme return (MapActivity) activity; } return null; - } - public void setOnDismissListener(DialogInterface.OnDismissListener dismissListener) { - this.dismissListener = dismissListener; - } - - public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable Fragment targetFragment, DialogInterface.OnDismissListener dismissListener) { + public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable OnDismissListener listener, @Nullable Runnable onStopAction) { if (!fragmentManager.isStateSaved()) { DismissRouteBottomSheetFragment fragment = new DismissRouteBottomSheetFragment(); - fragment.dismissListener = dismissListener; - fragment.setTargetFragment(targetFragment, REQUEST_CODE); + fragment.dismissListener = listener; + fragment.onStopAction = onStopAction; + fragment.setRetainInstance(true); fragment.show(fragmentManager, TAG); } } -} - +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java index 9a24d0aba6..e7cc9b4466 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/MapControlsLayer.java @@ -339,7 +339,7 @@ public class MapControlsLayer extends OsmandMapLayer { public void stopNavigation() { mapRouteInfoMenu.hide(); if (mapActivity.getRoutingHelper().isFollowingMode()) { - mapActivity.getMapActions().stopNavigationActionConfirm(); + mapActivity.getMapActions().stopNavigationActionConfirm(null); } else { mapActivity.getMapActions().stopNavigationWithoutConfirm(); } From 6677312acb24183f77c7f0c5ccc17b8f2d87be0c Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 4 Dec 2020 12:13:16 +0200 Subject: [PATCH 07/24] refactoring --- .../plus/wikivoyage/data/TravelObfHelper.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java index d469b5125d..da2c9ca763 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java @@ -4,6 +4,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import net.osmand.Collator; +import net.osmand.CollatorStringMatcher; import net.osmand.GPXUtilities; import net.osmand.IndexConstants; import net.osmand.OsmAndCollator; @@ -145,20 +146,35 @@ public class TravelObfHelper implements TravelHelper { @Override public List search(String searchQuery) { List res = new ArrayList<>(); + CollatorStringMatcher matcher = new CollatorStringMatcher(searchQuery, + CollatorStringMatcher.StringMatcherMode.CHECK_STARTS_FROM_SPACE); + for (TravelArticle article : popularArticles) { - if (article.title.toLowerCase().contains(searchQuery.toLowerCase())) { - WikivoyageSearchResult searchResult = new WikivoyageSearchResult(); - searchResult.articleTitles = Collections.singletonList(article.title); - searchResult.isPartOf = Collections.singletonList(article.isPartOf); - searchResult.imageTitle = article.imageTitle; - searchResult.langs = Collections.singletonList(article.lang); - searchResult.tripId = article.tripId; + if (checkArticleMatches(matcher, article)) { + + WikivoyageSearchResult searchResult = convertArticleToSearchResult(article); res.add(searchResult); } } return res; } + private WikivoyageSearchResult convertArticleToSearchResult(TravelArticle article) { + WikivoyageSearchResult searchResult = new WikivoyageSearchResult(); + searchResult.articleTitles = Collections.singletonList(article.title); + searchResult.isPartOf = Collections.singletonList(article.isPartOf); + searchResult.imageTitle = article.imageTitle; + searchResult.langs = Collections.singletonList(article.lang); + searchResult.tripId = article.tripId; + return searchResult; + } + + private boolean checkArticleMatches(CollatorStringMatcher matcher, TravelArticle article) { + return matcher.matches(article.getTitle()) + || matcher.matches(article.getContent()) + || matcher.matches(article.getContentsJson()); + } + @NonNull public List getPopularArticles() { return popularArticles; From 6396b96e8cf60411bb0fa45b52fa01c84594b2b8 Mon Sep 17 00:00:00 2001 From: androiddevkkotlin Date: Fri, 4 Dec 2020 12:31:54 +0200 Subject: [PATCH 08/24] Refactor --- OsmAnd/res/layout/settings_group_title.xml | 73 +++++++------------ .../fragments/ExportItemsBottomSheet.java | 3 +- 2 files changed, 27 insertions(+), 49 deletions(-) diff --git a/OsmAnd/res/layout/settings_group_title.xml b/OsmAnd/res/layout/settings_group_title.xml index 73a580b1c5..32629ed2de 100644 --- a/OsmAnd/res/layout/settings_group_title.xml +++ b/OsmAnd/res/layout/settings_group_title.xml @@ -10,65 +10,45 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="@dimen/bottom_sheet_title_height" + android:paddingStart="@dimen/content_padding" android:paddingLeft="@dimen/content_padding" android:paddingTop="@dimen/content_padding" + android:paddingEnd="@dimen/wikilink_bottom_sheet_padding" android:paddingRight="@dimen/wikilink_bottom_sheet_padding" - android:paddingBottom="@dimen/wikilink_bottom_sheet_padding" - android:paddingStart="@dimen/content_padding" - android:paddingEnd="@dimen/wikilink_bottom_sheet_padding"> + android:paddingBottom="@dimen/wikilink_bottom_sheet_padding"> - + android:ellipsize="end" + android:letterSpacing="@dimen/text_button_letter_spacing" + android:minHeight="@dimen/default_title_line_height" + android:textColor="?android:textColorPrimary" + android:textSize="@dimen/default_list_text_size" + app:lineHeight="@dimen/default_title_line_height" + app:typeface="@string/font_roboto_medium" + tools:text="Some title" /> - - - - - - - - + android:layout_below="@+id/title" + android:ellipsize="end" + android:letterSpacing="@dimen/description_letter_spacing" + android:minHeight="@dimen/default_desc_line_height" + android:textColor="?android:textColorSecondary" + android:textSize="@dimen/default_desc_text_size" + app:lineHeight="@dimen/default_desc_line_height" + app:typeface="@string/font_roboto_regular" + tools:text="Some description" /> + tools:text="5/6" /> diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java index 88ae8d1698..f5d52366fe 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java @@ -375,12 +375,11 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment { builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_route_distance, activeColorRes)); } else if (file.getAbsolutePath().contains(IndexConstants.AV_INDEX_DIR)) { int iconId = AudioVideoNotesPlugin.getIconIdForRecordingFile(file); - String formattedSize = AndroidUtils.formatSize(app, size); if (iconId == -1) { iconId = R.drawable.ic_action_photo_dark; } builder.setIcon(uiUtilities.getIcon(iconId, activeColorRes)); - builder.setDescription(formattedSize); + builder.setDescription(AndroidUtils.formatSize(app, size)); } else if (fileSubtype.isMap() || fileSubtype == FileSettingsItem.FileSubtype.TTS_VOICE || fileSubtype == FileSettingsItem.FileSubtype.VOICE) { From eb6cfac958dbb9ffb9001f38367596bb32f692c6 Mon Sep 17 00:00:00 2001 From: Hinagiku Zeppeki Date: Thu, 3 Dec 2020 10:49:27 +0000 Subject: [PATCH 09/24] Translated using Weblate (Japanese) Currently translated at 96.8% (3462 of 3574 strings) --- OsmAnd/res/values-ja/strings.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-ja/strings.xml b/OsmAnd/res/values-ja/strings.xml index 513bce443a..4de19463c6 100644 --- a/OsmAnd/res/values-ja/strings.xml +++ b/OsmAnd/res/values-ja/strings.xml @@ -3928,7 +3928,7 @@ POIの更新は利用できません 少なくとも2つの地点を追加する必要があります OpenStreetMapにログイン OpenStreetMap.orgにログイン - OpenStreetMapに登録 + OpenStreetMapにOAuthログイン 変更をアップロードするには、ログインする必要があります。 \n \n安全なOAuth方式を使用してログイン、または通常のユーザー名とパスワード方式が選択できます。 @@ -3949,4 +3949,6 @@ POIの更新は利用できません アカウント ルートが再計算されるのを待ちます。 \nグラフは再計算後に利用できるようになります。 + OSM通知/ POI / GPXのアップロードをテストする場合、openstreetmap.orgではなくdev.openstreetmap.orgを使用するよう切り替えます。 + dev.openstreetmap.orgを使用 \ No newline at end of file From 716a20b4edc2d49507aa1e134e7891258d9f8ee6 Mon Sep 17 00:00:00 2001 From: solokot Date: Fri, 4 Dec 2020 10:08:04 +0000 Subject: [PATCH 10/24] Translated using Weblate (Russian) Currently translated at 99.8% (3568 of 3574 strings) --- OsmAnd/res/values-ru/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 25e450c5d3..d760cb777c 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -3993,4 +3993,5 @@ Выбор изображения Каяк %1$s * %2$s + Немецкий (повседневный) \ No newline at end of file From b185f2b21509e59e59d04e3eea783a59f0d5407e Mon Sep 17 00:00:00 2001 From: jan madsen Date: Thu, 3 Dec 2020 12:55:57 +0000 Subject: [PATCH 11/24] Translated using Weblate (Danish) Currently translated at 98.9% (3821 of 3863 strings) --- OsmAnd/res/values-da/phrases.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-da/phrases.xml b/OsmAnd/res/values-da/phrases.xml index a298d7653d..236725e959 100644 --- a/OsmAnd/res/values-da/phrases.xml +++ b/OsmAnd/res/values-da/phrases.xml @@ -3883,4 +3883,6 @@ Langs gaden Overdækket parkering LNG + Sirene + Sygeplejerske \ No newline at end of file From 4b884c952e35292a11e2eb609d022d2f989183f9 Mon Sep 17 00:00:00 2001 From: x Date: Fri, 4 Dec 2020 00:11:27 +0000 Subject: [PATCH 12/24] Translated using Weblate (Italian) Currently translated at 76.8% (2967 of 3863 strings) --- OsmAnd/res/values-it/phrases.xml | 174 ++++++++++++++++++++++++++++++- 1 file changed, 173 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-it/phrases.xml b/OsmAnd/res/values-it/phrases.xml index ea5752b771..0c9125eda0 100644 --- a/OsmAnd/res/values-it/phrases.xml +++ b/OsmAnd/res/values-it/phrases.xml @@ -2311,7 +2311,7 @@ Tartan Tipo Checkpoint Ciotole - Accesso all\'acqua + Accesso al luogo dell\'acqua Villaggio turistico Terreno ricreativo Ciambella @@ -2820,4 +2820,176 @@ Berillio Negozio all\'ingrosso Accesso PSV: riservato + Civiltà: etrusca (XII - VI sec. a.C.) + Civiltà: nuragica (XVIII sec. a.C. - II sec. d.C.) + Civiltà: antica romana (753 a.C. - 284 d.C.) + Tipo: colombario + Tipo: caveau + Descrizione per non udenti + Prodotto: carbone + Prodotto: pelle + Prodotto: calce viva + Forno + Musica da camera + Burattino + Musical + Malati + Svantaggiati + Giovanile + Assistenza diurna + Officina + Assistenza ambulatoriale + Rifugiati: no + Servizi per i rifugiati + Tende massime + Improvviso: no + Improvviso: sì + Tipo di castello: castrum + Tipo di castello: difensivo, maestoso + Tipo di castello: cremlino + Tipo di castello: signorile + Pelliccia + Sorveglianza: interna + Allevamento: pollame + Coltivazione: luppolo + Coltivazione: orzo + Coltivazione: cereali + Coltivazione: mais + Ufficio editoriale + Ufficio cooperativo + Ufficio di consulenza + Ufficio della guida + Ufficio del campeggio + Monumento tecnico + Tipo: porto + Formazione: lingua + Binario leggero + Condividi il taxi + Tipo di ponte mobile: retrattile + Tipo di ponte mobile: trasportatore + Tipo di ponte mobile: sommergibile + Tipo di ponte mobile: ponte levatoio + Tipo di ponte mobile: basculante + Tipo di ponte: mobile + Struttura del ponte: trave + Ponte fluviale + Galleria ferroviaria + Galleria stradale + Architettura: postcostruttivismo + Architettura: oldrussian + Architettura: art nouveau + Architettura: umgebinde + Tipo di accesso a Internet: servizio + Cablata + Tipo di riparo: abbandonato + Tipo di riparo: tenda + Rifugio da campo + Riparo dal sole + Riparo in roccia + Capanna di base + Capannone + Palma + Ghiaia + Fango + Marea piatta + Salina + Palude + Palude + Tufo + Ardesia + Ardesia;minerale di ferro;rame + Arenaria + Rutilo + Rubino + Minerale di ferro + Argilla + Cromite + Bismuto + Bauxite + Barite + Antimonio + Decorazione della facciata + A forma di croce + Targa blu + Busto + Pedaggio automatico + Invio di pacchi + Ritiro dei pacchi e consegna della posta + Pescetariano + Dieta halal: no + Halal + Solo halal + Halal + Sede degli eventi + Bancomat (Geldkarte) non accettata + Bancomat (Geldkarte) + Non si accettano carte di credito + Nessuna bolla + Bolla + Scooter + Registrazione + Equitazione + Fango + Fonte di energia: biomassa + Deadlock + Fauna selvatica + Gomma + Frutteto di prato + Latifoglie + Capannone + Rack + Passanti a parete + Stand + Contenuto: foraggio + Contenuto: raccolto + Contenuto: acque reflue + Contenuto: liquame + Contenuto: letame + Contenuto: liquame + Wiki mongolo + Wiki aragonese + Wiki birmano + Wiki lombardo + Wiki punjabi + Wiki scozzese + Wiki giavanese + Wiki tartaro + Wiki malgascio + Wiki occitano + Wiki urdu + Wiki ceceno + Wiki uzbeko + Wiki kazako + Wiki tamil + Wiki serbo-croato + Wiki osseto + Wiki navajo + Wiki basso sassone + Wiki curdo + Wiki farsi + Wiki basco + Wiki esperanto + Wiki gallese + Wiki bosniaco + Wiki bishnupriya + Wiki azero + Wiki alsaziano + Stazione di segnale, avvertimento + Stazione di segnale, traffico + Stazione radio, seamark + Mucchio + Diga di Seamark + Boa di installazione + Piccoli elettrodomestici + Servizi per il cittadino + Visti per immigrati + Visti per non immigrati + Collegamento + Consolato + Ambasciata + Tabellone delle partenze + Ricarica di acqua potabile + Freccia + Vibrazione + Pressione \ No newline at end of file From a156eb5f7ea8607594dc1b6d4aca6b2f0892adc2 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 3 Dec 2020 18:28:34 +0000 Subject: [PATCH 13/24] Translated using Weblate (German) Currently translated at 99.6% (3850 of 3863 strings) --- OsmAnd/res/values-de/phrases.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-de/phrases.xml b/OsmAnd/res/values-de/phrases.xml index 950388e493..9d1ba89f5a 100644 --- a/OsmAnd/res/values-de/phrases.xml +++ b/OsmAnd/res/values-de/phrases.xml @@ -3883,4 +3883,7 @@ Verbindungsbüro Konsulat Botschaft + Sirene + Krankenpfleger/in + Mobiler Geldvermittler \ No newline at end of file From e6e5634e328b445aa8ff2e774dcac75445f5e03a Mon Sep 17 00:00:00 2001 From: Ihor Hordiichuk Date: Thu, 3 Dec 2020 17:27:31 +0000 Subject: [PATCH 14/24] Translated using Weblate (Ukrainian) Currently translated at 100.0% (3863 of 3863 strings) --- OsmAnd/res/values-uk/phrases.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-uk/phrases.xml b/OsmAnd/res/values-uk/phrases.xml index 70d6d83d6b..3e8c064f97 100644 --- a/OsmAnd/res/values-uk/phrases.xml +++ b/OsmAnd/res/values-uk/phrases.xml @@ -3868,4 +3868,7 @@ Посольство Консульство Посольство + Сирена + Медсестра + Мобільний грошовий агент \ No newline at end of file From 168cc838e2b492260319d2dc0b328ab803f20223 Mon Sep 17 00:00:00 2001 From: Ajeje Brazorf Date: Thu, 3 Dec 2020 15:48:17 +0000 Subject: [PATCH 15/24] Translated using Weblate (Sardinian) Currently translated at 99.6% (3849 of 3863 strings) --- OsmAnd/res/values-sc/phrases.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-sc/phrases.xml b/OsmAnd/res/values-sc/phrases.xml index f58e0f4dc5..ccf77c483c 100644 --- a/OsmAnd/res/values-sc/phrases.xml +++ b/OsmAnd/res/values-sc/phrases.xml @@ -3876,4 +3876,7 @@ Vistos pro immigrantes Vistos pro no immigrantes Ufìtziu de collegamentu + Sirena + Infermieri + Agente de denaru mòbile \ No newline at end of file From 39faf643bd9cde6057e6df89d447248567d8ef93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Babos=20G=C3=A1bor?= Date: Thu, 3 Dec 2020 08:12:06 +0000 Subject: [PATCH 16/24] Translated using Weblate (Hungarian) Currently translated at 99.9% (3861 of 3863 strings) --- OsmAnd/res/values-hu/phrases.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-hu/phrases.xml b/OsmAnd/res/values-hu/phrases.xml index 726efe646c..5385b21b40 100644 --- a/OsmAnd/res/values-hu/phrases.xml +++ b/OsmAnd/res/values-hu/phrases.xml @@ -3872,4 +3872,7 @@ Összekötő iroda Külképviselet Konzulátus + Ápoló + Sziréna + Mobilpénzfizetési iroda \ No newline at end of file From 7c6e2f800066def8109e003ed7284a267feb4cc3 Mon Sep 17 00:00:00 2001 From: Franco Date: Thu, 3 Dec 2020 23:57:20 +0000 Subject: [PATCH 17/24] Translated using Weblate (Spanish (Argentina)) Currently translated at 100.0% (3863 of 3863 strings) --- OsmAnd/res/values-es-rAR/phrases.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-es-rAR/phrases.xml b/OsmAnd/res/values-es-rAR/phrases.xml index 30855ccc5b..cdb42f90dd 100644 --- a/OsmAnd/res/values-es-rAR/phrases.xml +++ b/OsmAnd/res/values-es-rAR/phrases.xml @@ -3887,4 +3887,7 @@ Enlace Consulado Embajada + Sirena + Enfermera + Agente de dinero móvil \ No newline at end of file From ab619cc308736374399f83ccfbd3caaf595792fe Mon Sep 17 00:00:00 2001 From: Eduardo Addad de Oliveira Date: Thu, 3 Dec 2020 15:02:37 +0000 Subject: [PATCH 18/24] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (3863 of 3863 strings) --- OsmAnd/res/values-pt-rBR/phrases.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-pt-rBR/phrases.xml b/OsmAnd/res/values-pt-rBR/phrases.xml index a52a317b33..42c3d92278 100644 --- a/OsmAnd/res/values-pt-rBR/phrases.xml +++ b/OsmAnd/res/values-pt-rBR/phrases.xml @@ -3880,4 +3880,7 @@ Ligação Consulado Embaixada + Sereia + Enfermaria + Agente de dinheiro móvel \ No newline at end of file From cadc9817d3942319fd1a2f2d4d2708ce35b8e086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sveinn=20=C3=AD=20Felli?= Date: Thu, 3 Dec 2020 12:17:47 +0000 Subject: [PATCH 19/24] Translated using Weblate (Icelandic) Currently translated at 100.0% (3574 of 3574 strings) --- OsmAnd/res/values-is/strings.xml | 78 ++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 28 deletions(-) diff --git a/OsmAnd/res/values-is/strings.xml b/OsmAnd/res/values-is/strings.xml index 8af3d89837..b0f780c060 100644 --- a/OsmAnd/res/values-is/strings.xml +++ b/OsmAnd/res/values-is/strings.xml @@ -52,7 +52,7 @@ Færa ↓ Samnýtt minni Endurreikna leið - Gjafir + Styrkir Gerast áskrifandi Virkt Óvirkt @@ -131,7 +131,7 @@ Grænt Ljósblátt Blátt - Fjólublátt + Purpurablátt Bleikt Brúnt Ljóst @@ -229,7 +229,7 @@ Ekki sýna aftur Muna valið Endurnýja - Hlaða niður + Sækja Sæki… Aðgerð {0} Loka @@ -238,7 +238,7 @@ Sýna allt Fella saman Birta á korti - Landakort + Kort Eftirlæti Eftirlæti Heimilisfang @@ -293,8 +293,8 @@ Allt Ferilpunktar Fletta korti - Bíll - Reiðhjól + Akandi + Hjólandi Fótgangandi Halda Svahílí @@ -519,7 +519,7 @@ Á síðustu metrunum Sendi inn… Norður-Ameríka - Mið-Ameríka + MIð-Ameríka Suður-Ameríka Evrópa Rússland @@ -553,7 +553,7 @@ Útgefið Virkja Gera óvirkt - Aftengt + Afvirkjað Ný leit Tungumálið er ekki stutt Kerfi @@ -649,7 +649,7 @@ bæta við breyta eyða - Opna + Opið Athugasemd Enduropna Senda @@ -858,7 +858,7 @@ Grunnkort af heiminum Rennur út (mínútur): %1$s Rennur út (mínútur) - Slóð (URL) + Slóð Byrja nýjan undirferil Deild staðsetning Flákar @@ -968,7 +968,7 @@ Birta leið Hefja leiðsögn Stilltu fyrst áfangastað - Leiðir + Leiðarlýsingar Opnunartímar Hleð inn götum/byggingum… Hleð inn póstnúmerum… @@ -1023,7 +1023,7 @@ Settu heiti lands Skoðun korts Tæknilegar greinar - Kortaskýring + Skýringar á korti Stjórnborð eða valmyndastýring Einungis hlaða niður yfir WiFi-net OsmAnd hefur ekki heimildir til að nota SD-kortið @@ -1165,7 +1165,7 @@ Notandanafn og lykilorð á OSM Kortamerki Kortamerki - Náð í kort + Búið að ná í kort geo: Skráning ferðar Hæðarlínur @@ -1622,7 +1622,7 @@ Stefna korts miðað við skjá: Innflutningur eftirlæta tókst Vista gögn sem GPX-skrá eða flytja ferilpunkta inn í eftirlæti? - biðstöðvar + stoppmerki Næsta ferðaáætlun Fyrri ferðaáætlun Veldu biðstöð þar sem farið er út @@ -1856,13 +1856,13 @@ Jafnvægi Velja frekar hjáleiðir Kjörið landslag: slétt eða hæðótt. - Brekka + Halli Bæta við nýrri möppu Punkti/punktum eytt. Ertu viss um að þú viljir eyða %1$d punkt(i/um) \? Vegpunktar, merkisstaðir, nefnd fyrirbæri Ferill - Mesti hraði + Hámarkshraði Meðalhraði Tími á ferð Tímarammi @@ -2055,7 +2055,7 @@ Keyra forritið í öryggisham (notar hægvirkari Android-kóða í stað þess innbyggða). Bæta við ljósmyndum Byrja leit aftur - Auka radíus leitar + Stækka radíus leitar Ekkert fannst Birta/fela OSM-minnispunkta Birta OSM-minnispunkta @@ -2116,7 +2116,7 @@ Gat ekki flutt skrána inn. Vinsamlegast athugið hvort OsmAnd hafi réttindi til að lesa skrána þar sem hún er. Opna Mapillary Mapillary græja - Mapillary götumyndir + Mapillary Mapillary-mynd Mælistika út frá miðju hrings Heimildir @@ -2125,7 +2125,7 @@ Fela frá og með aðdráttarstigi Endurnýja Endurlesa kortaflísar til að sjá uppfærð gögn. - Tiglaskyndiminni + Kortaflísaskyndiminni Rangt notandanafn Til Frá @@ -2180,7 +2180,7 @@ Eftir gerð Leita að ferlum með ferilpunktum Meira - Framsetning á korti + Framsetning á kortinu Ferilpunktar í ferli Flokkur eftirlæta Bæta við hópi @@ -2685,7 +2685,7 @@ Fljótasiglingar Hreinsa út alla milliáfanga Þú getur bætt við öllum punktum ferilsins, eða valið aðskilda flokka. - Alls + Samtals Ekkert fannst: Punktar fjarlægðir úr kortamerkjum Ferðalög @@ -2784,7 +2784,7 @@ Bæta við punkti Vista sem feril Þú bættir við %1$s punktum. Settu inn heitið á skránni og vistaðu. - Veröld + Heimurinn Punkti %1$s eytt "• Leiðsögn: Framvindustika lagfærð, hraðari víxl á upphafi og enda leiða \n @@ -3438,7 +3438,7 @@ OSM-minnispunktarnir þínir eru í %1$s. Minnispunktar myndskeiða Minnispunktar ljósmynda - Auglýsing + Tilkynna Notandanafn og lykilorð Táknmynd birtist við hvíld. Athugaðu og deildu nákvæmum atvikaskrám úr forritinu @@ -3452,7 +3452,7 @@ Tilkynning Lágmarkshraði Lágmarksnákvæmni - Minnsta hreyfing + Lágmarkshreyfing Frumstilla stillingar viðbótar á sjálfgefin gildi Uppskipting upptöku Nota kerfisforrit @@ -3877,7 +3877,7 @@ Skrá leið í feril Velja annan feril Skrifa feril sjálfkrafa í GPX-skrá á meðan leiðsögn stendur - Nýjungar + Hvað er nýtt Einfaldaður ferill Aðeins leiðarlínan verður vistuð, ferilpunktunum verður eytt. Skráarheiti @@ -3905,10 +3905,10 @@ Tveggja-þátta leiðagerð fyrir bílaleiðsögn. Innbyggð þróun almenningssamgangna Skipta yfir í Java (öruggt) útreikning fyrir almenningssamgöngur - Framkvæma OAuth-innskráningu til að nota osmedit-eiginleika + Skrá inn með OAuth til að nota osmedit-eiginleika Skrá inn í gegnum OAuth Hreinsa OAuth-teikn OpenStreetMap - Útskráning tókst + Skráð út %s GPX-skrár valdar Mun setja GPX-skráningu í bið þegar forritið er drepið (slökkt á því í gegnum skjáinn fyrir nýleg forrit - bakgrunnsvísir OsmAnd hverfur þar með úr tilkynningastiku Android-kerfisins.) Veldu millibil skráninga í almenna leiðarskráningu (virkjað með viðmótshlutanum \'Skráning ferðar\' á kortinu). @@ -3960,7 +3960,7 @@ Það er vandamál með áskriftina þína. Smelltu á hnappinn til að fara í stillingar Google Play áskriftarinnar og laga þar greiðslumátann. Nota notandanafn og lykilorð Skrá inn á OpenStreetMap - Innskrá + Skrá inn Settu inn merki aðskilin með kommu. Senda GPX-skrá til OpenStreetMap Áskrift að OsmAnd Live er útrunnin @@ -3991,4 +3991,26 @@ Ljósmyndir eru í boði frá opna gagnaverkefninu OpenPlaceReviews.org. Til að geta sent inn myndir þarftu að skrá þig á vefsvæðinu. Gera athugasemd við OSM-minnispunkt \"Rekjanlegt\" þýðir að ferillinn birtist ekki á neinum opinberum listum, en meðhöndlaðir ferilpunktar með tímamerkjum úr ferlinum (sem ekki er hægt að tengja beint við þig) munu birtast í gögnum sem eru sótt í gegnum opinbert GPS API-forritsviðmót. + Þú getur notað hæðargögn til útreikninga á hækkun/lækkun í ferðunum þínum + OsmAnd birtir ljósmyndir frá ýmsum þjónustum: +\nOpenPlaceReviews - ljósmyndir POI-merkisstaða; +\nMapillary - myndefni í götuhæð; +\nWeb / Wikimedia - ljósmyndir POI-merkisstaða sem eru í gögnum OpenStreetMap. + Skiptu yfir í að nota dev.openstreetmap.org í staðinn fyrir openstreetmap.org til að prófa innsendingu OSM-minnispunkta / POI-merkisstaða / GPX-ferla. + Þýska (dagleg) + Nota dev.openstreetmap.org + Létt flugfar + Bæta í Mapillary + Ekki er nægilegt pláss + Tækið þitt er aðeins með %1$s laust. Losaðu um eitthvað minni eða afveldu atriði sem á að flytja út. + Bæta í OpenPlaceReviews + Nauðsynlegt fyrir innflutning + Veldu atriði sem á að flytja inn. + Veldu hópa sem á að flytja inn. + Áætluð skráarstærð + Tilföng + %1$s * %2$s + Veldu þau gögn sem á að flytja út í skrána. + Veldu mynd + Mistókst að senda inn mynd, reyndu aftur síðar \ No newline at end of file From aa7ca41e28f627825a6e41e07f4b699a6bea2578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sveinn=20=C3=AD=20Felli?= Date: Thu, 3 Dec 2020 11:43:34 +0000 Subject: [PATCH 20/24] Translated using Weblate (Icelandic) Currently translated at 100.0% (3863 of 3863 strings) --- OsmAnd/res/values-is/phrases.xml | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/OsmAnd/res/values-is/phrases.xml b/OsmAnd/res/values-is/phrases.xml index 9a88f1bc7c..3f8253cf35 100644 --- a/OsmAnd/res/values-is/phrases.xml +++ b/OsmAnd/res/values-is/phrases.xml @@ -3835,4 +3835,37 @@ Á þaki GPX-punktur Radarturn + Farsímagreiðsluþjónusta + Sendiráð + Nei + Hjúkrunarfræðingur + Vegabréfsáritun fyrir innflytjendur + Aðsetur + Undirþjóðlegt + Sírena + Sendinefnd + Tengifulltrúi + Tenging + + Skrifstofa + Ræðismaður + Ræðismannsskrifstofa + Sendinefnd Vatíkansins (nunciature) + Heiðursræðismaður + Borgaraþjónustur + Vegabréfsáritun fyrir ekki-innflytjendur + Nei + Umboðsskrifstofa + Sendiherra í forsvari + + Hagsmunadeild + + Sendifulltrúi + Sendiráð + Sendinefnd + Nei + Ræðismaður í forsvari + Ræðismannastofnun + Útibú + Ræðisskrifstofa \ No newline at end of file From 6dae42aa6a813b6711a6968263a042199ff37d8c Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Fri, 4 Dec 2020 01:57:28 +0000 Subject: [PATCH 21/24] Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (3863 of 3863 strings) --- OsmAnd/res/values-zh-rTW/phrases.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-zh-rTW/phrases.xml b/OsmAnd/res/values-zh-rTW/phrases.xml index 083311b0c0..0ff79b64b8 100644 --- a/OsmAnd/res/values-zh-rTW/phrases.xml +++ b/OsmAnd/res/values-zh-rTW/phrases.xml @@ -3879,4 +3879,7 @@ 聯絡處 領事館 大使館 + 警報器 + 護理師 + 行動貨幣代理商 \ No newline at end of file From c0148276293ee9a38a9ee5b0ca3797d8d0756734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sveinn=20=C3=AD=20Felli?= Date: Thu, 3 Dec 2020 12:23:37 +0000 Subject: [PATCH 22/24] Translated using Weblate (Icelandic) Currently translated at 100.0% (271 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/is/ --- OsmAnd-telegram/res/values-is/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-telegram/res/values-is/strings.xml b/OsmAnd-telegram/res/values-is/strings.xml index a915a2e4f4..5a10a5d775 100644 --- a/OsmAnd-telegram/res/values-is/strings.xml +++ b/OsmAnd-telegram/res/values-is/strings.xml @@ -155,7 +155,7 @@ Síðar Stefna Hraðaeining - Landakort + Kort Sía: Engin skráning punkta fyrir neðan valinn hraða í %1$s Leit: Hópur eða tengiliður From c206cfc212c6eddc73a2335cf37297cdaca314e4 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 4 Dec 2020 14:59:40 +0200 Subject: [PATCH 23/24] add sort and group filters --- .../plus/wikivoyage/data/TravelObfHelper.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java index da2c9ca763..45141118f5 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java @@ -20,13 +20,16 @@ import net.osmand.plus.R; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; +import org.apache.commons.compress.utils.Lists; import org.apache.commons.logging.Log; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; +import java.util.Comparator; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -156,6 +159,8 @@ public class TravelObfHelper implements TravelHelper { res.add(searchResult); } } + res = Lists.newArrayList(groupSearchResultsByCityId(res).iterator()); + sortSearchResults(searchQuery, res); return res; } @@ -169,6 +174,52 @@ public class TravelObfHelper implements TravelHelper { return searchResult; } + private Collection groupSearchResultsByCityId(List res) { + String baseLng = application.getLanguage(); + TLongObjectHashMap wikivoyage = new TLongObjectHashMap<>(); + for (WikivoyageSearchResult rs : res) { + WikivoyageSearchResult prev = wikivoyage.get(rs.tripId); + if (prev != null) { + int insInd = prev.langs.size(); + if (rs.langs.get(0).equals(baseLng)) { + insInd = 0; + } else if (rs.langs.get(0).equals("en")) { + if (!prev.langs.get(0).equals(baseLng)) { + insInd = 0; + } else { + insInd = 1; + } + } + prev.articleTitles.add(insInd, rs.articleTitles.get(0)); + prev.langs.add(insInd, rs.langs.get(0)); + prev.isPartOf.add(insInd, rs.isPartOf.get(0)); + } else { + wikivoyage.put(rs.tripId, rs); + } + } + return wikivoyage.valueCollection(); + } + + private void sortSearchResults(final String searchQuery, List list) { + Collections.sort(list, new Comparator() { + @Override + public int compare(WikivoyageSearchResult o1, WikivoyageSearchResult o2) { + boolean c1 = CollatorStringMatcher.cmatches(collator, searchQuery, o1.articleTitles.get(0), + CollatorStringMatcher.StringMatcherMode.CHECK_ONLY_STARTS_WITH); + boolean c2 = CollatorStringMatcher.cmatches(collator, searchQuery, o2.articleTitles.get(0), + CollatorStringMatcher.StringMatcherMode.CHECK_ONLY_STARTS_WITH); + if (c1 == c2) { + return collator.compare(o1.articleTitles.get(0), o2.articleTitles.get(0)); + } else if (c1) { + return -1; + } else if (c2) { + return 1; + } + return 0; + } + }); + } + private boolean checkArticleMatches(CollatorStringMatcher matcher, TravelArticle article) { return matcher.matches(article.getTitle()) || matcher.matches(article.getContent()) From cb0593e2cd4c025a55333ed5ee6fb030d78d746d Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 4 Dec 2020 15:12:28 +0200 Subject: [PATCH 24/24] improvements --- .../net/osmand/plus/wikivoyage/data/TravelObfHelper.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java index 45141118f5..9ccdc5f6c8 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java @@ -20,7 +20,6 @@ import net.osmand.plus.R; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; -import org.apache.commons.compress.utils.Lists; import org.apache.commons.logging.Log; import java.io.File; @@ -159,17 +158,17 @@ public class TravelObfHelper implements TravelHelper { res.add(searchResult); } } - res = Lists.newArrayList(groupSearchResultsByCityId(res).iterator()); + res = new ArrayList<>(groupSearchResultsByCityId(res)); sortSearchResults(searchQuery, res); return res; } private WikivoyageSearchResult convertArticleToSearchResult(TravelArticle article) { WikivoyageSearchResult searchResult = new WikivoyageSearchResult(); - searchResult.articleTitles = Collections.singletonList(article.title); - searchResult.isPartOf = Collections.singletonList(article.isPartOf); + searchResult.articleTitles = new ArrayList<>(Collections.singletonList(article.title)); + searchResult.isPartOf = new ArrayList<>(Collections.singletonList(article.isPartOf)); searchResult.imageTitle = article.imageTitle; - searchResult.langs = Collections.singletonList(article.lang); + searchResult.langs = new ArrayList<>(Collections.singletonList(article.lang)); searchResult.tripId = article.tripId; return searchResult; }