From 72ca4055fca9f1b5bb5b3af45e605ba4f7acd3bc Mon Sep 17 00:00:00 2001 From: vshcherb Date: Thu, 22 Apr 2021 10:04:09 +0200 Subject: [PATCH 1/5] Update OsmandSettings.java --- .../src/net/osmand/plus/settings/backend/OsmandSettings.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 5b770bafda..b3f23444eb 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -958,7 +958,7 @@ public class OsmandSettings { DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.BICYCLE, 2.77f); DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 1.11f); DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.BOAT, 1.38f); - DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.AIRCRAFT, 40f); + DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.AIRCRAFT, 200f); DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.SKI, 1.38f); } @@ -2888,4 +2888,4 @@ public class OsmandSettings { setPreference(QUICK_ACTION.getId(), actionState, mode); } } -} \ No newline at end of file +} From 32dff8b9e202cff936745135df84cc44345f01b2 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Thu, 22 Apr 2021 13:02:16 +0300 Subject: [PATCH 2/5] Fix #11362 name of underground station --- .../controllers/TransportStopController.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java index 2337031400..5a7ac0d665 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/TransportStopController.java @@ -189,7 +189,24 @@ public class TransportStopController extends MenuController { } } - private static void sortTransportStops(@NonNull LatLon latLon, List transportStops) { + private static void sortTransportStopsExits(@NonNull LatLon latLon, @NonNull List transportStops) { + for (TransportStop transportStop : transportStops) { + for (TransportStopExit exit : transportStop.getExits()) { + int distance = (int) MapUtils.getDistance(latLon, exit.getLocation()); + if (transportStop.distance > distance) { + transportStop.distance = distance; + } + } + } + Collections.sort(transportStops, new Comparator() { + @Override + public int compare(TransportStop s1, TransportStop s2) { + return Algorithms.compare(s1.distance, s2.distance); + } + }); + } + + private static void sortTransportStops(@NonNull LatLon latLon, @NonNull List transportStops) { for (TransportStop transportStop : transportStops) { transportStop.distance = (int) MapUtils.getDistance(latLon, transportStop.getLocation()); } @@ -227,6 +244,8 @@ public class TransportStopController extends MenuController { if (isSubwayEntrance) { stopAggregated = processTransportStopsForAmenity(transportStops, amenity); + sortTransportStopsExits(loc, stopAggregated.getLocalTransportStops()); + sortTransportStopsExits(loc, stopAggregated.getNearbyTransportStops()); } else { stopAggregated = new TransportStopAggregated(); stopAggregated.setAmenity(amenity); From 1ac919b8d32c5b4f3038928b0e0365e4b367e132 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Thu, 22 Apr 2021 14:12:49 +0300 Subject: [PATCH 3/5] RTL: fix Live Updates screen --- OsmAnd/res/drawable/rectangle_rounded_left.xml | 7 +++++++ OsmAnd/res/drawable/ripple_rectangle_rounded_left.xml | 11 +++++++++++ OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java | 3 +++ .../osmand/plus/liveupdates/LiveUpdatesFragment.java | 8 ++++---- .../bottomsheets/BooleanPreferenceBottomSheet.java | 8 +++++--- 5 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 OsmAnd/res/drawable/rectangle_rounded_left.xml create mode 100644 OsmAnd/res/drawable/ripple_rectangle_rounded_left.xml diff --git a/OsmAnd/res/drawable/rectangle_rounded_left.xml b/OsmAnd/res/drawable/rectangle_rounded_left.xml new file mode 100644 index 0000000000..56b3235c6c --- /dev/null +++ b/OsmAnd/res/drawable/rectangle_rounded_left.xml @@ -0,0 +1,7 @@ + + + + diff --git a/OsmAnd/res/drawable/ripple_rectangle_rounded_left.xml b/OsmAnd/res/drawable/ripple_rectangle_rounded_left.xml new file mode 100644 index 0000000000..c63df94daf --- /dev/null +++ b/OsmAnd/res/drawable/ripple_rectangle_rounded_left.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java index 5fdea403d3..8b3fc01882 100644 --- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java +++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java @@ -445,6 +445,9 @@ public class ContextMenuAdapter { ImageView imageView = (ImageView) convertView.findViewById(R.id.secondary_icon); imageView.setImageDrawable(drawable); imageView.setVisibility(View.VISIBLE); + if (secondaryDrawable == R.drawable.ic_action_additional_option) { + UiUtilities.rotateImageByLayoutDirection(imageView); + } } else { ImageView imageView = (ImageView) convertView.findViewById(R.id.secondary_icon); if (imageView != null) { diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index c4fa160e08..7bebeda1f2 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -275,16 +275,14 @@ public class LiveUpdatesFragment extends BaseOsmAndDialogFragment implements OnL TextViewEx toolbarTitle = (TextViewEx) toolbar.findViewById(R.id.toolbar_title); toolbarTitle.setText(R.string.osm_live); - View closeButton = toolbar.findViewById(R.id.close_button); + ImageView closeButton = (ImageView) toolbar.findViewById(R.id.close_button); + UiUtilities.rotateImageByLayoutDirection(closeButton); closeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); - if (closeButton instanceof ImageView) { - UiUtilities.rotateImageByLayoutDirection((ImageView) closeButton); - } FrameLayout iconHelpContainer = toolbar.findViewById(R.id.action_button); int iconColorResId = nightMode ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light; @@ -443,6 +441,8 @@ public class LiveUpdatesFragment extends BaseOsmAndDialogFragment implements OnL boolean isLastChild, View convertView, ViewGroup parent) { LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); convertView = inflater.inflate(R.layout.list_item_triple_row_icon_and_menu, parent, false); + ImageView secondaryIcon = (ImageView) convertView.findViewById(R.id.secondary_icon); + UiUtilities.rotateImageByLayoutDirection(secondaryIcon); LiveMapsViewHolder viewHolder = new LiveMapsViewHolder(convertView); convertView.setTag(viewHolder); viewHolder.bindLocalIndexInfo(getChild(groupPosition, childPosition).getFileName()); diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java index 858e32c962..1fd19e00c1 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java @@ -134,6 +134,7 @@ public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet { public static void updateCustomButtonView(OsmandApplication app, ApplicationMode mode, View customView, boolean checked, boolean nightMode) { Context themedCtx = UiUtilities.getThemedContext(app, nightMode); + boolean isLayoutRtl = AndroidUtils.isLayoutRtl(themedCtx); LinearLayout buttonView = customView.findViewById(R.id.button_container); int bgColor; @@ -149,10 +150,11 @@ public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet { ContextCompat.getColor(app, getActivePrimaryColorId(nightMode)), checked ? 0.3f : 0.5f); } - int bgResId = R.drawable.rectangle_rounded_right; + int bgResId = isLayoutRtl ? R.drawable.rectangle_rounded_left : R.drawable.rectangle_rounded_right; if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { - int selectableResId = R.drawable.ripple_rectangle_rounded_right; - + int selectableResId = isLayoutRtl ? + R.drawable.ripple_rectangle_rounded_left : + R.drawable.ripple_rectangle_rounded_right; Drawable bgDrawable = app.getUIUtilities().getPaintedIcon(bgResId, bgColor); Drawable selectable = app.getUIUtilities().getPaintedIcon(selectableResId, selectedColor); Drawable[] layers = {bgDrawable, selectable}; From 42604ac3b619d83c02c6bcf63241e02b4a9217af Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Thu, 22 Apr 2021 15:02:10 +0300 Subject: [PATCH 4/5] RTL: fix slider on Announcement Time dialog --- .../seekbar_progress_announcement_time.xml | 15 ---- .../seekbar_thumb_announcement_time.xml | 13 --- .../seekbar_tickmark_announcement_time.xml | 8 -- .../layout/bottom_sheet_announcement_time.xml | 14 +-- .../AnnouncementTimeBottomSheet.java | 86 ++++++------------- 5 files changed, 30 insertions(+), 106 deletions(-) delete mode 100644 OsmAnd/res/drawable/seekbar_progress_announcement_time.xml delete mode 100644 OsmAnd/res/drawable/seekbar_thumb_announcement_time.xml delete mode 100644 OsmAnd/res/drawable/seekbar_tickmark_announcement_time.xml diff --git a/OsmAnd/res/drawable/seekbar_progress_announcement_time.xml b/OsmAnd/res/drawable/seekbar_progress_announcement_time.xml deleted file mode 100644 index 794539923e..0000000000 --- a/OsmAnd/res/drawable/seekbar_progress_announcement_time.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/OsmAnd/res/drawable/seekbar_thumb_announcement_time.xml b/OsmAnd/res/drawable/seekbar_thumb_announcement_time.xml deleted file mode 100644 index a126aee222..0000000000 --- a/OsmAnd/res/drawable/seekbar_thumb_announcement_time.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/OsmAnd/res/drawable/seekbar_tickmark_announcement_time.xml b/OsmAnd/res/drawable/seekbar_tickmark_announcement_time.xml deleted file mode 100644 index d6662da81f..0000000000 --- a/OsmAnd/res/drawable/seekbar_tickmark_announcement_time.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/OsmAnd/res/layout/bottom_sheet_announcement_time.xml b/OsmAnd/res/layout/bottom_sheet_announcement_time.xml index 246ffe3476..308ad0278a 100644 --- a/OsmAnd/res/layout/bottom_sheet_announcement_time.xml +++ b/OsmAnd/res/layout/bottom_sheet_announcement_time.xml @@ -62,18 +62,12 @@ osmand:typeface="@string/font_roboto_medium" tools:text="Normal" /> - + android:layout_marginLeft="@dimen/content_padding" + android:layout_marginRight="@dimen/content_padding" /> Date: Thu, 22 Apr 2021 16:54:12 +0300 Subject: [PATCH 5/5] Fix test backup screen --- OsmAnd/src/net/osmand/plus/backup/BackupHelper.java | 9 ++++----- .../net/osmand/plus/development/TestBackupActivity.java | 5 ----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/backup/BackupHelper.java b/OsmAnd/src/net/osmand/plus/backup/BackupHelper.java index be81017d42..326315b7d1 100644 --- a/OsmAnd/src/net/osmand/plus/backup/BackupHelper.java +++ b/OsmAnd/src/net/osmand/plus/backup/BackupHelper.java @@ -131,10 +131,6 @@ public class BackupHelper { return token.matches("[0-9]+"); } - public boolean hasOsmLiveUpdates() { - return InAppPurchaseHelper.isSubscribedToLiveUpdates(app); - } - @Nullable public String getOrderId() { InAppPurchaseHelper purchaseHelper = app.getInAppPurchaseHelper(); @@ -167,7 +163,10 @@ public class BackupHelper { public void registerUser(@NonNull String email, @Nullable final OnRegisterUserListener listener) { Map params = new HashMap<>(); params.put("email", email); - params.put("orderid", getOrderId()); + String orderId = getOrderId(); + if (!Algorithms.isEmpty(orderId)) { + params.put("orderid", orderId); + } params.put("deviceid", app.getUserAndroidId()); AndroidNetworkUtils.sendRequestAsync(app, USER_REGISTER_URL, params, "Register user", true, true, new OnRequestResultListener() { @Override diff --git a/OsmAnd/src/net/osmand/plus/development/TestBackupActivity.java b/OsmAnd/src/net/osmand/plus/development/TestBackupActivity.java index a5d0daddf5..3b38b1469b 100644 --- a/OsmAnd/src/net/osmand/plus/development/TestBackupActivity.java +++ b/OsmAnd/src/net/osmand/plus/development/TestBackupActivity.java @@ -89,11 +89,6 @@ public class TestBackupActivity extends OsmandActionBarActivity { } }); - if (!backupHelper.hasOsmLiveUpdates()) { - findViewById(R.id.main_view).setVisibility(View.GONE); - return; - } - buttonRegister = findViewById(R.id.btn_register); UiUtilities.setupDialogButton(nightMode, buttonRegister, DialogButtonType.PRIMARY, "Register"); buttonVerify = findViewById(R.id.btn_verify);