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/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" />
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);
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/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);
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
+}
diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/AnnouncementTimeBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/AnnouncementTimeBottomSheet.java
index bbec0c6211..c697213c30 100644
--- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/AnnouncementTimeBottomSheet.java
+++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/AnnouncementTimeBottomSheet.java
@@ -1,26 +1,24 @@
package net.osmand.plus.settings.bottomsheets;
-import android.graphics.drawable.ClipDrawable;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.GradientDrawable;
-import android.graphics.drawable.LayerDrawable;
import android.os.Bundle;
-import android.view.Gravity;
import android.view.View;
+import android.view.View.OnClickListener;
import android.widget.ImageView;
-import android.widget.SeekBar;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
+import com.google.android.material.slider.Slider;
+import com.google.android.material.slider.Slider.OnChangeListener;
+
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
+import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem.Builder;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.routing.data.AnnounceTimeDistances;
import net.osmand.plus.settings.backend.ApplicationMode;
@@ -33,8 +31,7 @@ import org.apache.commons.logging.Log;
import static net.osmand.plus.settings.bottomsheets.SingleSelectPreferenceBottomSheet.SELECTED_ENTRY_INDEX_KEY;
-public class AnnouncementTimeBottomSheet extends BasePreferenceBottomSheet
- implements SeekBar.OnSeekBarChangeListener {
+public class AnnouncementTimeBottomSheet extends BasePreferenceBottomSheet {
public static final String TAG = AnnouncementTimeBottomSheet.class.getSimpleName();
private static final Log LOG = PlatformUtil.getLog(AnnouncementTimeBottomSheet.class);
@@ -46,7 +43,7 @@ public class AnnouncementTimeBottomSheet extends BasePreferenceBottomSheet
private int selectedEntryIndex = -1;
private TextViewEx tvSeekBarLabel;
- private SeekBar seekBarArrival;
+ private Slider slider;
private ImageView ivArrow;
private TextViewEx tvIntervalsDescr;
@@ -110,22 +107,6 @@ public class AnnouncementTimeBottomSheet extends BasePreferenceBottomSheet
dismiss();
}
- @Override
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- if (progress != selectedEntryIndex) {
- selectedEntryIndex = progress;
- updateViews();
- }
- }
-
- @Override
- public void onStartTrackingTouch(SeekBar seekBar) {
- }
-
- @Override
- public void onStopTrackingTouch(SeekBar seekBar) {
- }
-
private ListPreferenceEx getListPreference() {
return (ListPreferenceEx) getPreference();
}
@@ -135,30 +116,40 @@ public class AnnouncementTimeBottomSheet extends BasePreferenceBottomSheet
.inflate(R.layout.bottom_sheet_announcement_time, null);
tvSeekBarLabel = rootView.findViewById(R.id.tv_seek_bar_label);
- seekBarArrival = rootView.findViewById(R.id.seek_bar_arrival);
+ slider = rootView.findViewById(R.id.arrival_slider);
ivArrow = rootView.findViewById(R.id.iv_arrow);
tvIntervalsDescr = rootView.findViewById(R.id.tv_interval_descr);
+ int appModeColor = getAppMode().getProfileColor(nightMode);
- setProfileColorToSeekBar();
- seekBarArrival.setOnSeekBarChangeListener(this);
- seekBarArrival.setProgress(selectedEntryIndex);
- seekBarArrival.setMax(listPreference.getEntries().length - 1);
- rootView.findViewById(R.id.description_container).setOnClickListener(new View.OnClickListener() {
+ slider.setValue(selectedEntryIndex);
+ slider.setValueFrom(0);
+ slider.setValueTo(listPreference.getEntries().length - 1);
+ slider.setStepSize(1);
+ slider.addOnChangeListener(new OnChangeListener() {
+ @Override
+ public void onValueChange(@NonNull Slider slider, float value, boolean fromUser) {
+ int intValue = (int) value;
+ if (intValue != selectedEntryIndex) {
+ selectedEntryIndex = intValue;
+ updateViews();
+ }
+ }
+ });
+ UiUtilities.setupSlider(slider, nightMode, appModeColor, true);
+ rootView.findViewById(R.id.description_container).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
toggleDescriptionVisibility();
}
});
- return new BaseBottomSheetItem.Builder()
+ return new Builder()
.setCustomView(rootView)
.create();
}
private void updateViews() {
- seekBarArrival.setProgress(selectedEntryIndex);
tvSeekBarLabel.setText(listPreference.getEntries()[selectedEntryIndex]);
-
float value = (float) listPreference.getEntryValues()[selectedEntryIndex];
announceTimeDistances.setArrivalDistances(value);
tvIntervalsDescr.setText(announceTimeDistances.getIntervalsDescription(app));
@@ -170,31 +161,6 @@ public class AnnouncementTimeBottomSheet extends BasePreferenceBottomSheet
AndroidUiHelper.updateVisibility(tvIntervalsDescr, !collapsed);
}
- private void setProfileColorToSeekBar() {
- int color = getAppMode().getProfileColor(nightMode);
-
- LayerDrawable seekBarProgressLayer =
- (LayerDrawable) ContextCompat.getDrawable(app, R.drawable.seekbar_progress_announcement_time);
-
- GradientDrawable background = (GradientDrawable) seekBarProgressLayer.findDrawableByLayerId(R.id.background);
- background.setColor(color);
- background.setAlpha(70);
-
- GradientDrawable progress = (GradientDrawable) seekBarProgressLayer.findDrawableByLayerId(R.id.progress);
- progress.setColor(color);
- Drawable clippedProgress = new ClipDrawable(progress, Gravity.CENTER_VERTICAL | Gravity.START, 1);
-
- seekBarArrival.setProgressDrawable(new LayerDrawable(new Drawable[] {
- background, clippedProgress
- }));
-
- LayerDrawable seekBarThumpLayer =
- (LayerDrawable) ContextCompat.getDrawable(app, R.drawable.seekbar_thumb_announcement_time);
- GradientDrawable thump = (GradientDrawable) seekBarThumpLayer.findDrawableByLayerId(R.id.thump);
- thump.setColor(color);
- seekBarArrival.setThumb(thump);
- }
-
public static void showInstance(@NonNull FragmentManager fm, String prefKey, Fragment target,
@Nullable ApplicationMode appMode, boolean usedOnMap) {
try {
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};