From 4733919c3cc3b4e6a1cc108ce1c4abd811223402 Mon Sep 17 00:00:00 2001 From: ivanPyrohivskyi Date: Tue, 16 Feb 2021 13:24:12 +0200 Subject: [PATCH 001/250] Allow to disable en transliteration --- OsmAnd-java/src/main/java/net/osmand/data/MapObject.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java b/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java index c3205431cd..7cd6e1227c 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java @@ -182,7 +182,7 @@ public abstract class MapObject implements Comparable { public String getName(String lang, boolean transliterate) { if (lang != null && lang.length() > 0) { - if (lang.equals("en")) { + if (lang.equals("en") && !getEnName(transliterate).isEmpty()) { // ignore transliterate option here for backward compatibility return getEnName(true); } else { From 6f0e0ae21c357543783b8c926bfecfc6a1e2e9c4 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Tue, 16 Feb 2021 14:13:48 +0100 Subject: [PATCH 002/250] Update MapObject.java --- OsmAnd-java/src/main/java/net/osmand/data/MapObject.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java b/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java index 7cd6e1227c..79b3b8a349 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java @@ -182,9 +182,8 @@ public abstract class MapObject implements Comparable { public String getName(String lang, boolean transliterate) { if (lang != null && lang.length() > 0) { - if (lang.equals("en") && !getEnName(transliterate).isEmpty()) { - // ignore transliterate option here for backward compatibility - return getEnName(true); + if (lang.equals("en")) { + return getEnName(transliterate); } else { // get name if (names != null) { From 2f72ddc566e11c4253aecbdc8a0f1620e05febe6 Mon Sep 17 00:00:00 2001 From: cepprice Date: Wed, 3 Mar 2021 12:30:19 +0500 Subject: [PATCH 003/250] Add left side menu for GPX-points for landscape version of plan route --- OsmAnd/res/layout/main.xml | 5 + .../MeasurementToolFragment.java | 91 ++++++++++++------- 2 files changed, 65 insertions(+), 31 deletions(-) diff --git a/OsmAnd/res/layout/main.xml b/OsmAnd/res/layout/main.xml index 49f257c745..965e97a634 100644 --- a/OsmAnd/res/layout/main.xml +++ b/OsmAnd/res/layout/main.xml @@ -48,6 +48,11 @@ + + diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index bf6ee212dc..3b8154e40a 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -11,6 +11,8 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; +import android.view.ViewTreeObserver; +import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; @@ -18,17 +20,6 @@ import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; -import androidx.activity.OnBackPressedCallback; -import androidx.annotation.DrawableRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.content.res.AppCompatResources; -import androidx.core.content.ContextCompat; -import androidx.core.widget.TextViewCompat; -import androidx.fragment.app.FragmentManager; -import androidx.recyclerview.widget.ItemTouchHelper; -import androidx.recyclerview.widget.RecyclerView; - import com.google.android.material.snackbar.Snackbar; import net.osmand.AndroidUtils; @@ -94,6 +85,17 @@ import java.util.Date; import java.util.List; import java.util.Locale; +import androidx.activity.OnBackPressedCallback; +import androidx.annotation.DrawableRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.core.content.ContextCompat; +import androidx.core.widget.TextViewCompat; +import androidx.fragment.app.FragmentManager; +import androidx.recyclerview.widget.ItemTouchHelper; +import androidx.recyclerview.widget.RecyclerView; + import static net.osmand.IndexConstants.GPX_FILE_EXT; import static net.osmand.IndexConstants.GPX_INDEX_DIR; import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationMode; @@ -126,6 +128,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route private RadioItem pointsBtn; private RadioItem graphBtn; private View mainView; + private View bottomMapControls; private ImageView upDownBtn; private ImageView undoBtn; private ImageView redoBtn; @@ -281,8 +284,9 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route mainView = view.findViewById(R.id.main_view); AndroidUtils.setBackground(mapActivity, mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark); detailsMenu = new GraphDetailsMenu(); - cardsContainer = mainView.findViewById(R.id.cards_container); if (portrait) { + cardsContainer = mainView.findViewById(R.id.cards_container); + String pointsBtnTitle = getString(R.string.shared_string_gpx_points); pointsBtn = new RadioItem(pointsBtnTitle); pointsBtn.setOnClickListener(getInfoTypeBtnListener(InfoType.POINTS)); @@ -294,6 +298,15 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route LinearLayout infoButtonsContainer = mainView.findViewById(R.id.custom_radio_buttons); infoTypeBtn = new MultiStateToggleButton(app, infoButtonsContainer, nightMode); infoTypeBtn.setItems(pointsBtn, graphBtn); + } else { + cardsContainer = mapActivity.findViewById(R.id.left_side_menu); + bottomMapControls = mapActivity.findViewById(R.id.bottom_controls_container); + mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + updateCardContainerSize(); + } + }); } pointsCard = new PointsCard(mapActivity, this); graphsCard = new GraphsCard(mapActivity, detailsMenu, this); @@ -328,12 +341,10 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route upDownRow.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - if (portrait) { - if (infoExpanded) { - collapseInfoView(); - } else if (setInfoType(InfoType.POINTS)) { - infoTypeBtn.setSelectedItem(pointsBtn); - } + if (infoExpanded) { + collapseInfoView(); + } else if (setInfoType(InfoType.POINTS) && portrait) { + infoTypeBtn.setSelectedItem(pointsBtn); } } }); @@ -608,14 +619,13 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } private void expandInfoView() { - if (portrait) { - infoExpanded = true; - cardsContainer.setVisibility(View.VISIBLE); - setMapPosition(portrait - ? OsmandSettings.MIDDLE_TOP_CONSTANT - : OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT); - updateUpDownBtn(); - } + infoExpanded = true; + shiftBottomMapControls(false); + cardsContainer.setVisibility(View.VISIBLE); + setMapPosition(portrait + ? OsmandSettings.MIDDLE_TOP_CONSTANT + : OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT); + updateUpDownBtn(); } private void collapseInfoViewIfExpanded() { @@ -625,14 +635,16 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } private void collapseInfoView() { + cardsContainer.setVisibility(View.GONE); if (portrait) { - infoExpanded = false; - currentInfoType = null; infoTypeBtn.setSelectedItem(null); - cardsContainer.setVisibility(View.GONE); - setDefaultMapPosition(); - updateUpDownBtn(); + } else { + shiftBottomMapControls(true); } + infoExpanded = false; + currentInfoType = null; + setDefaultMapPosition(); + updateUpDownBtn(); } private void collapseInfoIfNotEnoughPoints() { @@ -659,6 +671,22 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } } + private void updateCardContainerSize() { + View measureModeControls = mainView.findViewById(R.id.measure_mode_controls); + int width = mainView.getWidth() - measureModeControls.getWidth(); + FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(width, -1); + int bottomMargin = measureModeControls.getHeight(); + bottomMargin = progressBarVisible ? bottomMargin + mainView.findViewById(R.id.snap_to_road_progress_bar).getHeight() : bottomMargin; + params.setMargins(0, 0, 0, bottomMargin); + cardsContainer.setLayoutParams(params); + } + + private void shiftBottomMapControls(boolean toInitialPosition) { + int leftMargin = toInitialPosition ? 0 : cardsContainer.getWidth(); + LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) bottomMapControls.getLayoutParams(); + params.setMargins(leftMargin, 0, 0, 0); + } + public boolean isInEditMode() { return !isPlanRouteMode() && !editingCtx.isNewData() && !isDirectionMode() && !isFollowTrackMode(); } @@ -780,6 +808,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route progressBar.setMinimumHeight(0); progressBar.setProgress(0); progressBarVisible = true; + updateCardContainerSize(); } public boolean isProgressBarVisible() { From 949523f1d1cbd95868878727bdcbd2cf2314c7d1 Mon Sep 17 00:00:00 2001 From: cepprice Date: Wed, 3 Mar 2021 12:40:48 +0500 Subject: [PATCH 004/250] Update card size on progress visibility change --- .../osmand/plus/measurementtool/MeasurementToolFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 3b8154e40a..19f3c1a7c6 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -248,6 +248,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route public void showProgressBar() { MeasurementToolFragment.this.showProgressBar(); updateInfoView(); + updateCardContainerSize(); } @Override @@ -260,6 +261,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route ((ProgressBar) mainView.findViewById(R.id.snap_to_road_progress_bar)).setVisibility(View.GONE); progressBarVisible = false; updateInfoView(); + updateCardContainerSize(); } @Override @@ -808,7 +810,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route progressBar.setMinimumHeight(0); progressBar.setProgress(0); progressBarVisible = true; - updateCardContainerSize(); } public boolean isProgressBarVisible() { From 4ac46d74e898e6943db07ebd70645341e266a87b Mon Sep 17 00:00:00 2001 From: cepprice Date: Thu, 4 Mar 2021 23:51:08 +0500 Subject: [PATCH 005/250] Fix NPE --- .../plus/measurementtool/MeasurementToolFragment.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 19f3c1a7c6..3bae0d9ba8 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -622,11 +622,13 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route private void expandInfoView() { infoExpanded = true; - shiftBottomMapControls(false); + if (portrait) { + setMapPosition(OsmandSettings.MIDDLE_TOP_CONSTANT); + } else { + shiftBottomMapControls(false); + setMapPosition(OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT); + } cardsContainer.setVisibility(View.VISIBLE); - setMapPosition(portrait - ? OsmandSettings.MIDDLE_TOP_CONSTANT - : OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT); updateUpDownBtn(); } From 908033e0a924b6cafef83a23b00834c50ae64092 Mon Sep 17 00:00:00 2001 From: cepprice Date: Sat, 6 Mar 2021 15:03:26 +0500 Subject: [PATCH 006/250] Finish UI of Track appearance context menu --- OsmAnd/res/drawable/bg_track_gradient.xml | 13 ++ OsmAnd/res/layout/gradient_card.xml | 46 +++++ OsmAnd/res/layout/track_coloring_card.xml | 13 +- OsmAnd/res/layout/track_width_card.xml | 3 +- OsmAnd/res/values/colors.xml | 4 + OsmAnd/res/values/strings.xml | 3 + .../net/osmand/plus/track/GradientCard.java | 81 ++++++++ .../plus/track/TrackAppearanceFragment.java | 34 +++- .../osmand/plus/track/TrackColoringCard.java | 186 ++++++++++++------ 9 files changed, 301 insertions(+), 82 deletions(-) create mode 100644 OsmAnd/res/drawable/bg_track_gradient.xml create mode 100644 OsmAnd/res/layout/gradient_card.xml create mode 100644 OsmAnd/src/net/osmand/plus/track/GradientCard.java diff --git a/OsmAnd/res/drawable/bg_track_gradient.xml b/OsmAnd/res/drawable/bg_track_gradient.xml new file mode 100644 index 0000000000..c72829a45e --- /dev/null +++ b/OsmAnd/res/drawable/bg_track_gradient.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/gradient_card.xml b/OsmAnd/res/layout/gradient_card.xml new file mode 100644 index 0000000000..ff0834bee0 --- /dev/null +++ b/OsmAnd/res/layout/gradient_card.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/track_coloring_card.xml b/OsmAnd/res/layout/track_coloring_card.xml index 2c7721f61d..0b1738293b 100644 --- a/OsmAnd/res/layout/track_coloring_card.xml +++ b/OsmAnd/res/layout/track_coloring_card.xml @@ -20,9 +20,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:paddingTop="@dimen/context_menu_padding_margin_tiny" - android:visibility="gone" - android:paddingBottom="@dimen/content_padding"> + android:paddingTop="@dimen/context_menu_buttons_padding_bottom"> - - \ No newline at end of file diff --git a/OsmAnd/res/layout/track_width_card.xml b/OsmAnd/res/layout/track_width_card.xml index 3710ad43b4..744c90d137 100644 --- a/OsmAnd/res/layout/track_width_card.xml +++ b/OsmAnd/res/layout/track_width_card.xml @@ -45,14 +45,13 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:paddingBottom="@dimen/content_padding"> + android:paddingBottom="@dimen/favorites_select_group_button_height"> #1AFFFFFF #67727272 + #5ADC5F + #D4EF32 + #F3374D + \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index ed1259ed1f..98c8410b5e 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -12,6 +12,9 @@ --> + Please select another type of colorization. + The track does not contain speed data. + The track does not contain altitude data. The recording will be continued. Distance by tap A toggle to show or hide the Coordinates widget on the map. diff --git a/OsmAnd/src/net/osmand/plus/track/GradientCard.java b/OsmAnd/src/net/osmand/plus/track/GradientCard.java new file mode 100644 index 0000000000..77d881574e --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/track/GradientCard.java @@ -0,0 +1,81 @@ +package net.osmand.plus.track; + +import android.text.Spannable; +import android.text.SpannableString; +import android.text.style.ForegroundColorSpan; +import android.widget.TextView; + +import net.osmand.AndroidUtils; +import net.osmand.GPXUtilities.GPXTrackAnalysis; +import net.osmand.plus.OsmAndFormatter; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.routepreparationmenu.cards.BaseCard; + +import androidx.annotation.NonNull; + +public class GradientCard extends BaseCard { + + private GPXTrackAnalysis gpxTrackAnalysis; + private GradientScaleType selectedScaleType = null; + + public GradientCard(@NonNull MapActivity mapActivity, @NonNull GPXTrackAnalysis gpxTrackAnalysis) { + super(mapActivity); + this.gpxTrackAnalysis = gpxTrackAnalysis; + } + + @Override + public int getCardLayoutId() { + return R.layout.gradient_card; + } + + @Override + protected void updateContent() { + if (selectedScaleType == null) { + AndroidUiHelper.updateVisibility(view, false); + return; + } + + AndroidUiHelper.updateVisibility(view, true); + TextView minValue = view.findViewById(R.id.min_value); + TextView maxValue = view.findViewById(R.id.max_value); + float min = getMinValue(); + float max = getMaxValue(min); + minValue.setText(formatValue(min)); + maxValue.setText(formatValue(max)); + } + + public void setSelectedScaleType(GradientScaleType type) { + this.selectedScaleType = type; + updateContent(); + } + + private float getMinValue() { + return (float) (selectedScaleType == GradientScaleType.ALTITUDE ? gpxTrackAnalysis.minElevation : 0.0); + } + + private float getMaxValue(float minValue) { + if (selectedScaleType == GradientScaleType.SPEED) { + return (Math.max(gpxTrackAnalysis.maxSpeed, app.getSettings().getApplicationMode().getMaxSpeed())); + } else if (selectedScaleType == GradientScaleType.ALTITUDE) { + return (float) Math.max(gpxTrackAnalysis.maxElevation, minValue + 50); + } else { + return 25; + } + } + + private CharSequence formatValue(float value) { + if (selectedScaleType == GradientScaleType.ALTITUDE) { + return OsmAndFormatter.getFormattedAlt(value, app); + } else if (selectedScaleType == GradientScaleType.SLOPE) { + return (int) value + " %"; + } + String speed = OsmAndFormatter.getFormattedSpeed(value, app); + Spannable formattedSpeed = new SpannableString(speed); + formattedSpeed.setSpan( + new ForegroundColorSpan(AndroidUtils.getColorFromAttr(app, android.R.attr.textColorSecondary)), + speed.indexOf(" "), speed.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + return formattedSpeed; + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java index 4642175b09..1de2c1c6ee 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java @@ -15,14 +15,6 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ScrollView; -import androidx.activity.OnBackPressedCallback; -import androidx.annotation.ColorInt; -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.AndroidUtils; import net.osmand.GPXUtilities.GPXFile; import net.osmand.PlatformUtil; @@ -60,6 +52,14 @@ import java.io.File; import java.util.ArrayList; import java.util.List; +import androidx.activity.OnBackPressedCallback; +import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.fragment.app.FragmentManager; + import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR; import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_BOLD; import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_MEDIUM; @@ -89,6 +89,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement private SplitIntervalCard splitIntervalCard; private TrackColoringCard trackColoringCard; private ColorsCard colorsCard; + private GradientCard gradientCard; private boolean showStartFinishIconsInitialValue; private ImageView trackIcon; @@ -340,6 +341,14 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement if (mapActivity != null) { if (card instanceof SplitIntervalCard) { SplitIntervalBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), trackDrawInfo, this); + } else if (card instanceof TrackColoringCard) { + GradientScaleType currentScaleType = ((TrackColoringCard) card).getSelectedScaleType(); + if (gradientCard != null) { + gradientCard.setSelectedScaleType(currentScaleType); + } + if (colorsCard != null) { + AndroidUiHelper.updateVisibility(colorsCard.getView(), currentScaleType == null); + } } else if (card instanceof ColorsCard) { int color = ((ColorsCard) card).getSelectedColor(); trackDrawInfo.setColor(color); @@ -553,6 +562,9 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement if (trackWidthCard != null) { trackWidthCard.updateItems(); } + if (trackColoringCard != null) { + trackColoringCard.updateColor(); + } MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { mapActivity.refreshMap(); @@ -640,12 +652,16 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement showStartFinishCard.setListener(this); cardsContainer.addView(showStartFinishCard.build(mapActivity)); - trackColoringCard = new TrackColoringCard(mapActivity, trackDrawInfo, this); + trackColoringCard = new TrackColoringCard(mapActivity, selectedGpxFile.getTrackAnalysis(app), trackDrawInfo); trackColoringCard.setListener(this); cardsContainer.addView(trackColoringCard.build(mapActivity)); setupColorsCard(cardsContainer); + gradientCard = new GradientCard(mapActivity, selectedGpxFile.getTrackAnalysis(app)); + AndroidUiHelper.updateVisibility(gradientCard.build(mapActivity), false); + cardsContainer.addView(gradientCard.getView()); + trackWidthCard = new TrackWidthCard(mapActivity, trackDrawInfo, new OnNeedScrollListener() { @Override diff --git a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java index 0a17f5e06b..44645180ea 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java @@ -7,14 +7,10 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; -import androidx.annotation.DrawableRes; -import androidx.annotation.NonNull; -import androidx.appcompat.content.res.AppCompatResources; -import androidx.core.content.ContextCompat; -import androidx.fragment.app.Fragment; -import androidx.recyclerview.widget.RecyclerView; +import com.google.android.material.snackbar.Snackbar; import net.osmand.AndroidUtils; +import net.osmand.GPXUtilities.GPXTrackAnalysis; import net.osmand.PlatformUtil; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; @@ -27,26 +23,29 @@ import org.apache.commons.logging.Log; import java.util.ArrayList; import java.util.List; -public class TrackColoringCard extends BaseCard { +import androidx.annotation.DrawableRes; +import androidx.annotation.NonNull; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; - private static final int MINIMUM_CONTRAST_RATIO = 3; +public class TrackColoringCard extends BaseCard { private final static String SOLID_COLOR = "solid_color"; private static final Log log = PlatformUtil.getLog(TrackColoringCard.class); + private GPXTrackAnalysis gpxTrackAnalysis; private TrackDrawInfo trackDrawInfo; private TrackColoringAdapter coloringAdapter; private TrackAppearanceItem selectedAppearanceItem; private List appearanceItems; - private Fragment target; - - public TrackColoringCard(MapActivity mapActivity, TrackDrawInfo trackDrawInfo, Fragment target) { + public TrackColoringCard(MapActivity mapActivity, GPXTrackAnalysis gpxTrackAnalysis, TrackDrawInfo trackDrawInfo) { super(mapActivity); - this.target = target; this.trackDrawInfo = trackDrawInfo; - appearanceItems = getGradientAppearanceItems(); + this.gpxTrackAnalysis = gpxTrackAnalysis; + appearanceItems = getTrackAppearanceItems(); } @Override @@ -58,25 +57,44 @@ public class TrackColoringCard extends BaseCard { protected void updateContent() { updateHeader(); -// coloringAdapter = new TrackColoringAdapter(appearanceItems); -// RecyclerView groupRecyclerView = view.findViewById(R.id.recycler_view); -// groupRecyclerView.setAdapter(coloringAdapter); -// groupRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false)); + coloringAdapter = new TrackColoringAdapter(appearanceItems); + RecyclerView groupRecyclerView = view.findViewById(R.id.recycler_view); + groupRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false)); + groupRecyclerView.setAdapter(coloringAdapter); AndroidUiHelper.updateVisibility(view.findViewById(R.id.top_divider), isShowDivider()); } - private List getGradientAppearanceItems() { + public void updateColor() { + if (coloringAdapter != null) { + // Provide empty object to update item without animation + coloringAdapter.notifyItemChanged(0, new Object()); + } + } + + public GradientScaleType getSelectedScaleType() { + String attrName = selectedAppearanceItem.getAttrName(); + return attrName.equals(SOLID_COLOR) ? null : GradientScaleType.valueOf(attrName.toUpperCase()); + } + + private List getTrackAppearanceItems() { List items = new ArrayList<>(); - items.add(new TrackAppearanceItem(SOLID_COLOR, app.getString(R.string.track_coloring_solid), R.drawable.ic_action_circle)); - -// for (GradientScaleType scaleType : GradientScaleType.values()) { -// items.add(new TrackAppearanceItem(scaleType.getTypeName(), scaleType.getHumanString(app), scaleType.getIconId())); -// } - + items.add(new TrackAppearanceItem(SOLID_COLOR, app.getString(R.string.track_coloring_solid), R.drawable.ic_action_circle, true)); + for (GradientScaleType scaleType : GradientScaleType.values()) { + items.add(new TrackAppearanceItem(scaleType.getTypeName(), + scaleType.getHumanString(app), scaleType.getIconId(), isScaleTypeActive(scaleType))); + } return items; } + private boolean isScaleTypeActive(GradientScaleType scaleType) { + if (scaleType == GradientScaleType.SPEED) { + return gpxTrackAnalysis.isSpeedSpecified(); + } else { + return gpxTrackAnalysis.isElevationSpecified(); + } + } + private TrackAppearanceItem getSelectedAppearanceItem() { if (selectedAppearanceItem == null) { GradientScaleType scaleType = trackDrawInfo.getGradientScaleType(); @@ -98,27 +116,22 @@ public class TrackColoringCard extends BaseCard { headerView.setBackgroundDrawable(null); TextView titleView = view.findViewById(R.id.title); - titleView.setText(R.string.select_color); + titleView.setText(R.string.shared_string_color); TextView descriptionView = view.findViewById(R.id.description); descriptionView.setText(getSelectedAppearanceItem().getLocalizedValue()); } - private void updateColorSelector() { - boolean visible = getSelectedAppearanceItem().getAttrName().equals(SOLID_COLOR); - AndroidUiHelper.updateVisibility(view.findViewById(R.id.select_color), visible); - } - public void setGradientScaleType(TrackAppearanceItem item) { + selectedAppearanceItem = item; if (item.getAttrName().equals(SOLID_COLOR)) { trackDrawInfo.setGradientScaleType(null); } else { - trackDrawInfo.setGradientScaleType(GradientScaleType.valueOf(item.getAttrName())); + trackDrawInfo.setGradientScaleType(GradientScaleType.valueOf(item.getAttrName().toUpperCase())); } mapActivity.refreshMap(); updateHeader(); - updateColorSelector(); } private class TrackColoringAdapter extends RecyclerView.Adapter { @@ -136,42 +149,38 @@ public class TrackColoringCard extends BaseCard { View view = themedInflater.inflate(R.layout.point_editor_group_select_item, parent, false); view.getLayoutParams().width = app.getResources().getDimensionPixelSize(R.dimen.gpx_group_button_width); view.getLayoutParams().height = app.getResources().getDimensionPixelSize(R.dimen.gpx_group_button_height); - - TrackAppearanceViewHolder holder = new TrackAppearanceViewHolder(view); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - AndroidUtils.setBackground(app, holder.button, nightMode, R.drawable.ripple_solid_light_6dp, - R.drawable.ripple_solid_dark_6dp); - } - return holder; + return new TrackAppearanceViewHolder(view); } @Override public void onBindViewHolder(@NonNull final TrackAppearanceViewHolder holder, int position) { - TrackAppearanceItem item = items.get(position); - holder.title.setText(item.getLocalizedValue()); + final TrackAppearanceItem item = items.get(position); - updateButtonBg(holder, item); - - int colorId; - if (item.getAttrName().equals(SOLID_COLOR)) { - colorId = trackDrawInfo.getColor(); - } else if (item.getAttrName().equals(getSelectedAppearanceItem().getAttrName())) { - colorId = ContextCompat.getColor(app, nightMode ? R.color.icon_color_active_dark : R.color.icon_color_active_light); - } else { - colorId = AndroidUtils.getColorFromAttr(holder.itemView.getContext(), R.attr.default_icon_color); + if (item.isActive() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + AndroidUtils.setBackground(app, holder.button, nightMode, R.drawable.ripple_solid_light_6dp, + R.drawable.ripple_solid_dark_6dp); } - holder.icon.setImageDrawable(app.getUIUtilities().getPaintedIcon(item.getIconId(), colorId)); + updateButtonBg(holder, item); + updateTextAndIconColor(holder, item); + holder.title.setText(item.getLocalizedValue()); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { + if (!item.isActive()) { + showSnackbar(view, item.getAttrName()); + return; + } + int prevSelectedPosition = getItemPosition(getSelectedAppearanceItem()); selectedAppearanceItem = items.get(holder.getAdapterPosition()); notifyItemChanged(holder.getAdapterPosition()); notifyItemChanged(prevSelectedPosition); - setGradientScaleType(selectedAppearanceItem); + if (getListener() != null) { + getListener().onCardPressed(TrackColoringCard.this); + } } }); } @@ -179,18 +188,70 @@ public class TrackColoringCard extends BaseCard { private void updateButtonBg(TrackAppearanceViewHolder holder, TrackAppearanceItem item) { GradientDrawable rectContourDrawable = (GradientDrawable) AppCompatResources.getDrawable(app, R.drawable.bg_select_group_button_outline); if (rectContourDrawable != null) { - if (getSelectedAppearanceItem() != null && getSelectedAppearanceItem().equals(item)) { - int strokeColor = ContextCompat.getColor(app, nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light); - rectContourDrawable.setStroke(AndroidUtils.dpToPx(app, 2), strokeColor); + boolean itemSelected = getSelectedAppearanceItem() != null && getSelectedAppearanceItem().equals(item); + + int strokeColor; + int backgroundColor; + int strokeWidth; + + if (itemSelected) { + strokeColor = AndroidUtils.getColorFromAttr(app, R.attr.pstsIndicatorColor); + backgroundColor = 0; + strokeWidth = 2; + } else if (!item.isActive()) { + strokeColor = AndroidUtils.getColorFromAttr(app, R.attr.stroked_buttons_and_links_outline); + backgroundColor = AndroidUtils.getColorFromAttr(app, R.attr.ctx_menu_card_btn); + strokeWidth = 2; } else { - int strokeColor = ContextCompat.getColor(app, nightMode ? R.color.stroked_buttons_and_links_outline_dark - : R.color.stroked_buttons_and_links_outline_light); - rectContourDrawable.setStroke(AndroidUtils.dpToPx(app, 1), strokeColor); + strokeColor = AndroidUtils.getColorFromAttr(app, R.attr.stroked_buttons_and_links_outline); + backgroundColor = 0; + strokeWidth = 1; } + + rectContourDrawable.mutate(); + rectContourDrawable.setColor(backgroundColor); + rectContourDrawable.setStroke(AndroidUtils.dpToPx(app, strokeWidth), strokeColor); holder.button.setImageDrawable(rectContourDrawable); } } + private void updateTextAndIconColor(TrackAppearanceViewHolder holder, TrackAppearanceItem item) { + boolean isSelected = item.getAttrName().equals(getSelectedAppearanceItem().getAttrName()); + int iconColorId; + int textColorId; + + if (isSelected) { + iconColorId = AndroidUtils.getColorFromAttr(app, R.attr.default_icon_color); + textColorId = AndroidUtils.getColorFromAttr(app, android.R.attr.textColor); + } else if (!item.isActive()) { + iconColorId = AndroidUtils.getColorFromAttr(app, R.attr.default_icon_color); + textColorId = AndroidUtils.getColorFromAttr(app, android.R.attr.textColorSecondary); + } else { + iconColorId = AndroidUtils.getColorFromAttr(app, R.attr.pstsIndicatorColor); + textColorId = iconColorId; + } + + if (item.getAttrName().equals(SOLID_COLOR)) { + iconColorId = trackDrawInfo.getColor(); + } + + holder.icon.setImageDrawable(app.getUIUtilities().getPaintedIcon(item.getIconId(), iconColorId)); + holder.title.setTextColor(textColorId); + } + + private void showSnackbar(View view, String attrName) { + if (view == null || mapActivity == null) { + return; + } + String text = attrName.equals(GradientScaleType.SPEED.getTypeName()) ? + app.getString(R.string.track_has_no_speed) : app.getString(R.string.track_has_no_altitude); + text += " " + app.getString(R.string.select_another_colorization); + Snackbar snackbar = Snackbar.make(view, text, Snackbar.LENGTH_LONG) + .setAnchorView(mapActivity.findViewById(R.id.dismiss_button)); + UiUtilities.setupSnackbar(snackbar, nightMode); + snackbar.show(); + } + @Override public int getItemCount() { return items.size(); @@ -209,10 +270,13 @@ public class TrackColoringCard extends BaseCard { @DrawableRes private int iconId; - public TrackAppearanceItem(String attrName, String localizedValue, int iconId) { + private boolean isActive; + + public TrackAppearanceItem(String attrName, String localizedValue, int iconId, boolean isActive) { this.attrName = attrName; this.localizedValue = localizedValue; this.iconId = iconId; + this.isActive = isActive; } public String getAttrName() { @@ -226,5 +290,9 @@ public class TrackColoringCard extends BaseCard { public int getIconId() { return iconId; } + + public boolean isActive() { + return isActive; + } } } \ No newline at end of file From ab65c9b1c9d1ff38755da23d8029a9b934d4dfa6 Mon Sep 17 00:00:00 2001 From: Skalii Date: Sat, 6 Mar 2021 17:46:20 +0200 Subject: [PATCH 007/250] all changes in redesign OsmAnd Live --- .../bottom_sheet_button_with_icon_center.xml | 46 ++ ...ottom_sheet_item_with_descr_icon_right.xml | 50 ++ OsmAnd/res/layout/fragment_live_updates.xml | 52 +- .../list_group_title_with_right_descr.xml | 57 ++ OsmAnd/res/layout/list_item_import.xml | 1 + ...ist_item_single_line_descrition_narrow.xml | 1 + .../list_item_triple_row_icon_and_menu.xml | 102 +++ .../res/layout/osm_live_banner_list_item.xml | 148 ++-- OsmAnd/res/values/sizes.xml | 2 + OsmAnd/res/values/strings.xml | 10 + .../plus/activities/LocalIndexInfo.java | 14 +- .../plus/activities/MapActivityActions.java | 32 +- .../download/ui/UpdatesIndexFragment.java | 263 ++++++- .../LiveUpdatesClearDialogFragment.java | 129 ++++ .../plus/liveupdates/LiveUpdatesFragment.java | 2 +- .../liveupdates/LiveUpdatesFragmentNew.java | 731 ++++++++++++++++++ .../plus/liveupdates/LiveUpdatesHelper.java | 96 ++- .../LiveUpdatesSettingsDialogFragment.java | 6 +- .../LiveUpdatesSettingsDialogFragmentNew.java | 520 +++++++++++++ .../plus/liveupdates/OsmLiveActivity.java | 91 +-- .../PerformLiveUpdateAsyncTask.java | 60 +- .../BooleanPreferenceBottomSheet.java | 30 +- 22 files changed, 2202 insertions(+), 241 deletions(-) create mode 100644 OsmAnd/res/layout/bottom_sheet_button_with_icon_center.xml create mode 100644 OsmAnd/res/layout/bottom_sheet_item_with_descr_icon_right.xml create mode 100644 OsmAnd/res/layout/list_group_title_with_right_descr.xml create mode 100644 OsmAnd/res/layout/list_item_triple_row_icon_and_menu.xml create mode 100644 OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java create mode 100644 OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java create mode 100644 OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java diff --git a/OsmAnd/res/layout/bottom_sheet_button_with_icon_center.xml b/OsmAnd/res/layout/bottom_sheet_button_with_icon_center.xml new file mode 100644 index 0000000000..493705898b --- /dev/null +++ b/OsmAnd/res/layout/bottom_sheet_button_with_icon_center.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/bottom_sheet_item_with_descr_icon_right.xml b/OsmAnd/res/layout/bottom_sheet_item_with_descr_icon_right.xml new file mode 100644 index 0000000000..5fd2456378 --- /dev/null +++ b/OsmAnd/res/layout/bottom_sheet_item_with_descr_icon_right.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + diff --git a/OsmAnd/res/layout/fragment_live_updates.xml b/OsmAnd/res/layout/fragment_live_updates.xml index 3992373c27..a9d2f8d979 100644 --- a/OsmAnd/res/layout/fragment_live_updates.xml +++ b/OsmAnd/res/layout/fragment_live_updates.xml @@ -1,8 +1,34 @@ - + + + + + + + + + + + - + tools:context=".liveupdates.LiveUpdatesFragmentNew" /> + - - - \ No newline at end of file + \ No newline at end of file diff --git a/OsmAnd/res/layout/list_group_title_with_right_descr.xml b/OsmAnd/res/layout/list_group_title_with_right_descr.xml new file mode 100644 index 0000000000..c691336be0 --- /dev/null +++ b/OsmAnd/res/layout/list_group_title_with_right_descr.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/list_item_import.xml b/OsmAnd/res/layout/list_item_import.xml index 3ec1c65d55..52b21a76af 100644 --- a/OsmAnd/res/layout/list_item_import.xml +++ b/OsmAnd/res/layout/list_item_import.xml @@ -13,6 +13,7 @@ android:layout_height="wrap_content"> + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/osm_live_banner_list_item.xml b/OsmAnd/res/layout/osm_live_banner_list_item.xml index 6caea4bbeb..2cba180cec 100644 --- a/OsmAnd/res/layout/osm_live_banner_list_item.xml +++ b/OsmAnd/res/layout/osm_live_banner_list_item.xml @@ -1,77 +1,103 @@ + android:orientation="vertical" + android:paddingStart="@dimen/list_content_padding" + android:paddingLeft="@dimen/list_content_padding" + android:paddingTop="@dimen/content_padding" + android:paddingEnd="@dimen/list_content_padding" + android:paddingRight="@dimen/list_content_padding" + android:paddingBottom="@dimen/content_padding"> - + - + - + - + - + - + - + - + - + - + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index 107bb45da7..dae06fed05 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -416,4 +416,6 @@ 5sp 3sp + + 80dp \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 0447ac33aa..7f5fac013a 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -12,6 +12,16 @@ --> + Purchases + Are you sure you want to delete all %s live updates? + Delete updates + Map updates will be checked every hour. Next time%s in %s. + Map updates will be checked every day. Next time%s in %s. + Map updates will be checked every week. Next time%s in %s. + Update frequency + Last time checked: %s + Updated: %s + Latest OpenStreetMap update available: Distance by tap A toggle to show or hide the Coordinates widget on the map. Show Coordinates widget diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java index 0550c5aa16..853a714d85 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java @@ -8,7 +8,7 @@ import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType; import java.io.File; -public class LocalIndexInfo { +public class LocalIndexInfo implements Comparable { private LocalIndexType type; private String description = ""; @@ -46,11 +46,11 @@ public class LocalIndexInfo { public void setAttachedObject(Object attachedObject) { this.attachedObject = attachedObject; } - + public Object getAttachedObject() { return attachedObject; } - + private String formatName(String name) { int ext = name.indexOf('.'); if (ext != -1) { @@ -172,8 +172,8 @@ public class LocalIndexInfo { return type.getBasename(this); } - - - - + @Override + public int compareTo(LocalIndexInfo o) { + return getName().compareTo(o.getName()); + } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 2bb6f5caec..ae614ad09a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -927,22 +927,6 @@ public class MapActivityActions implements DialogProvider { } }).createItem()); - if (Version.isGooglePlayEnabled() || Version.isHuawei() || Version.isDeveloperVersion(app)) { - optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.osm_live, mapActivity) - .setId(DRAWER_OSMAND_LIVE_ID) - .setIcon(R.drawable.ic_action_osm_live) - .setListener(new ItemClickListener() { - @Override - public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) { - app.logEvent("drawer_osm_live_open"); - Intent intent = new Intent(mapActivity, OsmLiveActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); - mapActivity.startActivity(intent); - return true; - } - }).createItem()); - } - optionsMenuHelper.addItem(new ItemBuilder().setTitle(getString(R.string.shared_string_travel_guides) + " (Beta)") .setId(DRAWER_TRAVEL_GUIDES_ID) .setIcon(R.drawable.ic_action_travel) @@ -1046,6 +1030,22 @@ public class MapActivityActions implements DialogProvider { }).createItem()); */ + if (Version.isGooglePlayEnabled() || Version.isHuawei() || Version.isDeveloperVersion(app)) { + optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.purchases, mapActivity) + .setId(DRAWER_OSMAND_LIVE_ID) + .setIcon(R.drawable.ic_action_osm_live) + .setListener(new ItemClickListener() { + @Override + public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) { + app.logEvent("drawer_osm_live_open"); + Intent intent = new Intent(mapActivity, OsmLiveActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); + mapActivity.startActivity(intent); + return true; + } + }).createItem()); + } + optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_help, mapActivity) .setId(DRAWER_HELP_ID) .setIcon(R.drawable.ic_action_help) diff --git a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java index faf39a56f7..7b32ecc06d 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java @@ -3,8 +3,12 @@ package net.osmand.plus.download.ui; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; +import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; +import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; +import android.util.TypedValue; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -13,17 +17,31 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; +import androidx.annotation.ColorRes; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.cardview.widget.CardView; +import androidx.core.content.ContextCompat; import androidx.core.view.MenuItemCompat; +import net.osmand.AndroidUtils; import net.osmand.Collator; import net.osmand.OsmAndCollator; import net.osmand.map.OsmandRegions; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.UiUtilities; +import net.osmand.plus.activities.LocalIndexHelper; +import net.osmand.plus.activities.LocalIndexInfo; +import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.liveupdates.LiveUpdatesClearDialogFragment.OnRefreshLiveUpdates; +import net.osmand.plus.liveupdates.LiveUpdatesFragmentNew; +import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.base.OsmAndListFragment; @@ -35,20 +53,32 @@ import net.osmand.plus.download.IndexItem; import net.osmand.plus.inapp.InAppPurchaseHelper; import net.osmand.util.Algorithms; +import java.util.ArrayList; import java.util.Comparator; import java.util.List; -public class UpdatesIndexFragment extends OsmAndListFragment implements DownloadEvents { +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; + +public class UpdatesIndexFragment extends OsmAndListFragment implements DownloadEvents, OnRefreshLiveUpdates { private static final int RELOAD_ID = 5; private UpdateIndexAdapter listAdapter; private String errorMessage; + private OsmandApplication app; + private OsmandSettings settings; + private boolean nightMode; + private LoadLiveMapsTask loadLiveMapsTask; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); + app = getMyApplication(); + settings = app.getSettings(); + nightMode = !app.getSettings().isLightContent(); } - + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -62,29 +92,31 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download super.onActivityCreated(savedInstanceState); updateErrorMessage(); } - + @Override public void onAttach(Activity activity) { super.onAttach(activity); invalidateListView(activity); + startLoadLiveMapsAsyncTask(); } @Override public ArrayAdapter getAdapter() { return listAdapter; } - + @Override public void downloadHasFinished() { invalidateListView(getMyActivity()); updateUpdateAllButton(); + startLoadLiveMapsAsyncTask(); } - + @Override public void downloadInProgress() { listAdapter.notifyDataSetChanged(); } - + @Override public void newDownloadIndexes() { invalidateListView(getMyActivity()); @@ -104,13 +136,12 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download listAdapter.sort(new Comparator() { @Override public int compare(IndexItem indexItem, IndexItem indexItem2) { - return collator.compare(indexItem.getVisibleName(getMyApplication(), osmandRegions), + return collator.compare(indexItem.getVisibleName(getMyApplication(), osmandRegions), indexItem2.getVisibleName(getMyApplication(), osmandRegions)); } }); setListAdapter(listAdapter); updateErrorMessage(); - } private void updateErrorMessage() { @@ -130,7 +161,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download } private void updateUpdateAllButton() { - + View view = getView(); if (view == null) { return; @@ -185,12 +216,33 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download updateUpdateAllButton(); } + @Override + public void onPause() { + super.onPause(); + stopLoadLiveMapsAsyncTask(); + } + + private void startLoadLiveMapsAsyncTask() { + loadLiveMapsTask = new LoadLiveMapsTask(listAdapter, this); + loadLiveMapsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } + + private void stopLoadLiveMapsAsyncTask() { + if (loadLiveMapsTask != null) { + loadLiveMapsTask.cancel(true); + } + } + @Override public void onListItemClick(ListView l, View v, int position, long id) { - if (listAdapter.isShowOsmLiveBanner() && position == 0) { + if (position == 0) { DownloadActivity activity = getMyActivity(); if (activity != null) { - ChoosePlanDialogFragment.showOsmLiveInstance(activity.getSupportFragmentManager()); + if (listAdapter.isNotSubscribed()) { + ChoosePlanDialogFragment.showOsmLiveInstance(activity.getSupportFragmentManager()); + } else { + LiveUpdatesFragmentNew.showInstance(activity.getSupportFragmentManager(), this); + } } } else { final IndexItem e = (IndexItem) getListAdapter().getItem(position); @@ -234,75 +286,218 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download return super.onOptionsItemSelected(item); } + @Override + public void onUpdateStates() { + startLoadLiveMapsAsyncTask(); + } + private class UpdateIndexAdapter extends ArrayAdapter { static final int INDEX_ITEM = 0; static final int OSM_LIVE_BANNER = 1; - List items; - boolean showOsmLiveBanner; + private final ArrayList mapsList = new ArrayList<>(); + private final boolean isNotSubscribed; + private TextView countView; + private int countAll = 0; + private int countEnabled = 0; - public UpdateIndexAdapter(Context context, int resource, List items, boolean showOsmLiveBanner) { - super(context, resource, items); - this.items = items; - this.showOsmLiveBanner = showOsmLiveBanner; + public void clearLii() { + mapsList.clear(); } - public boolean isShowOsmLiveBanner() { - return showOsmLiveBanner; + public void addLii(LocalIndexInfo info) { + mapsList.add(info); + } + + public void updateCountEnabled() { + countAll = 0; + countEnabled = 0; + if (countView != null) { + for (LocalIndexInfo map : mapsList) { + countAll++; + CommonPreference preference = preferenceForLocalIndex(map.getFileName(), settings); + if (preference.get()) { + countEnabled++; + } + } + String countText = countEnabled + "/" + countAll; + countView.setText(countText); + } + } + + public UpdateIndexAdapter(Context context, int resource, List items, boolean isNotSubscribed) { + super(context, resource, items); + this.items = items; + this.isNotSubscribed = isNotSubscribed; + } + + public boolean isNotSubscribed() { + return isNotSubscribed; } @Override public int getCount() { - return super.getCount() + (showOsmLiveBanner ? 1 : 0); + return super.getCount() + 1; } @Override public IndexItem getItem(int position) { - if (showOsmLiveBanner && position == 0) { + if (position == 0) { return null; } else { - return super.getItem(position - (showOsmLiveBanner ? 1 : 0)); + return super.getItem(position - 1); } } @Override public int getPosition(IndexItem item) { - return super.getPosition(item) + (showOsmLiveBanner ? 1 : 0); + return super.getPosition(item) + 1; } @Override public int getViewTypeCount() { - return showOsmLiveBanner ? 2 : 1; + return 2; } @Override public int getItemViewType(int position) { - return showOsmLiveBanner && position == 0 ? OSM_LIVE_BANNER : INDEX_ITEM; + return position == 0 ? OSM_LIVE_BANNER : INDEX_ITEM; } @Override public View getView(final int position, final View convertView, final ViewGroup parent) { - View v = convertView; + View view = convertView; int viewType = getItemViewType(position); - if (v == null) { + if (view == null) { + LayoutInflater inflater = LayoutInflater.from(getMyActivity()); if (viewType == INDEX_ITEM) { - LayoutInflater inflater = LayoutInflater.from(getMyActivity()); - v = inflater.inflate(R.layout.two_line_with_images_list_item, parent, false); - v.setTag(new ItemViewHolder(v, getMyActivity())); + view = inflater.inflate(R.layout.two_line_with_images_list_item, parent, false); + view.setTag(new ItemViewHolder(view, getMyActivity())); } else if (viewType == OSM_LIVE_BANNER) { - LayoutInflater inflater = LayoutInflater.from(getMyActivity()); - v = inflater.inflate(R.layout.osm_live_banner_list_item, parent, false); + if (isNotSubscribed) { + view = inflater.inflate(R.layout.osm_live_banner_list_item, parent, false); + ColorStateList stateList = AndroidUtils.createPressedColorStateList(app, nightMode, + R.color.switch_button_active_light, R.color.switch_button_active_stroke_light, + R.color.switch_button_active_dark, R.color.switch_button_active_stroke_dark); + ((CardView) view.findViewById(R.id.card_view)).setCardBackgroundColor(stateList); + } else { + view = inflater.inflate(R.layout.bottom_sheet_item_with_descr_switch_and_additional_button_56dp, parent, false); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + view.setBackground(null); + } + AndroidUiHelper.setVisibility(View.GONE, view.findViewById(R.id.compound_button)); + ((ImageView) view.findViewById(R.id.icon)).setImageResource(R.drawable.ic_action_subscription_osmand_live); + TextView tvTitle = view.findViewById(R.id.title); + tvTitle.setText(R.string.download_live_updates); + AndroidUtils.setTextPrimaryColor(app, tvTitle, nightMode); + countView = view.findViewById(R.id.description); + AndroidUtils.setTextSecondaryColor(app, countView, nightMode); + Drawable additionalIconDrawable = AppCompatResources.getDrawable(app, R.drawable.ic_action_refresh_dark); + UiUtilities.tintDrawable(additionalIconDrawable, ContextCompat.getColor(app, getDefaultIconColorId(nightMode))); + ((ImageView) view.findViewById(R.id.additional_button_icon)).setImageDrawable(additionalIconDrawable); + LinearLayout additionalButton = view.findViewById(R.id.additional_button); + TypedValue typedValue = new TypedValue(); + app.getTheme().resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true); + additionalButton.setBackgroundResource(typedValue.resourceId); + additionalButton.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + showUpdateDialog(); + } + }); + } } } if (viewType == INDEX_ITEM) { - ItemViewHolder holder = (ItemViewHolder) v.getTag(); + ItemViewHolder holder = (ItemViewHolder) view.getTag(); holder.setShowRemoteDate(true); holder.setShowTypeInDesc(true); holder.setShowParentRegionName(true); holder.bindIndexItem(getItem(position)); } - return v; + return view; } } + + public static class LoadLiveMapsTask + extends AsyncTask> + implements AbstractLoadLocalIndexTask { + + //private List result; + private final UpdateIndexAdapter adapter; + private final LocalIndexHelper helper; + + public LoadLiveMapsTask(UpdateIndexAdapter adapter, + UpdatesIndexFragment fragment) { + this.adapter = adapter; + helper = new LocalIndexHelper(fragment.getMyApplication()); + } + + @Override + protected void onPreExecute() { + adapter.clearLii(); + } + + @Override + protected List doInBackground(Void... params) { + return helper.getLocalFullMaps(this); + } + + @Override + public void loadFile(LocalIndexInfo... loaded) { + publishProgress(loaded); + } + + @Override + protected void onProgressUpdate(LocalIndexInfo... values) { + String fileNameL; + for (LocalIndexInfo localIndexInfo : values) { + fileNameL = localIndexInfo.getFileName().toLowerCase(); + if (localIndexInfo.getType() == LocalIndexHelper.LocalIndexType.MAP_DATA + && !fileNameL.contains("world") && !fileNameL.startsWith("depth_")) { + adapter.addLii(localIndexInfo); + } + } + } + + @Override + protected void onPostExecute(List result) { + //this.result = result; + adapter.updateCountEnabled(); + + } + } + + private void showUpdateDialog() { + if (!Algorithms.isEmpty(listAdapter.mapsList)) { + if (listAdapter.countEnabled == 1) { + LocalIndexInfo li = listAdapter.mapsList.get(0); + runLiveUpdate(getActivity(), li.getFileName(), false); + } else if (listAdapter.countEnabled > 1) { + AlertDialog.Builder bld = new AlertDialog.Builder(getMyActivity()); + bld.setMessage(R.string.update_all_maps_now); + bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + for (LocalIndexInfo li : listAdapter.mapsList) { + CommonPreference localUpdateOn = preferenceLiveUpdatesOn(li.getFileName(), settings); + if (localUpdateOn.get()) { + runLiveUpdate(getActivity(), li.getFileName(), false); + } + } + } + }); + bld.setNegativeButton(R.string.shared_string_no, null); + bld.show(); + } + } + } + + @ColorRes + public static int getDefaultIconColorId(boolean nightMode) { + return nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light; + } + } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java new file mode 100644 index 0000000000..de68d90b9c --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java @@ -0,0 +1,129 @@ +package net.osmand.plus.liveupdates; + +import android.graphics.Typeface; +import android.os.Bundle; +import android.text.SpannableString; +import android.text.style.StyleSpan; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; + +import net.osmand.PlatformUtil; +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.base.MenuBottomSheetDialogFragment; +import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem; +import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem; +import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem; +import net.osmand.plus.resources.IncrementalChangesManager; +import net.osmand.plus.settings.backend.OsmandSettings; +import net.osmand.util.Algorithms; + +import org.apache.commons.logging.Log; + +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLatestUpdateAvailable; +import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.getPrimaryTextColorId; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryTextColorId; + +public class LiveUpdatesClearDialogFragment extends MenuBottomSheetDialogFragment { + + public static final String TAG = LiveUpdatesClearDialogFragment.class.getSimpleName(); + private static final Log LOG = PlatformUtil.getLog(LiveUpdatesClearDialogFragment.class); + private static final String LOCAL_INDEX_FILE_NAME = "local_index_file_name"; + + private OsmandApplication app; + private OsmandSettings settings; + + private String fileName; + + public static void showInstance(@NonNull FragmentManager fragmentManager, Fragment target, String fileName) { + if (!fragmentManager.isStateSaved()) { + LiveUpdatesClearDialogFragment fragment = new LiveUpdatesClearDialogFragment(); + fragment.setTargetFragment(target, 0); + fragment.fileName = fileName; + fragment.show(fragmentManager, TAG); + } + } + + @Override + public void createMenuItems(Bundle savedInstanceState) { + app = getMyApplication(); + settings = app.getSettings(); + + if (savedInstanceState != null) { + if (savedInstanceState.containsKey(LOCAL_INDEX_FILE_NAME)) { + fileName = savedInstanceState.getString(LOCAL_INDEX_FILE_NAME); + } + } + + items.add(new SimpleBottomSheetItem.Builder() + .setTitle(app.getResources().getString(R.string.delete_updates)) + .setTitleColorId(getPrimaryTextColorId(nightMode)) + .setLayoutId(R.layout.bottom_sheet_item_title) + .create()); + + String nameToDisplay = getNameToDisplay(fileName, app); + String text = app.getResources().getString(R.string.live_update_delete_updates_msg, nameToDisplay); + SpannableString message = UiUtilities.createSpannableString(text, new StyleSpan(Typeface.BOLD), nameToDisplay); + + items.add(new LongDescriptionItem.Builder() + .setDescription(message) + .setDescriptionColorId(getSecondaryTextColorId(nightMode)) + .setDescriptionMaxLines(5) + .setLayoutId(R.layout.bottom_sheet_item_description_long) + .create()); + + items.add(new DividerSpaceItem(app, getResources().getDimensionPixelSize(R.dimen.content_padding_small))); + } + + @Override + public void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + outState.putString(LOCAL_INDEX_FILE_NAME, fileName); + } + + private void deleteUpdates() { + IncrementalChangesManager changesManager = app.getResourceManager().getChangesManager(); + String fileNameWithoutExt = Algorithms.getFileNameWithoutExtension(fileName); + changesManager.deleteUpdates(fileNameWithoutExt); + preferenceLastCheck(fileName, settings).resetToDefault(); + preferenceLatestUpdateAvailable(fileName, settings).resetToDefault(); + } + + public interface OnRefreshLiveUpdates { + void onUpdateStates(); + } + + @Override + protected void onRightBottomButtonClick() { + deleteUpdates(); + + Fragment fragment = getTargetFragment(); + if (fragment instanceof OnRefreshLiveUpdates) { + ((OnRefreshLiveUpdates) fragment).onUpdateStates(); + } + + dismiss(); + } + + @Override + protected int getDismissButtonTextId() { + return R.string.shared_string_cancel; + } + + @Override + protected int getRightBottomButtonTextId() { + return R.string.shared_string_delete; + } + + @Override + protected DialogButtonType getRightBottomButtonType() { + return DialogButtonType.SECONDARY_HARMFUL; + } + +} diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index c503162910..1d44f1ec70 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -575,7 +575,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc preferenceLiveUpdatesOn(item, fragment.getSettings()); IncrementalChangesManager changesManager = context.getResourceManager().getChangesManager(); - nameTextView.setText(getNameToDisplay(item, fragment.getMyActivity())); + nameTextView.setText(getNameToDisplay(item, fragment.getMyActivity().getMyApplication())); if (shouldUpdatePreference.get()) { final Integer frequencyId = preferenceUpdateFrequency(item, fragment.getSettings()).get(); final Integer timeOfDateToUpdateId = preferenceTimeOfDayToUpdate(item, fragment.getSettings()).get(); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java new file mode 100644 index 0000000000..c6d7b63c0f --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -0,0 +1,731 @@ +package net.osmand.plus.liveupdates; + +import android.app.AlarmManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.DialogInterface; +import android.graphics.Typeface; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; +import android.os.AsyncTask; +import android.os.Build; +import android.os.Bundle; +import android.util.TypedValue; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.CompoundButton; +import android.widget.ExpandableListView; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.ColorRes; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.widget.AppCompatImageView; +import androidx.appcompat.widget.SwitchCompat; +import androidx.appcompat.widget.Toolbar; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; + +import net.osmand.AndroidNetworkUtils; +import net.osmand.AndroidUtils; +import net.osmand.PlatformUtil; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.UiUtilities; +import net.osmand.plus.activities.LocalIndexHelper; +import net.osmand.plus.activities.LocalIndexInfo; +import net.osmand.plus.activities.OsmandBaseExpandableListAdapter; +import net.osmand.plus.base.BaseOsmAndDialogFragment; +import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask; +import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.helpers.FontCache; +import net.osmand.plus.inapp.InAppPurchaseHelper; +import net.osmand.plus.liveupdates.LiveUpdatesClearDialogFragment.OnRefreshLiveUpdates; +import net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay; +import net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency; +import net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.OnLiveUpdatesForLocalChange; +import net.osmand.plus.liveupdates.PerformLiveUpdateAsyncTask.AsyncResponse; +import net.osmand.plus.settings.backend.CommonPreference; +import net.osmand.plus.settings.backend.OsmandSettings; +import net.osmand.plus.widgets.TextViewEx; +import net.osmand.util.Algorithms; + +import org.apache.commons.logging.Log; + +import java.lang.ref.WeakReference; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.TimeZone; + +import static net.osmand.plus.UiUtilities.CompoundButtonType.GLOBAL; +import static net.osmand.plus.UiUtilities.CompoundButtonType.TOOLBAR; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatShortDateTime; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLatestUpdateAvailable; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.setAlarmForPendingIntent; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getActiveTextColorId; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getOsmandIconColorId; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryIconColorId; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryTextColorId; + +public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements OnLiveUpdatesForLocalChange { + + public static final String URL = "https://osmand.net/api/osmlive_status"; + public static final String TAG = LiveUpdatesFragmentNew.class.getSimpleName(); + private final static Log LOG = PlatformUtil.getLog(LiveUpdatesFragmentNew.class); + + private OsmandApplication app; + private OsmandSettings settings; + private boolean nightMode; + + private View toolbarSwitchContainer; + private ExpandableListView listView; + private TextViewEx descriptionTime; + private LiveMapsAdapter adapter; + + private GetLastUpdateDateTask getLastUpdateDateTask; + private LoadLiveMapsTask loadLiveMapsTask; + + public static void showInstance(@NonNull FragmentManager fragmentManager, Fragment target) { + if (!fragmentManager.isStateSaved()) { + LiveUpdatesFragmentNew fragment = new LiveUpdatesFragmentNew(); + fragment.setTargetFragment(target, 0); + fragment.show(fragmentManager, TAG); + } + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + app = getMyApplication(); + settings = getSettings(); + nightMode = isNightMode(false); + setHasOptionsMenu(true); + } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_live_updates, container, false); + + Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar); + toolbar.setTitle(R.string.osm_live); + int iconColorResId = nightMode ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light; + Drawable icBack = getMyApplication().getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(app), iconColorResId); + DrawableCompat.setTint(icBack, ContextCompat.getColor(app, iconColorResId)); + toolbar.setNavigationIcon(icBack); + toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up); + toolbar.setNavigationOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dismiss(); + } + }); + + listView = (ExpandableListView) view.findViewById(android.R.id.list); + adapter = new LiveMapsAdapter(); + listView.setAdapter(adapter); + expandAllGroups(); + + View bottomShadowView = inflater.inflate(R.layout.card_bottom_divider, listView, false); + listView.addFooterView(bottomShadowView); + listView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { + @Override + public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { + if (InAppPurchaseHelper.isSubscribedToLiveUpdates(app) && settings.IS_LIVE_UPDATES_ON.get()) { + if (getFragmentManager() != null) { + LiveUpdatesSettingsDialogFragmentNew + .showInstance(getFragmentManager(), LiveUpdatesFragmentNew.this, adapter.getChild(groupPosition, childPosition).getFileName()); + } + return true; + } else { + return false; + } + } + }); + + final SwipeRefreshLayout swipeRefresh = view.findViewById(R.id.swipe_refresh); + int swipeColor = ContextCompat.getColor(app, nightMode ? R.color.osmand_orange_dark : R.color.osmand_orange); + swipeRefresh.setColorSchemeColors(swipeColor); + swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { + @Override + public void onRefresh() { + if (settings.IS_LIVE_UPDATES_ON.get()) { + showUpdateDialog(); + } + swipeRefresh.setRefreshing(false); + } + }); + + toolbarSwitchContainer = view.findViewById(R.id.toolbar_switch_container); + updateToolbarSwitch(settings.IS_LIVE_UPDATES_ON.get()); + + View timeContainer = view.findViewById(R.id.item_import_container); + AndroidUtils.setListItemBackground(app, timeContainer, nightMode); + + AppCompatImageView descriptionIcon = timeContainer.findViewById(R.id.icon); + Drawable icon = UiUtilities.createTintedDrawable(app, R.drawable.ic_action_time, + ContextCompat.getColor(app, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light)); + descriptionIcon.setImageDrawable(icon); + + TextViewEx title = timeContainer.findViewById(R.id.title); + AndroidUtils.setTextSecondaryColor(app, title, nightMode); + title.setText(R.string.latest_openstreetmap_update); + title.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.default_desc_text_size)); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + title.setLetterSpacing(AndroidUtils.getFloatValueFromRes(app, R.dimen.description_letter_spacing)); + } + + descriptionTime = timeContainer.findViewById(R.id.sub_title); + AndroidUtils.setTextPrimaryColor(app, descriptionTime, nightMode); + Typeface typeface = FontCache.getFont(app, app.getResources().getString(R.string.font_roboto_medium)); + descriptionTime.setTypeface(typeface); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + descriptionTime.setLetterSpacing(AndroidUtils.getFloatValueFromRes(app, R.dimen.description_letter_spacing)); + } + + return view; + } + + @Override + public void onResume() { + super.onResume(); + startUpdateDateAsyncTask(); + startLoadLiveMapsAsyncTask(); + } + + @Override + public void onPause() { + super.onPause(); + stopUpdateDateAsyncTask(); + stopLoadLiveMapsAsyncTask(); + } + @Override + public void onDismiss(@NonNull DialogInterface dialog) { + super.onDismiss(dialog); + Fragment target = getTargetFragment(); + if (target instanceof OnRefreshLiveUpdates) { + ((OnRefreshLiveUpdates) target).onUpdateStates(); + } + } + + private void startUpdateDateAsyncTask() { + getLastUpdateDateTask = new GetLastUpdateDateTask(this); + getLastUpdateDateTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } + + private void stopUpdateDateAsyncTask() { + if (getLastUpdateDateTask != null) { + getLastUpdateDateTask.cancel(true); + } + } + + private void startLoadLiveMapsAsyncTask() { + if (loadLiveMapsTask == null) { + loadLiveMapsTask = new LoadLiveMapsTask(adapter, this); + loadLiveMapsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } + } + + private void stopLoadLiveMapsAsyncTask() { + if (loadLiveMapsTask != null) { + loadLiveMapsTask.cancel(true); + } + } + + private void updateToolbarSwitch(final boolean isChecked) { + int switchColor = ContextCompat.getColor(app, isChecked ? getActiveTextColorId(nightMode) : getSecondaryTextColorId(nightMode)); + AndroidUtils.setBackground(toolbarSwitchContainer, new ColorDrawable(switchColor)); + + SwitchCompat switchView = toolbarSwitchContainer.findViewById(R.id.switchWidget); + switchView.setChecked(isChecked); + UiUtilities.setupCompoundButton(switchView, nightMode, TOOLBAR); + + toolbarSwitchContainer.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + boolean visible = !isChecked; + + if (visible) { + if (InAppPurchaseHelper.isSubscribedToLiveUpdates(app)) { + switchOnLiveUpdates(); + updateToolbarSwitch(true); + } else { + app.showToastMessage(getString(R.string.osm_live_ask_for_purchase)); + updateToolbarSwitch(false); + } + } else { + settings.IS_LIVE_UPDATES_ON.set(false); + enableLiveUpdates(false); + updateToolbarSwitch(false); + } + updateList(); + } + }); + + TextView title = toolbarSwitchContainer.findViewById(R.id.switchButtonText); + title.setText(isChecked ? R.string.shared_string_enabled : R.string.shared_string_disabled); + } + + private void switchOnLiveUpdates() { + settings.IS_LIVE_UPDATES_ON.set(true); + enableLiveUpdates(true); + showUpdateDialog(); + } + + private void showUpdateDialog() { + final AsyncResponse runListSort = new AsyncResponse() { + @Override + public void processFinish() { + adapter.notifyDataSetChanged(); + } + }; + if (!Algorithms.isEmpty(adapter.mapsList)) { + if (adapter.countEnabled == 1) { + LocalIndexInfo li = adapter.mapsList.get(0); + runLiveUpdate(getActivity(), li.getFileName(), false, runListSort); + } else if (adapter.countEnabled > 1) { + AlertDialog.Builder bld = new AlertDialog.Builder(getMyActivity()); + bld.setMessage(R.string.update_all_maps_now); + bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + for (LocalIndexInfo li : adapter.mapsList) { + CommonPreference localUpdateOn = preferenceForLocalIndex(li.getFileName(), settings); + if (localUpdateOn.get()) { + if (adapter.mapsList.indexOf(li) == adapter.mapsList.size() - 1) { + runLiveUpdate(getActivity(), li.getFileName(), false, runListSort); + } else { + runLiveUpdate(getActivity(), li.getFileName(), false); + } + } + startUpdateDateAsyncTask(); + } + } + }); + bld.setNegativeButton(R.string.shared_string_no, null); + bld.show(); + } + } + } + + private void enableLiveUpdates(boolean enable) { + if (!Algorithms.isEmpty(adapter.mapsList)) { + AlarmManager alarmMgr = (AlarmManager) app.getSystemService(Context.ALARM_SERVICE); + for (LocalIndexInfo li : adapter.mapsList) { + CommonPreference localUpdateOn = preferenceLiveUpdatesOn(li.getFileName(), settings); + if (localUpdateOn.get()) { + String fileName = li.getFileName(); + PendingIntent alarmIntent = getPendingIntent(app, fileName); + if (enable) { + final CommonPreference updateFrequencyPreference = + preferenceUpdateFrequency(fileName, settings); + final CommonPreference timeOfDayPreference = + preferenceTimeOfDayToUpdate(fileName, settings); + UpdateFrequency updateFrequency = UpdateFrequency.values()[updateFrequencyPreference.get()]; + TimeOfDay timeOfDayToUpdate = TimeOfDay.values()[timeOfDayPreference.get()]; + setAlarmForPendingIntent(alarmIntent, alarmMgr, updateFrequency, timeOfDayToUpdate); + } else { + alarmMgr.cancel(alarmIntent); + } + } + } + } + } + + private void expandAllGroups() { + for (int i = 0; i < adapter.getGroupCount(); i++) { + listView.expandGroup(i); + } + } + + public void notifyLiveUpdatesChanged() { + if (getActivity() != null) { + runSort(); + } + } + + protected class LiveMapsAdapter extends OsmandBaseExpandableListAdapter { + private final ArrayList mapsList = new ArrayList<>(); + private int countEnabled = 0; + private TextViewEx countView; + + public void addData(LocalIndexInfo info) { + mapsList.add(info); + } + + @Override + public void notifyDataSetInvalidated() { + super.notifyDataSetInvalidated(); + } + + public void sort() { + countEnabled = 0; + for (LocalIndexInfo map : mapsList) { + CommonPreference preference = preferenceForLocalIndex(map.getFileName(), getSettings()); + if (preference.get()) { + countEnabled++; + } + } + updateCountEnabled(); + + Collections.sort(mapsList); + Collections.sort(mapsList, new Comparator() { + @Override + public int compare(LocalIndexInfo o1, LocalIndexInfo o2) { + CommonPreference preference1 = preferenceForLocalIndex(o1.getFileName(), getSettings()); + CommonPreference preference2 = preferenceForLocalIndex(o2.getFileName(), getSettings()); + return preference2.get().compareTo(preference1.get()); + } + }); + notifyDataSetInvalidated(); + } + + public void updateCountEnabled() { + if (countView != null) { + String countText = countEnabled + "/" + mapsList.size(); + countView.setText(countText); + } + } + + @Override + public LocalIndexInfo getChild(int groupPosition, int childPosition) { + return mapsList.get(childPosition); + } + + @Override + public long getChildId(int groupPosition, int childPosition) { + return groupPosition * 10000 + childPosition; // it would be unusable to have 10000 local indexes + } + + @Override + public View getChildView(final int groupPosition, final int childPosition, + boolean isLastChild, View convertView, ViewGroup parent) { + LiveMapsViewHolder viewHolder; +// if (convertView == null) { + LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); + convertView = inflater.inflate(R.layout.list_item_triple_row_icon_and_menu, parent, false); + viewHolder = new LiveMapsViewHolder(convertView); + convertView.setTag(viewHolder); +// } else { +// viewHolder = (LiveMapsViewHolder) convertView.getTag(); +// } + viewHolder.bindLocalIndexInfo(getChild(groupPosition, childPosition).getFileName()); + return convertView; + } + + @Override + public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { + View view = convertView; + if (view == null) { + LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); + view = inflater.inflate(R.layout.list_group_title_with_right_descr, parent, false); + } + view.setOnClickListener(null); + View topShadowView = view.findViewById(R.id.bottomShadowView); + if (groupPosition == 0) { + topShadowView.setVisibility(View.GONE); + } else { + topShadowView.setVisibility(View.VISIBLE); + } + + TextViewEx titleView = ((TextViewEx) view.findViewById(R.id.title)); + titleView.setText(getGroup(groupPosition)); + + countView = ((TextViewEx) view.findViewById(R.id.description)); + AndroidUtils.setTextSecondaryColor(app, countView, nightMode); + updateCountEnabled(); + + return view; + } + + @Override + public int getChildrenCount(int groupPosition) { + return mapsList.size(); + } + + @Override + public String getGroup(int groupPosition) { + return getString(R.string.available_maps); + } + + @Override + public int getGroupCount() { + return 1; + } + + @Override + public long getGroupId(int groupPosition) { + return groupPosition; + } + + @Override + public boolean hasStableIds() { + return false; + } + + @Override + public boolean isChildSelectable(int groupPosition, int childPosition) { + return true; + } + } + + private class LiveMapsViewHolder { + private final ImageView statusIcon; + private final TextView title; + private final TextView subTitle; + private final TextView description; + private final CompoundButton option; + + private LiveMapsViewHolder(View view) { + statusIcon = (AppCompatImageView) view.findViewById(R.id.icon); + title = (TextView) view.findViewById(R.id.title); + subTitle = (TextView) view.findViewById(R.id.sub_title); + description = (TextView) view.findViewById(R.id.description); + option = (CompoundButton) view.findViewById(R.id.toggle_item); + } + + public void bindLocalIndexInfo(@NonNull final String item) { + boolean liveUpdateOn = settings.IS_LIVE_UPDATES_ON.get(); + final CommonPreference localUpdateOn = preferenceLiveUpdatesOn(item, settings); +// IncrementalChangesManager changesManager = app.getResourceManager().getChangesManager(); + UiUtilities.setupCompoundButton(option, nightMode, GLOBAL); + CommonPreference liveUpdatePreference = preferenceForLocalIndex(item, settings); + option.setChecked(liveUpdatePreference.get()); + + title.setText(getNameToDisplay(item, app)); + + AndroidUiHelper.updateVisibility(subTitle, localUpdateOn.get()); + if (localUpdateOn.get()) { + int frequencyId = preferenceUpdateFrequency(item, settings).get(); + final UpdateFrequency frequency = UpdateFrequency.values()[frequencyId]; + String subTitleText = app.getResources().getString(frequency.getLocalizedId()); + /*int timeOfDateToUpdateId = preferenceTimeOfDayToUpdate(item, settings).get(); + final TimeOfDay timeOfDay = TimeOfDay.values()[timeOfDateToUpdateId]; + if (frequency != UpdateFrequency.HOURLY) { + subTitleText += " • " + app.getResources().getString(timeOfDay.getLocalizedId()); + }*/ + subTitle.setText(subTitleText); + subTitle.setTextColor(ContextCompat.getColor(app, liveUpdateOn ? getActiveTextColorId(nightMode) : getSecondaryTextColorId(nightMode))); + Typeface typeface = FontCache.getFont(app, app.getResources().getString(R.string.font_roboto_medium)); + subTitle.setTypeface(typeface); + } + + Drawable statusDrawable = ContextCompat.getDrawable(app, R.drawable.ic_map); + int resColorId = !localUpdateOn.get() ? getSecondaryIconColorId(nightMode) : !liveUpdateOn ? getDefaultIconColorId(nightMode) : getOsmandIconColorId(nightMode); + int statusColor = ContextCompat.getColor(app, resColorId); + if (statusDrawable != null) { + DrawableCompat.setTint(statusDrawable, statusColor); + } + statusIcon.setImageDrawable(statusDrawable); + + description.setText(getLastCheckString(item, app)); + + if (InAppPurchaseHelper.isSubscribedToLiveUpdates(app)) { + option.setEnabled(liveUpdateOn); + option.setOnCheckedChangeListener(new SwitchCompat.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + onUpdateLocalIndex(item, isChecked, null); + } + }); + } else { + option.setEnabled(false); + } + } + } + + public static class GetLastUpdateDateTask extends AsyncTask { + + private final OsmandApplication app; + private final WeakReference fragment; + + GetLastUpdateDateTask(LiveUpdatesFragmentNew fragment) { + this.fragment = new WeakReference<>(fragment); + app = fragment.getMyApplication(); + } + + @Override + protected String doInBackground(Void... params) { + try { + return AndroidNetworkUtils.sendRequest(app, URL, null, "Requesting map updates info...", false, false); + } catch (Exception e) { + LOG.error("Error: " + "Requesting map updates info error", e); + return null; + } + } + + @Override + protected void onPostExecute(String response) { + LiveUpdatesFragmentNew f = fragment.get(); + if (response != null && f != null) { + TextViewEx descriptionTime = f.descriptionTime; + if (descriptionTime != null) { + SimpleDateFormat source = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US); + source.setTimeZone(TimeZone.getTimeZone("UTC")); + SimpleDateFormat dest = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US); + dest.setTimeZone(TimeZone.getDefault()); + try { + LOG.debug("response = " + response); + Date parsed = source.parse(response); + if (parsed != null) { + long dateTime = parsed.getTime(); + LOG.debug("dateTime = " + dateTime); + descriptionTime.setText(dest.format(parsed)); + } + } catch (ParseException e) { + e.printStackTrace(); + } + } + } + } + } + + public static class LoadLiveMapsTask + extends AsyncTask> + implements AbstractLoadLocalIndexTask { + + //private List result; + private final LiveMapsAdapter adapter; + private final LocalIndexHelper helper; + + public LoadLiveMapsTask(LiveMapsAdapter adapter, + LiveUpdatesFragmentNew fragment) { + this.adapter = adapter; + helper = new LocalIndexHelper(fragment.getMyApplication()); + } + + @Override + protected List doInBackground(Void... params) { + return helper.getLocalFullMaps(this); + } + + @Override + public void loadFile(LocalIndexInfo... loaded) { + publishProgress(loaded); + } + + @Override + protected void onProgressUpdate(LocalIndexInfo... values) { + String fileNameL; + for (LocalIndexInfo localIndexInfo : values) { + fileNameL = localIndexInfo.getFileName().toLowerCase(); + if (localIndexInfo.getType() == LocalIndexHelper.LocalIndexType.MAP_DATA + && !fileNameL.contains("world") && !fileNameL.startsWith("depth_")) { + adapter.addData(localIndexInfo); + } + } + } + + @Override + protected void onPostExecute(List result) { + //this.result = result; + adapter.sort(); + } + } + + protected static String getLastCheckString(String fileName, OsmandApplication app) { + return getLastCheckString(fileName, app, false); + } + + protected static String getLastCheckString(String fileName, OsmandApplication app, boolean lastTimeChecked) { + OsmandSettings settings = app.getSettings(); + + final long lastUpdate = preferenceLatestUpdateAvailable(fileName, settings).get(); + String lastUpdateString = formatShortDateTime(app, lastUpdate); + String description = app.getResources().getString(R.string.updated, lastUpdateString); + + if (lastTimeChecked) { + final long lastCheck = preferenceLastCheck(fileName, settings).get(); + String lastCheckString = formatShortDateTime(app, lastCheck); + if (!lastUpdateString.equals(app.getResources().getString(R.string.shared_string_never))) { + description = description.concat("\n" + app.getResources().getString(R.string.last_time_checked, lastCheckString)); + } + } + return description; + } + + @Override + public boolean onUpdateLocalIndex(String fileName, boolean newValue, final Runnable callback) { + + int frequencyId = preferenceUpdateFrequency(fileName, settings).get(); + int timeOfDateToUpdateId = preferenceTimeOfDayToUpdate(fileName, settings).get(); + final AlarmManager alarmManager = (AlarmManager) app.getSystemService(Context.ALARM_SERVICE); + final PendingIntent alarmIntent = getPendingIntent(app, fileName); + + final CommonPreference liveUpdatePreference = preferenceForLocalIndex(fileName, settings); + liveUpdatePreference.set(newValue); + if (settings.IS_LIVE_UPDATES_ON.get() && liveUpdatePreference.get()) { + runLiveUpdate(getActivity(), fileName, true, new AsyncResponse() { + @Override + public void processFinish() { + runSort(); + if (callback != null) { + callback.run(); + } + } + }); + UpdateFrequency updateFrequency = UpdateFrequency.values()[frequencyId]; + TimeOfDay timeOfDayToUpdate = TimeOfDay.values()[timeOfDateToUpdateId]; + setAlarmForPendingIntent(alarmIntent, alarmManager, updateFrequency, timeOfDayToUpdate); + } else { + alarmManager.cancel(alarmIntent); + runSort(); + } + + return true; + } + + @Override + public void forceUpdateLocal(String fileName, boolean userRequested, final Runnable callback) { + if (settings.IS_LIVE_UPDATES_ON.get()) { + runLiveUpdate(getActivity(), fileName, userRequested, new AsyncResponse() { + @Override + public void processFinish() { + updateList(); + if (callback != null) { + callback.run(); + } + } + }); + } + } + + @Override + public void runSort() { + if (adapter != null) { + adapter.sort(); + } + } + + @Override + public void updateList() { + if (adapter != null) { + adapter.notifyDataSetChanged(); + } + } + + @ColorRes + public static int getDefaultIconColorId(boolean nightMode) { + return nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light; + } + +} diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java index ce9d3d9c5b..08284f6a65 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java @@ -5,18 +5,22 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; +import android.text.format.DateUtils; +import android.text.format.Time; import androidx.annotation.NonNull; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.liveupdates.PerformLiveUpdateAsyncTask.AsyncResponse; import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; -import net.osmand.plus.activities.OsmandActionBarActivity; import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.util.Algorithms; import java.io.File; import java.util.Calendar; +import java.util.concurrent.TimeUnit; public class LiveUpdatesHelper { private static final String UPDATE_TIMES_POSTFIX = "_update_times"; @@ -25,6 +29,7 @@ public class LiveUpdatesHelper { private static final String LIVE_UPDATES_ON_POSTFIX = "_live_updates_on"; private static final String LAST_UPDATE_ATTEMPT_ON_POSTFIX = "_last_update_attempt"; public static final String LOCAL_INDEX_INFO = "local_index_info"; + public static final String LIVE_UPDATES_LAST_AVAILABLE = "live_updates_last_available"; private static final int MORNING_UPDATE_TIME = 8; @@ -45,6 +50,7 @@ public class LiveUpdatesHelper { } return p; } + public static CommonPreference preferenceForLocalIndex( String fileName, OsmandSettings settings) { final String settingId = fileName + LIVE_UPDATES_ON_POSTFIX; @@ -81,9 +87,19 @@ public class LiveUpdatesHelper { return checkPref(settings.registerLongPreference(settingId, DEFAULT_LAST_CHECK)); } - public static String getNameToDisplay(String fileName, OsmandActionBarActivity activity) { - return FileNameTranslationHelper.getFileName(activity, - activity.getMyApplication().getResourceManager().getOsmandRegions(), + public static CommonPreference preferenceLatestUpdateAvailable( + String fileName, OsmandSettings settings) { + final String settingId = fileName + LIVE_UPDATES_LAST_AVAILABLE; + return checkPref(settings.registerLongPreference(settingId, DEFAULT_LAST_CHECK)); + } + + public static CommonPreference preferenceLatestUpdateAvailable(OsmandSettings settings) { + return checkPref(settings.registerLongPreference(LIVE_UPDATES_LAST_AVAILABLE, DEFAULT_LAST_CHECK)); + } + + public static String getNameToDisplay(String fileName, OsmandApplication context) { + return FileNameTranslationHelper.getFileName(context, + context.getResourceManager().getOsmandRegions(), fileName); } @@ -93,6 +109,72 @@ public class LiveUpdatesHelper { return dateFormat.format(dateTime) + " " + timeFormat.format(dateTime); } + public static String formatShortDateTime(Context ctx, long dateTime) { + if (dateTime == -1) { + return ctx.getResources().getString(R.string.shared_string_never); + } else { + StringBuilder result = new StringBuilder(); + if (DateUtils.isToday(dateTime)) { + result.append(ctx.getResources().getString(R.string.today)); + } else { + int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_MONTH; + Time time = new Time(); + time.set(dateTime); + int thenYear = time.year; + time.set(System.currentTimeMillis()); + if (thenYear == time.year) { + flags = flags | DateUtils.FORMAT_NO_YEAR; + } + result.append(DateUtils.formatDateTime(ctx, dateTime, flags)); + } + result.append(" - ").append(DateUtils.formatDateTime(ctx, dateTime, DateUtils.FORMAT_SHOW_TIME)); + return result.toString(); + } + } + + public static String formatHelpDateTime(Context ctx, UpdateFrequency updateFrequency, TimeOfDay timeOfDay, long lastDateTime) { + if (lastDateTime == -1) { + lastDateTime = System.currentTimeMillis(); + } + switch (updateFrequency) { + case DAILY: { + return helpDateTimeBuilder(ctx, R.string.live_update_frequency_day_variant, lastDateTime, 1, TimeUnit.DAYS, timeOfDay); + } + case WEEKLY: { + return helpDateTimeBuilder(ctx, R.string.live_update_frequency_week_variant, lastDateTime, 7, TimeUnit.DAYS, timeOfDay); + } + default: + case HOURLY: { + return helpDateTimeBuilder(ctx, R.string.live_update_frequency_hour_variant, lastDateTime, 1, TimeUnit.HOURS, timeOfDay); + } + } + } + + private static String helpDateTimeBuilder(Context ctx, int stringResId, long lastDateTime, long sourceDuration, TimeUnit sourceUnit, TimeOfDay timeOfDay) { + long nextDateTime = lastDateTime + TimeUnit.MILLISECONDS.convert(sourceDuration, sourceUnit); + + if (sourceUnit != TimeUnit.HOURS) { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(nextDateTime); + calendar.set(Calendar.HOUR_OF_DAY, timeOfDay == TimeOfDay.MORNING ? MORNING_UPDATE_TIME : NIGHT_UPDATE_TIME); + nextDateTime = calendar.getTimeInMillis(); + } + + int flagsBase = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_MONTH; + int flagsBaseNoYear = flagsBase | DateUtils.FORMAT_NO_YEAR; + int flagsTime = DateUtils.FORMAT_SHOW_TIME; + + Time checkYearTime = new Time(); + checkYearTime.set(nextDateTime); + int thenYear = checkYearTime.year; + checkYearTime.set(System.currentTimeMillis()); + + String date = DateUtils.formatDateTime(ctx, nextDateTime, thenYear == checkYearTime.year ? flagsBaseNoYear : flagsBase); + String time = DateUtils.formatDateTime(ctx, nextDateTime, flagsTime); + + return ctx.getResources().getString(stringResId, DateUtils.isToday(nextDateTime) ? "" : " " + date, time); + } + public static PendingIntent getPendingIntent(@NonNull Context context, @NonNull String fileName) { Intent intent = new Intent(context, LiveUpdatesAlarmReceiver.class); @@ -168,6 +250,7 @@ public class LiveUpdatesHelper { public int getLocalizedId() { return localizedId; } + public long getTime() { return time; } @@ -177,4 +260,9 @@ public class LiveUpdatesHelper { final String fnExt = Algorithms.getFileNameWithoutExtension(new File(fileName)); new PerformLiveUpdateAsyncTask(context, fileName, userRequested).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, fnExt); } + + public static void runLiveUpdate(Context context, final String fileName, boolean userRequested, final AsyncResponse runOnPost) { + final String fnExt = Algorithms.getFileNameWithoutExtension(new File(fileName)); + new PerformLiveUpdateAsyncTask(context, fileName, userRequested, runOnPost).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, fnExt); + } } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java index d27e733d7a..46438a03b2 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java @@ -54,10 +54,10 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment { private static final String LOCAL_INDEX_FILE_NAME = "local_index_file_name"; private TextView sizeTextView; - + private String fileName; private String fileNameWithoutExtension; - + @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { @@ -77,7 +77,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment { final View updateTimesOfDayLayout = view.findViewById(R.id.updateTimesOfDayLayout); sizeTextView = (TextView) view.findViewById(R.id.sizeTextView); - regionNameTextView.setText(getNameToDisplay(fileName, getMyActivity())); + regionNameTextView.setText(getNameToDisplay(fileName, getMyActivity().getMyApplication())); fileNameWithoutExtension = Algorithms.getFileNameWithoutExtension(new File(fileName)); final IncrementalChangesManager changesManager = getMyApplication().getResourceManager().getChangesManager(); final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java new file mode 100644 index 0000000000..3400652710 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java @@ -0,0 +1,520 @@ +package net.osmand.plus.liveupdates; + +import android.graphics.Typeface; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.text.SpannableString; +import android.text.TextUtils; +import android.text.style.StyleSpan; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.CompoundButton; +import android.widget.LinearLayout; + +import androidx.annotation.ColorRes; +import androidx.annotation.NonNull; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.appcompat.widget.AppCompatImageView; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; + +import net.osmand.AndroidUtils; +import net.osmand.PlatformUtil; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.UiUtilities; +import net.osmand.plus.base.MenuBottomSheetDialogFragment; +import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; +import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton; +import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription; +import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem; +import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem; +import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem; +import net.osmand.plus.base.bottomsheetmenu.simpleitems.ShortDescriptionItem; +import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.liveupdates.LiveUpdatesClearDialogFragment.OnRefreshLiveUpdates; +import net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay; +import net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency; +import net.osmand.plus.resources.IncrementalChangesManager; +import net.osmand.plus.settings.backend.CommonPreference; +import net.osmand.plus.settings.backend.OsmandSettings; +import net.osmand.plus.widgets.MultiStateToggleButton; +import net.osmand.plus.widgets.MultiStateToggleButton.OnRadioItemClickListener; +import net.osmand.plus.widgets.MultiStateToggleButton.RadioItem; +import net.osmand.plus.widgets.TextViewEx; +import net.osmand.util.Algorithms; + +import org.apache.commons.logging.Log; + +import java.util.Arrays; + +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatHelpDateTime; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatShortDateTime; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceDownloadViaWiFi; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLatestUpdateAvailable; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryTextColorId; +import static net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.getCustomButtonView; +import static net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.updateCustomButtonView; + +public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogFragment implements OnRefreshLiveUpdates { + + public static final String TAG = LiveUpdatesSettingsDialogFragmentNew.class.getSimpleName(); + private static final Log LOG = PlatformUtil.getLog(LiveUpdatesSettingsDialogFragmentNew.class); + private static final String LOCAL_INDEX_FILE_NAME = "local_index_file_name"; + + private OsmandApplication app; + private OsmandSettings settings; + + private String fileName; + private int itemLastCheckIndex = -1; + private int itemLiveUpdateIndex = -1; + private int itemFrequencyButtonsIndex = -1; + private int itemTimeOfDayButtonsIndex = -1; + private int itemFrequencyHelpMessageIndex = -1; + private int itemSizeIndex = -1; + private int itemOnWiFiIndex = -1; + + public static void showInstance(@NonNull FragmentManager fragmentManager, Fragment target, String fileName) { + if (!fragmentManager.isStateSaved()) { + LiveUpdatesSettingsDialogFragmentNew fragment = new LiveUpdatesSettingsDialogFragmentNew(); + fragment.setTargetFragment(target, 0); + fragment.fileName = fileName; + fragment.show(fragmentManager, TAG); + } + } + + @Override + public void createMenuItems(Bundle savedInstanceState) { + app = getMyApplication(); + settings = app.getSettings(); + LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); + final OnLiveUpdatesForLocalChange confirmationInterface = (OnLiveUpdatesForLocalChange) getTargetFragment(); + final CommonPreference liveUpdatePreference = preferenceForLocalIndex(fileName, settings); + final CommonPreference downloadViaWiFiPreference = preferenceDownloadViaWiFi(fileName, settings); + final CommonPreference frequencyPreference = preferenceUpdateFrequency(fileName, settings); + final CommonPreference timeOfDayPreference = preferenceTimeOfDayToUpdate(fileName, settings); + final String on = getString(R.string.shared_string_enabled); + final String off = getString(R.string.shared_string_disabled); + int dp4 = getResources().getDimensionPixelSize(R.dimen.context_menu_buttons_padding_bottom); + int dp6 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_tiny); + int dp8 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_small); + int dp12 = getResources().getDimensionPixelSize(R.dimen.content_padding_small); + int dp20 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_large); + int dp40 = getResources().getDimensionPixelSize(R.dimen.list_header_height); + int dp56 = getResources().getDimensionPixelSize(R.dimen.bottom_sheet_selected_item_title_height); + + if (savedInstanceState != null) { + if (savedInstanceState.containsKey(LOCAL_INDEX_FILE_NAME)) { + fileName = savedInstanceState.getString(LOCAL_INDEX_FILE_NAME); + } + } + + items.add(new SimpleBottomSheetItem.Builder() + .setTitle(getNameToDisplay(fileName, app)) + .setTitleColorId(getPrimaryTextColorId(nightMode)) + .setLayoutId(R.layout.bottom_sheet_item_title_big) + .create()); + + items.add(new ShortDescriptionItem.Builder() + .setDescription(getLastCheckString()) + .setDescriptionColorId(getSecondaryTextColorId(nightMode)) + .setDescriptionMaxLines(2) + .setLayoutId(R.layout.bottom_sheet_item_description) + .create()); + itemLastCheckIndex = items.size() - 1; + + View itemLiveUpdate = getCustomButtonView(app, null, liveUpdatePreference.get(), nightMode); + View itemLiveUpdateButton = itemLiveUpdate.findViewById(R.id.button_container); + itemLiveUpdateButton.setMinimumHeight(dp56); + items.add(new BottomSheetItemWithCompoundButton.Builder() + .setChecked(liveUpdatePreference.get()) + .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (confirmationInterface != null + && confirmationInterface.onUpdateLocalIndex(fileName, isChecked, new Runnable() { + @Override + public void run() { + if (itemLastCheckIndex != -1) { + ((BottomSheetItemWithDescription) items.get(itemLastCheckIndex)) + .setDescription(getLastCheckString()); + } + if (itemFrequencyHelpMessageIndex != -1) { + ((BottomSheetItemWithDescription) items.get(itemFrequencyHelpMessageIndex)) + .setDescription(getFrequencyHelpMessage()); + } + if (itemSizeIndex != -1) { + ((BottomSheetItemWithDescription) items.get(itemSizeIndex)) + .setDescription(getUpdatesSizeStr()); + } + } + })) { + if (itemLiveUpdateIndex != -1) { + BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(itemLiveUpdateIndex); + button.setTitle(isChecked ? on : off); + button.setChecked(isChecked); + updateCustomButtonView(app, null, button.getView(), isChecked, nightMode); + } + for (int i = 0; i < items.size(); i++) { + if (i == itemOnWiFiIndex || i == itemFrequencyButtonsIndex || i == itemTimeOfDayButtonsIndex) { + items.get(i).getView().setEnabled(isChecked); + } + } + } + } + }) + .setTitle(liveUpdatePreference.get() ? on : off) + .setTitleColorId(getActiveTabTextColorId(nightMode)) + .setCustomView(itemLiveUpdate) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (itemLiveUpdateIndex != -1) { + BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(itemLiveUpdateIndex); + button.setChecked(!button.isChecked()); + } + } + }) + .create()); + itemLiveUpdateIndex = items.size() - 1; + + TextViewEx frequencyTitle = (TextViewEx) inflater.inflate(R.layout.bottom_sheet_item_title, null); + frequencyTitle.setHeight(AndroidUtils.dpToPx(app, 48)); + frequencyTitle.setMinimumHeight(AndroidUtils.dpToPx(app, 48)); + frequencyTitle.setText(R.string.update_frequency); + AndroidUtils.setPadding(frequencyTitle, frequencyTitle.getPaddingLeft(), 0, frequencyTitle.getPaddingRight(), 0); + AndroidUtils.setTextPrimaryColor(app, frequencyTitle, nightMode); + items.add(new BaseBottomSheetItem.Builder() + .setCustomView(frequencyTitle) + .create()); + + LinearLayout itemFrequencyButtons = (LinearLayout) inflater.inflate(R.layout.custom_radio_buttons, null); + LinearLayout.MarginLayoutParams itemFrequencyParams = new LinearLayout.MarginLayoutParams(LinearLayout.MarginLayoutParams.MATCH_PARENT, LinearLayout.MarginLayoutParams.WRAP_CONTENT); + AndroidUtils.setMargins(itemFrequencyParams, AndroidUtils.dpToPx(app, 16), 0, AndroidUtils.dpToPx(app, 16), 20); + itemFrequencyButtons.setLayoutParams(itemFrequencyParams); + + String hourly = getString(R.string.hourly); + String daily = getString(R.string.daily); + String weekly = getString(R.string.weekly); + RadioItem hourlyButton = new RadioItem(hourly); + RadioItem dailyButton = new RadioItem(daily); + RadioItem weeklyButton = new RadioItem(weekly); + MultiStateToggleButton frequencyToggleButton = new MultiStateToggleButton(app, itemFrequencyButtons, nightMode); + frequencyToggleButton.setItems(hourlyButton, dailyButton, weeklyButton); + setSelectedRadioItem(frequencyToggleButton, frequencyPreference.get(), hourlyButton, dailyButton, weeklyButton); + + items.add(new BaseBottomSheetItem.Builder() + .setCustomView(itemFrequencyButtons) + .create()); + itemFrequencyButtonsIndex = items.size() - 1; + + TextViewEx timeOfDayTitle = (TextViewEx) inflater.inflate(R.layout.bottom_sheet_item_title, null); + timeOfDayTitle.setHeight(dp40); + timeOfDayTitle.setMinimumHeight(dp40); + timeOfDayTitle.setText(R.string.update_time); + AndroidUtils.setPadding(timeOfDayTitle, timeOfDayTitle.getPaddingLeft(), 0, timeOfDayTitle.getPaddingRight(), 0); + AndroidUtils.setTextPrimaryColor(app, timeOfDayTitle, nightMode); + items.add(new BaseBottomSheetItem.Builder() + .setCustomView(timeOfDayTitle) + .create()); + + LinearLayout itemTimeOfDayButtons = (LinearLayout) inflater.inflate(R.layout.custom_radio_buttons, null); + LinearLayout.MarginLayoutParams itemTimeOfDayParams = new LinearLayout.MarginLayoutParams(LinearLayout.MarginLayoutParams.MATCH_PARENT, LinearLayout.MarginLayoutParams.WRAP_CONTENT); + AndroidUtils.setMargins(itemTimeOfDayParams, AndroidUtils.dpToPx(app, 16), 0, AndroidUtils.dpToPx(app, 16), AndroidUtils.dpToPx(app, 10)); + itemTimeOfDayButtons.setLayoutParams(itemTimeOfDayParams); + + String morning = getString(R.string.morning); + String night = getString(R.string.night); + RadioItem morningButton = new RadioItem(morning); + RadioItem nightButton = new RadioItem(night); + MultiStateToggleButton timeOfDayToggleButton = new MultiStateToggleButton(app, itemTimeOfDayButtons, nightMode); + timeOfDayToggleButton.setItems(morningButton, nightButton); + setSelectedRadioItem(timeOfDayToggleButton, timeOfDayPreference.get(), morningButton, nightButton); + refreshTimeOfDayLayout(frequencyPreference.get(), itemTimeOfDayButtons, timeOfDayTitle); + + hourlyButton.setOnClickListener(getFrequencyButtonListener(UpdateFrequency.HOURLY, itemTimeOfDayButtons, timeOfDayTitle)); + dailyButton.setOnClickListener(getFrequencyButtonListener(UpdateFrequency.DAILY, itemTimeOfDayButtons, timeOfDayTitle)); + weeklyButton.setOnClickListener(getFrequencyButtonListener(UpdateFrequency.WEEKLY, itemTimeOfDayButtons, timeOfDayTitle)); + morningButton.setOnClickListener(getTimeOfDayButtonListener(TimeOfDay.MORNING)); + nightButton.setOnClickListener(getTimeOfDayButtonListener(TimeOfDay.NIGHT)); + + items.add(new BaseBottomSheetItem.Builder() + .setCustomView(itemTimeOfDayButtons) + .create() + ); + itemTimeOfDayButtonsIndex = items.size() - 1; + + items.add(new ShortDescriptionItem.Builder() + .setDescription(getFrequencyHelpMessage()) + .setDescriptionColorId(getSecondaryTextColorId(nightMode)) + .setLayoutId(R.layout.bottom_sheet_item_description) + .create()); + itemFrequencyHelpMessageIndex = items.size() - 1; + + LinearLayout itemUpdateNowButton = (LinearLayout) inflater.inflate(R.layout.bottom_sheet_button_with_icon_center, null); + LinearLayout.MarginLayoutParams itemUpdateNowParams = new LinearLayout.MarginLayoutParams(LinearLayout.MarginLayoutParams.MATCH_PARENT, AndroidUtils.dpToPx(app, 36)); + AndroidUtils.setMargins(itemUpdateNowParams, AndroidUtils.dpToPx(app, 12), AndroidUtils.dpToPx(app, 12), AndroidUtils.dpToPx(app, 16), AndroidUtils.dpToPx(app, 12)); + itemUpdateNowButton.setLayoutParams(itemUpdateNowParams); + ((AppCompatImageView) itemUpdateNowButton.findViewById(R.id.button_icon)).setImageDrawable( + ContextCompat.getDrawable(app, R.drawable.ic_action_refresh_dark)); + UiUtilities.setupDialogButton(nightMode, itemUpdateNowButton, UiUtilities.DialogButtonType.SECONDARY, app.getResources().getString(R.string.update_now)); + itemUpdateNowButton.setMinimumHeight(AndroidUtils.dpToPx(app, app.getResources().getDimension(R.dimen.dialog_button_height))); + + items.add(new BaseBottomSheetItem.Builder() + .setCustomView(itemUpdateNowButton) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (!settings.isInternetConnectionAvailable()) { + app.showShortToastMessage(R.string.no_internet_connection); + } else { + if (confirmationInterface != null) { + confirmationInterface.forceUpdateLocal(fileName, true, new Runnable() { + @Override + public void run() { + if (itemLastCheckIndex != -1) { + ((BottomSheetItemWithDescription) items.get(itemLastCheckIndex)) + .setDescription(getLastCheckString()); + } + if (itemFrequencyHelpMessageIndex != -1) { + ((BottomSheetItemWithDescription) items.get(itemFrequencyHelpMessageIndex)) + .setDescription(getFrequencyHelpMessage()); + } + if (itemSizeIndex != -1) { + ((BottomSheetItemWithDescription) items.get(itemSizeIndex)) + .setDescription(getUpdatesSizeStr()); + } + } + }); + } + } + } + }) + .create()); + + items.add(createDividerItem()); + + int iconDeleteColor = ContextCompat.getColor(app, R.color.color_osm_edit_delete); + Drawable iconDelete = AppCompatResources.getDrawable(app, R.drawable.ic_action_delete_dark); + + items.add( + new BottomSheetItemWithDescription.Builder() + .setDescription(getUpdatesSizeStr()) + .setIcon(UiUtilities.tintDrawable(iconDelete, iconDeleteColor)) + .setTitle(app.getResources().getString(R.string.updates_size)) + .setLayoutId(R.layout.bottom_sheet_item_with_descr_icon_right) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (getUpdatesSize() > 0) { + if (getFragmentManager() != null) { + LiveUpdatesClearDialogFragment + .showInstance(getFragmentManager(), + LiveUpdatesSettingsDialogFragmentNew.this, fileName); + } + } + } + }) + .create() + ); + itemSizeIndex = items.size() - 1; + + items.add(createDividerItem()); + + items.add( + new BottomSheetItemWithCompoundButton.Builder() + .setChecked(downloadViaWiFiPreference.get()) + .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + downloadViaWiFiPreference.set(isChecked); + } + }) + .setDescription(downloadViaWiFiPreference.get() ? on : off) + .setIconHidden(true) + .setTitle(app.getResources().getString(R.string.only_download_over_wifi)) + .setLayoutId(R.layout.bottom_sheet_item_with_descr_and_switch_56dp) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (liveUpdatePreference.get() && itemOnWiFiIndex != -1) { + BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(itemOnWiFiIndex); + button.setChecked(!button.isChecked()); + button.setDescription(downloadViaWiFiPreference.get() ? on : off); + } + } + }) + .create() + ); + itemOnWiFiIndex = items.size() - 1; + + items.add(new DividerSpaceItem(app, dp20)); + + } + + @Override + public void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + outState.putString(LOCAL_INDEX_FILE_NAME, fileName); + } + + + protected SpannableString getLastCheckString() { + final long lastUpdate = preferenceLatestUpdateAvailable(fileName, settings).get(); + String updatedTimeStr = app.getResources().getString(R.string.updated, formatShortDateTime(app, lastUpdate)); + SpannableString updatedTimeSpannable = SpannableString.valueOf(updatedTimeStr); + + if (!updatedTimeStr.contains(app.getResources().getString(R.string.shared_string_never))) { + SpannableString fullUpdatedTimeSpannable = UiUtilities.createSpannableString(updatedTimeStr, + new StyleSpan(Typeface.BOLD), updatedTimeStr.substring(updatedTimeStr.indexOf(" - "), updatedTimeStr.length() - 1)); + + final long lastCheck = preferenceLastCheck(fileName, settings).get(); + String lastCheckStr = "\n" + app.getResources().getString(R.string.last_time_checked, formatShortDateTime(app, lastCheck)); + + SpannableString lastCheckTimeSpannable = UiUtilities.createSpannableString(lastCheckStr, + new StyleSpan(Typeface.BOLD), lastCheckStr.substring(lastCheckStr.lastIndexOf(" - "))); + + return SpannableString.valueOf(TextUtils.concat(fullUpdatedTimeSpannable, lastCheckTimeSpannable)); + } + return updatedTimeSpannable; + } + + protected String getFrequencyHelpMessage() { + CommonPreference updateFrequency = preferenceUpdateFrequency(fileName, settings); + CommonPreference timeOfDayToUpdate = preferenceTimeOfDayToUpdate(fileName, settings); + final long lastUpdate = preferenceLatestUpdateAvailable(fileName, settings).get(); + return formatHelpDateTime(app, UpdateFrequency.values()[updateFrequency.get()], TimeOfDay.values()[timeOfDayToUpdate.get()], lastUpdate); + } + + private long getUpdatesSize() { + IncrementalChangesManager changesManager = app.getResourceManager().getChangesManager(); + String fileNameWithoutExt = Algorithms.getFileNameWithoutExtension(fileName); + return changesManager.getUpdatesSize(fileNameWithoutExt); + } + + private String getUpdatesSizeStr() { + long updatesSize = getUpdatesSize(); + return updatesSize > 0 + ? AndroidUtils.formatSize(app, updatesSize) + : app.getResources().getString(R.string.ltr_or_rtl_combine_via_space, "0.0", "kB"); + } + + + private BaseBottomSheetItem createDividerItem() { + DividerItem dividerItem = new DividerItem(app); + int start = app.getResources().getDimensionPixelSize(R.dimen.content_padding); + int vertical = getResources().getDimensionPixelSize(R.dimen.content_padding_small_half); + dividerItem.setMargins(start, vertical, 0, vertical); + return dividerItem; + } + + private void setSelectedRadioItem(MultiStateToggleButton toggleButton, int position, RadioItem... buttons) { + toggleButton.setSelectedItem(buttons[position]); + } + + private void refreshTimeOfDayLayout(int position, View... timeOfDayLayouts) { + switch (UpdateFrequency.values()[position]) { + case HOURLY: + for (View timeOfDayLayout : timeOfDayLayouts) { + AndroidUiHelper.updateVisibility(timeOfDayLayout, false); + } + break; + case DAILY: + case WEEKLY: + for (View timeOfDayLayout : timeOfDayLayouts) { + AndroidUiHelper.updateVisibility(timeOfDayLayout, true); + } + break; + } + } + + private OnRadioItemClickListener getFrequencyButtonListener(@NonNull final UpdateFrequency type, final View... timeOfDayLayouts) { + return new OnRadioItemClickListener() { + @Override + public boolean onRadioItemClick(RadioItem radioItem, View view) { + final CommonPreference frequencyPreference = preferenceUpdateFrequency(fileName, settings); + setOnRadioItemClick(frequencyPreference, type.ordinal(), timeOfDayLayouts); + return true; + } + }; + } + + private OnRadioItemClickListener getTimeOfDayButtonListener(@NonNull final TimeOfDay type) { + return new OnRadioItemClickListener() { + @Override + public boolean onRadioItemClick(RadioItem radioItem, View view) { + final CommonPreference timeOfDayPreference = preferenceTimeOfDayToUpdate(fileName, settings); + setOnRadioItemClick(timeOfDayPreference, type.ordinal()); + return true; + } + }; + } + + private void setOnRadioItemClick(CommonPreference preference, int newValue, View... timeOfDayLayouts) { + CommonPreference liveUpdatePreference = preferenceForLocalIndex(fileName, settings); + if (liveUpdatePreference.get()) { + preference.set(newValue); + if (!Algorithms.isEmpty(Arrays.asList(timeOfDayLayouts))) { + refreshTimeOfDayLayout(newValue, timeOfDayLayouts); + } + if (itemFrequencyHelpMessageIndex != -1) { + ((BottomSheetItemWithDescription) items.get(itemFrequencyHelpMessageIndex)) + .setDescription(getFrequencyHelpMessage()); + } + OnLiveUpdatesForLocalChange confirmationInterface = (OnLiveUpdatesForLocalChange) getTargetFragment(); + if (confirmationInterface != null) { + confirmationInterface.updateList(); + } + } + } + + @Override + public void onUpdateStates() { + final OnLiveUpdatesForLocalChange confirmationInterface = (OnLiveUpdatesForLocalChange) getTargetFragment(); + if (confirmationInterface != null) { + confirmationInterface.updateList(); + } + if (itemSizeIndex != -1) { + ((BottomSheetItemWithDescription) items.get(itemSizeIndex)) + .setDescription(getUpdatesSizeStr()); + } + } + + public interface OnLiveUpdatesForLocalChange { + + boolean onUpdateLocalIndex(String fileName, boolean newValue, Runnable callback); + + void forceUpdateLocal(String fileName, boolean userRequested, Runnable callback); + + void runSort(); + + void updateList(); + } + + @ColorRes + public static int getPrimaryTextColorId(boolean nightMode) { + return nightMode ? R.color.text_color_primary_dark : R.color.text_color_primary_light; + } + + @ColorRes + public static int getActiveTabTextColorId(boolean nightMode) { + return nightMode ? R.color.text_color_tab_active_dark : R.color.text_color_tab_active_light; + } + + @ColorRes + public static int getActivePrimaryColorId(boolean nightMode) { + return nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light; + } + + @Override + protected int getDismissButtonTextId() { + return R.string.shared_string_close; + } + +} diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java b/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java index 6014ebbc88..7cff8422dd 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java @@ -2,12 +2,10 @@ package net.osmand.plus.liveupdates; import android.content.Intent; import android.content.res.Resources; -import android.os.AsyncTask; import android.os.Bundle; import android.view.MenuItem; import android.view.View; -import androidx.appcompat.app.ActionBar; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; @@ -16,33 +14,22 @@ import androidx.viewpager.widget.ViewPager; import com.google.android.material.tabs.TabLayout; -import net.osmand.AndroidNetworkUtils; import net.osmand.PlatformUtil; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogListener; import net.osmand.plus.download.AbstractDownloadActivity; -import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents; import net.osmand.plus.inapp.InAppPurchaseHelper; import org.apache.commons.logging.Log; -import java.lang.ref.WeakReference; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; -import java.util.TimeZone; - -public class OsmLiveActivity extends AbstractDownloadActivity implements DownloadEvents, ChoosePlanDialogListener { +public class OsmLiveActivity extends AbstractDownloadActivity implements ChoosePlanDialogListener { private final static Log LOG = PlatformUtil.getLog(OsmLiveActivity.class); public final static String SHOW_SETTINGS_ONLY_INTENT_PARAM = "show_settings_only_intent_param"; private LiveUpdatesFragmentPagerAdapter pagerAdapter; private boolean showSettingOnly; - private GetLastUpdateDateTask getLastUpdateDateTask; - private static final String URL = "https://osmand.net/api/osmlive_status"; @Override protected void onCreate(Bundle savedInstanceState) { @@ -67,9 +54,6 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa tabLayout.setupWithViewPager(viewPager); if (showSettingOnly) { tabLayout.setVisibility(View.GONE); - } else { - getLastUpdateDateTask = new GetLastUpdateDateTask(this); - getLastUpdateDateTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } boolean nightMode = !app.getSettings().isLightContent(); @@ -99,20 +83,6 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa } } - @Override - protected void onPause() { - super.onPause(); - getMyApplication().getDownloadThread().resetUiActivity(this); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - if (getLastUpdateDateTask != null) { - getLastUpdateDateTask.cancel(true); - } - } - @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); @@ -132,64 +102,9 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa return true; } - @Override - public void newDownloadIndexes() { - } - - @Override - public void downloadInProgress() { - - } - - @Override - public void downloadHasFinished() { - ((LiveUpdatesFragment) pagerAdapter.fragments[0]).notifyLiveUpdatesChanged(); - } - - private static class GetLastUpdateDateTask extends AsyncTask { - - private OsmandApplication app; - private WeakReference activity; - - GetLastUpdateDateTask(OsmLiveActivity activity) { - this.activity = new WeakReference<>(activity); - app = activity.getMyApplication(); - } - - @Override - protected String doInBackground(Void... params) { - try { - return AndroidNetworkUtils.sendRequest(app, URL, null, "Requesting map updates info...", false, false); - } catch (Exception e) { - LOG.error("Error: " + "Requesting map updates info error", e); - return null; - } - } - - @Override - protected void onPostExecute(String response) { - OsmLiveActivity a = activity.get(); - if (response != null && a != null) { - ActionBar actionBar = a.getSupportActionBar(); - if (actionBar != null) { - SimpleDateFormat source = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US); - source.setTimeZone(TimeZone.getTimeZone("UTC")); - SimpleDateFormat dest = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US); - dest.setTimeZone(TimeZone.getDefault()); - try { - Date parsed = source.parse(response); - actionBar.setSubtitle(dest.format(parsed)); - } catch (ParseException e) { - e.printStackTrace(); - } - } - } - } - } - public static class LiveUpdatesFragmentPagerAdapter extends FragmentPagerAdapter { - private final Fragment[] fragments = new Fragment[] { new LiveUpdatesFragment(), new ReportsFragment() }; - private static final int[] titleIds = new int[] { LiveUpdatesFragment.TITLE, ReportsFragment.TITLE }; + private final Fragment[] fragments = new Fragment[] { new ReportsFragment() }; + private static final int[] titleIds = new int[] { ReportsFragment.TITLE }; private final String[] titles; private final boolean showSettingsOnly; diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java b/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java index 4cebb245f9..176f9c7c52 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java @@ -7,8 +7,10 @@ import android.os.AsyncTask; import androidx.annotation.NonNull; +import net.osmand.AndroidNetworkUtils; import net.osmand.PlatformUtil; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.download.DownloadActivity; import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; @@ -17,12 +19,20 @@ import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.IndexItem; import net.osmand.plus.resources.IncrementalChangesManager; +import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.Locale; +import java.util.TimeZone; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLatestUpdateAvailable; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; public class PerformLiveUpdateAsyncTask @@ -34,6 +44,11 @@ public class PerformLiveUpdateAsyncTask @NonNull private final String localIndexFileName; private final boolean userRequested; + private AsyncResponse runOnPost; + + public interface AsyncResponse { + void processFinish(); + } public PerformLiveUpdateAsyncTask(@NonNull Context context, @NonNull String localIndexFileName, @@ -43,6 +58,16 @@ public class PerformLiveUpdateAsyncTask this.userRequested = userRequested; } + public PerformLiveUpdateAsyncTask(@NonNull Context context, + @NonNull String localIndexFileName, + boolean userRequested, + AsyncResponse runOnPost) { + this.context = context; + this.localIndexFileName = localIndexFileName; + this.userRequested = userRequested; + this.runOnPost = runOnPost; + } + @Override protected void onPreExecute() { LOG.debug("onPreExecute"); @@ -52,7 +77,7 @@ public class PerformLiveUpdateAsyncTask } final OsmandApplication myApplication = getMyApplication(); CommonPreference lastCheckPreference = - LiveUpdatesHelper.preferenceLastCheck(localIndexFileName, myApplication.getSettings()); + preferenceLastCheck(localIndexFileName, myApplication.getSettings()); lastCheckPreference.set(System.currentTimeMillis()); } @@ -129,16 +154,24 @@ public class PerformLiveUpdateAsyncTask if (context instanceof DownloadIndexesThread.DownloadEvents) { ((DownloadIndexesThread.DownloadEvents) context).downloadInProgress(); } + updateLatestAvailability(application, localIndexFileName); + if (runOnPost != null) { + runOnPost.processFinish(); + } } else { LOG.debug("onPostExecute: Not enough space for updates"); } - } + } LOG.debug("onPostExecute: No internet connection"); } } else { if (context instanceof DownloadIndexesThread.DownloadEvents) { ((DownloadIndexesThread.DownloadEvents) context).downloadInProgress(); - if (userRequested && context instanceof OsmLiveActivity) { + if (userRequested && context instanceof DownloadActivity) { + updateLatestAvailability(application, localIndexFileName); + if (runOnPost != null) { + runOnPost.processFinish(); + } application.showShortToastMessage(R.string.no_updates_available); } } @@ -170,4 +203,25 @@ public class PerformLiveUpdateAsyncTask settings.LIVE_UPDATES_RETRIES.resetToDefault(); } } + + private void updateLatestAvailability(OsmandApplication app, @NonNull String localIndexFileName) { + OsmandSettings settings = app.getSettings(); + try { + String latestUpdateAvailable = AndroidNetworkUtils.sendRequest( + app, LiveUpdatesFragmentNew.URL, null, "Requesting map updates info...", false, false); + if (!Algorithms.isEmpty(latestUpdateAvailable)) { + SimpleDateFormat source = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US); + source.setTimeZone(TimeZone.getTimeZone("UTC")); + Date parsed = source.parse(latestUpdateAvailable); + if (parsed != null) { + long dateTime = parsed.getTime(); + preferenceLatestUpdateAvailable(settings).set(dateTime); + } + } + } catch (ParseException e) { + e.printStackTrace(); + } + long latestUpdateAvailable = preferenceLatestUpdateAvailable(settings).get(); + preferenceLatestUpdateAvailable(localIndexFileName, settings).set(latestUpdateAvailable); + } } diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java index 8b8b241b1b..3588d49483 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java @@ -6,6 +6,8 @@ import android.graphics.drawable.LayerDrawable; import android.os.Build; import android.os.Bundle; import android.view.View; +import android.widget.CompoundButton; +import android.widget.LinearLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -32,6 +34,10 @@ import net.osmand.plus.settings.preferences.SwitchPreferenceEx; import org.apache.commons.logging.Log; +import static net.osmand.plus.UiUtilities.CompoundButtonType.TOOLBAR; +import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.getActivePrimaryColorId; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryIconColorId; + public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet { public static final String TAG = BooleanPreferenceBottomSheet.class.getSimpleName(); @@ -125,18 +131,30 @@ public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet { public static View getCustomButtonView(OsmandApplication app, ApplicationMode mode, boolean checked, boolean nightMode) { View customView = UiUtilities.getInflater(app, nightMode).inflate(R.layout.bottom_sheet_item_preference_switch, null); updateCustomButtonView(app, mode, customView, checked, nightMode); - + if (mode == null) { + CompoundButton button = (CompoundButton) customView.findViewById(R.id.compound_button); + UiUtilities.setupCompoundButton(button, nightMode, TOOLBAR); + } return customView; } public static void updateCustomButtonView(OsmandApplication app, ApplicationMode mode, View customView, boolean checked, boolean nightMode) { Context themedCtx = UiUtilities.getThemedContext(app, nightMode); - View buttonView = customView.findViewById(R.id.button_container); + LinearLayout buttonView = customView.findViewById(R.id.button_container); - int colorRes = mode.getIconColorInfo().getColor(nightMode); - int color = checked ? ContextCompat.getColor(themedCtx, colorRes) : AndroidUtils.getColorFromAttr(themedCtx, R.attr.divider_color_basic); - int bgColor = UiUtilities.getColorWithAlpha(color, checked ? 0.1f : 0.5f); - int selectedColor = UiUtilities.getColorWithAlpha(color, checked ? 0.3f : 0.5f); + int bgColor; + int selectedColor; + if (mode != null) { + int colorRes = mode.getIconColorInfo().getColor(nightMode); + int color = checked ? ContextCompat.getColor(themedCtx, colorRes) : AndroidUtils.getColorFromAttr(themedCtx, R.attr.divider_color_basic); + bgColor = UiUtilities.getColorWithAlpha(color, checked ? 0.1f : 0.5f); + selectedColor = UiUtilities.getColorWithAlpha(color, checked ? 0.3f : 0.5f); + } else { + bgColor = ContextCompat.getColor(app, checked + ? getActivePrimaryColorId(nightMode) : getSecondaryIconColorId(nightMode)); + selectedColor = UiUtilities.getColorWithAlpha( + ContextCompat.getColor(app, getActivePrimaryColorId(nightMode)), checked ? 0.3f : 0.5f); + } int bgResId = R.drawable.rectangle_rounded_right; if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { From 7a5ffdeeb66b17d052e20183901ac63071ebe10b Mon Sep 17 00:00:00 2001 From: Skalii Date: Sat, 6 Mar 2021 17:56:10 +0200 Subject: [PATCH 008/250] fix using new icon refresh --- .../src/net/osmand/plus/download/ui/UpdatesIndexFragment.java | 2 +- .../plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java index 7b32ecc06d..0eaaeb8bfe 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java @@ -393,7 +393,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download AndroidUtils.setTextPrimaryColor(app, tvTitle, nightMode); countView = view.findViewById(R.id.description); AndroidUtils.setTextSecondaryColor(app, countView, nightMode); - Drawable additionalIconDrawable = AppCompatResources.getDrawable(app, R.drawable.ic_action_refresh_dark); + Drawable additionalIconDrawable = AppCompatResources.getDrawable(app, R.drawable.ic_action_update); UiUtilities.tintDrawable(additionalIconDrawable, ContextCompat.getColor(app, getDefaultIconColorId(nightMode))); ((ImageView) view.findViewById(R.id.additional_button_icon)).setImageDrawable(additionalIconDrawable); LinearLayout additionalButton = view.findViewById(R.id.additional_button); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java index 3400652710..6d1d403e91 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java @@ -262,7 +262,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF AndroidUtils.setMargins(itemUpdateNowParams, AndroidUtils.dpToPx(app, 12), AndroidUtils.dpToPx(app, 12), AndroidUtils.dpToPx(app, 16), AndroidUtils.dpToPx(app, 12)); itemUpdateNowButton.setLayoutParams(itemUpdateNowParams); ((AppCompatImageView) itemUpdateNowButton.findViewById(R.id.button_icon)).setImageDrawable( - ContextCompat.getDrawable(app, R.drawable.ic_action_refresh_dark)); + ContextCompat.getDrawable(app, R.drawable.ic_action_update)); UiUtilities.setupDialogButton(nightMode, itemUpdateNowButton, UiUtilities.DialogButtonType.SECONDARY, app.getResources().getString(R.string.update_now)); itemUpdateNowButton.setMinimumHeight(AndroidUtils.dpToPx(app, app.getResources().getDimension(R.dimen.dialog_button_height))); From 9c9acaed4d4eba7bca4332f41f4fd055696b572e Mon Sep 17 00:00:00 2001 From: Skalii Date: Sat, 6 Mar 2021 18:52:13 +0200 Subject: [PATCH 009/250] fix npe after rotate screen --- .../download/ui/UpdatesIndexFragment.java | 27 ++++++++++--------- .../LiveUpdatesClearDialogFragment.java | 4 +-- .../liveupdates/LiveUpdatesFragmentNew.java | 2 +- .../LiveUpdatesSettingsDialogFragmentNew.java | 2 +- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java index 0eaaeb8bfe..a409f3a833 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java @@ -23,6 +23,7 @@ import android.widget.ListView; import android.widget.TextView; import androidx.annotation.ColorRes; +import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.content.res.AppCompatResources; @@ -97,7 +98,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download public void onAttach(Activity activity) { super.onAttach(activity); invalidateListView(activity); - startLoadLiveMapsAsyncTask(); + startLoadLiveMapsAsyncTask(getMyApplication()); } @Override @@ -109,7 +110,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download public void downloadHasFinished() { invalidateListView(getMyActivity()); updateUpdateAllButton(); - startLoadLiveMapsAsyncTask(); + startLoadLiveMapsAsyncTask(getMyApplication()); } @Override @@ -222,8 +223,8 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download stopLoadLiveMapsAsyncTask(); } - private void startLoadLiveMapsAsyncTask() { - loadLiveMapsTask = new LoadLiveMapsTask(listAdapter, this); + private void startLoadLiveMapsAsyncTask(OsmandApplication app) { + loadLiveMapsTask = new LoadLiveMapsTask(listAdapter, app); loadLiveMapsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } @@ -256,6 +257,11 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download return (DownloadActivity) getActivity(); } + @Nullable + public OsmandApplication getMyApplication() { + return getMyActivity().getMyApplication(); + } + @SuppressWarnings("deprecation") @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { @@ -272,10 +278,6 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download } } - public OsmandApplication getMyApplication() { - return getMyActivity().getMyApplication(); - } - @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == RELOAD_ID) { @@ -287,8 +289,8 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download } @Override - public void onUpdateStates() { - startLoadLiveMapsAsyncTask(); + public void onUpdateStates(OsmandApplication app) { + startLoadLiveMapsAsyncTask(app); } private class UpdateIndexAdapter extends ArrayAdapter { @@ -428,10 +430,9 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download private final UpdateIndexAdapter adapter; private final LocalIndexHelper helper; - public LoadLiveMapsTask(UpdateIndexAdapter adapter, - UpdatesIndexFragment fragment) { + public LoadLiveMapsTask(UpdateIndexAdapter adapter, OsmandApplication app) { this.adapter = adapter; - helper = new LocalIndexHelper(fragment.getMyApplication()); + helper = new LocalIndexHelper(app); } @Override diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java index de68d90b9c..2d46883aeb 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java @@ -96,7 +96,7 @@ public class LiveUpdatesClearDialogFragment extends MenuBottomSheetDialogFragmen } public interface OnRefreshLiveUpdates { - void onUpdateStates(); + void onUpdateStates(OsmandApplication app); } @Override @@ -105,7 +105,7 @@ public class LiveUpdatesClearDialogFragment extends MenuBottomSheetDialogFragmen Fragment fragment = getTargetFragment(); if (fragment instanceof OnRefreshLiveUpdates) { - ((OnRefreshLiveUpdates) fragment).onUpdateStates(); + ((OnRefreshLiveUpdates) fragment).onUpdateStates(app); } dismiss(); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index c6d7b63c0f..b34c6986ba 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -222,7 +222,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements super.onDismiss(dialog); Fragment target = getTargetFragment(); if (target instanceof OnRefreshLiveUpdates) { - ((OnRefreshLiveUpdates) target).onUpdateStates(); + ((OnRefreshLiveUpdates) target).onUpdateStates(app); } } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java index 6d1d403e91..13dfb63bb0 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java @@ -475,7 +475,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF } @Override - public void onUpdateStates() { + public void onUpdateStates(OsmandApplication app) { final OnLiveUpdatesForLocalChange confirmationInterface = (OnLiveUpdatesForLocalChange) getTargetFragment(); if (confirmationInterface != null) { confirmationInterface.updateList(); From 2c6204810c64347ace507c2a37d5e92275b96a11 Mon Sep 17 00:00:00 2001 From: Skalii Date: Sun, 7 Mar 2021 02:28:09 +0200 Subject: [PATCH 010/250] add inactive state for custom radio buttons and wifi toggle; some fixes; --- .../download/ui/UpdatesIndexFragment.java | 8 +- .../LiveUpdatesClearDialogFragment.java | 3 +- .../LiveUpdatesSettingsDialogFragmentNew.java | 175 +++++++++++------- .../plus/widgets/MultiStateToggleButton.java | 17 +- 4 files changed, 129 insertions(+), 74 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java index a409f3a833..8b88eb756a 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java @@ -289,8 +289,10 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download } @Override - public void onUpdateStates(OsmandApplication app) { - startLoadLiveMapsAsyncTask(app); + public void onUpdateStates(Context context) { + if (context instanceof OsmandApplication) { + startLoadLiveMapsAsyncTask((OsmandApplication) context); + } } private class UpdateIndexAdapter extends ArrayAdapter { @@ -471,7 +473,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download } private void showUpdateDialog() { - if (!Algorithms.isEmpty(listAdapter.mapsList)) { + if (!listAdapter.isNotSubscribed() && !Algorithms.isEmpty(listAdapter.mapsList)) { if (listAdapter.countEnabled == 1) { LocalIndexInfo li = listAdapter.mapsList.get(0); runLiveUpdate(getActivity(), li.getFileName(), false); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java index 2d46883aeb..9a67fc228e 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java @@ -1,5 +1,6 @@ package net.osmand.plus.liveupdates; +import android.content.Context; import android.graphics.Typeface; import android.os.Bundle; import android.text.SpannableString; @@ -96,7 +97,7 @@ public class LiveUpdatesClearDialogFragment extends MenuBottomSheetDialogFragmen } public interface OnRefreshLiveUpdates { - void onUpdateStates(OsmandApplication app); + void onUpdateStates(Context context); } @Override diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java index 13dfb63bb0..d65df0b4c1 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java @@ -1,5 +1,6 @@ package net.osmand.plus.liveupdates; +import android.content.Context; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Bundle; @@ -8,8 +9,10 @@ import android.text.TextUtils; import android.text.style.StyleSpan; import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.LinearLayout; +import android.widget.TextView; import androidx.annotation.ColorRes; import androidx.annotation.NonNull; @@ -70,15 +73,18 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF private OsmandApplication app; private OsmandSettings settings; + private OnLiveUpdatesForLocalChange onLiveUpdatesForLocalChange; + private MultiStateToggleButton frequencyToggleButton; + private MultiStateToggleButton timeOfDayToggleButton; private String fileName; - private int itemLastCheckIndex = -1; - private int itemLiveUpdateIndex = -1; - private int itemFrequencyButtonsIndex = -1; - private int itemTimeOfDayButtonsIndex = -1; - private int itemFrequencyHelpMessageIndex = -1; - private int itemSizeIndex = -1; - private int itemOnWiFiIndex = -1; + private int indexLastCheckItem = -1; + private int indexSwitchLiveUpdateItem = -1; + private int indexFrequencyButtonsItem = -1; + private int indexTimeOfDayButtonsItem = -1; + private int indexFrequencyHelpMessageItem = -1; + private int indexClearItem = -1; + private int indexViaWiFiItem = -1; public static void showInstance(@NonNull FragmentManager fragmentManager, Fragment target, String fileName) { if (!fragmentManager.isStateSaved()) { @@ -94,19 +100,23 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF app = getMyApplication(); settings = app.getSettings(); LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); - final OnLiveUpdatesForLocalChange confirmationInterface = (OnLiveUpdatesForLocalChange) getTargetFragment(); - final CommonPreference liveUpdatePreference = preferenceForLocalIndex(fileName, settings); + if (getTargetFragment() instanceof OnLiveUpdatesForLocalChange) { + onLiveUpdatesForLocalChange = (OnLiveUpdatesForLocalChange) getTargetFragment(); + } + final CommonPreference localUpdatePreference = preferenceForLocalIndex(fileName, settings); final CommonPreference downloadViaWiFiPreference = preferenceDownloadViaWiFi(fileName, settings); final CommonPreference frequencyPreference = preferenceUpdateFrequency(fileName, settings); final CommonPreference timeOfDayPreference = preferenceTimeOfDayToUpdate(fileName, settings); - final String on = getString(R.string.shared_string_enabled); - final String off = getString(R.string.shared_string_disabled); int dp4 = getResources().getDimensionPixelSize(R.dimen.context_menu_buttons_padding_bottom); int dp6 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_tiny); int dp8 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_small); + int dp10 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_medium); int dp12 = getResources().getDimensionPixelSize(R.dimen.content_padding_small); + int dp16 = getResources().getDimensionPixelSize(R.dimen.content_padding); int dp20 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_large); + int dp36 = getResources().getDimensionPixelSize(R.dimen.measurement_tool_button_height); int dp40 = getResources().getDimensionPixelSize(R.dimen.list_header_height); + int dp48 = getResources().getDimensionPixelSize(R.dimen.context_menu_buttons_bottom_height); int dp56 = getResources().getDimensionPixelSize(R.dimen.bottom_sheet_selected_item_title_height); if (savedInstanceState != null) { @@ -127,66 +137,64 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF .setDescriptionMaxLines(2) .setLayoutId(R.layout.bottom_sheet_item_description) .create()); - itemLastCheckIndex = items.size() - 1; + indexLastCheckItem = items.size() - 1; - View itemLiveUpdate = getCustomButtonView(app, null, liveUpdatePreference.get(), nightMode); + View itemLiveUpdate = getCustomButtonView(app, null, localUpdatePreference.get(), nightMode); View itemLiveUpdateButton = itemLiveUpdate.findViewById(R.id.button_container); itemLiveUpdateButton.setMinimumHeight(dp56); items.add(new BottomSheetItemWithCompoundButton.Builder() - .setChecked(liveUpdatePreference.get()) + .setChecked(localUpdatePreference.get()) .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (confirmationInterface != null - && confirmationInterface.onUpdateLocalIndex(fileName, isChecked, new Runnable() { + if (onLiveUpdatesForLocalChange != null + && onLiveUpdatesForLocalChange.onUpdateLocalIndex(fileName, isChecked, new Runnable() { @Override public void run() { - if (itemLastCheckIndex != -1) { - ((BottomSheetItemWithDescription) items.get(itemLastCheckIndex)) + if (indexLastCheckItem != -1) { + ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) .setDescription(getLastCheckString()); } - if (itemFrequencyHelpMessageIndex != -1) { - ((BottomSheetItemWithDescription) items.get(itemFrequencyHelpMessageIndex)) + if (indexFrequencyHelpMessageItem != -1) { + ((BottomSheetItemWithDescription) items.get(indexFrequencyHelpMessageItem)) .setDescription(getFrequencyHelpMessage()); } - if (itemSizeIndex != -1) { - ((BottomSheetItemWithDescription) items.get(itemSizeIndex)) + if (indexClearItem != -1) { + ((BottomSheetItemWithDescription) items.get(indexClearItem)) .setDescription(getUpdatesSizeStr()); } } })) { - if (itemLiveUpdateIndex != -1) { - BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(itemLiveUpdateIndex); - button.setTitle(isChecked ? on : off); + if (indexSwitchLiveUpdateItem != -1) { + BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(indexSwitchLiveUpdateItem); + button.setTitle(getStateText(isChecked)); button.setChecked(isChecked); updateCustomButtonView(app, null, button.getView(), isChecked, nightMode); } - for (int i = 0; i < items.size(); i++) { - if (i == itemOnWiFiIndex || i == itemFrequencyButtonsIndex || i == itemTimeOfDayButtonsIndex) { - items.get(i).getView().setEnabled(isChecked); - } - } + frequencyToggleButton.updateView(localUpdatePreference.get()); + timeOfDayToggleButton.updateView(localUpdatePreference.get()); + setStateViaWiFiButton(localUpdatePreference); } } }) - .setTitle(liveUpdatePreference.get() ? on : off) + .setTitle(getStateText(localUpdatePreference.get())) .setTitleColorId(getActiveTabTextColorId(nightMode)) .setCustomView(itemLiveUpdate) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - if (itemLiveUpdateIndex != -1) { - BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(itemLiveUpdateIndex); + if (indexSwitchLiveUpdateItem != -1) { + BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(indexSwitchLiveUpdateItem); button.setChecked(!button.isChecked()); } } }) .create()); - itemLiveUpdateIndex = items.size() - 1; + indexSwitchLiveUpdateItem = items.size() - 1; TextViewEx frequencyTitle = (TextViewEx) inflater.inflate(R.layout.bottom_sheet_item_title, null); - frequencyTitle.setHeight(AndroidUtils.dpToPx(app, 48)); - frequencyTitle.setMinimumHeight(AndroidUtils.dpToPx(app, 48)); + frequencyTitle.setHeight(dp48); + frequencyTitle.setMinimumHeight(dp48); frequencyTitle.setText(R.string.update_frequency); AndroidUtils.setPadding(frequencyTitle, frequencyTitle.getPaddingLeft(), 0, frequencyTitle.getPaddingRight(), 0); AndroidUtils.setTextPrimaryColor(app, frequencyTitle, nightMode); @@ -196,7 +204,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF LinearLayout itemFrequencyButtons = (LinearLayout) inflater.inflate(R.layout.custom_radio_buttons, null); LinearLayout.MarginLayoutParams itemFrequencyParams = new LinearLayout.MarginLayoutParams(LinearLayout.MarginLayoutParams.MATCH_PARENT, LinearLayout.MarginLayoutParams.WRAP_CONTENT); - AndroidUtils.setMargins(itemFrequencyParams, AndroidUtils.dpToPx(app, 16), 0, AndroidUtils.dpToPx(app, 16), 20); + AndroidUtils.setMargins(itemFrequencyParams, dp16, 0, dp16, dp12); itemFrequencyButtons.setLayoutParams(itemFrequencyParams); String hourly = getString(R.string.hourly); @@ -205,14 +213,15 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF RadioItem hourlyButton = new RadioItem(hourly); RadioItem dailyButton = new RadioItem(daily); RadioItem weeklyButton = new RadioItem(weekly); - MultiStateToggleButton frequencyToggleButton = new MultiStateToggleButton(app, itemFrequencyButtons, nightMode); + frequencyToggleButton = new MultiStateToggleButton(app, itemFrequencyButtons, nightMode); frequencyToggleButton.setItems(hourlyButton, dailyButton, weeklyButton); setSelectedRadioItem(frequencyToggleButton, frequencyPreference.get(), hourlyButton, dailyButton, weeklyButton); + frequencyToggleButton.updateView(localUpdatePreference.get()); items.add(new BaseBottomSheetItem.Builder() .setCustomView(itemFrequencyButtons) .create()); - itemFrequencyButtonsIndex = items.size() - 1; + indexFrequencyButtonsItem = items.size() - 1; TextViewEx timeOfDayTitle = (TextViewEx) inflater.inflate(R.layout.bottom_sheet_item_title, null); timeOfDayTitle.setHeight(dp40); @@ -226,16 +235,17 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF LinearLayout itemTimeOfDayButtons = (LinearLayout) inflater.inflate(R.layout.custom_radio_buttons, null); LinearLayout.MarginLayoutParams itemTimeOfDayParams = new LinearLayout.MarginLayoutParams(LinearLayout.MarginLayoutParams.MATCH_PARENT, LinearLayout.MarginLayoutParams.WRAP_CONTENT); - AndroidUtils.setMargins(itemTimeOfDayParams, AndroidUtils.dpToPx(app, 16), 0, AndroidUtils.dpToPx(app, 16), AndroidUtils.dpToPx(app, 10)); + AndroidUtils.setMargins(itemTimeOfDayParams, dp16, 0, dp16, dp10); itemTimeOfDayButtons.setLayoutParams(itemTimeOfDayParams); String morning = getString(R.string.morning); String night = getString(R.string.night); RadioItem morningButton = new RadioItem(morning); RadioItem nightButton = new RadioItem(night); - MultiStateToggleButton timeOfDayToggleButton = new MultiStateToggleButton(app, itemTimeOfDayButtons, nightMode); + timeOfDayToggleButton = new MultiStateToggleButton(app, itemTimeOfDayButtons, nightMode); timeOfDayToggleButton.setItems(morningButton, nightButton); setSelectedRadioItem(timeOfDayToggleButton, timeOfDayPreference.get(), morningButton, nightButton); + timeOfDayToggleButton.updateView(localUpdatePreference.get()); refreshTimeOfDayLayout(frequencyPreference.get(), itemTimeOfDayButtons, timeOfDayTitle); hourlyButton.setOnClickListener(getFrequencyButtonListener(UpdateFrequency.HOURLY, itemTimeOfDayButtons, timeOfDayTitle)); @@ -248,18 +258,18 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF .setCustomView(itemTimeOfDayButtons) .create() ); - itemTimeOfDayButtonsIndex = items.size() - 1; + indexTimeOfDayButtonsItem = items.size() - 1; items.add(new ShortDescriptionItem.Builder() .setDescription(getFrequencyHelpMessage()) .setDescriptionColorId(getSecondaryTextColorId(nightMode)) .setLayoutId(R.layout.bottom_sheet_item_description) .create()); - itemFrequencyHelpMessageIndex = items.size() - 1; + indexFrequencyHelpMessageItem = items.size() - 1; LinearLayout itemUpdateNowButton = (LinearLayout) inflater.inflate(R.layout.bottom_sheet_button_with_icon_center, null); - LinearLayout.MarginLayoutParams itemUpdateNowParams = new LinearLayout.MarginLayoutParams(LinearLayout.MarginLayoutParams.MATCH_PARENT, AndroidUtils.dpToPx(app, 36)); - AndroidUtils.setMargins(itemUpdateNowParams, AndroidUtils.dpToPx(app, 12), AndroidUtils.dpToPx(app, 12), AndroidUtils.dpToPx(app, 16), AndroidUtils.dpToPx(app, 12)); + LinearLayout.MarginLayoutParams itemUpdateNowParams = new LinearLayout.MarginLayoutParams(LinearLayout.MarginLayoutParams.MATCH_PARENT, dp36); + AndroidUtils.setMargins(itemUpdateNowParams, dp12, dp12, dp16, dp12); itemUpdateNowButton.setLayoutParams(itemUpdateNowParams); ((AppCompatImageView) itemUpdateNowButton.findViewById(R.id.button_icon)).setImageDrawable( ContextCompat.getDrawable(app, R.drawable.ic_action_update)); @@ -274,20 +284,20 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF if (!settings.isInternetConnectionAvailable()) { app.showShortToastMessage(R.string.no_internet_connection); } else { - if (confirmationInterface != null) { - confirmationInterface.forceUpdateLocal(fileName, true, new Runnable() { + if (onLiveUpdatesForLocalChange != null) { + onLiveUpdatesForLocalChange.forceUpdateLocal(fileName, true, new Runnable() { @Override public void run() { - if (itemLastCheckIndex != -1) { - ((BottomSheetItemWithDescription) items.get(itemLastCheckIndex)) + if (indexLastCheckItem != -1) { + ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) .setDescription(getLastCheckString()); } - if (itemFrequencyHelpMessageIndex != -1) { - ((BottomSheetItemWithDescription) items.get(itemFrequencyHelpMessageIndex)) + if (indexFrequencyHelpMessageItem != -1) { + ((BottomSheetItemWithDescription) items.get(indexFrequencyHelpMessageItem)) .setDescription(getFrequencyHelpMessage()); } - if (itemSizeIndex != -1) { - ((BottomSheetItemWithDescription) items.get(itemSizeIndex)) + if (indexClearItem != -1) { + ((BottomSheetItemWithDescription) items.get(indexClearItem)) .setDescription(getUpdatesSizeStr()); } } @@ -323,7 +333,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF }) .create() ); - itemSizeIndex = items.size() - 1; + indexClearItem = items.size() - 1; items.add(createDividerItem()); @@ -336,34 +346,62 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF downloadViaWiFiPreference.set(isChecked); } }) - .setDescription(downloadViaWiFiPreference.get() ? on : off) + .setDescription(getStateText(downloadViaWiFiPreference.get())) .setIconHidden(true) .setTitle(app.getResources().getString(R.string.only_download_over_wifi)) .setLayoutId(R.layout.bottom_sheet_item_with_descr_and_switch_56dp) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (liveUpdatePreference.get() && itemOnWiFiIndex != -1) { - BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(itemOnWiFiIndex); + if (localUpdatePreference.get() && indexViaWiFiItem != -1) { + BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(indexViaWiFiItem); button.setChecked(!button.isChecked()); - button.setDescription(downloadViaWiFiPreference.get() ? on : off); + button.setDescription(getStateText(button.isChecked())); } } }) .create() ); - itemOnWiFiIndex = items.size() - 1; + indexViaWiFiItem = items.size() - 1; items.add(new DividerSpaceItem(app, dp20)); } + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { + View view = super.onCreateView(inflater, parent, savedInstanceState); + CommonPreference localUpdatePreference = preferenceForLocalIndex(fileName, settings); + setStateViaWiFiButton(localUpdatePreference); + return view; + } + @Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); outState.putString(LOCAL_INDEX_FILE_NAME, fileName); } + private void setStateViaWiFiButton(CommonPreference localUpdatePreference) { + if (indexViaWiFiItem != -1) { + BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(indexViaWiFiItem); + if (button.getView() != null) { + TextView title = button.getView().findViewById(R.id.title); + TextView description = button.getView().findViewById(R.id.description); + CompoundButton compoundButton = button.getView().findViewById(R.id.compound_button); + if (localUpdatePreference.get()) { + AndroidUtils.setTextPrimaryColor(app, title, nightMode); + AndroidUtils.setTextSecondaryColor(app, description, nightMode); + compoundButton.setEnabled(true); + } else { + AndroidUtils.setTextSecondaryColor(app, title, nightMode); + description.setTextColor(ContextCompat.getColor(app, getTertiaryTextColorId(nightMode))); + compoundButton.setEnabled(false); + } + } + } + } protected SpannableString getLastCheckString() { final long lastUpdate = preferenceLatestUpdateAvailable(fileName, settings).get(); @@ -463,8 +501,8 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF if (!Algorithms.isEmpty(Arrays.asList(timeOfDayLayouts))) { refreshTimeOfDayLayout(newValue, timeOfDayLayouts); } - if (itemFrequencyHelpMessageIndex != -1) { - ((BottomSheetItemWithDescription) items.get(itemFrequencyHelpMessageIndex)) + if (indexFrequencyHelpMessageItem != -1) { + ((BottomSheetItemWithDescription) items.get(indexFrequencyHelpMessageItem)) .setDescription(getFrequencyHelpMessage()); } OnLiveUpdatesForLocalChange confirmationInterface = (OnLiveUpdatesForLocalChange) getTargetFragment(); @@ -475,13 +513,13 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF } @Override - public void onUpdateStates(OsmandApplication app) { + public void onUpdateStates(Context context) { final OnLiveUpdatesForLocalChange confirmationInterface = (OnLiveUpdatesForLocalChange) getTargetFragment(); if (confirmationInterface != null) { confirmationInterface.updateList(); } - if (itemSizeIndex != -1) { - ((BottomSheetItemWithDescription) items.get(itemSizeIndex)) + if (indexClearItem != -1) { + ((BottomSheetItemWithDescription) items.get(indexClearItem)) .setDescription(getUpdatesSizeStr()); } } @@ -497,6 +535,10 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF void updateList(); } + public String getStateText(boolean state) { + return app.getResources().getString(state ? R.string.shared_string_enabled : R.string.shared_string_disabled); + } + @ColorRes public static int getPrimaryTextColorId(boolean nightMode) { return nightMode ? R.color.text_color_primary_dark : R.color.text_color_primary_light; @@ -512,6 +554,11 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF return nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light; } + @ColorRes + public static int getTertiaryTextColorId(boolean nightMode) { + return nightMode ? R.color.text_color_tertiary_dark : R.color.text_color_tertiary_light; + } + @Override protected int getDismissButtonTextId() { return R.string.shared_string_close; diff --git a/OsmAnd/src/net/osmand/plus/widgets/MultiStateToggleButton.java b/OsmAnd/src/net/osmand/plus/widgets/MultiStateToggleButton.java index 3bd4c29631..605584f5b8 100644 --- a/OsmAnd/src/net/osmand/plus/widgets/MultiStateToggleButton.java +++ b/OsmAnd/src/net/osmand/plus/widgets/MultiStateToggleButton.java @@ -37,7 +37,7 @@ public class MultiStateToggleButton { this.nightMode = nightMode; } - public void setItems(RadioItem firstBtn, RadioItem secondBtn, RadioItem ... other) { + public void setItems(RadioItem firstBtn, RadioItem secondBtn, RadioItem... other) { items.clear(); items.add(firstBtn); items.add(secondBtn); @@ -101,12 +101,16 @@ public class MultiStateToggleButton { } private void updateView() { + updateView(true); + } + + public void updateView(boolean isEnabled) { int activeColor = ContextCompat.getColor(app, nightMode - ? R.color.active_color_primary_dark - : R.color.active_color_primary_light); + ? isEnabled ? R.color.active_color_primary_dark : R.color.icon_color_default_dark + : isEnabled ? R.color.active_color_primary_light : R.color.icon_color_default_light); int textColor = ContextCompat.getColor(app, nightMode - ? R.color.text_color_primary_dark - : R.color.text_color_primary_light); + ? isEnabled ? R.color.text_color_primary_dark : R.color.text_color_secondary_dark + : isEnabled ? R.color.text_color_primary_light : R.color.text_color_secondary_light); int radius = AndroidUtils.dpToPx(app, 4); float[] leftBtnRadii = new float[]{radius, radius, 0, 0, 0, 0, radius, radius}; float[] rightBtnRadii = new float[]{0, 0, radius, radius, radius, radius, 0, 0}; @@ -121,6 +125,7 @@ public class MultiStateToggleButton { for (int i = 0; i < items.size(); i++) { RadioItem item = items.get(i); ViewGroup container = buttons.get(i); + container.setEnabled(isEnabled); TextView tvTitle = (TextView) container.findViewById(R.id.title); if (selectedItem == item) { if (i == 0) { @@ -148,7 +153,7 @@ public class MultiStateToggleButton { } } - private void hideDividers(int ... dividerIndexes) { + private void hideDividers(int... dividerIndexes) { for (int dividerIndex : dividerIndexes) { if (dividerIndex >= 0 && dividerIndex < dividers.size()) { dividers.get(dividerIndex).setVisibility(View.GONE); From 1797e24f43318e2c80d326e4ddddf72da0508f38 Mon Sep 17 00:00:00 2001 From: Skalii Date: Sun, 7 Mar 2021 12:50:26 +0200 Subject: [PATCH 011/250] fix refresh last date check after clear downloaded data; fix refresh list after update all enabled --- .../plus/liveupdates/LiveUpdatesFragmentNew.java | 14 +++++--------- .../LiveUpdatesSettingsDialogFragmentNew.java | 8 ++++++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index b34c6986ba..1c898c4bef 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -217,6 +217,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements stopUpdateDateAsyncTask(); stopLoadLiveMapsAsyncTask(); } + @Override public void onDismiss(@NonNull DialogInterface dialog) { super.onDismiss(dialog); @@ -262,7 +263,6 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements @Override public void onClick(View view) { boolean visible = !isChecked; - if (visible) { if (InAppPurchaseHelper.isSubscribedToLiveUpdates(app)) { switchOnLiveUpdates(); @@ -291,7 +291,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements } private void showUpdateDialog() { - final AsyncResponse runListSort = new AsyncResponse() { + final AsyncResponse refreshAfterUpdate = new AsyncResponse() { @Override public void processFinish() { adapter.notifyDataSetChanged(); @@ -300,7 +300,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements if (!Algorithms.isEmpty(adapter.mapsList)) { if (adapter.countEnabled == 1) { LocalIndexInfo li = adapter.mapsList.get(0); - runLiveUpdate(getActivity(), li.getFileName(), false, runListSort); + runLiveUpdate(getActivity(), li.getFileName(), false, refreshAfterUpdate); } else if (adapter.countEnabled > 1) { AlertDialog.Builder bld = new AlertDialog.Builder(getMyActivity()); bld.setMessage(R.string.update_all_maps_now); @@ -311,14 +311,10 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements for (LocalIndexInfo li : adapter.mapsList) { CommonPreference localUpdateOn = preferenceForLocalIndex(li.getFileName(), settings); if (localUpdateOn.get()) { - if (adapter.mapsList.indexOf(li) == adapter.mapsList.size() - 1) { - runLiveUpdate(getActivity(), li.getFileName(), false, runListSort); - } else { - runLiveUpdate(getActivity(), li.getFileName(), false); - } + runLiveUpdate(getActivity(), li.getFileName(), false, refreshAfterUpdate); } - startUpdateDateAsyncTask(); } + startUpdateDateAsyncTask(); } }); bld.setNegativeButton(R.string.shared_string_no, null); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java index d65df0b4c1..df408b17e7 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java @@ -518,6 +518,10 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF if (confirmationInterface != null) { confirmationInterface.updateList(); } + if (indexLastCheckItem != -1) { + ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) + .setDescription(getLastCheckString()); + } if (indexClearItem != -1) { ((BottomSheetItemWithDescription) items.get(indexClearItem)) .setDescription(getUpdatesSizeStr()); @@ -535,8 +539,8 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF void updateList(); } - public String getStateText(boolean state) { - return app.getResources().getString(state ? R.string.shared_string_enabled : R.string.shared_string_disabled); + public String getStateText(boolean isEnabled) { + return app.getResources().getString(isEnabled ? R.string.shared_string_enabled : R.string.shared_string_disabled); } @ColorRes From a6cedd2767694089272b0902c69358553948244e Mon Sep 17 00:00:00 2001 From: cepprice Date: Mon, 8 Mar 2021 21:32:19 +0500 Subject: [PATCH 012/250] Implement colorization type in settings --- .../main/java/net/osmand/GPXUtilities.java | 8 +-- .../java/net/osmand/router/RouteColorize.java | 21 ++++---- .../main/java/net/osmand/util/Algorithms.java | 27 ++++++++++ OsmAnd/src/net/osmand/plus/GPXDatabase.java | 51 +++++++++---------- OsmAnd/src/net/osmand/plus/GpxDbHelper.java | 4 +- .../net/osmand/plus/helpers/GpxUiHelper.java | 12 ++--- .../plus/settings/backend/OsmandSettings.java | 2 + .../backend/backup/GpxAppearanceInfo.java | 28 +++++----- .../backend/backup/GpxSettingsItem.java | 4 ++ .../osmand/plus/track/GradientScaleType.java | 13 +++++ .../plus/track/TrackAppearanceFragment.java | 4 ++ 11 files changed, 111 insertions(+), 63 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java index 4db84c5c33..cb5f40a4b9 100644 --- a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java +++ b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java @@ -1662,16 +1662,16 @@ public class GPXUtilities { return new QuadRect(left, top, right, bottom); } - public int getGradientScaleColor(String gradientScaleType, int defColor) { + public int[] getGradientScaleColor(String gradientScaleType) { String clrValue = null; if (extensions != null) { clrValue = extensions.get(gradientScaleType); } - return parseColor(clrValue, defColor); + return Algorithms.stringToGradientPalette(clrValue); } - public void setGradientScaleColor(String gradientScaleType, int gradientScaleColor) { - getExtensionsToWrite().put(gradientScaleType, Algorithms.colorToString(gradientScaleColor)); + public void setGradientScaleColor(String gradientScaleType, int[] gradientScalePalette) { + getExtensionsToWrite().put(gradientScaleType, Algorithms.gradientPaletteToString(gradientScalePalette)); } public String getGradientScaleType() { diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java index 6730965d1f..63f0ee1cd3 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java @@ -24,11 +24,12 @@ public class RouteColorize { public static final int DARK_GREY = rgbaToDecimal(92, 92, 92, 255); public static final int LIGHT_GREY = rgbaToDecimal(200, 200, 200, 255); - public static final int RED = rgbaToDecimal(255,1,1,255); - public static final int GREEN = rgbaToDecimal(46,185,0,191); - public static final int YELLOW = rgbaToDecimal(255,222,2,227); + public static final int GREEN = rgbaToDecimal(90, 220, 95, 1); + public static final int YELLOW = rgbaToDecimal(212, 239, 50, 1); + public static final int RED = rgbaToDecimal(243, 55, 77, 1); + public static final int[] colors = new int[] {GREEN, YELLOW, RED}; - public enum ValueType { + public enum ColorizationType { ELEVATION, SPEED, SLOPE, @@ -42,7 +43,7 @@ public class RouteColorize { private final int BLUE_COLOR_INDEX = 3;//RGB private final int ALPHA_COLOR_INDEX = 4;//RGBA - private ValueType valueType; + private ColorizationType colorizationType; public static int SLOPE_RANGE = 150;//150 meters private static final double MIN_DIFFERENCE_SLOPE = 0.05d;//5% @@ -73,7 +74,7 @@ public class RouteColorize { /** * @param type ELEVATION, SPEED, SLOPE */ - public RouteColorize(int zoom, GPXUtilities.GPXFile gpxFile, ValueType type) { + public RouteColorize(int zoom, GPXUtilities.GPXFile gpxFile, ColorizationType type) { if (!gpxFile.hasTrkPt()) { LOG.warn("GPX file is not consist of track points"); @@ -88,7 +89,7 @@ public class RouteColorize { for (GPXUtilities.WptPt p : ts.points) { latList.add(p.lat); lonList.add(p.lon); - if (type == ValueType.SPEED) { + if (type == ColorizationType.SPEED) { valList.add(p.speed); } else { valList.add(p.ele); @@ -101,14 +102,14 @@ public class RouteColorize { latitudes = listToArray(latList); longitudes = listToArray(lonList); - if (type == ValueType.SLOPE) { + if (type == ColorizationType.SLOPE) { values = calculateSlopesByElevations(latitudes, longitudes, listToArray(valList), SLOPE_RANGE); } else { values = listToArray(valList); } calculateMinMaxValue(); - valueType = type; + colorizationType = type; checkPalette(); sortPalette(); } @@ -282,7 +283,7 @@ public class RouteColorize { double[][] defaultPalette = { {minValue, GREEN}, - {valueType == ValueType.SLOPE ? 0 : (minValue + maxValue) / 2, YELLOW}, + {colorizationType == ColorizationType.SLOPE ? 0 : (minValue + maxValue) / 2, YELLOW}, {maxValue, RED} }; palette = defaultPalette; diff --git a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java index 36c0034a26..737e302e6a 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java @@ -2,6 +2,7 @@ package net.osmand.util; import net.osmand.IProgress; import net.osmand.PlatformUtil; +import net.osmand.router.RouteColorize; import org.apache.commons.logging.Log; import org.xmlpull.v1.XmlPullParser; @@ -1027,4 +1028,30 @@ public class Algorithms { } return false; } + + public static int[] stringToGradientPalette(String str) { + if (Algorithms.isBlank(str)) { + return RouteColorize.colors; + } + String[] arr = str.split(" "); + if (arr.length != 3) { + return RouteColorize.colors; + } + int[] colors = new int[3]; + try { + for (int i = 0; i < 3; i++) { + colors[i] = Algorithms.parseColor(arr[i]); + } + } catch (IllegalArgumentException e) { + return RouteColorize.colors; + } + return colors; + } + + public static String gradientPaletteToString(int[] colors) { + int[] src = colors.length == 3 ? colors : RouteColorize.colors; + return Algorithms.colorToString(src[0]) + " " + + Algorithms.colorToString(src[1]) + " " + + Algorithms.colorToString(src[2]); + } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/GPXDatabase.java b/OsmAnd/src/net/osmand/plus/GPXDatabase.java index 74dc02be9c..b08013017f 100644 --- a/OsmAnd/src/net/osmand/plus/GPXDatabase.java +++ b/OsmAnd/src/net/osmand/plus/GPXDatabase.java @@ -178,9 +178,9 @@ public class GPXDatabase { private String width; private GradientScaleType gradientScaleType; private int color; - private int gradientSpeedColor; - private int gradientAltitudeColor; - private int gradientSlopeColor; + private int[] gradientSpeedPalette; + private int[] gradientAltitudePalette; + private int[] gradientSlopePalette; private int splitType; private double splitInterval; private long fileLastModifiedTime; @@ -210,9 +210,9 @@ public class GPXDatabase { width = gpxFile.getWidth(null); showArrows = gpxFile.isShowArrows(); showStartFinish = gpxFile.isShowStartFinish(); - gradientSpeedColor = gpxFile.getGradientScaleColor(GradientScaleType.SPEED.getColorTypeName(), 0); - gradientSlopeColor = gpxFile.getGradientScaleColor(GradientScaleType.SLOPE.getColorTypeName(), 0); - gradientAltitudeColor = gpxFile.getGradientScaleColor(GradientScaleType.ALTITUDE.getColorTypeName(), 0); + gradientSpeedPalette = gpxFile.getGradientScaleColor(GradientScaleType.SPEED.getColorTypeName()); + gradientSlopePalette = gpxFile.getGradientScaleColor(GradientScaleType.SLOPE.getColorTypeName()); + gradientAltitudePalette = gpxFile.getGradientScaleColor(GradientScaleType.ALTITUDE.getColorTypeName()); if (!Algorithms.isEmpty(gpxFile.getSplitType()) && gpxFile.getSplitInterval() > 0) { GpxSplitType gpxSplitType = GpxSplitType.getSplitTypeByName(gpxFile.getSplitType()); @@ -243,23 +243,22 @@ public class GPXDatabase { return gradientScaleType; } - public int getGradientSpeedColor() { - return gradientSpeedColor; + public int[] getGradientSpeedPalette() { + return gradientSpeedPalette; } - public int getGradientAltitudeColor() { - return gradientAltitudeColor; + public int[] getGradientAltitudePalette() { + return gradientAltitudePalette; } - public int getGradientSlopeColor() { - return gradientSlopeColor; + public int[] getGradientSlopePalette() { + return gradientSlopePalette; } public String getWidth() { return width; } - public long getFileLastModifiedTime() { return fileLastModifiedTime; } @@ -507,7 +506,7 @@ public class GPXDatabase { return false; } - public boolean updateGradientScaleColor(@NonNull GpxDataItem item, @NonNull GradientScaleType gradientScaleType, int gradientScaleColor) { + public boolean updateGradientScaleColor(@NonNull GpxDataItem item, @NonNull GradientScaleType gradientScaleType, int[] gradientScalePalette) { SQLiteConnection db = openConnection(false); if (db != null) { try { @@ -516,17 +515,17 @@ public class GPXDatabase { String columnName = null; if (GradientScaleType.SPEED == gradientScaleType) { columnName = GPX_COL_GRADIENT_SPEED_COLOR; - item.gradientSpeedColor = gradientScaleColor; + item.gradientSpeedPalette = gradientScalePalette; } else if (GradientScaleType.ALTITUDE == gradientScaleType) { columnName = GPX_COL_GRADIENT_ALTITUDE_COLOR; - item.gradientAltitudeColor = gradientScaleColor; + item.gradientAltitudePalette = gradientScalePalette; } else if (GradientScaleType.SLOPE == gradientScaleType) { columnName = GPX_COL_GRADIENT_SLOPE_COLOR; - item.gradientSlopeColor = gradientScaleColor; + item.gradientSlopePalette = gradientScalePalette; } db.execSQL("UPDATE " + GPX_TABLE_NAME + " SET " + columnName + " = ? " + " WHERE " + GPX_COL_NAME + " = ? AND " + GPX_COL_DIR + " = ?", - new Object[] {(gradientScaleColor == 0 ? "" : Algorithms.colorToString(gradientScaleColor)), fileName, fileDir}); + new Object[] {Algorithms.gradientPaletteToString(gradientScalePalette), fileName, fileDir}); } finally { db.close(); } @@ -729,7 +728,7 @@ public class GPXDatabase { color, item.file.lastModified(), item.splitType, item.splitInterval, item.apiImported ? 1 : 0, Algorithms.encodeStringSet(item.analysis.wptCategoryNames), item.showAsMarkers ? 1 : 0, item.joinSegments ? 1 : 0, item.showArrows ? 1 : 0, item.showStartFinish ? 1 : 0, item.width, - item.gradientSpeedColor, item.gradientAltitudeColor, item.gradientSlopeColor, gradientScaleType}); + item.gradientSpeedPalette, item.gradientAltitudePalette, item.gradientSlopePalette, gradientScaleType}); } else { db.execSQL("INSERT INTO " + GPX_TABLE_NAME + "(" + GPX_COL_NAME + ", " + @@ -752,7 +751,7 @@ public class GPXDatabase { new Object[] {fileName, fileDir, color, 0, item.splitType, item.splitInterval, item.apiImported ? 1 : 0, item.showAsMarkers ? 1 : 0, item.joinSegments ? 1 : 0, item.showArrows ? 1 : 0, item.showStartFinish ? 1 : 0, item.width, - item.gradientSpeedColor, item.gradientAltitudeColor, item.gradientSlopeColor, gradientScaleType}); + item.gradientSpeedPalette, item.gradientAltitudePalette, item.gradientSlopePalette, gradientScaleType}); } } @@ -836,9 +835,9 @@ public class GPXDatabase { boolean showArrows = query.getInt(26) == 1; boolean showStartFinish = query.getInt(27) == 1; String width = query.getString(28); - String gradientSpeedColor = query.getString(29); - String gradientAltitudeColor = query.getString(30); - String gradientSlopeColor = query.getString(31); + String gradientSpeedPalette = query.getString(29); + String gradientAltitudePalette = query.getString(30); + String gradientSlopePalette = query.getString(31); String gradientScaleType = query.getString(32); GPXTrackAnalysis a = new GPXTrackAnalysis(); @@ -880,9 +879,9 @@ public class GPXDatabase { item.showArrows = showArrows; item.showStartFinish = showStartFinish; item.width = width; - item.gradientSpeedColor = parseColor(gradientSpeedColor); - item.gradientAltitudeColor = parseColor(gradientAltitudeColor); - item.gradientSlopeColor = parseColor(gradientSlopeColor); + item.gradientSpeedPalette = Algorithms.stringToGradientPalette(gradientSpeedPalette); + item.gradientAltitudePalette = Algorithms.stringToGradientPalette(gradientAltitudePalette); + item.gradientSlopePalette = Algorithms.stringToGradientPalette(gradientSlopePalette); try { item.gradientScaleType = Algorithms.isEmpty(gradientScaleType) ? null : GradientScaleType.valueOf(gradientScaleType); diff --git a/OsmAnd/src/net/osmand/plus/GpxDbHelper.java b/OsmAnd/src/net/osmand/plus/GpxDbHelper.java index 8a7d886a63..ef93703190 100644 --- a/OsmAnd/src/net/osmand/plus/GpxDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/GpxDbHelper.java @@ -78,8 +78,8 @@ public class GpxDbHelper { return res; } - public boolean updateGradientScaleColor(@NonNull GpxDataItem item, @NonNull GradientScaleType gradientScaleType, int color) { - boolean res = db.updateGradientScaleColor(item, gradientScaleType, color); + public boolean updateGradientScaleColor(@NonNull GpxDataItem item, @NonNull GradientScaleType gradientScaleType, int[] palette) { + boolean res = db.updateGradientScaleColor(item, gradientScaleType, palette); putToCache(item); return res; } diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index c2f3d831b8..ce33c21803 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -2246,15 +2246,9 @@ public class GpxUiHelper { if (dataItem.getWidth() != null) { gpxFile.setWidth(dataItem.getWidth()); } - if (dataItem.getGradientSpeedColor() != 0) { - gpxFile.setGradientScaleColor(GradientScaleType.SPEED.getColorTypeName(), dataItem.getGradientSpeedColor()); - } - if (dataItem.getGradientSlopeColor() != 0) { - gpxFile.setGradientScaleColor(GradientScaleType.SLOPE.getColorTypeName(), dataItem.getGradientSlopeColor()); - } - if (dataItem.getGradientAltitudeColor() != 0) { - gpxFile.setGradientScaleColor(GradientScaleType.ALTITUDE.getColorTypeName(), dataItem.getGradientAltitudeColor()); - } + gpxFile.setGradientScaleColor(GradientScaleType.SPEED.getColorTypeName(), dataItem.getGradientSpeedPalette()); + gpxFile.setGradientScaleColor(GradientScaleType.SLOPE.getColorTypeName(), dataItem.getGradientSlopePalette()); + gpxFile.setGradientScaleColor(GradientScaleType.ALTITUDE.getColorTypeName(), dataItem.getGradientAltitudePalette()); if (dataItem.getGradientScaleType() != null) { gpxFile.setGradientScaleType(dataItem.getGradientScaleType().name()); } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 2854520bbf..0635f8d7c1 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -50,6 +50,7 @@ import net.osmand.plus.rastermaps.LayerTransparencySeekbarMode; import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.routing.RouteProvider.RouteService; import net.osmand.plus.srtmplugin.TerrainMode; +import net.osmand.plus.track.GradientScaleType; import net.osmand.plus.views.layers.RadiusRulerControlLayer.RadiusRulerMode; import net.osmand.plus.voice.CommandPlayer; import net.osmand.plus.wikipedia.WikiArticleShowImages; @@ -1408,6 +1409,7 @@ public class OsmandSettings { public final OsmandPreference LAST_UPDATES_CARD_REFRESH = new LongPreference(this, "last_updates_card_refresh", 0).makeGlobal(); public final CommonPreference CURRENT_TRACK_COLOR = new IntPreference(this, "current_track_color", 0).makeGlobal().makeShared().cache(); + public final CommonPreference CURRENT_TRACK_COLORIZATION = new EnumStringPreference<>(this, "current_track_colorization", null, GradientScaleType.values()).makeGlobal().makeShared().cache(); public final CommonPreference CURRENT_TRACK_WIDTH = new StringPreference(this, "current_track_width", "").makeGlobal().makeShared().cache(); public final CommonPreference CURRENT_TRACK_SHOW_ARROWS = new BooleanPreference(this, "current_track_show_arrows", false).makeGlobal().makeShared().cache(); public final CommonPreference CURRENT_TRACK_SHOW_START_FINISH = new BooleanPreference(this, "current_track_show_start_finish", true).makeGlobal().makeShared().cache(); diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxAppearanceInfo.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxAppearanceInfo.java index 157d5ecb0a..a893e63a41 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxAppearanceInfo.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxAppearanceInfo.java @@ -17,9 +17,9 @@ public class GpxAppearanceInfo { public String width; public GradientScaleType scaleType; public int color; - public int gradientSpeedColor; - public int gradientAltitudeColor; - public int gradientSlopeColor; + public int[] gradientSpeedPalette; + public int[] gradientAltitudePalette; + public int[] gradientSlopePalette; public int splitType; public double splitInterval; public boolean showArrows; @@ -41,9 +41,9 @@ public class GpxAppearanceInfo { splitType = dataItem.getSplitType(); splitInterval = dataItem.getSplitInterval(); scaleType = dataItem.getGradientScaleType(); - gradientSpeedColor = dataItem.getGradientSpeedColor(); - gradientSlopeColor = dataItem.getGradientSlopeColor(); - gradientAltitudeColor = dataItem.getGradientAltitudeColor(); + gradientSpeedPalette = dataItem.getGradientSpeedPalette(); + gradientSlopePalette = dataItem.getGradientSlopePalette(); + gradientAltitudePalette = dataItem.getGradientAltitudePalette(); GPXTrackAnalysis analysis = dataItem.getAnalysis(); if (analysis != null) { @@ -61,9 +61,9 @@ public class GpxAppearanceInfo { writeParam(json, "split_type", GpxSplitType.getSplitTypeByTypeId(splitType).getTypeName()); writeParam(json, "split_interval", splitInterval); writeParam(json, "gradient_scale_type", scaleType); - writeParam(json, GradientScaleType.SPEED.getColorTypeName(), gradientSpeedColor); - writeParam(json, GradientScaleType.SLOPE.getColorTypeName(), gradientSlopeColor); - writeParam(json, GradientScaleType.ALTITUDE.getColorTypeName(), gradientAltitudeColor); + writeParam(json, GradientScaleType.SPEED.getColorTypeName(), Algorithms.gradientPaletteToString(gradientSpeedPalette)); + writeParam(json, GradientScaleType.ALTITUDE.getColorTypeName(), Algorithms.gradientPaletteToString(gradientAltitudePalette)); + writeParam(json, GradientScaleType.SLOPE.getColorTypeName(), Algorithms.gradientPaletteToString(gradientSlopePalette)); writeParam(json, "time_span", timeSpan); writeParam(json, "wpt_points", wptPoints); @@ -79,9 +79,9 @@ public class GpxAppearanceInfo { gpxAppearanceInfo.splitType = GpxSplitType.getSplitTypeByName(json.optString("split_type")).getType(); gpxAppearanceInfo.splitInterval = json.optDouble("split_interval"); gpxAppearanceInfo.scaleType = getScaleType(json.optString("gradient_scale_type")); - gpxAppearanceInfo.gradientSpeedColor = json.optInt(GradientScaleType.SPEED.getColorTypeName()); - gpxAppearanceInfo.gradientSlopeColor = json.optInt(GradientScaleType.SLOPE.getColorTypeName()); - gpxAppearanceInfo.gradientAltitudeColor = json.optInt(GradientScaleType.ALTITUDE.getColorTypeName()); + gpxAppearanceInfo.gradientSpeedPalette = getGradientPalette(json, GradientScaleType.SPEED); + gpxAppearanceInfo.gradientAltitudePalette = getGradientPalette(json, GradientScaleType.ALTITUDE); + gpxAppearanceInfo.gradientSlopePalette = getGradientPalette(json, GradientScaleType.SLOPE); gpxAppearanceInfo.timeSpan = json.optLong("time_span"); gpxAppearanceInfo.wptPoints = json.optInt("wpt_points"); @@ -101,6 +101,10 @@ public class GpxAppearanceInfo { return null; } + private static int[] getGradientPalette(JSONObject json, GradientScaleType scaleType) { + return Algorithms.stringToGradientPalette(json.optString(scaleType.getColorTypeName())); + } + private static void writeParam(@NonNull JSONObject json, @NonNull String name, @Nullable Object value) throws JSONException { if (value instanceof Integer) { if ((Integer) value != 0) { diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxSettingsItem.java index b9c39026a9..2eca72fba1 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxSettingsItem.java @@ -9,6 +9,7 @@ import net.osmand.plus.GpxDbHelper; import net.osmand.plus.GpxDbHelper.GpxDataItemCallback; import net.osmand.plus.OsmandApplication; import net.osmand.plus.track.GpxSplitType; +import net.osmand.plus.track.GradientScaleType; import org.json.JSONException; import org.json.JSONObject; @@ -83,6 +84,9 @@ public class GpxSettingsItem extends FileSettingsItem { gpxDbHelper.updateShowStartFinish(dataItem, appearanceInfo.showStartFinish); gpxDbHelper.updateSplit(dataItem, splitType, appearanceInfo.splitInterval); gpxDbHelper.updateGradientScaleType(dataItem, appearanceInfo.scaleType); + gpxDbHelper.updateGradientScaleColor(dataItem, GradientScaleType.SPEED, appearanceInfo.gradientSpeedPalette); + gpxDbHelper.updateGradientScaleColor(dataItem, GradientScaleType.ALTITUDE, appearanceInfo.gradientAltitudePalette); + gpxDbHelper.updateGradientScaleColor(dataItem, GradientScaleType.SLOPE, appearanceInfo.gradientSlopePalette); } private void createGpxAppearanceInfo() { diff --git a/OsmAnd/src/net/osmand/plus/track/GradientScaleType.java b/OsmAnd/src/net/osmand/plus/track/GradientScaleType.java index f237c1e721..9b7e681122 100644 --- a/OsmAnd/src/net/osmand/plus/track/GradientScaleType.java +++ b/OsmAnd/src/net/osmand/plus/track/GradientScaleType.java @@ -7,6 +7,7 @@ import androidx.annotation.NonNull; import androidx.annotation.StringRes; import net.osmand.plus.R; +import net.osmand.router.RouteColorize.ColorizationType; public enum GradientScaleType { @@ -44,6 +45,18 @@ public enum GradientScaleType { return ctx.getString(resId); } + public ColorizationType toColorizationType() { + if (this == SPEED) { + return ColorizationType.SPEED; + } else if (this == ALTITUDE) { + return ColorizationType.ELEVATION; + } else if (this == SLOPE) { + return ColorizationType.SLOPE; + } else { + return ColorizationType.NONE; + } + } + public static GradientScaleType getGradientTypeByName(@NonNull String name) { for (GradientScaleType scaleType : GradientScaleType.values()) { if (scaleType.name().equalsIgnoreCase(name)) { diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java index 1de2c1c6ee..98831141bc 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java @@ -159,6 +159,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement if (selectedGpxFile.isShowCurrentTrack()) { trackDrawInfo = new TrackDrawInfo(true); trackDrawInfo.setColor(app.getSettings().CURRENT_TRACK_COLOR.get()); + trackDrawInfo.setGradientScaleType(app.getSettings().CURRENT_TRACK_COLORIZATION.get()); trackDrawInfo.setWidth(app.getSettings().CURRENT_TRACK_WIDTH.get()); trackDrawInfo.setShowArrows(app.getSettings().CURRENT_TRACK_SHOW_ARROWS.get()); trackDrawInfo.setShowStartFinish(app.getSettings().CURRENT_TRACK_SHOW_START_FINISH.get()); @@ -343,6 +344,8 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement SplitIntervalBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), trackDrawInfo, this); } else if (card instanceof TrackColoringCard) { GradientScaleType currentScaleType = ((TrackColoringCard) card).getSelectedScaleType(); + trackDrawInfo.setGradientScaleType(currentScaleType); + mapActivity.refreshMap(); if (gradientCard != null) { gradientCard.setSelectedScaleType(currentScaleType); } @@ -575,6 +578,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement GPXFile gpxFile = selectedGpxFile.getGpxFile(); if (gpxFile.showCurrentTrack) { app.getSettings().CURRENT_TRACK_COLOR.set(trackDrawInfo.getColor()); + app.getSettings().CURRENT_TRACK_COLORIZATION.set(trackDrawInfo.getGradientScaleType()); app.getSettings().CURRENT_TRACK_WIDTH.set(trackDrawInfo.getWidth()); app.getSettings().CURRENT_TRACK_SHOW_ARROWS.set(trackDrawInfo.isShowArrows()); app.getSettings().CURRENT_TRACK_SHOW_START_FINISH.set(trackDrawInfo.isShowStartFinish()); From b0b5528cc6430628ae78e9cd0ca15d6bdcd0de70 Mon Sep 17 00:00:00 2001 From: cepprice Date: Wed, 10 Mar 2021 16:55:55 +0500 Subject: [PATCH 013/250] Add gradient coloring of track --- .../main/java/net/osmand/GPXUtilities.java | 17 ++++ .../java/net/osmand/router/RouteColorize.java | 18 +++- .../net/osmand/plus/track/TrackDrawInfo.java | 16 ++++ .../src/net/osmand/plus/views/Renderable.java | 52 ++++++++++- .../osmand/plus/views/layers/GPXLayer.java | 87 ++++++++++++++++++- 5 files changed, 180 insertions(+), 10 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java index cb5f40a4b9..ae4080b367 100644 --- a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java +++ b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java @@ -6,6 +6,7 @@ import net.osmand.binary.StringBundle; import net.osmand.binary.StringBundleWriter; import net.osmand.binary.StringBundleXmlWriter; import net.osmand.data.QuadRect; +import net.osmand.router.RouteColorize.ColorizationType; import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; @@ -227,6 +228,9 @@ public class GPXUtilities { public double hdop = Double.NaN; public float heading = Float.NaN; public boolean deleted = false; + public int speedColor = 0; + public int altitudeColor = 0; + public int slopeColor = 0; public int colourARGB = 0; // point colour (used for altitude/speed colouring) public double distance = 0.0; // cumulative distance, if in a track @@ -249,6 +253,9 @@ public class GPXUtilities { this.hdop = wptPt.hdop; this.heading = wptPt.heading; this.deleted = wptPt.deleted; + this.speedColor = wptPt.speedColor; + this.altitudeColor = wptPt.altitudeColor; + this.slopeColor = wptPt.slopeColor; this.colourARGB = wptPt.colourARGB; this.distance = wptPt.distance; } @@ -311,6 +318,16 @@ public class GPXUtilities { getExtensionsToWrite().put(ICON_NAME_EXTENSION, iconName); } + public int getColor(ColorizationType type) { + if (type == ColorizationType.SPEED) { + return speedColor; + } else if (type == ColorizationType.ELEVATION) { + return altitudeColor; + } else { + return slopeColor; + } + } + public String getBackgroundType() { return getExtensionsToRead().get(BACKGROUND_TYPE_EXTENSION); } diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java index 63f0ee1cd3..301a69a101 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java @@ -5,6 +5,7 @@ import net.osmand.PlatformUtil; import net.osmand.osm.edit.Node; import net.osmand.osm.edit.OsmMapUtils; import net.osmand.util.MapUtils; + import org.apache.commons.logging.Log; import java.util.ArrayList; @@ -24,9 +25,9 @@ public class RouteColorize { public static final int DARK_GREY = rgbaToDecimal(92, 92, 92, 255); public static final int LIGHT_GREY = rgbaToDecimal(200, 200, 200, 255); - public static final int GREEN = rgbaToDecimal(90, 220, 95, 1); - public static final int YELLOW = rgbaToDecimal(212, 239, 50, 1); - public static final int RED = rgbaToDecimal(243, 55, 77, 1); + public static final int GREEN = rgbaToDecimal(90, 220, 95, 255); + public static final int YELLOW = rgbaToDecimal(212, 239, 50, 255); + public static final int RED = rgbaToDecimal(243, 55, 77, 255); public static final int[] colors = new int[] {GREEN, YELLOW, RED}; public enum ColorizationType { @@ -202,6 +203,17 @@ public class RouteColorize { sortPalette(); } + public void setPalette(int[] gradientPalette) { + if (gradientPalette.length != 3) { + return; + } + setPalette(new double[][] { + {minValue, gradientPalette[0]}, + {colorizationType == ColorizationType.SLOPE ? 12.5 : (minValue + maxValue) / 2}, + {maxValue, gradientPalette[0]} + }); + } + private int getDefaultColor() { return rgbaToDecimal(0, 0, 0, 0); } diff --git a/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java b/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java index 18d1c30775..f08f87546d 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java @@ -26,6 +26,9 @@ public class TrackDrawInfo { private String width; private GradientScaleType gradientScaleType; private int color; + private int[] speedGradientPalette; + private int[] altitudeGradientPalette; + private int[] slopeGradientPalette; private int splitType; private double splitInterval; private boolean joinSegments; @@ -46,6 +49,9 @@ public class TrackDrawInfo { width = gpxDataItem.getWidth(); gradientScaleType = gpxDataItem.getGradientScaleType(); color = gpxDataItem.getColor(); + speedGradientPalette = gpxDataItem.getGradientSpeedPalette(); + altitudeGradientPalette = gpxDataItem.getGradientAltitudePalette(); + slopeGradientPalette = gpxDataItem.getGradientSlopePalette(); splitType = gpxDataItem.getSplitType(); splitInterval = gpxDataItem.getSplitInterval(); joinSegments = gpxDataItem.isJoinSegments(); @@ -82,6 +88,16 @@ public class TrackDrawInfo { this.color = color; } + public int[] getGradientPalette(@NonNull GradientScaleType scaleType) { + if (scaleType == GradientScaleType.SPEED) { + return speedGradientPalette; + } else if (scaleType == GradientScaleType.ALTITUDE) { + return altitudeGradientPalette; + } else { + return slopeGradientPalette; + } + } + public int getSplitType() { return splitType; } diff --git a/OsmAnd/src/net/osmand/plus/views/Renderable.java b/OsmAnd/src/net/osmand/plus/views/Renderable.java index ec8d302dab..e8d4a6183f 100644 --- a/OsmAnd/src/net/osmand/plus/views/Renderable.java +++ b/OsmAnd/src/net/osmand/plus/views/Renderable.java @@ -1,8 +1,10 @@ package net.osmand.plus.views; import android.graphics.Canvas; +import android.graphics.LinearGradient; import android.graphics.Paint; import android.graphics.Path; +import android.graphics.Shader; import androidx.annotation.NonNull; @@ -10,7 +12,7 @@ import net.osmand.GPXUtilities; import net.osmand.GPXUtilities.WptPt; import net.osmand.data.QuadRect; import net.osmand.data.RotatedTileBox; -import net.osmand.plus.views.layers.geometry.GeometryWay; +import net.osmand.plus.track.GradientScaleType; import net.osmand.plus.views.layers.geometry.GpxGeometryWay; import net.osmand.util.Algorithms; @@ -65,6 +67,7 @@ public class Renderable { protected double zoom = -1; protected AsynchronousResampler culler = null; // The currently active resampler protected Paint paint = null; // MUST be set by 'updateLocalPaint' before use + protected GradientScaleType scaleType = null; protected GpxGeometryWay geometryWay; @@ -85,6 +88,10 @@ public class Renderable { paint.setStrokeWidth(p.getStrokeWidth()); } + public void setGradientScaleType(GradientScaleType type) { + this.scaleType = type; + } + public GpxGeometryWay getGeometryWay() { return geometryWay; } @@ -124,7 +131,7 @@ public class Renderable { } } - protected void draw(List pts, Paint p, Canvas canvas, RotatedTileBox tileBox) { + protected void drawSolid(List pts, Paint p, Canvas canvas, RotatedTileBox tileBox) { if (pts.size() > 1) { updateLocalPaint(p); canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); @@ -160,6 +167,38 @@ public class Renderable { canvas.rotate(tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); } } + + protected void drawGradient(List pts, Paint p, Canvas canvas, RotatedTileBox tileBox) { + if (pts.size() < 2) { + return; + } + + updateLocalPaint(p); + canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); + QuadRect tileBounds = tileBox.getLatLonBounds(); + WptPt prevPt = pts.get(0); + for (int i = 1; i < pts.size(); i++) { + WptPt currentPt = pts.get(i); + if (Math.min(currentPt.lon, prevPt.lon) < tileBounds.right && Math.max(currentPt.lon, prevPt.lon) > tileBounds.left + && Math.min(currentPt.lat, prevPt.lat) < tileBounds.top && Math.max(currentPt.lat, prevPt.lat) > tileBounds.bottom) { + float startX = tileBox.getPixXFromLatLon(prevPt.lat, prevPt.lon); + float startY = tileBox.getPixYFromLatLon(prevPt.lat, prevPt.lon); + float endX = tileBox.getPixXFromLatLon(currentPt.lat, currentPt.lon); + float endY = tileBox.getPixYFromLatLon(currentPt.lat, currentPt.lon); + int prevColor = prevPt.getColor(scaleType.toColorizationType()); + int currentColor = currentPt.getColor(scaleType.toColorizationType()); + LinearGradient gradient = new LinearGradient(startX, startY, endX, endY, prevColor, currentColor, Shader.TileMode.CLAMP); + Paint paint = new Paint(this.paint); + paint.setShader(gradient); + Path path = new Path(); + path.moveTo(startX, startY); + path.lineTo(endX, endY); + canvas.drawPath(path, paint); + } + prevPt = currentPt; + } + canvas.rotate(tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); + } } public static class StandardTrack extends RenderableSegment { @@ -193,7 +232,12 @@ public class Renderable { } @Override public void drawSingleSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) { - draw(culled.isEmpty() ? points : culled, p, canvas, tileBox); + if (scaleType != null) { + drawGradient(getPointsForDrawing(), p, canvas, tileBox); + scaleType = null; + } else { + drawSolid(getPointsForDrawing(), p, canvas, tileBox); + } } } @@ -215,7 +259,7 @@ public class Renderable { @Override protected void startCuller(double newZoom) {} @Override public void drawSingleSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) { - draw(points, p, canvas, tileBox); + drawSolid(points, p, canvas, tileBox); } } } diff --git a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java index 339192e6b6..abb99e8428 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java @@ -53,6 +53,7 @@ import net.osmand.plus.render.OsmandRenderer; import net.osmand.plus.render.OsmandRenderer.RenderingContext; import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu; import net.osmand.plus.settings.backend.CommonPreference; +import net.osmand.plus.track.GradientScaleType; import net.osmand.plus.track.SaveGpxAsyncTask; import net.osmand.plus.track.TrackDrawInfo; import net.osmand.plus.views.OsmandMapLayer; @@ -66,6 +67,7 @@ import net.osmand.plus.views.layers.geometry.GpxGeometryWayContext; import net.osmand.render.RenderingRuleProperty; import net.osmand.render.RenderingRuleSearchRequest; import net.osmand.render.RenderingRulesStorage; +import net.osmand.router.RouteColorize; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; @@ -142,6 +144,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM private CommonPreference defaultTrackWidthPref; private CommonPreference currentTrackColorPref; + private CommonPreference currentTrackScaleType; private CommonPreference currentTrackWidthPref; private CommonPreference currentTrackShowArrowsPref; private CommonPreference currentTrackShowStartFinishPref; @@ -155,6 +158,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM osmandRenderer = view.getApplication().getResourceManager().getRenderer().getRenderer(); currentTrackColorPref = view.getSettings().CURRENT_TRACK_COLOR; + currentTrackScaleType = view.getSettings().CURRENT_TRACK_COLORIZATION; currentTrackWidthPref = view.getSettings().CURRENT_TRACK_WIDTH; currentTrackShowArrowsPref = view.getSettings().CURRENT_TRACK_SHOW_ARROWS; currentTrackShowStartFinishPref = view.getSettings().CURRENT_TRACK_SHOW_START_FINISH; @@ -661,10 +665,22 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM private void drawSelectedFileSegments(SelectedGpxFile selectedGpxFile, boolean currentTrack, Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) { + GPXFile gpxFile = selectedGpxFile.getGpxFile(); List segments = selectedGpxFile.getPointsToDisplay(); + GradientScaleType scaleType = getGradientScaleType(gpxFile); + List colorsOfPoints = null; + if (scaleType != null) { + RouteColorize colorize = new RouteColorize(view.getZoom(), gpxFile, scaleType.toColorizationType()); + colorize.setPalette(getColorizationPalette(gpxFile, scaleType)); + colorsOfPoints = colorize.getResult(false); + } + int startIdx = 0; for (TrkSegment ts : segments) { - String width = getTrackWidthName(selectedGpxFile.getGpxFile(), defaultTrackWidthPref.get()); - int color = getTrackColor(selectedGpxFile.getGpxFile(), ts.getColor(cachedColor)); + String width = getTrackWidthName(gpxFile, defaultTrackWidthPref.get()); + int color = getTrackColor(gpxFile, ts.getColor(cachedColor)); + if (colorsOfPoints != null) { + startIdx = setColorsToPoints(ts, colorsOfPoints, scaleType, startIdx); + } if (ts.renderer == null && !ts.points.isEmpty()) { Renderable.RenderableSegment renderer; if (currentTrack) { @@ -677,11 +693,45 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM } updatePaints(color, width, selectedGpxFile.isRoutePoints(), currentTrack, settings, tileBox); if (ts.renderer instanceof Renderable.RenderableSegment) { - ((Renderable.RenderableSegment) ts.renderer).drawSegment(view.getZoom(), paint, canvas, tileBox); + Renderable.RenderableSegment renderableSegment = (Renderable.RenderableSegment) ts.renderer; + if (scaleType != null) { + renderableSegment.setGradientScaleType(scaleType); + } + renderableSegment.drawSegment(view.getZoom(), paint, canvas, tileBox); } } } + private int setColorsToPoints(TrkSegment segment, List colors, GradientScaleType scaleType, int startIdx) { + int pointsSize = segment.points.size(); + RouteColorize.RouteColorizationPoint startColor = colors.get(startIdx); + RouteColorize.RouteColorizationPoint endColor = colors.get(startIdx + pointsSize - 1); + WptPt firstPoint = segment.points.get(0); + WptPt lastPoint = segment.points.get(pointsSize - 1); + while (!compareCoordinates(firstPoint, startColor) && compareCoordinates(lastPoint, endColor)) { + startIdx++; + startColor = colors.get(startIdx); + endColor = colors.get(startIdx + pointsSize - 1); + } + + for (int i = startIdx; i < startIdx + pointsSize; i++) { + WptPt currentPoint = segment.points.get(i - startIdx); + int currentColor = colors.get(i).color; + if (scaleType == GradientScaleType.SPEED) { + currentPoint.speedColor = currentColor; + } else if (scaleType == GradientScaleType.ALTITUDE) { + currentPoint.altitudeColor = currentColor; + } else { + currentPoint.slopeColor = currentColor; + } + } + return startIdx; + } + + private boolean compareCoordinates(WptPt left, RouteColorize.RouteColorizationPoint right) { + return left.lat == right.lat && left.lon == right.lon; + } + private float getTrackWidth(String width, float defaultTrackWidth) { Float trackWidth = cachedTrackWidth.get(width); return trackWidth != null ? trackWidth : defaultTrackWidth; @@ -702,6 +752,37 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM return color != 0 ? color : defaultColor; } + private GradientScaleType getGradientScaleType(GPXFile gpxFile) { + if (hasTrackDrawInfoForTrack(gpxFile)) { + return trackDrawInfo.getGradientScaleType(); + } else if (gpxFile.showCurrentTrack) { + return currentTrackScaleType.get(); + } else { + GpxDataItem dataItem = gpxDbHelper.getItem(new File(gpxFile.path)); + if (dataItem != null && dataItem.getGradientScaleType() != null) { + return dataItem.getGradientScaleType(); + } + } + return null; + } + + private int[] getColorizationPalette(GPXFile gpxFile, GradientScaleType scaleType) { + if (hasTrackDrawInfoForTrack(gpxFile)) { + return trackDrawInfo.getGradientPalette(scaleType); + } + GpxDataItem dataItem = gpxDbHelper.getItem(new File(gpxFile.path)); + if (dataItem == null) { + return RouteColorize.colors; + } + if (scaleType == GradientScaleType.SPEED) { + return dataItem.getGradientSpeedPalette(); + } else if (scaleType == GradientScaleType.ALTITUDE) { + return dataItem.getGradientAltitudePalette(); + } else { + return dataItem.getGradientSlopePalette(); + } + } + private String getTrackWidthName(GPXFile gpxFile, String defaultWidth) { String width = null; if (hasTrackDrawInfoForTrack(gpxFile)) { From 116ec774add189de5628e8be26c8c0f5c6539ef6 Mon Sep 17 00:00:00 2001 From: cepprice Date: Wed, 10 Mar 2021 18:43:40 +0500 Subject: [PATCH 014/250] Small fixes --- .../java/net/osmand/router/RouteColorize.java | 2 +- OsmAnd/src/net/osmand/plus/GPXDatabase.java | 4 ++-- .../plus/settings/backend/OsmandSettings.java | 24 ++++++++++++++++++- .../net/osmand/plus/track/TrackDrawInfo.java | 2 +- .../src/net/osmand/plus/views/Renderable.java | 22 +++++++---------- 5 files changed, 35 insertions(+), 19 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java index 301a69a101..a259a8ebb6 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java @@ -204,7 +204,7 @@ public class RouteColorize { } public void setPalette(int[] gradientPalette) { - if (gradientPalette.length != 3) { + if (gradientPalette == null || gradientPalette.length != 3) { return; } setPalette(new double[][] { diff --git a/OsmAnd/src/net/osmand/plus/GPXDatabase.java b/OsmAnd/src/net/osmand/plus/GPXDatabase.java index b08013017f..0f70144a73 100644 --- a/OsmAnd/src/net/osmand/plus/GPXDatabase.java +++ b/OsmAnd/src/net/osmand/plus/GPXDatabase.java @@ -176,8 +176,8 @@ public class GPXDatabase { private File file; private GPXTrackAnalysis analysis; private String width; - private GradientScaleType gradientScaleType; private int color; + private GradientScaleType gradientScaleType; private int[] gradientSpeedPalette; private int[] gradientAltitudePalette; private int[] gradientSlopePalette; @@ -884,7 +884,7 @@ public class GPXDatabase { item.gradientSlopePalette = Algorithms.stringToGradientPalette(gradientSlopePalette); try { - item.gradientScaleType = Algorithms.isEmpty(gradientScaleType) ? null : GradientScaleType.valueOf(gradientScaleType); + item.gradientScaleType = Algorithms.isEmpty(gradientScaleType) ? null : GradientScaleType.valueOf(gradientScaleType.toUpperCase()); } catch (IllegalArgumentException e) { item.gradientScaleType = null; } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 0635f8d7c1..7abb6245d6 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -1409,7 +1409,29 @@ public class OsmandSettings { public final OsmandPreference LAST_UPDATES_CARD_REFRESH = new LongPreference(this, "last_updates_card_refresh", 0).makeGlobal(); public final CommonPreference CURRENT_TRACK_COLOR = new IntPreference(this, "current_track_color", 0).makeGlobal().makeShared().cache(); - public final CommonPreference CURRENT_TRACK_COLORIZATION = new EnumStringPreference<>(this, "current_track_colorization", null, GradientScaleType.values()).makeGlobal().makeShared().cache(); + public final CommonPreference CURRENT_TRACK_COLORIZATION = new CommonPreference(this, "current_track_colorization", null) { + @Override + protected GradientScaleType getValue(Object prefs, GradientScaleType defaultValue) { + String name = getSettingsAPI().getString(prefs, getId(), null); + return parseString(name); + } + + @Override + protected boolean setValue(Object prefs, GradientScaleType val) { + String name = val == null ? null : val.getTypeName(); + return getSettingsAPI().edit(prefs).putString(getId(), name).commit(); + } + + @Override + public GradientScaleType parseString(String s) { + for (GradientScaleType value : GradientScaleType.values()) { + if (value.name().equals(s)) { + return value; + } + } + return null; + } + }.makeGlobal().makeShared().cache(); public final CommonPreference CURRENT_TRACK_WIDTH = new StringPreference(this, "current_track_width", "").makeGlobal().makeShared().cache(); public final CommonPreference CURRENT_TRACK_SHOW_ARROWS = new BooleanPreference(this, "current_track_show_arrows", false).makeGlobal().makeShared().cache(); public final CommonPreference CURRENT_TRACK_SHOW_START_FINISH = new BooleanPreference(this, "current_track_show_start_finish", true).makeGlobal().makeShared().cache(); diff --git a/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java b/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java index f08f87546d..d3531c0c9d 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java @@ -47,8 +47,8 @@ public class TrackDrawInfo { public TrackDrawInfo(@NonNull OsmandApplication app, @NonNull GpxDataItem gpxDataItem, boolean currentRecording) { filePath = gpxDataItem.getFile().getPath(); width = gpxDataItem.getWidth(); - gradientScaleType = gpxDataItem.getGradientScaleType(); color = gpxDataItem.getColor(); + gradientScaleType = gpxDataItem.getGradientScaleType(); speedGradientPalette = gpxDataItem.getGradientSpeedPalette(); altitudeGradientPalette = gpxDataItem.getGradientAltitudePalette(); slopeGradientPalette = gpxDataItem.getGradientSlopePalette(); diff --git a/OsmAnd/src/net/osmand/plus/views/Renderable.java b/OsmAnd/src/net/osmand/plus/views/Renderable.java index e8d4a6183f..a8d8351967 100644 --- a/OsmAnd/src/net/osmand/plus/views/Renderable.java +++ b/OsmAnd/src/net/osmand/plus/views/Renderable.java @@ -102,7 +102,14 @@ public class Renderable { protected abstract void startCuller(double newZoom); - protected void drawSingleSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) {} + protected void drawSingleSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) { + if (scaleType != null) { + drawGradient(getPointsForDrawing(), p, canvas, tileBox); + scaleType = null; + } else { + drawSolid(getPointsForDrawing(), p, canvas, tileBox); + } + } public void drawSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) { @@ -230,15 +237,6 @@ public class Renderable { } } } - - @Override public void drawSingleSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) { - if (scaleType != null) { - drawGradient(getPointsForDrawing(), p, canvas, tileBox); - scaleType = null; - } else { - drawSolid(getPointsForDrawing(), p, canvas, tileBox); - } - } } public static class CurrentTrack extends RenderableSegment { @@ -257,9 +255,5 @@ public class Renderable { } @Override protected void startCuller(double newZoom) {} - - @Override public void drawSingleSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) { - drawSolid(points, p, canvas, tileBox); - } } } From c473f77a4db72c9b7d92b1a5a1c504f0178f8987 Mon Sep 17 00:00:00 2001 From: cepprice Date: Wed, 10 Mar 2021 19:59:06 +0500 Subject: [PATCH 015/250] Fix palette --- .../src/main/java/net/osmand/router/RouteColorize.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java index a259a8ebb6..7b9f46c108 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java @@ -209,8 +209,8 @@ public class RouteColorize { } setPalette(new double[][] { {minValue, gradientPalette[0]}, - {colorizationType == ColorizationType.SLOPE ? 12.5 : (minValue + maxValue) / 2}, - {maxValue, gradientPalette[0]} + {colorizationType == ColorizationType.SLOPE ? 0 : (minValue + maxValue) / 2}, + {maxValue, gradientPalette[2]} }); } From 772df1dd46d856e0f49ce11d3f0bb7d0bd665033 Mon Sep 17 00:00:00 2001 From: cepprice Date: Wed, 10 Mar 2021 23:11:08 +0500 Subject: [PATCH 016/250] Fix NPE --- OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java index 737e302e6a..be59b4bf6f 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java @@ -1049,7 +1049,7 @@ public class Algorithms { } public static String gradientPaletteToString(int[] colors) { - int[] src = colors.length == 3 ? colors : RouteColorize.colors; + int[] src = (colors != null && colors.length == 3) ? colors : RouteColorize.colors; return Algorithms.colorToString(src[0]) + " " + Algorithms.colorToString(src[1]) + " " + Algorithms.colorToString(src[2]); From 39c1d6b7f97ac0b398fd76f8f4bc86545505a458 Mon Sep 17 00:00:00 2001 From: Skalii Date: Thu, 11 Mar 2021 05:56:22 +0200 Subject: [PATCH 017/250] many fixes --- .../bottom_sheet_button_with_icon_center.xml | 12 +- .../list_item_triple_row_icon_and_menu.xml | 23 +-- .../res/layout/osm_live_banner_list_item.xml | 6 +- OsmAnd/res/values/strings.xml | 16 +- .../src/net/osmand/plus/AppInitializer.java | 6 +- .../download/ui/UpdatesIndexFragment.java | 136 ++++++---------- .../liveupdates/LiveUpdatesAlarmReceiver.java | 2 +- .../LiveUpdatesClearDialogFragment.java | 22 ++- .../plus/liveupdates/LiveUpdatesFragment.java | 6 +- .../liveupdates/LiveUpdatesFragmentNew.java | 102 ++++-------- .../plus/liveupdates/LiveUpdatesHelper.java | 43 +++-- .../LiveUpdatesSettingsDialogFragment.java | 4 +- .../LiveUpdatesSettingsDialogFragmentNew.java | 153 ++++++++---------- .../plus/liveupdates/LoadLiveMapsTask.java | 83 ++++++++++ .../PerformLiveUpdateAsyncTask.java | 57 ++++--- .../controllers/MapDataMenuController.java | 2 +- 16 files changed, 315 insertions(+), 358 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java diff --git a/OsmAnd/res/layout/bottom_sheet_button_with_icon_center.xml b/OsmAnd/res/layout/bottom_sheet_button_with_icon_center.xml index 493705898b..ce9b53918b 100644 --- a/OsmAnd/res/layout/bottom_sheet_button_with_icon_center.xml +++ b/OsmAnd/res/layout/bottom_sheet_button_with_icon_center.xml @@ -11,22 +11,21 @@ android:layout_marginRight="@dimen/content_padding" android:orientation="vertical"> - @@ -34,13 +33,14 @@ android:id="@+id/button_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_centerInParent="true" + android:layout_marginEnd="@dimen/context_menu_controller_height" + android:layout_marginRight="@dimen/context_menu_controller_height" android:letterSpacing="@dimen/description_letter_spacing" android:textColor="?attr/active_color_basic" android:textSize="@dimen/default_desc_text_size" osmand:typeface="@string/font_roboto_medium" tools:text="Button" /> - + \ No newline at end of file diff --git a/OsmAnd/res/layout/list_item_triple_row_icon_and_menu.xml b/OsmAnd/res/layout/list_item_triple_row_icon_and_menu.xml index e2a03293eb..1f179b8178 100644 --- a/OsmAnd/res/layout/list_item_triple_row_icon_and_menu.xml +++ b/OsmAnd/res/layout/list_item_triple_row_icon_and_menu.xml @@ -1,10 +1,11 @@ - @@ -12,7 +13,6 @@ android:id="@+id/icon" android:layout_width="@dimen/standard_icon_size" android:layout_height="@dimen/standard_icon_size" - android:layout_centerVertical="true" android:layout_gravity="center_vertical" android:layout_marginStart="@dimen/content_padding" android:layout_marginLeft="@dimen/content_padding" @@ -22,15 +22,11 @@ tools:tint="@color/icon_color_osmand_light" /> @@ -53,9 +49,9 @@ android:id="@+id/sub_title" android:layout_width="match_parent" android:layout_height="wrap_content" + android:ellipsize="end" android:letterSpacing="@dimen/description_letter_spacing" android:lines="1" - android:ellipsize="end" android:textColor="?attr/active_color_basic" android:textSize="@dimen/default_desc_text_size" tools:text="Sub" /> @@ -86,12 +82,9 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/OsmAnd/res/layout/osm_live_banner_list_item.xml b/OsmAnd/res/layout/osm_live_banner_list_item.xml index 2cba180cec..b9f103ddd7 100644 --- a/OsmAnd/res/layout/osm_live_banner_list_item.xml +++ b/OsmAnd/res/layout/osm_live_banner_list_item.xml @@ -5,7 +5,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/list_background_color" - android:descendantFocusability="blocksDescendants" android:orientation="vertical" android:paddingStart="@dimen/list_content_padding" android:paddingLeft="@dimen/list_content_padding" @@ -52,13 +51,13 @@ android:textColor="?android:textColorSecondary" android:textSize="@dimen/default_desc_text_size" /> - @@ -66,6 +65,7 @@ android:id="@+id/card_container" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" android:gravity="center_vertical" android:minHeight="@dimen/dialog_button_height" android:orientation="horizontal" diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index f12f918a96..b8583dfe36 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -19,9 +19,9 @@ Purchases Are you sure you want to delete all %s live updates? Delete updates - Map updates will be checked every hour. Next time%s in %s. - Map updates will be checked every day. Next time%s in %s. - Map updates will be checked every week. Next time%s in %s. + Map updates will be checked every hour. Next time%1$s in %2$s. + Map updates will be checked every day. Next time%1$s in %2$s. + Map updates will be checked every week. Next time%1$s in %2$s. Update frequency Last time checked: %s Updated: %s @@ -30,7 +30,6 @@ A toggle to show or hide the Coordinates widget on the map. Show Coordinates widget Hide Coordinates widget - Show/Hide coordinates widget Routing could avoid strong uphills. Application restart required to apply some settings. On pause @@ -355,7 +354,6 @@ A toggle to show or hide the Mapillary layer on the map. Show Mapillary Hide Mapillary - Show/hide Mapillary Set vessel width to avoid narrow bridges Set vessel height to avoid low bridges. Keep in mind, if the bridge is movable, we will use its height in the open state. You can set vessel height to avoid low bridges. Keep in mind, if the bridge is movable, we will use its height in the open state. @@ -432,7 +430,6 @@ Parking positions Create or edit POI Button showing or hiding public transport on the map. - Show or hide public transport Show public transport Hide public transport @@ -534,7 +531,6 @@ A button to show or hide terrain layer on the map. Show terrain Hide terrain - Show or hide terrain Slopes %1$s of %2$s The route will be recalculated if the distance from the route to the current location is more than selected value. @@ -737,11 +733,9 @@ Button showing or hiding contour lines on the map. Show contour lines Hide contour lines - Show/hide contour lines A button to show or hide hillshades on the map. Show hillshade Hide hillshade - Show/hide hillshade You can apply this change to all or only the selected profile. Shared Prefer unpaved roads @@ -1128,7 +1122,6 @@ Swap Show more Displayed tracks - Show/hide tracks A button to show or hide selected tracks on the map. Hide Tracks Show Tracks @@ -1541,7 +1534,6 @@ Increase search radius Nothing found Change the search or increase its radius. - Show or hide OSM notes Show OSM notes Hide OSM notes Button to show or hide OSM notes on the map. @@ -4025,10 +4017,8 @@ Quick action name duplicate A toggle to show or hide the Favorite points on the map. A toggle to show or hide POIs on the map. - Show/hide Favorites Show Favorites Hide Favorites - Show/hide POI Show %1$s Hide %1$s Add a category diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java index 819590a516..6a5be10def 100644 --- a/OsmAnd/src/net/osmand/plus/AppInitializer.java +++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java @@ -93,8 +93,8 @@ import btools.routingapp.IBRouterService; import static net.osmand.plus.AppVersionUpgradeOnInit.LAST_APP_VERSION; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent; +import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck; -import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; @@ -714,7 +714,7 @@ public class AppInitializer implements IProgress { AlarmManager alarmMgr = (AlarmManager) app.getSystemService(Context.ALARM_SERVICE); for (LocalIndexInfo fm : fullMaps) { String fileName = fm.getFileName(); - if (!preferenceLiveUpdatesOn(fileName, settings).get()) { + if (!preferenceForLocalIndex(fileName, settings).get()) { continue; } int updateFrequencyOrd = preferenceUpdateFrequency(fileName, settings).get(); @@ -723,7 +723,7 @@ public class AppInitializer implements IProgress { long lastCheck = preferenceLastCheck(fileName, settings).get(); if (System.currentTimeMillis() - lastCheck > updateFrequency.getTime() * 2) { - runLiveUpdate(app, fileName, false); + runLiveUpdate(app, fileName, false, null); PendingIntent alarmIntent = getPendingIntent(app, fileName); int timeOfDayOrd = preferenceTimeOfDayToUpdate(fileName, settings).get(); LiveUpdatesHelper.TimeOfDay timeOfDayToUpdate = diff --git a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java index 8b88eb756a..486c503842 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java @@ -23,7 +23,6 @@ import android.widget.ListView; import android.widget.TextView; import androidx.annotation.ColorRes; -import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.content.res.AppCompatResources; @@ -37,11 +36,12 @@ import net.osmand.OsmAndCollator; import net.osmand.map.OsmandRegions; import net.osmand.plus.OsmandApplication; import net.osmand.plus.UiUtilities; -import net.osmand.plus.activities.LocalIndexHelper; import net.osmand.plus.activities.LocalIndexInfo; import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.liveupdates.LiveUpdatesClearDialogFragment.OnRefreshLiveUpdates; +import net.osmand.plus.liveupdates.LiveUpdatesClearDialogFragment.RefreshLiveUpdates; import net.osmand.plus.liveupdates.LiveUpdatesFragmentNew; +import net.osmand.plus.liveupdates.LoadLiveMapsTask; +import net.osmand.plus.liveupdates.LoadLiveMapsTask.LocalIndexInfoAdapter; import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; @@ -59,25 +59,20 @@ import java.util.Comparator; import java.util.List; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex; -import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; -public class UpdatesIndexFragment extends OsmAndListFragment implements DownloadEvents, OnRefreshLiveUpdates { +public class UpdatesIndexFragment extends OsmAndListFragment implements DownloadEvents, RefreshLiveUpdates { private static final int RELOAD_ID = 5; private UpdateIndexAdapter listAdapter; private String errorMessage; - private OsmandApplication app; private OsmandSettings settings; - private boolean nightMode; private LoadLiveMapsTask loadLiveMapsTask; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); - app = getMyApplication(); - settings = app.getSettings(); - nightMode = !app.getSettings().isLightContent(); + settings = getMyApplication().getSettings(); } @@ -125,20 +120,20 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download } public void invalidateListView(Activity a) { - DownloadResources indexes = getMyApplication().getDownloadThread().getIndexes(); + final OsmandApplication app = getMyApplication(); + OsmandSettings settings = app.getSettings(); + DownloadResources indexes = app.getDownloadThread().getIndexes(); List indexItems = indexes.getItemsToUpdate(); - final OsmandRegions osmandRegions = - getMyApplication().getResourceManager().getOsmandRegions(); - OsmandSettings settings = getMyApplication().getSettings(); + final OsmandRegions osmandRegions = app.getResourceManager().getOsmandRegions(); listAdapter = new UpdateIndexAdapter(a, R.layout.download_index_list_item, indexItems, - !InAppPurchaseHelper.isSubscribedToLiveUpdates(getMyApplication()) || settings.SHOULD_SHOW_FREE_VERSION_BANNER.get()); + !InAppPurchaseHelper.isSubscribedToLiveUpdates(app) || settings.SHOULD_SHOW_FREE_VERSION_BANNER.get()); final Collator collator = OsmAndCollator.primaryCollator(); listAdapter.sort(new Comparator() { @Override public int compare(IndexItem indexItem, IndexItem indexItem2) { - return collator.compare(indexItem.getVisibleName(getMyApplication(), osmandRegions), - indexItem2.getVisibleName(getMyApplication(), osmandRegions)); + return collator.compare(indexItem.getVisibleName(app, osmandRegions), + indexItem2.getVisibleName(app, osmandRegions)); } }); setListAdapter(listAdapter); @@ -185,26 +180,27 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download for (IndexItem indexItem : indexItems) { downloadsSize += indexItem.getSize(); } - String updateAllText = getActivity().getString( + String updateAllText = getString( R.string.update_all, String.valueOf(downloadsSize >> 20)); updateAllButton.setText(updateAllText); updateAllButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + final DownloadActivity activity = getMyActivity(); if (indexItems.size() > 3) { - AlertDialog.Builder dialog = new AlertDialog.Builder(getMyActivity()); + AlertDialog.Builder dialog = new AlertDialog.Builder(activity); dialog.setTitle(R.string.update_all_maps); dialog.setMessage(getString(R.string.update_all_maps_q, indexItems.size())); dialog.setNegativeButton(R.string.shared_string_cancel, null); dialog.setPositiveButton(R.string.shared_string_update, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - getMyActivity().startDownload(indexItems.toArray(new IndexItem[0])); + activity.startDownload(indexItems.toArray(new IndexItem[0])); } }); dialog.create().show(); } else { - getMyActivity().startDownload(indexItems.toArray(new IndexItem[0])); + activity.startDownload(indexItems.toArray(new IndexItem[0])); } } }); @@ -225,12 +221,13 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download private void startLoadLiveMapsAsyncTask(OsmandApplication app) { loadLiveMapsTask = new LoadLiveMapsTask(listAdapter, app); + loadLiveMapsTask.setUpdateCount(true); loadLiveMapsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private void stopLoadLiveMapsAsyncTask() { - if (loadLiveMapsTask != null) { - loadLiveMapsTask.cancel(true); + if (loadLiveMapsTask != null && loadLiveMapsTask.getStatus() == AsyncTask.Status.RUNNING) { + loadLiveMapsTask.cancel(false); } } @@ -239,9 +236,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download if (position == 0) { DownloadActivity activity = getMyActivity(); if (activity != null) { - if (listAdapter.isNotSubscribed()) { - ChoosePlanDialogFragment.showOsmLiveInstance(activity.getSupportFragmentManager()); - } else { + if (!listAdapter.isNotSubscribed()) { LiveUpdatesFragmentNew.showInstance(activity.getSupportFragmentManager(), this); } } @@ -257,11 +252,6 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download return (DownloadActivity) getActivity(); } - @Nullable - public OsmandApplication getMyApplication() { - return getMyActivity().getMyApplication(); - } - @SuppressWarnings("deprecation") @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { @@ -295,7 +285,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download } } - private class UpdateIndexAdapter extends ArrayAdapter { + private class UpdateIndexAdapter extends ArrayAdapter implements LocalIndexInfoAdapter { static final int INDEX_ITEM = 0; static final int OSM_LIVE_BANNER = 1; @@ -306,14 +296,21 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download private int countAll = 0; private int countEnabled = 0; - public void clearLii() { - mapsList.clear(); - } - - public void addLii(LocalIndexInfo info) { + @Override + public void addData(LocalIndexInfo info) { mapsList.add(info); } + @Override + public void clearData() { + mapsList.clear(); + } + + @Override + public void sort() { + } + + @Override public void updateCountEnabled() { countAll = 0; countEnabled = 0; @@ -379,12 +376,21 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download view = inflater.inflate(R.layout.two_line_with_images_list_item, parent, false); view.setTag(new ItemViewHolder(view, getMyActivity())); } else if (viewType == OSM_LIVE_BANNER) { + OsmandApplication app = getMyApplication(); + boolean nightMode = !app.getSettings().isLightContent(); if (isNotSubscribed) { view = inflater.inflate(R.layout.osm_live_banner_list_item, parent, false); ColorStateList stateList = AndroidUtils.createPressedColorStateList(app, nightMode, R.color.switch_button_active_light, R.color.switch_button_active_stroke_light, R.color.switch_button_active_dark, R.color.switch_button_active_stroke_dark); - ((CardView) view.findViewById(R.id.card_view)).setCardBackgroundColor(stateList); + CardView cardView = ((CardView) view.findViewById(R.id.card_view)); + cardView.setCardBackgroundColor(stateList); + cardView.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + ChoosePlanDialogFragment.showOsmLiveInstance(getMyActivity().getSupportFragmentManager()); + } + }); } else { view = inflater.inflate(R.layout.bottom_sheet_item_with_descr_switch_and_additional_button_56dp, parent, false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { @@ -424,59 +430,11 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download } } - public static class LoadLiveMapsTask - extends AsyncTask> - implements AbstractLoadLocalIndexTask { - - //private List result; - private final UpdateIndexAdapter adapter; - private final LocalIndexHelper helper; - - public LoadLiveMapsTask(UpdateIndexAdapter adapter, OsmandApplication app) { - this.adapter = adapter; - helper = new LocalIndexHelper(app); - } - - @Override - protected void onPreExecute() { - adapter.clearLii(); - } - - @Override - protected List doInBackground(Void... params) { - return helper.getLocalFullMaps(this); - } - - @Override - public void loadFile(LocalIndexInfo... loaded) { - publishProgress(loaded); - } - - @Override - protected void onProgressUpdate(LocalIndexInfo... values) { - String fileNameL; - for (LocalIndexInfo localIndexInfo : values) { - fileNameL = localIndexInfo.getFileName().toLowerCase(); - if (localIndexInfo.getType() == LocalIndexHelper.LocalIndexType.MAP_DATA - && !fileNameL.contains("world") && !fileNameL.startsWith("depth_")) { - adapter.addLii(localIndexInfo); - } - } - } - - @Override - protected void onPostExecute(List result) { - //this.result = result; - adapter.updateCountEnabled(); - - } - } - private void showUpdateDialog() { if (!listAdapter.isNotSubscribed() && !Algorithms.isEmpty(listAdapter.mapsList)) { if (listAdapter.countEnabled == 1) { LocalIndexInfo li = listAdapter.mapsList.get(0); - runLiveUpdate(getActivity(), li.getFileName(), false); + runLiveUpdate(getActivity(), li.getFileName(), false, null); } else if (listAdapter.countEnabled > 1) { AlertDialog.Builder bld = new AlertDialog.Builder(getMyActivity()); bld.setMessage(R.string.update_all_maps_now); @@ -485,9 +443,9 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download @Override public void onClick(DialogInterface dialog, int which) { for (LocalIndexInfo li : listAdapter.mapsList) { - CommonPreference localUpdateOn = preferenceLiveUpdatesOn(li.getFileName(), settings); + CommonPreference localUpdateOn = preferenceForLocalIndex(li.getFileName(), getMyApplication().getSettings()); if (localUpdateOn.get()) { - runLiveUpdate(getActivity(), li.getFileName(), false); + runLiveUpdate(getActivity(), li.getFileName(), false, null); } } } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java index 9cc47eda82..78d84bf220 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesAlarmReceiver.java @@ -32,7 +32,7 @@ public class LiveUpdatesAlarmReceiver extends BroadcastReceiver { final OsmandSettings settings = application.getSettings(); if (!preferenceDownloadViaWiFi(localIndexInfoFile, settings).get() || wifi.isWifiEnabled()) { - new PerformLiveUpdateAsyncTask(context, localIndexInfoFile, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, fileName); + new PerformLiveUpdateAsyncTask(context, localIndexInfoFile, false, null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, fileName); } else { PerformLiveUpdateAsyncTask.tryRescheduleDownload(context, settings, localIndexInfoFile); } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java index 9a67fc228e..23bf471c24 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java @@ -56,20 +56,18 @@ public class LiveUpdatesClearDialogFragment extends MenuBottomSheetDialogFragmen app = getMyApplication(); settings = app.getSettings(); - if (savedInstanceState != null) { - if (savedInstanceState.containsKey(LOCAL_INDEX_FILE_NAME)) { - fileName = savedInstanceState.getString(LOCAL_INDEX_FILE_NAME); - } + if (savedInstanceState != null && savedInstanceState.containsKey(LOCAL_INDEX_FILE_NAME)) { + fileName = savedInstanceState.getString(LOCAL_INDEX_FILE_NAME); } items.add(new SimpleBottomSheetItem.Builder() - .setTitle(app.getResources().getString(R.string.delete_updates)) + .setTitle(getString(R.string.delete_updates)) .setTitleColorId(getPrimaryTextColorId(nightMode)) .setLayoutId(R.layout.bottom_sheet_item_title) .create()); String nameToDisplay = getNameToDisplay(fileName, app); - String text = app.getResources().getString(R.string.live_update_delete_updates_msg, nameToDisplay); + String text = getString(R.string.live_update_delete_updates_msg, nameToDisplay); SpannableString message = UiUtilities.createSpannableString(text, new StyleSpan(Typeface.BOLD), nameToDisplay); items.add(new LongDescriptionItem.Builder() @@ -96,22 +94,22 @@ public class LiveUpdatesClearDialogFragment extends MenuBottomSheetDialogFragmen preferenceLatestUpdateAvailable(fileName, settings).resetToDefault(); } - public interface OnRefreshLiveUpdates { - void onUpdateStates(Context context); - } - @Override protected void onRightBottomButtonClick() { deleteUpdates(); Fragment fragment = getTargetFragment(); - if (fragment instanceof OnRefreshLiveUpdates) { - ((OnRefreshLiveUpdates) fragment).onUpdateStates(app); + if (fragment instanceof RefreshLiveUpdates) { + ((RefreshLiveUpdates) fragment).onUpdateStates(app); } dismiss(); } + public interface RefreshLiveUpdates { + void onUpdateStates(Context context); + } + @Override protected int getDismissButtonTextId() { return R.string.shared_string_cancel; diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index 1d44f1ec70..4c7e814c2b 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -448,7 +448,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc private void showUpdateDialog() { if(dataShouldUpdate.size() > 0) { if (dataShouldUpdate.size() == 1) { - runLiveUpdate(app, dataShouldUpdate.get(0).getFileName(), false); + runLiveUpdate(app, dataShouldUpdate.get(0).getFileName(), false, null); } else { Builder bld = new AlertDialog.Builder(ctx); bld.setMessage(R.string.update_all_maps_now); @@ -457,7 +457,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc @Override public void onClick(DialogInterface dialog, int which) { for (LocalIndexInfo li : dataShouldUpdate) { - runLiveUpdate(app, li.getFileName(), false); + runLiveUpdate(app, li.getFileName(), false, null); } notifyDataSetChanged(); } @@ -575,7 +575,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc preferenceLiveUpdatesOn(item, fragment.getSettings()); IncrementalChangesManager changesManager = context.getResourceManager().getChangesManager(); - nameTextView.setText(getNameToDisplay(item, fragment.getMyActivity().getMyApplication())); + nameTextView.setText(getNameToDisplay(item, context)); if (shouldUpdatePreference.get()) { final Integer frequencyId = preferenceUpdateFrequency(item, fragment.getSettings()).get(); final Integer timeOfDateToUpdateId = preferenceTimeOfDayToUpdate(item, fragment.getSettings()).get(); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index 1c898c4bef..03d726a918 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -37,18 +37,17 @@ import net.osmand.PlatformUtil; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; -import net.osmand.plus.activities.LocalIndexHelper; import net.osmand.plus.activities.LocalIndexInfo; import net.osmand.plus.activities.OsmandBaseExpandableListAdapter; import net.osmand.plus.base.BaseOsmAndDialogFragment; -import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask; import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.inapp.InAppPurchaseHelper; -import net.osmand.plus.liveupdates.LiveUpdatesClearDialogFragment.OnRefreshLiveUpdates; +import net.osmand.plus.liveupdates.LiveUpdatesClearDialogFragment.RefreshLiveUpdates; import net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay; import net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency; import net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.OnLiveUpdatesForLocalChange; +import net.osmand.plus.liveupdates.LoadLiveMapsTask.LocalIndexInfoAdapter; import net.osmand.plus.liveupdates.PerformLiveUpdateAsyncTask.AsyncResponse; import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; @@ -64,7 +63,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Date; -import java.util.List; import java.util.Locale; import java.util.TimeZone; @@ -76,7 +74,6 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLatestUpdateAvailable; -import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; @@ -128,7 +125,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar); toolbar.setTitle(R.string.osm_live); int iconColorResId = nightMode ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light; - Drawable icBack = getMyApplication().getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(app), iconColorResId); + Drawable icBack = app.getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(app), iconColorResId); DrawableCompat.setTint(icBack, ContextCompat.getColor(app, iconColorResId)); toolbar.setNavigationIcon(icBack); toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up); @@ -195,7 +192,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements descriptionTime = timeContainer.findViewById(R.id.sub_title); AndroidUtils.setTextPrimaryColor(app, descriptionTime, nightMode); - Typeface typeface = FontCache.getFont(app, app.getResources().getString(R.string.font_roboto_medium)); + Typeface typeface = FontCache.getFont(app, getString(R.string.font_roboto_medium)); descriptionTime.setTypeface(typeface); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { descriptionTime.setLetterSpacing(AndroidUtils.getFloatValueFromRes(app, R.dimen.description_letter_spacing)); @@ -222,8 +219,8 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements public void onDismiss(@NonNull DialogInterface dialog) { super.onDismiss(dialog); Fragment target = getTargetFragment(); - if (target instanceof OnRefreshLiveUpdates) { - ((OnRefreshLiveUpdates) target).onUpdateStates(app); + if (target instanceof RefreshLiveUpdates) { + ((RefreshLiveUpdates) target).onUpdateStates(app); } } @@ -240,14 +237,15 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements private void startLoadLiveMapsAsyncTask() { if (loadLiveMapsTask == null) { - loadLiveMapsTask = new LoadLiveMapsTask(adapter, this); + loadLiveMapsTask = new LoadLiveMapsTask(adapter, app); + loadLiveMapsTask.setSort(true); loadLiveMapsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } private void stopLoadLiveMapsAsyncTask() { - if (loadLiveMapsTask != null) { - loadLiveMapsTask.cancel(true); + if (loadLiveMapsTask != null && loadLiveMapsTask.getStatus() == AsyncTask.Status.RUNNING) { + loadLiveMapsTask.cancel(false); } } @@ -291,13 +289,14 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements } private void showUpdateDialog() { - final AsyncResponse refreshAfterUpdate = new AsyncResponse() { - @Override - public void processFinish() { - adapter.notifyDataSetChanged(); - } - }; + startUpdateDateAsyncTask(); if (!Algorithms.isEmpty(adapter.mapsList)) { + final AsyncResponse refreshAfterUpdate = new AsyncResponse() { + @Override + public void processFinish() { + adapter.notifyDataSetChanged(); + } + }; if (adapter.countEnabled == 1) { LocalIndexInfo li = adapter.mapsList.get(0); runLiveUpdate(getActivity(), li.getFileName(), false, refreshAfterUpdate); @@ -314,7 +313,6 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements runLiveUpdate(getActivity(), li.getFileName(), false, refreshAfterUpdate); } } - startUpdateDateAsyncTask(); } }); bld.setNegativeButton(R.string.shared_string_no, null); @@ -327,7 +325,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements if (!Algorithms.isEmpty(adapter.mapsList)) { AlarmManager alarmMgr = (AlarmManager) app.getSystemService(Context.ALARM_SERVICE); for (LocalIndexInfo li : adapter.mapsList) { - CommonPreference localUpdateOn = preferenceLiveUpdatesOn(li.getFileName(), settings); + CommonPreference localUpdateOn = preferenceForLocalIndex(li.getFileName(), settings); if (localUpdateOn.get()) { String fileName = li.getFileName(); PendingIntent alarmIntent = getPendingIntent(app, fileName); @@ -359,20 +357,21 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements } } - protected class LiveMapsAdapter extends OsmandBaseExpandableListAdapter { + protected class LiveMapsAdapter extends OsmandBaseExpandableListAdapter implements LocalIndexInfoAdapter { private final ArrayList mapsList = new ArrayList<>(); private int countEnabled = 0; private TextViewEx countView; + @Override public void addData(LocalIndexInfo info) { mapsList.add(info); } @Override - public void notifyDataSetInvalidated() { - super.notifyDataSetInvalidated(); + public void clearData() { } + @Override public void sort() { countEnabled = 0; for (LocalIndexInfo map : mapsList) { @@ -395,6 +394,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements notifyDataSetInvalidated(); } + @Override public void updateCountEnabled() { if (countView != null) { String countText = countEnabled + "/" + mapsList.size(); @@ -496,16 +496,15 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements title = (TextView) view.findViewById(R.id.title); subTitle = (TextView) view.findViewById(R.id.sub_title); description = (TextView) view.findViewById(R.id.description); - option = (CompoundButton) view.findViewById(R.id.toggle_item); + option = (CompoundButton) view.findViewById(R.id.compound_button); } public void bindLocalIndexInfo(@NonNull final String item) { boolean liveUpdateOn = settings.IS_LIVE_UPDATES_ON.get(); - final CommonPreference localUpdateOn = preferenceLiveUpdatesOn(item, settings); + CommonPreference localUpdateOn = preferenceForLocalIndex(item, settings); // IncrementalChangesManager changesManager = app.getResourceManager().getChangesManager(); UiUtilities.setupCompoundButton(option, nightMode, GLOBAL); - CommonPreference liveUpdatePreference = preferenceForLocalIndex(item, settings); - option.setChecked(liveUpdatePreference.get()); + option.setChecked(localUpdateOn.get()); title.setText(getNameToDisplay(item, app)); @@ -513,15 +512,15 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements if (localUpdateOn.get()) { int frequencyId = preferenceUpdateFrequency(item, settings).get(); final UpdateFrequency frequency = UpdateFrequency.values()[frequencyId]; - String subTitleText = app.getResources().getString(frequency.getLocalizedId()); + String subTitleText = getString(frequency.getLocalizedId()); /*int timeOfDateToUpdateId = preferenceTimeOfDayToUpdate(item, settings).get(); final TimeOfDay timeOfDay = TimeOfDay.values()[timeOfDateToUpdateId]; if (frequency != UpdateFrequency.HOURLY) { - subTitleText += " • " + app.getResources().getString(timeOfDay.getLocalizedId()); + subTitleText += " • " + getString(timeOfDay.getLocalizedId()); }*/ subTitle.setText(subTitleText); subTitle.setTextColor(ContextCompat.getColor(app, liveUpdateOn ? getActiveTextColorId(nightMode) : getSecondaryTextColorId(nightMode))); - Typeface typeface = FontCache.getFont(app, app.getResources().getString(R.string.font_roboto_medium)); + Typeface typeface = FontCache.getFont(app, getString(R.string.font_roboto_medium)); subTitle.setTypeface(typeface); } @@ -595,49 +594,6 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements } } - public static class LoadLiveMapsTask - extends AsyncTask> - implements AbstractLoadLocalIndexTask { - - //private List result; - private final LiveMapsAdapter adapter; - private final LocalIndexHelper helper; - - public LoadLiveMapsTask(LiveMapsAdapter adapter, - LiveUpdatesFragmentNew fragment) { - this.adapter = adapter; - helper = new LocalIndexHelper(fragment.getMyApplication()); - } - - @Override - protected List doInBackground(Void... params) { - return helper.getLocalFullMaps(this); - } - - @Override - public void loadFile(LocalIndexInfo... loaded) { - publishProgress(loaded); - } - - @Override - protected void onProgressUpdate(LocalIndexInfo... values) { - String fileNameL; - for (LocalIndexInfo localIndexInfo : values) { - fileNameL = localIndexInfo.getFileName().toLowerCase(); - if (localIndexInfo.getType() == LocalIndexHelper.LocalIndexType.MAP_DATA - && !fileNameL.contains("world") && !fileNameL.startsWith("depth_")) { - adapter.addData(localIndexInfo); - } - } - } - - @Override - protected void onPostExecute(List result) { - //this.result = result; - adapter.sort(); - } - } - protected static String getLastCheckString(String fileName, OsmandApplication app) { return getLastCheckString(fileName, app, false); } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java index 08284f6a65..4ff0afee0a 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java @@ -6,9 +6,9 @@ import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.text.format.DateUtils; -import android.text.format.Time; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import net.osmand.plus.OsmandApplication; import net.osmand.plus.liveupdates.PerformLiveUpdateAsyncTask.AsyncResponse; @@ -109,31 +109,34 @@ public class LiveUpdatesHelper { return dateFormat.format(dateTime) + " " + timeFormat.format(dateTime); } + public static boolean isCurrentYear(long dateTime) { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(dateTime); + return calendar.get(Calendar.YEAR) == Calendar.getInstance().get(Calendar.YEAR); + } + public static String formatShortDateTime(Context ctx, long dateTime) { - if (dateTime == -1) { + if (dateTime == DEFAULT_LAST_CHECK) { return ctx.getResources().getString(R.string.shared_string_never); } else { - StringBuilder result = new StringBuilder(); + String date, times; if (DateUtils.isToday(dateTime)) { - result.append(ctx.getResources().getString(R.string.today)); + date = ctx.getResources().getString(R.string.today); } else { int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_MONTH; - Time time = new Time(); - time.set(dateTime); - int thenYear = time.year; - time.set(System.currentTimeMillis()); - if (thenYear == time.year) { + if (isCurrentYear(dateTime)) { flags = flags | DateUtils.FORMAT_NO_YEAR; } - result.append(DateUtils.formatDateTime(ctx, dateTime, flags)); + date = DateUtils.formatDateTime(ctx, dateTime, flags); } - result.append(" - ").append(DateUtils.formatDateTime(ctx, dateTime, DateUtils.FORMAT_SHOW_TIME)); - return result.toString(); + times = DateUtils.formatDateTime(ctx, dateTime, DateUtils.FORMAT_SHOW_TIME); + String pattern = ctx.getString(R.string.ltr_or_rtl_combine_via_dash); + return String.format(pattern, date, times); } } public static String formatHelpDateTime(Context ctx, UpdateFrequency updateFrequency, TimeOfDay timeOfDay, long lastDateTime) { - if (lastDateTime == -1) { + if (lastDateTime == DEFAULT_LAST_CHECK) { lastDateTime = System.currentTimeMillis(); } switch (updateFrequency) { @@ -164,12 +167,7 @@ public class LiveUpdatesHelper { int flagsBaseNoYear = flagsBase | DateUtils.FORMAT_NO_YEAR; int flagsTime = DateUtils.FORMAT_SHOW_TIME; - Time checkYearTime = new Time(); - checkYearTime.set(nextDateTime); - int thenYear = checkYearTime.year; - checkYearTime.set(System.currentTimeMillis()); - - String date = DateUtils.formatDateTime(ctx, nextDateTime, thenYear == checkYearTime.year ? flagsBaseNoYear : flagsBase); + String date = DateUtils.formatDateTime(ctx, nextDateTime, isCurrentYear(nextDateTime) ? flagsBaseNoYear : flagsBase); String time = DateUtils.formatDateTime(ctx, nextDateTime, flagsTime); return ctx.getResources().getString(stringResId, DateUtils.isToday(nextDateTime) ? "" : " " + date, time); @@ -256,12 +254,7 @@ public class LiveUpdatesHelper { } } - public static void runLiveUpdate(Context context, final String fileName, boolean userRequested) { - final String fnExt = Algorithms.getFileNameWithoutExtension(new File(fileName)); - new PerformLiveUpdateAsyncTask(context, fileName, userRequested).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, fnExt); - } - - public static void runLiveUpdate(Context context, final String fileName, boolean userRequested, final AsyncResponse runOnPost) { + public static void runLiveUpdate(Context context, final String fileName, boolean userRequested, @Nullable final AsyncResponse runOnPost) { final String fnExt = Algorithms.getFileNameWithoutExtension(new File(fileName)); new PerformLiveUpdateAsyncTask(context, fileName, userRequested, runOnPost).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, fnExt); } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java index 46438a03b2..242f44f83a 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java @@ -167,7 +167,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment { timeOfDayPreference.set(timeOfDayInt); if (liveUpdatesSwitch.isChecked() && getSettings().IS_LIVE_UPDATES_ON.get()) { - runLiveUpdate(getActivity(), fileName, false); + runLiveUpdate(getActivity(), fileName, false, null); UpdateFrequency updateFrequency = UpdateFrequency.values()[updateFrequencyInt]; TimeOfDay timeOfDayToUpdate = TimeOfDay.values()[timeOfDayInt]; setAlarmForPendingIntent(alarmIntent, alarmMgr, updateFrequency, timeOfDayToUpdate); @@ -194,7 +194,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment { if (!getSettings().isInternetConnectionAvailable()) { getMyApplication().showShortToastMessage(R.string.no_internet_connection); } else { - runLiveUpdate(getActivity(), fileName, true); + runLiveUpdate(getActivity(), fileName, true, null); final IncrementalChangesManager changesManager = getMyApplication().getResourceManager().getChangesManager(); sizeTextView.setText(getUpdatesSize(getMyActivity(), fileNameWithoutExtension, changesManager)); dialog.dismiss(); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java index df408b17e7..a51a9ada28 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java @@ -5,8 +5,6 @@ import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.text.SpannableString; -import android.text.TextUtils; -import android.text.style.StyleSpan; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -36,7 +34,8 @@ import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.ShortDescriptionItem; import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.liveupdates.LiveUpdatesClearDialogFragment.OnRefreshLiveUpdates; +import net.osmand.plus.helpers.FontCache; +import net.osmand.plus.liveupdates.LiveUpdatesClearDialogFragment.RefreshLiveUpdates; import net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay; import net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency; import net.osmand.plus.resources.IncrementalChangesManager; @@ -46,6 +45,7 @@ import net.osmand.plus.widgets.MultiStateToggleButton; import net.osmand.plus.widgets.MultiStateToggleButton.OnRadioItemClickListener; import net.osmand.plus.widgets.MultiStateToggleButton.RadioItem; import net.osmand.plus.widgets.TextViewEx; +import net.osmand.plus.widgets.style.CustomTypefaceSpan; import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; @@ -65,7 +65,7 @@ import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecon import static net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.getCustomButtonView; import static net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.updateCustomButtonView; -public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogFragment implements OnRefreshLiveUpdates { +public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogFragment implements RefreshLiveUpdates { public static final String TAG = LiveUpdatesSettingsDialogFragmentNew.class.getSimpleName(); private static final Log LOG = PlatformUtil.getLog(LiveUpdatesSettingsDialogFragmentNew.class); @@ -103,13 +103,13 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF if (getTargetFragment() instanceof OnLiveUpdatesForLocalChange) { onLiveUpdatesForLocalChange = (OnLiveUpdatesForLocalChange) getTargetFragment(); } - final CommonPreference localUpdatePreference = preferenceForLocalIndex(fileName, settings); - final CommonPreference downloadViaWiFiPreference = preferenceDownloadViaWiFi(fileName, settings); - final CommonPreference frequencyPreference = preferenceUpdateFrequency(fileName, settings); - final CommonPreference timeOfDayPreference = preferenceTimeOfDayToUpdate(fileName, settings); - int dp4 = getResources().getDimensionPixelSize(R.dimen.context_menu_buttons_padding_bottom); - int dp6 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_tiny); - int dp8 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_small); + if (savedInstanceState != null && savedInstanceState.containsKey(LOCAL_INDEX_FILE_NAME)) { + fileName = savedInstanceState.getString(LOCAL_INDEX_FILE_NAME); + } + CommonPreference localUpdatePreference = preferenceForLocalIndex(fileName, settings); + CommonPreference downloadViaWiFiPreference = preferenceDownloadViaWiFi(fileName, settings); + CommonPreference frequencyPreference = preferenceUpdateFrequency(fileName, settings); + CommonPreference timeOfDayPreference = preferenceTimeOfDayToUpdate(fileName, settings); int dp10 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_medium); int dp12 = getResources().getDimensionPixelSize(R.dimen.content_padding_small); int dp16 = getResources().getDimensionPixelSize(R.dimen.content_padding); @@ -119,12 +119,6 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF int dp48 = getResources().getDimensionPixelSize(R.dimen.context_menu_buttons_bottom_height); int dp56 = getResources().getDimensionPixelSize(R.dimen.bottom_sheet_selected_item_title_height); - if (savedInstanceState != null) { - if (savedInstanceState.containsKey(LOCAL_INDEX_FILE_NAME)) { - fileName = savedInstanceState.getString(LOCAL_INDEX_FILE_NAME); - } - } - items.add(new SimpleBottomSheetItem.Builder() .setTitle(getNameToDisplay(fileName, app)) .setTitleColorId(getPrimaryTextColorId(nightMode)) @@ -144,39 +138,6 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF itemLiveUpdateButton.setMinimumHeight(dp56); items.add(new BottomSheetItemWithCompoundButton.Builder() .setChecked(localUpdatePreference.get()) - .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (onLiveUpdatesForLocalChange != null - && onLiveUpdatesForLocalChange.onUpdateLocalIndex(fileName, isChecked, new Runnable() { - @Override - public void run() { - if (indexLastCheckItem != -1) { - ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) - .setDescription(getLastCheckString()); - } - if (indexFrequencyHelpMessageItem != -1) { - ((BottomSheetItemWithDescription) items.get(indexFrequencyHelpMessageItem)) - .setDescription(getFrequencyHelpMessage()); - } - if (indexClearItem != -1) { - ((BottomSheetItemWithDescription) items.get(indexClearItem)) - .setDescription(getUpdatesSizeStr()); - } - } - })) { - if (indexSwitchLiveUpdateItem != -1) { - BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(indexSwitchLiveUpdateItem); - button.setTitle(getStateText(isChecked)); - button.setChecked(isChecked); - updateCustomButtonView(app, null, button.getView(), isChecked, nightMode); - } - frequencyToggleButton.updateView(localUpdatePreference.get()); - timeOfDayToggleButton.updateView(localUpdatePreference.get()); - setStateViaWiFiButton(localUpdatePreference); - } - } - }) .setTitle(getStateText(localUpdatePreference.get())) .setTitleColorId(getActiveTabTextColorId(nightMode)) .setCustomView(itemLiveUpdate) @@ -186,6 +147,33 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF if (indexSwitchLiveUpdateItem != -1) { BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(indexSwitchLiveUpdateItem); button.setChecked(!button.isChecked()); + if (onLiveUpdatesForLocalChange != null + && onLiveUpdatesForLocalChange.onUpdateLocalIndex(fileName, button.isChecked(), new Runnable() { + @Override + public void run() { + if (indexLastCheckItem != -1 && items.size() > 0) { + ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) + .setDescription(getLastCheckString()); + } + if (indexFrequencyHelpMessageItem != -1 && items.size() > 0) { + ((BottomSheetItemWithDescription) items.get(indexFrequencyHelpMessageItem)) + .setDescription(getFrequencyHelpMessage()); + } + if (indexClearItem != -1 && items.size() > 0) { + ((BottomSheetItemWithDescription) items.get(indexClearItem)) + .setDescription(getUpdatesSizeStr()); + } + } + })) { + if (indexSwitchLiveUpdateItem != -1 && items.size() > 0) { + button.setTitle(getStateText(button.isChecked())); + updateCustomButtonView(app, null, button.getView(), button.isChecked(), nightMode); + } + CommonPreference localUpdatePreference = preferenceForLocalIndex(fileName, settings); + frequencyToggleButton.updateView(localUpdatePreference.get()); + timeOfDayToggleButton.updateView(localUpdatePreference.get()); + setStateViaWiFiButton(localUpdatePreference); + } } } }) @@ -273,7 +261,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF itemUpdateNowButton.setLayoutParams(itemUpdateNowParams); ((AppCompatImageView) itemUpdateNowButton.findViewById(R.id.button_icon)).setImageDrawable( ContextCompat.getDrawable(app, R.drawable.ic_action_update)); - UiUtilities.setupDialogButton(nightMode, itemUpdateNowButton, UiUtilities.DialogButtonType.SECONDARY, app.getResources().getString(R.string.update_now)); + UiUtilities.setupDialogButton(nightMode, itemUpdateNowButton, UiUtilities.DialogButtonType.SECONDARY, getString(R.string.update_now)); itemUpdateNowButton.setMinimumHeight(AndroidUtils.dpToPx(app, app.getResources().getDimension(R.dimen.dialog_button_height))); items.add(new BaseBottomSheetItem.Builder() @@ -288,15 +276,15 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF onLiveUpdatesForLocalChange.forceUpdateLocal(fileName, true, new Runnable() { @Override public void run() { - if (indexLastCheckItem != -1) { + if (indexLastCheckItem != -1 && items.size() > 0) { ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) .setDescription(getLastCheckString()); } - if (indexFrequencyHelpMessageItem != -1) { + if (indexFrequencyHelpMessageItem != -1 && items.size() > 0) { ((BottomSheetItemWithDescription) items.get(indexFrequencyHelpMessageItem)) .setDescription(getFrequencyHelpMessage()); } - if (indexClearItem != -1) { + if (indexClearItem != -1 && items.size() > 0) { ((BottomSheetItemWithDescription) items.get(indexClearItem)) .setDescription(getUpdatesSizeStr()); } @@ -317,7 +305,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF new BottomSheetItemWithDescription.Builder() .setDescription(getUpdatesSizeStr()) .setIcon(UiUtilities.tintDrawable(iconDelete, iconDeleteColor)) - .setTitle(app.getResources().getString(R.string.updates_size)) + .setTitle(getString(R.string.updates_size)) .setLayoutId(R.layout.bottom_sheet_item_with_descr_icon_right) .setOnClickListener(new View.OnClickListener() { @Override @@ -340,23 +328,18 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF items.add( new BottomSheetItemWithCompoundButton.Builder() .setChecked(downloadViaWiFiPreference.get()) - .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - downloadViaWiFiPreference.set(isChecked); - } - }) .setDescription(getStateText(downloadViaWiFiPreference.get())) .setIconHidden(true) - .setTitle(app.getResources().getString(R.string.only_download_over_wifi)) + .setTitle(getString(R.string.only_download_over_wifi)) .setLayoutId(R.layout.bottom_sheet_item_with_descr_and_switch_56dp) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (localUpdatePreference.get() && indexViaWiFiItem != -1) { + if (preferenceForLocalIndex(fileName, settings).get() && indexViaWiFiItem != -1 && items.size() > 0) { BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(indexViaWiFiItem); button.setChecked(!button.isChecked()); button.setDescription(getStateText(button.isChecked())); + preferenceDownloadViaWiFi(fileName, settings).set(button.isChecked()); } } }) @@ -384,7 +367,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF } private void setStateViaWiFiButton(CommonPreference localUpdatePreference) { - if (indexViaWiFiItem != -1) { + if (indexViaWiFiItem != -1 && items.size() > 0) { BottomSheetItemWithCompoundButton button = (BottomSheetItemWithCompoundButton) items.get(indexViaWiFiItem); if (button.getView() != null) { TextView title = button.getView().findViewById(R.id.title); @@ -405,22 +388,26 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF protected SpannableString getLastCheckString() { final long lastUpdate = preferenceLatestUpdateAvailable(fileName, settings).get(); - String updatedTimeStr = app.getResources().getString(R.string.updated, formatShortDateTime(app, lastUpdate)); - SpannableString updatedTimeSpannable = SpannableString.valueOf(updatedTimeStr); - - if (!updatedTimeStr.contains(app.getResources().getString(R.string.shared_string_never))) { - SpannableString fullUpdatedTimeSpannable = UiUtilities.createSpannableString(updatedTimeStr, - new StyleSpan(Typeface.BOLD), updatedTimeStr.substring(updatedTimeStr.indexOf(" - "), updatedTimeStr.length() - 1)); - + String updatedTimeStr = getString(R.string.updated, formatShortDateTime(app, lastUpdate)); + if (!updatedTimeStr.contains(getString(R.string.shared_string_never))) { final long lastCheck = preferenceLastCheck(fileName, settings).get(); - String lastCheckStr = "\n" + app.getResources().getString(R.string.last_time_checked, formatShortDateTime(app, lastCheck)); - - SpannableString lastCheckTimeSpannable = UiUtilities.createSpannableString(lastCheckStr, - new StyleSpan(Typeface.BOLD), lastCheckStr.substring(lastCheckStr.lastIndexOf(" - "))); - - return SpannableString.valueOf(TextUtils.concat(fullUpdatedTimeSpannable, lastCheckTimeSpannable)); + String lastCheckStr = getString(R.string.last_time_checked, formatShortDateTime(app, lastCheck)); + updatedTimeStr = updatedTimeStr.concat("\n").concat(lastCheckStr); + SpannableString spanStr = new SpannableString(updatedTimeStr); + Typeface typeface = FontCache.getRobotoMedium(getContext()); + int start = updatedTimeStr.indexOf(" — "); + if (start != -1) { + int end = updatedTimeStr.indexOf(lastCheckStr) - 1; + spanStr.setSpan(new CustomTypefaceSpan(typeface), start, end, 0); + start = updatedTimeStr.lastIndexOf(" — "); + if (start != -1) { + end = updatedTimeStr.length() - 1; + spanStr.setSpan(new CustomTypefaceSpan(typeface), start, end, 0); + } + } + return spanStr; } - return updatedTimeSpannable; + return new SpannableString(updatedTimeStr); } protected String getFrequencyHelpMessage() { @@ -440,7 +427,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF long updatesSize = getUpdatesSize(); return updatesSize > 0 ? AndroidUtils.formatSize(app, updatesSize) - : app.getResources().getString(R.string.ltr_or_rtl_combine_via_space, "0.0", "kB"); + : getString(R.string.ltr_or_rtl_combine_via_space, "0.0", "kB"); } @@ -501,7 +488,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF if (!Algorithms.isEmpty(Arrays.asList(timeOfDayLayouts))) { refreshTimeOfDayLayout(newValue, timeOfDayLayouts); } - if (indexFrequencyHelpMessageItem != -1) { + if (indexFrequencyHelpMessageItem != -1 && items.size() > 0) { ((BottomSheetItemWithDescription) items.get(indexFrequencyHelpMessageItem)) .setDescription(getFrequencyHelpMessage()); } @@ -518,11 +505,11 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF if (confirmationInterface != null) { confirmationInterface.updateList(); } - if (indexLastCheckItem != -1) { + if (indexLastCheckItem != -1 && items.size() > 0) { ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) .setDescription(getLastCheckString()); } - if (indexClearItem != -1) { + if (indexClearItem != -1 && items.size() > 0) { ((BottomSheetItemWithDescription) items.get(indexClearItem)) .setDescription(getUpdatesSizeStr()); } @@ -540,7 +527,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF } public String getStateText(boolean isEnabled) { - return app.getResources().getString(isEnabled ? R.string.shared_string_enabled : R.string.shared_string_disabled); + return getString(isEnabled ? R.string.shared_string_enabled : R.string.shared_string_disabled); } @ColorRes diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java b/OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java new file mode 100644 index 0000000000..a02a3d298f --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java @@ -0,0 +1,83 @@ +package net.osmand.plus.liveupdates; + +import android.os.AsyncTask; + +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.activities.LocalIndexHelper; +import net.osmand.plus.activities.LocalIndexInfo; +import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask; + +import java.util.List; + +public class LoadLiveMapsTask + extends AsyncTask> + implements AbstractLoadLocalIndexTask { + + public interface LocalIndexInfoAdapter { + + void addData(LocalIndexInfo localIndexInfo); + + void clearData(); + + void sort(); + + void updateCountEnabled(); + } + + //private List result; + private final LocalIndexInfoAdapter adapter; + private final LocalIndexHelper helper; + private boolean updateCount = false; + private boolean sort = false; + + public void setUpdateCount(boolean updateCount) { + this.updateCount = updateCount; + } + + public void setSort(boolean sort) { + this.sort = sort; + } + + public LoadLiveMapsTask(LocalIndexInfoAdapter adapter, OsmandApplication app) { + this.adapter = adapter; + helper = new LocalIndexHelper(app); + } + + @Override + protected void onPreExecute() { + adapter.clearData(); + } + + @Override + protected List doInBackground(Void... params) { + return helper.getLocalFullMaps(this); + } + + @Override + public void loadFile(LocalIndexInfo... loaded) { + publishProgress(loaded); + } + + @Override + protected void onProgressUpdate(LocalIndexInfo... values) { + String fileNameL; + for (LocalIndexInfo localIndexInfo : values) { + fileNameL = localIndexInfo.getFileName().toLowerCase(); + if (localIndexInfo.getType() == LocalIndexHelper.LocalIndexType.MAP_DATA + && !fileNameL.contains("world") && !fileNameL.startsWith("depth_")) { + adapter.addData(localIndexInfo); + } + } + } + + @Override + protected void onPostExecute(List result) { + //this.result = result; + if (sort) { + adapter.sort(); + } + if (updateCount) { + adapter.updateCountEnabled(); + } + } +} diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java b/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java index 176f9c7c52..920127cfa5 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java @@ -6,8 +6,10 @@ import android.content.Context; import android.os.AsyncTask; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import net.osmand.AndroidNetworkUtils; +import net.osmand.AndroidNetworkUtils.OnRequestResultListener; import net.osmand.PlatformUtil; import net.osmand.plus.OsmandApplication; import net.osmand.plus.download.DownloadActivity; @@ -44,24 +46,16 @@ public class PerformLiveUpdateAsyncTask @NonNull private final String localIndexFileName; private final boolean userRequested; - private AsyncResponse runOnPost; + private final AsyncResponse runOnPost; public interface AsyncResponse { void processFinish(); } - public PerformLiveUpdateAsyncTask(@NonNull Context context, - @NonNull String localIndexFileName, - boolean userRequested) { - this.context = context; - this.localIndexFileName = localIndexFileName; - this.userRequested = userRequested; - } - public PerformLiveUpdateAsyncTask(@NonNull Context context, @NonNull String localIndexFileName, boolean userRequested, - AsyncResponse runOnPost) { + @Nullable AsyncResponse runOnPost) { this.context = context; this.localIndexFileName = localIndexFileName; this.userRequested = userRequested; @@ -204,24 +198,29 @@ public class PerformLiveUpdateAsyncTask } } - private void updateLatestAvailability(OsmandApplication app, @NonNull String localIndexFileName) { - OsmandSettings settings = app.getSettings(); - try { - String latestUpdateAvailable = AndroidNetworkUtils.sendRequest( - app, LiveUpdatesFragmentNew.URL, null, "Requesting map updates info...", false, false); - if (!Algorithms.isEmpty(latestUpdateAvailable)) { - SimpleDateFormat source = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US); - source.setTimeZone(TimeZone.getTimeZone("UTC")); - Date parsed = source.parse(latestUpdateAvailable); - if (parsed != null) { - long dateTime = parsed.getTime(); - preferenceLatestUpdateAvailable(settings).set(dateTime); - } - } - } catch (ParseException e) { - e.printStackTrace(); - } - long latestUpdateAvailable = preferenceLatestUpdateAvailable(settings).get(); - preferenceLatestUpdateAvailable(localIndexFileName, settings).set(latestUpdateAvailable); + private void updateLatestAvailability(OsmandApplication app, @NonNull final String localIndexFileName) { + final OsmandSettings settings = app.getSettings(); + AndroidNetworkUtils.sendRequestAsync( + app, LiveUpdatesFragmentNew.URL, null, "Requesting map updates info...", false, false, new OnRequestResultListener() { + @Override + public void onResult(String result) { + if (!Algorithms.isEmpty(result)) { + SimpleDateFormat source = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US); + source.setTimeZone(TimeZone.getTimeZone("UTC")); + try { + Date parsed = source.parse(result); + if (parsed != null) { + long dateTime = parsed.getTime(); + preferenceLatestUpdateAvailable(settings).set(dateTime); + preferenceLatestUpdateAvailable(localIndexFileName, settings).set(dateTime); + } + } catch (ParseException e) { + long dateTime = preferenceLatestUpdateAvailable(settings).get(); + preferenceLatestUpdateAvailable(localIndexFileName, settings).set(dateTime); + LOG.error(e.getMessage(), e); + } + } + } + }); } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java index 22d6d97830..2f436a69eb 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java @@ -118,7 +118,7 @@ public class MapDataMenuController extends MenuController { } else if (!downloaded || indexItem.isOutdated()) { new DownloadValidationManager(app).startDownload(activity, indexItem); } else if (isLiveUpdatesOn()) { - LiveUpdatesHelper.runLiveUpdate(activity, indexItem.getTargetFileName(), true); + LiveUpdatesHelper.runLiveUpdate(activity, indexItem.getTargetFileName(), true, null); } } } From 6e5964de40e0ecb69d189ae776cb111e94813d9a Mon Sep 17 00:00:00 2001 From: Skalii Date: Thu, 11 Mar 2021 13:07:28 +0200 Subject: [PATCH 018/250] add help button; fix purchase icon; fix toolbar title in purchases fragment; --- OsmAnd/AndroidManifest.xml | 2 +- OsmAnd/res/layout/fragment_live_updates.xml | 17 ++++++++- .../plus/activities/MapActivityActions.java | 2 +- .../liveupdates/LiveUpdatesFragmentNew.java | 35 ++++++++++++++----- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index a1c3af7e30..5cc90e170d 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -1064,7 +1064,7 @@ + android:label="@string/purchases"/> diff --git a/OsmAnd/res/layout/fragment_live_updates.xml b/OsmAnd/res/layout/fragment_live_updates.xml index a9d2f8d979..e0fd41c95e 100644 --- a/OsmAnd/res/layout/fragment_live_updates.xml +++ b/OsmAnd/res/layout/fragment_live_updates.xml @@ -22,7 +22,22 @@ app:contentInsetEnd="0dp" app:contentInsetLeft="@dimen/settings_divider_margin_start" app:contentInsetRight="0dp" - app:contentInsetStart="@dimen/settings_divider_margin_start" /> + app:contentInsetStart="@dimen/settings_divider_margin_start"> + + + + diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index b0ab0283cc..c0fec48168 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -1033,7 +1033,7 @@ public class MapActivityActions implements DialogProvider { if (Version.isGooglePlayEnabled() || Version.isHuawei() || Version.isDeveloperVersion(app)) { optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.purchases, mapActivity) .setId(DRAWER_OSMAND_LIVE_ID) - .setIcon(R.drawable.ic_action_osm_live) + .setIcon(R.drawable.ic_action_purchases) .setListener(new ItemClickListener() { @Override public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) { diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index 03d726a918..ba48b27df1 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -4,9 +4,11 @@ import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.graphics.Typeface; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; +import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; @@ -16,6 +18,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; import android.widget.ExpandableListView; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; @@ -37,6 +40,7 @@ import net.osmand.PlatformUtil; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; +import net.osmand.plus.UiUtilities.CompoundButtonType; import net.osmand.plus.activities.LocalIndexInfo; import net.osmand.plus.activities.OsmandBaseExpandableListAdapter; import net.osmand.plus.base.BaseOsmAndDialogFragment; @@ -66,8 +70,6 @@ import java.util.Date; import java.util.Locale; import java.util.TimeZone; -import static net.osmand.plus.UiUtilities.CompoundButtonType.GLOBAL; -import static net.osmand.plus.UiUtilities.CompoundButtonType.TOOLBAR; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatShortDateTime; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent; @@ -88,6 +90,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements public static final String URL = "https://osmand.net/api/osmlive_status"; public static final String TAG = LiveUpdatesFragmentNew.class.getSimpleName(); private final static Log LOG = PlatformUtil.getLog(LiveUpdatesFragmentNew.class); + private static final String SUBSCRIPTION_URL = "https://osmand.net/features/subscription"; private OsmandApplication app; private OsmandSettings settings; @@ -135,6 +138,18 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements dismiss(); } }); + ImageButton iconHelp = toolbar.findViewById(R.id.toolbar_action); + Drawable helpDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_help, iconColorResId); + iconHelp.setImageDrawable(helpDrawable); + iconHelp.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(SUBSCRIPTION_URL)); + if (AndroidUtils.isIntentSafe(app, intent)) { + startActivity(intent); + } + } + }); listView = (ExpandableListView) view.findViewById(android.R.id.list); adapter = new LiveMapsAdapter(); @@ -149,7 +164,8 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements if (InAppPurchaseHelper.isSubscribedToLiveUpdates(app) && settings.IS_LIVE_UPDATES_ON.get()) { if (getFragmentManager() != null) { LiveUpdatesSettingsDialogFragmentNew - .showInstance(getFragmentManager(), LiveUpdatesFragmentNew.this, adapter.getChild(groupPosition, childPosition).getFileName()); + .showInstance(getFragmentManager(), LiveUpdatesFragmentNew.this, + adapter.getChild(groupPosition, childPosition).getFileName()); } return true; } else { @@ -250,12 +266,13 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements } private void updateToolbarSwitch(final boolean isChecked) { - int switchColor = ContextCompat.getColor(app, isChecked ? getActiveTextColorId(nightMode) : getSecondaryTextColorId(nightMode)); + int switchColor = ContextCompat.getColor(app, + isChecked ? getActiveTextColorId(nightMode) : getSecondaryTextColorId(nightMode)); AndroidUtils.setBackground(toolbarSwitchContainer, new ColorDrawable(switchColor)); SwitchCompat switchView = toolbarSwitchContainer.findViewById(R.id.switchWidget); switchView.setChecked(isChecked); - UiUtilities.setupCompoundButton(switchView, nightMode, TOOLBAR); + UiUtilities.setupCompoundButton(switchView, nightMode, CompoundButtonType.TOOLBAR); toolbarSwitchContainer.setOnClickListener(new View.OnClickListener() { @Override @@ -503,7 +520,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements boolean liveUpdateOn = settings.IS_LIVE_UPDATES_ON.get(); CommonPreference localUpdateOn = preferenceForLocalIndex(item, settings); // IncrementalChangesManager changesManager = app.getResourceManager().getChangesManager(); - UiUtilities.setupCompoundButton(option, nightMode, GLOBAL); + UiUtilities.setupCompoundButton(option, nightMode, CompoundButtonType.GLOBAL); option.setChecked(localUpdateOn.get()); title.setText(getNameToDisplay(item, app)); @@ -525,7 +542,8 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements } Drawable statusDrawable = ContextCompat.getDrawable(app, R.drawable.ic_map); - int resColorId = !localUpdateOn.get() ? getSecondaryIconColorId(nightMode) : !liveUpdateOn ? getDefaultIconColorId(nightMode) : getOsmandIconColorId(nightMode); + int resColorId = !localUpdateOn.get() ? getSecondaryIconColorId(nightMode) : + !liveUpdateOn ? getDefaultIconColorId(nightMode) : getOsmandIconColorId(nightMode); int statusColor = ContextCompat.getColor(app, resColorId); if (statusDrawable != null) { DrawableCompat.setTint(statusDrawable, statusColor); @@ -561,7 +579,8 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements @Override protected String doInBackground(Void... params) { try { - return AndroidNetworkUtils.sendRequest(app, URL, null, "Requesting map updates info...", false, false); + return AndroidNetworkUtils.sendRequest(app, URL, null, + "Requesting map updates info...", false, false); } catch (Exception e) { LOG.error("Error: " + "Requesting map updates info error", e); return null; From 1c4484b44c06c7e33b802b46ab469cf7f03c9061 Mon Sep 17 00:00:00 2001 From: Skalii Date: Thu, 11 Mar 2021 14:06:40 +0200 Subject: [PATCH 019/250] fix toggle button display after rotate screen --- ..._sheet_item_with_descr_and_switch_56dp.xml | 108 +++++++++--------- .../plus/mapmarkers/PlanRouteFragment.java | 4 +- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_switch_56dp.xml b/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_switch_56dp.xml index 82d4698be8..b79d61c4b2 100644 --- a/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_switch_56dp.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_with_descr_and_switch_56dp.xml @@ -1,63 +1,63 @@ - + android:paddingLeft="@dimen/content_padding" + android:paddingEnd="@dimen/content_padding" + android:paddingRight="@dimen/content_padding"> - + - + - + - - + + - + diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 3e0842710c..71b9523f34 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -11,9 +11,9 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; +import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; @@ -688,7 +688,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat } }); if (!portrait) { - LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) appModesBtn.getLayoutParams(); + FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) appModesBtn.getLayoutParams(); params.leftMargin = mapActivity.getResources().getDimensionPixelSize(R.dimen.dashboard_land_width); appModesBtn.setLayoutParams(params); } From 5ce6dbe85a9bc038a6ce6d85adbfd8d90c95bccf Mon Sep 17 00:00:00 2001 From: Skalii Date: Thu, 11 Mar 2021 14:26:16 +0200 Subject: [PATCH 020/250] fix toggle button display after rotate screen p.2 --- .../res/layout/bottom_sheet_item_preference_switch.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OsmAnd/res/layout/bottom_sheet_item_preference_switch.xml b/OsmAnd/res/layout/bottom_sheet_item_preference_switch.xml index 6e281a4d04..d424b02fb1 100644 --- a/OsmAnd/res/layout/bottom_sheet_item_preference_switch.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_preference_switch.xml @@ -13,11 +13,11 @@ android:layout_marginEnd="@dimen/content_padding" android:layout_marginRight="@dimen/content_padding" android:minHeight="@dimen/bottom_sheet_list_item_height" + android:paddingStart="@dimen/content_padding" android:paddingLeft="@dimen/content_padding" - android:paddingRight="@dimen/content_padding" - tools:background="@drawable/rectangle_rounded_right" android:paddingEnd="@dimen/content_padding" - android:paddingStart="@dimen/content_padding"> + android:paddingRight="@dimen/content_padding" + tools:background="@drawable/rectangle_rounded_right"> + android:focusableInTouchMode="false" + android:saveEnabled="false" /> From bccfe95597760bbdf75eaabc1a55791ae8e7103b Mon Sep 17 00:00:00 2001 From: Skalii Date: Thu, 11 Mar 2021 15:25:17 +0200 Subject: [PATCH 021/250] fix toggle button display after rotate screen p.3 --- .../osmand/plus/liveupdates/LiveUpdatesFragmentNew.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index ba48b27df1..2ab25f1696 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -80,6 +80,7 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayT import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.setAlarmForPendingIntent; +import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.getTertiaryTextColorId; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getActiveTextColorId; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getOsmandIconColorId; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryIconColorId; @@ -520,8 +521,12 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements boolean liveUpdateOn = settings.IS_LIVE_UPDATES_ON.get(); CommonPreference localUpdateOn = preferenceForLocalIndex(item, settings); // IncrementalChangesManager changesManager = app.getResourceManager().getChangesManager(); - UiUtilities.setupCompoundButton(option, nightMode, CompoundButtonType.GLOBAL); option.setChecked(localUpdateOn.get()); + if (!liveUpdateOn && localUpdateOn.get()) { + UiUtilities.setupCompoundButton(nightMode, ContextCompat.getColor(app, getTertiaryTextColorId(nightMode)), option); + } else { + UiUtilities.setupCompoundButton(option, nightMode, CompoundButtonType.GLOBAL); + } title.setText(getNameToDisplay(item, app)); From e2b108aefc01bc387c91901f663af5e12a71e206 Mon Sep 17 00:00:00 2001 From: Skalii Date: Thu, 11 Mar 2021 16:14:40 +0200 Subject: [PATCH 022/250] small fixes --- .../plus/liveupdates/LiveUpdatesFragmentNew.java | 12 ++++++------ .../plus/liveupdates/LiveUpdatesHelper.java | 6 +++--- .../liveupdates/PerformLiveUpdateAsyncTask.java | 16 ++++++++-------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index 2ab25f1696..45ccf2b3fa 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -52,7 +52,7 @@ import net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay; import net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency; import net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.OnLiveUpdatesForLocalChange; import net.osmand.plus.liveupdates.LoadLiveMapsTask.LocalIndexInfoAdapter; -import net.osmand.plus.liveupdates.PerformLiveUpdateAsyncTask.AsyncResponse; +import net.osmand.plus.liveupdates.PerformLiveUpdateAsyncTask.LiveUpdateListener; import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.widgets.TextViewEx; @@ -309,7 +309,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements private void showUpdateDialog() { startUpdateDateAsyncTask(); if (!Algorithms.isEmpty(adapter.mapsList)) { - final AsyncResponse refreshAfterUpdate = new AsyncResponse() { + final LiveUpdateListener listener = new LiveUpdateListener() { @Override public void processFinish() { adapter.notifyDataSetChanged(); @@ -317,7 +317,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements }; if (adapter.countEnabled == 1) { LocalIndexInfo li = adapter.mapsList.get(0); - runLiveUpdate(getActivity(), li.getFileName(), false, refreshAfterUpdate); + runLiveUpdate(getActivity(), li.getFileName(), false, listener); } else if (adapter.countEnabled > 1) { AlertDialog.Builder bld = new AlertDialog.Builder(getMyActivity()); bld.setMessage(R.string.update_all_maps_now); @@ -328,7 +328,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements for (LocalIndexInfo li : adapter.mapsList) { CommonPreference localUpdateOn = preferenceForLocalIndex(li.getFileName(), settings); if (localUpdateOn.get()) { - runLiveUpdate(getActivity(), li.getFileName(), false, refreshAfterUpdate); + runLiveUpdate(getActivity(), li.getFileName(), false, listener); } } } @@ -650,7 +650,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements final CommonPreference liveUpdatePreference = preferenceForLocalIndex(fileName, settings); liveUpdatePreference.set(newValue); if (settings.IS_LIVE_UPDATES_ON.get() && liveUpdatePreference.get()) { - runLiveUpdate(getActivity(), fileName, true, new AsyncResponse() { + runLiveUpdate(getActivity(), fileName, true, new LiveUpdateListener() { @Override public void processFinish() { runSort(); @@ -673,7 +673,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements @Override public void forceUpdateLocal(String fileName, boolean userRequested, final Runnable callback) { if (settings.IS_LIVE_UPDATES_ON.get()) { - runLiveUpdate(getActivity(), fileName, userRequested, new AsyncResponse() { + runLiveUpdate(getActivity(), fileName, userRequested, new LiveUpdateListener() { @Override public void processFinish() { updateList(); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java index 4ff0afee0a..afcb313217 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesHelper.java @@ -11,7 +11,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import net.osmand.plus.OsmandApplication; -import net.osmand.plus.liveupdates.PerformLiveUpdateAsyncTask.AsyncResponse; +import net.osmand.plus.liveupdates.PerformLiveUpdateAsyncTask.LiveUpdateListener; import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; @@ -254,8 +254,8 @@ public class LiveUpdatesHelper { } } - public static void runLiveUpdate(Context context, final String fileName, boolean userRequested, @Nullable final AsyncResponse runOnPost) { + public static void runLiveUpdate(Context context, final String fileName, boolean userRequested, @Nullable final LiveUpdateListener listener) { final String fnExt = Algorithms.getFileNameWithoutExtension(new File(fileName)); - new PerformLiveUpdateAsyncTask(context, fileName, userRequested, runOnPost).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, fnExt); + new PerformLiveUpdateAsyncTask(context, fileName, userRequested, listener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, fnExt); } } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java b/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java index 920127cfa5..d148e8c697 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java @@ -46,20 +46,20 @@ public class PerformLiveUpdateAsyncTask @NonNull private final String localIndexFileName; private final boolean userRequested; - private final AsyncResponse runOnPost; + private final LiveUpdateListener listener; - public interface AsyncResponse { + public interface LiveUpdateListener { void processFinish(); } public PerformLiveUpdateAsyncTask(@NonNull Context context, @NonNull String localIndexFileName, boolean userRequested, - @Nullable AsyncResponse runOnPost) { + @Nullable LiveUpdateListener listener) { this.context = context; this.localIndexFileName = localIndexFileName; this.userRequested = userRequested; - this.runOnPost = runOnPost; + this.listener = listener; } @Override @@ -149,8 +149,8 @@ public class PerformLiveUpdateAsyncTask ((DownloadIndexesThread.DownloadEvents) context).downloadInProgress(); } updateLatestAvailability(application, localIndexFileName); - if (runOnPost != null) { - runOnPost.processFinish(); + if (listener != null) { + listener.processFinish(); } } else { LOG.debug("onPostExecute: Not enough space for updates"); @@ -163,8 +163,8 @@ public class PerformLiveUpdateAsyncTask ((DownloadIndexesThread.DownloadEvents) context).downloadInProgress(); if (userRequested && context instanceof DownloadActivity) { updateLatestAvailability(application, localIndexFileName); - if (runOnPost != null) { - runOnPost.processFinish(); + if (listener != null) { + listener.processFinish(); } application.showShortToastMessage(R.string.no_updates_available); } From d3cf4fade645118977572b22c638cd8bcd3a470e Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Fri, 12 Mar 2021 12:52:33 +0200 Subject: [PATCH 023/250] wrong recording note button is shown on profile change --- .../src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 6d425ef65e..9861cfd073 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -782,8 +782,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { @Override public boolean updateInfo(DrawSettings drawSettings) { boolean recording = isRecording(); - if (!Algorithms.objectEquals(recording, cachedRecording)) { - cachedRecording = recording; + cachedRecording = recording; if (recording) { setText(app.getString(R.string.shared_string_control_stop), null); setIcons(R.drawable.widget_icon_av_active, R.drawable.widget_icon_av_active_night); @@ -805,7 +804,6 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { break; } } - } return false; }; }; From a592b397fc7641590753b03fc1250e6e5fd5fbfc Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Fri, 12 Mar 2021 16:21:12 +0200 Subject: [PATCH 024/250] wrong direction contextmenu item https://github.com/osmandapp/OsmAnd/issues/10961 --- OsmAnd/src/net/osmand/plus/UiUtilities.java | 21 ++++++++++--------- .../MapContextMenuFragment.java | 1 + 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/UiUtilities.java b/OsmAnd/src/net/osmand/plus/UiUtilities.java index e6ce06ca35..918faf8fbd 100644 --- a/OsmAnd/src/net/osmand/plus/UiUtilities.java +++ b/OsmAnd/src/net/osmand/plus/UiUtilities.java @@ -18,6 +18,7 @@ import android.text.Spanned; import android.text.style.StyleSpan; import android.view.Gravity; import android.view.LayoutInflater; +import android.view.Surface; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; @@ -66,12 +67,8 @@ public class UiUtilities { private static final Log LOG = PlatformUtil.getLog(UiUtilities.class); - private TLongObjectHashMap drawableCache = new TLongObjectHashMap<>(); - private OsmandApplication app; - private static final int ORIENTATION_0 = 0; - private static final int ORIENTATION_90 = 3; - private static final int ORIENTATION_270 = 1; - private static final int ORIENTATION_180 = 2; + private final TLongObjectHashMap drawableCache = new TLongObjectHashMap<>(); + private final OsmandApplication app; private static final int INVALID_ID = -1; public enum DialogButtonType { @@ -259,6 +256,10 @@ public class UiUtilities { } public static class UpdateLocationViewCache { + public void setScreenOrientation(int screenOrientation) { + this.screenOrientation = screenOrientation; + } + int screenOrientation; public boolean paintTxt = true; public int arrowResId; @@ -356,16 +357,16 @@ public class UiUtilities { public int getScreenOrientation() { int screenOrientation = ((WindowManager) app.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation(); switch (screenOrientation) { - case ORIENTATION_0: // Device default (normally portrait) + case Surface.ROTATION_0: // Device default (normally portrait) screenOrientation = 0; break; - case ORIENTATION_90: // Landscape right + case Surface.ROTATION_90: // Landscape right screenOrientation = 90; break; - case ORIENTATION_270: // Landscape left + case Surface.ROTATION_270: // Landscape left screenOrientation = 270; break; - case ORIENTATION_180: // Upside down + case Surface.ROTATION_180: // Upside down screenOrientation = 180; break; } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index a3026eda83..937328e721 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -1386,6 +1386,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo mapActivity.getChooseRouteFragment().dismiss(); } updateLocationViewCache = mapActivity.getMyApplication().getUIUtilities().getUpdateLocationViewCache(); + updateLocationViewCache.setScreenOrientation(0); mapActivity.getMapViewTrackingUtilities().setContextMenu(menu); mapActivity.getMapViewTrackingUtilities().setMapLinkedToLocation(false); wasDrawerDisabled = mapActivity.isDrawerDisabled(); From db0038a050989e9b10837c35bde1f8ad9e6f35aa Mon Sep 17 00:00:00 2001 From: Skalii Date: Fri, 12 Mar 2021 16:32:27 +0200 Subject: [PATCH 025/250] fix displaying shadow above bottom buttons in older android versions --- OsmAnd/res/drawable/shadow.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OsmAnd/res/drawable/shadow.xml b/OsmAnd/res/drawable/shadow.xml index 25b8ac43b3..450b150e17 100644 --- a/OsmAnd/res/drawable/shadow.xml +++ b/OsmAnd/res/drawable/shadow.xml @@ -9,8 +9,8 @@ + android:centerColor="#00000000" + android:endColor="#00000000" /> @@ -23,8 +23,8 @@ + android:centerColor="#00000000" + android:endColor="#00000000" /> From 979c10aba40ac4b84ca3f94d8c60044634ae9e30 Mon Sep 17 00:00:00 2001 From: cepprice Date: Fri, 12 Mar 2021 20:04:51 +0500 Subject: [PATCH 026/250] Small fixes & saving gradient palette of speed/altitude/slope scale types --- .../java/net/osmand/router/RouteColorize.java | 2 +- OsmAnd/res/layout/gradient_card.xml | 2 +- OsmAnd/src/net/osmand/plus/GPXDatabase.java | 12 +-- OsmAnd/src/net/osmand/plus/GpxDbHelper.java | 2 +- .../backend/EnumStringPreference.java | 6 +- .../plus/settings/backend/OsmandSettings.java | 27 +----- .../backend/backup/GpxSettingsItem.java | 6 +- .../net/osmand/plus/track/GradientCard.java | 9 +- .../plus/track/TrackAppearanceFragment.java | 17 +++- .../osmand/plus/track/TrackColoringCard.java | 23 ++--- .../net/osmand/plus/track/TrackDrawInfo.java | 24 ++++++ .../src/net/osmand/plus/views/Renderable.java | 86 +++++++++---------- .../osmand/plus/views/layers/GPXLayer.java | 20 ++++- 13 files changed, 136 insertions(+), 100 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java index 7b9f46c108..8fb0046bb4 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteColorize.java @@ -209,7 +209,7 @@ public class RouteColorize { } setPalette(new double[][] { {minValue, gradientPalette[0]}, - {colorizationType == ColorizationType.SLOPE ? 0 : (minValue + maxValue) / 2}, + {colorizationType == ColorizationType.SLOPE ? 0 : (minValue + maxValue) / 2, gradientPalette[1]}, {maxValue, gradientPalette[2]} }); } diff --git a/OsmAnd/res/layout/gradient_card.xml b/OsmAnd/res/layout/gradient_card.xml index ff0834bee0..a4edba9be2 100644 --- a/OsmAnd/res/layout/gradient_card.xml +++ b/OsmAnd/res/layout/gradient_card.xml @@ -3,7 +3,7 @@ xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_height="wrap_content" android:orientation="vertical" android:padding="@dimen/content_padding" android:paddingStart="@dimen/content_padding" diff --git a/OsmAnd/src/net/osmand/plus/GPXDatabase.java b/OsmAnd/src/net/osmand/plus/GPXDatabase.java index 0f70144a73..385ec79484 100644 --- a/OsmAnd/src/net/osmand/plus/GPXDatabase.java +++ b/OsmAnd/src/net/osmand/plus/GPXDatabase.java @@ -1,8 +1,5 @@ package net.osmand.plus; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.GPXTrackAnalysis; import net.osmand.IndexConstants; @@ -16,6 +13,9 @@ import java.io.File; import java.util.ArrayList; import java.util.List; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + public class GPXDatabase { private static final int DB_VERSION = 11; @@ -751,7 +751,9 @@ public class GPXDatabase { new Object[] {fileName, fileDir, color, 0, item.splitType, item.splitInterval, item.apiImported ? 1 : 0, item.showAsMarkers ? 1 : 0, item.joinSegments ? 1 : 0, item.showArrows ? 1 : 0, item.showStartFinish ? 1 : 0, item.width, - item.gradientSpeedPalette, item.gradientAltitudePalette, item.gradientSlopePalette, gradientScaleType}); + Algorithms.gradientPaletteToString(item.gradientSpeedPalette), + Algorithms.gradientPaletteToString(item.gradientAltitudePalette), + Algorithms.gradientPaletteToString(item.gradientSlopePalette), gradientScaleType}); } } @@ -884,7 +886,7 @@ public class GPXDatabase { item.gradientSlopePalette = Algorithms.stringToGradientPalette(gradientSlopePalette); try { - item.gradientScaleType = Algorithms.isEmpty(gradientScaleType) ? null : GradientScaleType.valueOf(gradientScaleType.toUpperCase()); + item.gradientScaleType = GradientScaleType.getGradientTypeByName(gradientScaleType); } catch (IllegalArgumentException e) { item.gradientScaleType = null; } diff --git a/OsmAnd/src/net/osmand/plus/GpxDbHelper.java b/OsmAnd/src/net/osmand/plus/GpxDbHelper.java index ef93703190..21154d5819 100644 --- a/OsmAnd/src/net/osmand/plus/GpxDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/GpxDbHelper.java @@ -78,7 +78,7 @@ public class GpxDbHelper { return res; } - public boolean updateGradientScaleColor(@NonNull GpxDataItem item, @NonNull GradientScaleType gradientScaleType, int[] palette) { + public boolean updateGradientScalePalette(@NonNull GpxDataItem item, @NonNull GradientScaleType gradientScaleType, int[] palette) { boolean res = db.updateGradientScaleColor(item, gradientScaleType, palette); putToCache(item); return res; diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/EnumStringPreference.java b/OsmAnd/src/net/osmand/plus/settings/backend/EnumStringPreference.java index d51deca152..a88a17fed3 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/EnumStringPreference.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/EnumStringPreference.java @@ -12,7 +12,8 @@ public class EnumStringPreference> extends CommonPreference @Override protected E getValue(Object prefs, E defaultValue) { try { - String name = getSettingsAPI().getString(prefs, getId(), defaultValue.name()); + String defaultValueName = defaultValue == null ? null : defaultValue.name(); + String name = getSettingsAPI().getString(prefs, getId(), defaultValueName); E value = parseString(name); return value != null ? value : defaultValue; } catch (ClassCastException ex) { @@ -23,7 +24,8 @@ public class EnumStringPreference> extends CommonPreference @Override public boolean setValue(Object prefs, E val) { - return getSettingsAPI().edit(prefs).putString(getId(), val.name()).commit(); + String name = val == null ? null : val.name(); + return getSettingsAPI().edit(prefs).putString(getId(), name).commit(); } @Override diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 7abb6245d6..1a2658870b 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -1409,29 +1409,10 @@ public class OsmandSettings { public final OsmandPreference LAST_UPDATES_CARD_REFRESH = new LongPreference(this, "last_updates_card_refresh", 0).makeGlobal(); public final CommonPreference CURRENT_TRACK_COLOR = new IntPreference(this, "current_track_color", 0).makeGlobal().makeShared().cache(); - public final CommonPreference CURRENT_TRACK_COLORIZATION = new CommonPreference(this, "current_track_colorization", null) { - @Override - protected GradientScaleType getValue(Object prefs, GradientScaleType defaultValue) { - String name = getSettingsAPI().getString(prefs, getId(), null); - return parseString(name); - } - - @Override - protected boolean setValue(Object prefs, GradientScaleType val) { - String name = val == null ? null : val.getTypeName(); - return getSettingsAPI().edit(prefs).putString(getId(), name).commit(); - } - - @Override - public GradientScaleType parseString(String s) { - for (GradientScaleType value : GradientScaleType.values()) { - if (value.name().equals(s)) { - return value; - } - } - return null; - } - }.makeGlobal().makeShared().cache(); + public final CommonPreference CURRENT_TRACK_COLORIZATION = new EnumStringPreference<>(this, "current_track_colorization", null, GradientScaleType.values()).makeGlobal().makeShared().cache(); + public final CommonPreference CURRENT_TRACK_SPEED_GRADIENT_PALETTE = new StringPreference(this, "current_track_speed_gradient_palette", null).makeGlobal().makeShared().cache(); + public final CommonPreference CURRENT_TRACK_ALTITUDE_GRADIENT_PALETTE = new StringPreference(this, "current_track_altitude_gradient_palette", null).makeGlobal().makeShared().cache(); + public final CommonPreference CURRENT_TRACK_SLOPE_GRADIENT_PALETTE = new StringPreference(this, "current_track_slope_gradient_palette", null).makeGlobal().makeShared().cache(); public final CommonPreference CURRENT_TRACK_WIDTH = new StringPreference(this, "current_track_width", "").makeGlobal().makeShared().cache(); public final CommonPreference CURRENT_TRACK_SHOW_ARROWS = new BooleanPreference(this, "current_track_show_arrows", false).makeGlobal().makeShared().cache(); public final CommonPreference CURRENT_TRACK_SHOW_START_FINISH = new BooleanPreference(this, "current_track_show_start_finish", true).makeGlobal().makeShared().cache(); diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxSettingsItem.java index 2eca72fba1..fe6fd9b67a 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/GpxSettingsItem.java @@ -84,9 +84,9 @@ public class GpxSettingsItem extends FileSettingsItem { gpxDbHelper.updateShowStartFinish(dataItem, appearanceInfo.showStartFinish); gpxDbHelper.updateSplit(dataItem, splitType, appearanceInfo.splitInterval); gpxDbHelper.updateGradientScaleType(dataItem, appearanceInfo.scaleType); - gpxDbHelper.updateGradientScaleColor(dataItem, GradientScaleType.SPEED, appearanceInfo.gradientSpeedPalette); - gpxDbHelper.updateGradientScaleColor(dataItem, GradientScaleType.ALTITUDE, appearanceInfo.gradientAltitudePalette); - gpxDbHelper.updateGradientScaleColor(dataItem, GradientScaleType.SLOPE, appearanceInfo.gradientSlopePalette); + gpxDbHelper.updateGradientScalePalette(dataItem, GradientScaleType.SPEED, appearanceInfo.gradientSpeedPalette); + gpxDbHelper.updateGradientScalePalette(dataItem, GradientScaleType.ALTITUDE, appearanceInfo.gradientAltitudePalette); + gpxDbHelper.updateGradientScalePalette(dataItem, GradientScaleType.SLOPE, appearanceInfo.gradientSlopePalette); } private void createGpxAppearanceInfo() { diff --git a/OsmAnd/src/net/osmand/plus/track/GradientCard.java b/OsmAnd/src/net/osmand/plus/track/GradientCard.java index 77d881574e..217ad2a8f1 100644 --- a/OsmAnd/src/net/osmand/plus/track/GradientCard.java +++ b/OsmAnd/src/net/osmand/plus/track/GradientCard.java @@ -14,15 +14,17 @@ import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.routepreparationmenu.cards.BaseCard; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; public class GradientCard extends BaseCard { private GPXTrackAnalysis gpxTrackAnalysis; - private GradientScaleType selectedScaleType = null; + private GradientScaleType selectedScaleType; - public GradientCard(@NonNull MapActivity mapActivity, @NonNull GPXTrackAnalysis gpxTrackAnalysis) { + public GradientCard(@NonNull MapActivity mapActivity, @NonNull GPXTrackAnalysis gpxTrackAnalysis, @Nullable GradientScaleType selectedScaleType) { super(mapActivity); this.gpxTrackAnalysis = gpxTrackAnalysis; + this.selectedScaleType = selectedScaleType; } @Override @@ -72,10 +74,11 @@ public class GradientCard extends BaseCard { return (int) value + " %"; } String speed = OsmAndFormatter.getFormattedSpeed(value, app); + String speedUnit = app.getSettings().SPEED_SYSTEM.get().toShortString(app); Spannable formattedSpeed = new SpannableString(speed); formattedSpeed.setSpan( new ForegroundColorSpan(AndroidUtils.getColorFromAttr(app, android.R.attr.textColorSecondary)), - speed.indexOf(" "), speed.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + speed.indexOf(speedUnit), speed.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return formattedSpeed; } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java index 98831141bc..3aaeebccae 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java @@ -160,6 +160,9 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement trackDrawInfo = new TrackDrawInfo(true); trackDrawInfo.setColor(app.getSettings().CURRENT_TRACK_COLOR.get()); trackDrawInfo.setGradientScaleType(app.getSettings().CURRENT_TRACK_COLORIZATION.get()); + trackDrawInfo.setSpeedGradientPalette(Algorithms.stringToArray(app.getSettings().CURRENT_TRACK_SPEED_GRADIENT_PALETTE.get())); + trackDrawInfo.setAltitudeGradientPalette(Algorithms.stringToArray(app.getSettings().CURRENT_TRACK_ALTITUDE_GRADIENT_PALETTE.get())); + trackDrawInfo.setSlopeGradientPalette(Algorithms.stringToArray(app.getSettings().CURRENT_TRACK_SLOPE_GRADIENT_PALETTE.get())); trackDrawInfo.setWidth(app.getSettings().CURRENT_TRACK_WIDTH.get()); trackDrawInfo.setShowArrows(app.getSettings().CURRENT_TRACK_SHOW_ARROWS.get()); trackDrawInfo.setShowStartFinish(app.getSettings().CURRENT_TRACK_SHOW_START_FINISH.get()); @@ -579,12 +582,18 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement if (gpxFile.showCurrentTrack) { app.getSettings().CURRENT_TRACK_COLOR.set(trackDrawInfo.getColor()); app.getSettings().CURRENT_TRACK_COLORIZATION.set(trackDrawInfo.getGradientScaleType()); + app.getSettings().CURRENT_TRACK_SPEED_GRADIENT_PALETTE.set(Algorithms.arrayToString(trackDrawInfo.getSpeedGradientPalette())); + app.getSettings().CURRENT_TRACK_ALTITUDE_GRADIENT_PALETTE.set(Algorithms.arrayToString(trackDrawInfo.getAltitudeGradientPalette())); + app.getSettings().CURRENT_TRACK_SLOPE_GRADIENT_PALETTE.set(Algorithms.arrayToString(trackDrawInfo.getSlopeGradientPalette())); app.getSettings().CURRENT_TRACK_WIDTH.set(trackDrawInfo.getWidth()); app.getSettings().CURRENT_TRACK_SHOW_ARROWS.set(trackDrawInfo.isShowArrows()); app.getSettings().CURRENT_TRACK_SHOW_START_FINISH.set(trackDrawInfo.isShowStartFinish()); } else if (gpxDataItem != null) { GpxSplitType splitType = GpxSplitType.getSplitTypeByTypeId(trackDrawInfo.getSplitType()); gpxDbHelper.updateColor(gpxDataItem, trackDrawInfo.getColor()); + gpxDbHelper.updateGradientScalePalette(gpxDataItem, GradientScaleType.SPEED, trackDrawInfo.getSpeedGradientPalette()); + gpxDbHelper.updateGradientScalePalette(gpxDataItem, GradientScaleType.ALTITUDE, trackDrawInfo.getAltitudeGradientPalette()); + gpxDbHelper.updateGradientScalePalette(gpxDataItem, GradientScaleType.SLOPE, trackDrawInfo.getSlopeGradientPalette()); gpxDbHelper.updateWidth(gpxDataItem, trackDrawInfo.getWidth()); gpxDbHelper.updateShowArrows(gpxDataItem, trackDrawInfo.isShowArrows()); // gpxDbHelper.updateShowStartFinish(gpxDataItem, trackDrawInfo.isShowStartFinish()); @@ -662,9 +671,8 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement setupColorsCard(cardsContainer); - gradientCard = new GradientCard(mapActivity, selectedGpxFile.getTrackAnalysis(app)); - AndroidUiHelper.updateVisibility(gradientCard.build(mapActivity), false); - cardsContainer.addView(gradientCard.getView()); + gradientCard = new GradientCard(mapActivity, selectedGpxFile.getTrackAnalysis(app), trackDrawInfo.getGradientScaleType()); + cardsContainer.addView(gradientCard.build(mapActivity)); trackWidthCard = new TrackWidthCard(mapActivity, trackDrawInfo, new OnNeedScrollListener() { @@ -692,7 +700,8 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement List colors = getTrackColors(); colorsCard = new ColorsCard(mapActivity, trackDrawInfo.getColor(), this, colors, app.getSettings().CUSTOM_TRACK_COLORS, null); colorsCard.setListener(this); - cardsContainer.addView(colorsCard.build(mapActivity)); + AndroidUiHelper.updateVisibility(colorsCard.build(mapActivity), trackDrawInfo.getGradientScaleType() == null); + cardsContainer.addView(colorsCard.getView()); } } diff --git a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java index 44645180ea..41e17ac37e 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackColoringCard.java @@ -1,5 +1,6 @@ package net.osmand.plus.track; +import android.content.Context; import android.graphics.drawable.GradientDrawable; import android.os.Build; import android.view.LayoutInflater; @@ -188,6 +189,7 @@ public class TrackColoringCard extends BaseCard { private void updateButtonBg(TrackAppearanceViewHolder holder, TrackAppearanceItem item) { GradientDrawable rectContourDrawable = (GradientDrawable) AppCompatResources.getDrawable(app, R.drawable.bg_select_group_button_outline); if (rectContourDrawable != null) { + Context ctx = holder.itemView.getContext(); boolean itemSelected = getSelectedAppearanceItem() != null && getSelectedAppearanceItem().equals(item); int strokeColor; @@ -195,39 +197,40 @@ public class TrackColoringCard extends BaseCard { int strokeWidth; if (itemSelected) { - strokeColor = AndroidUtils.getColorFromAttr(app, R.attr.pstsIndicatorColor); + strokeColor = AndroidUtils.getColorFromAttr(ctx, R.attr.colorPrimary); backgroundColor = 0; strokeWidth = 2; } else if (!item.isActive()) { - strokeColor = AndroidUtils.getColorFromAttr(app, R.attr.stroked_buttons_and_links_outline); - backgroundColor = AndroidUtils.getColorFromAttr(app, R.attr.ctx_menu_card_btn); + strokeColor = AndroidUtils.getColorFromAttr(ctx, R.attr.stroked_buttons_and_links_outline); + backgroundColor = AndroidUtils.getColorFromAttr(ctx, R.attr.ctx_menu_card_btn); strokeWidth = 2; } else { - strokeColor = AndroidUtils.getColorFromAttr(app, R.attr.stroked_buttons_and_links_outline); + strokeColor = AndroidUtils.getColorFromAttr(ctx, R.attr.stroked_buttons_and_links_outline); backgroundColor = 0; strokeWidth = 1; } rectContourDrawable.mutate(); rectContourDrawable.setColor(backgroundColor); - rectContourDrawable.setStroke(AndroidUtils.dpToPx(app, strokeWidth), strokeColor); + rectContourDrawable.setStroke(AndroidUtils.dpToPx(ctx, strokeWidth), strokeColor); holder.button.setImageDrawable(rectContourDrawable); } } private void updateTextAndIconColor(TrackAppearanceViewHolder holder, TrackAppearanceItem item) { + Context ctx = holder.itemView.getContext(); boolean isSelected = item.getAttrName().equals(getSelectedAppearanceItem().getAttrName()); int iconColorId; int textColorId; if (isSelected) { - iconColorId = AndroidUtils.getColorFromAttr(app, R.attr.default_icon_color); - textColorId = AndroidUtils.getColorFromAttr(app, android.R.attr.textColor); + iconColorId = AndroidUtils.getColorFromAttr(ctx, R.attr.default_icon_color); + textColorId = AndroidUtils.getColorFromAttr(ctx, android.R.attr.textColor); } else if (!item.isActive()) { - iconColorId = AndroidUtils.getColorFromAttr(app, R.attr.default_icon_color); - textColorId = AndroidUtils.getColorFromAttr(app, android.R.attr.textColorSecondary); + iconColorId = AndroidUtils.getColorFromAttr(ctx, R.attr.default_icon_color); + textColorId = AndroidUtils.getColorFromAttr(ctx, android.R.attr.textColorSecondary); } else { - iconColorId = AndroidUtils.getColorFromAttr(app, R.attr.pstsIndicatorColor); + iconColorId = AndroidUtils.getColorFromAttr(ctx, R.attr.colorPrimary); textColorId = iconColorId; } diff --git a/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java b/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java index d3531c0c9d..2f3d0a2c32 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackDrawInfo.java @@ -98,6 +98,30 @@ public class TrackDrawInfo { } } + public int[] getSpeedGradientPalette() { + return speedGradientPalette; + } + + public int[] getAltitudeGradientPalette() { + return altitudeGradientPalette; + } + + public int[] getSlopeGradientPalette() { + return slopeGradientPalette; + } + + public void setSpeedGradientPalette(int[] palette) { + this.speedGradientPalette = palette; + } + + public void setAltitudeGradientPalette(int[] palette) { + this.altitudeGradientPalette = palette; + } + + public void setSlopeGradientPalette(int[] palette) { + this.slopeGradientPalette = palette; + } + public int getSplitType() { return splitType; } diff --git a/OsmAnd/src/net/osmand/plus/views/Renderable.java b/OsmAnd/src/net/osmand/plus/views/Renderable.java index a8d8351967..5053f46a69 100644 --- a/OsmAnd/src/net/osmand/plus/views/Renderable.java +++ b/OsmAnd/src/net/osmand/plus/views/Renderable.java @@ -6,8 +6,6 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.Shader; -import androidx.annotation.NonNull; - import net.osmand.GPXUtilities; import net.osmand.GPXUtilities.WptPt; import net.osmand.data.QuadRect; @@ -27,6 +25,8 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import androidx.annotation.NonNull; + public class Renderable { @@ -103,12 +103,18 @@ public class Renderable { protected abstract void startCuller(double newZoom); protected void drawSingleSegment(double zoom, Paint p, Canvas canvas, RotatedTileBox tileBox) { + if (points.size() < 2) { + return; + } + + updateLocalPaint(p); + canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); if (scaleType != null) { drawGradient(getPointsForDrawing(), p, canvas, tileBox); - scaleType = null; } else { drawSolid(getPointsForDrawing(), p, canvas, tileBox); } + canvas.rotate(tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); } @@ -139,55 +145,44 @@ public class Renderable { } protected void drawSolid(List pts, Paint p, Canvas canvas, RotatedTileBox tileBox) { - if (pts.size() > 1) { - updateLocalPaint(p); - canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); - QuadRect tileBounds = tileBox.getLatLonBounds(); - WptPt lastPt = pts.get(0); - boolean recalculateLastXY = true; - Path path = new Path(); - for (int i = 1; i < pts.size(); i++) { - WptPt pt = pts.get(i); - if (Math.min(pt.lon, lastPt.lon) < tileBounds.right && Math.max(pt.lon, lastPt.lon) > tileBounds.left - && Math.min(pt.lat, lastPt.lat) < tileBounds.top && Math.max(pt.lat, lastPt.lat) > tileBounds.bottom) { - if (recalculateLastXY) { - recalculateLastXY = false; - float lastX = tileBox.getPixXFromLatLon(lastPt.lat, lastPt.lon); - float lastY = tileBox.getPixYFromLatLon(lastPt.lat, lastPt.lon); - if (!path.isEmpty()) { - canvas.drawPath(path, paint); - } - path.reset(); - path.moveTo(lastX, lastY); + QuadRect tileBounds = tileBox.getLatLonBounds(); + WptPt lastPt = pts.get(0); + boolean recalculateLastXY = true; + Path path = new Path(); + for (int i = 1; i < pts.size(); i++) { + WptPt pt = pts.get(i); + if (arePointsInsideTile(pt, lastPt, tileBounds)) { + if (recalculateLastXY) { + recalculateLastXY = false; + float lastX = tileBox.getPixXFromLatLon(lastPt.lat, lastPt.lon); + float lastY = tileBox.getPixYFromLatLon(lastPt.lat, lastPt.lon); + if (!path.isEmpty()) { + canvas.drawPath(path, paint); } - float x = tileBox.getPixXFromLatLon(pt.lat, pt.lon); - float y = tileBox.getPixYFromLatLon(pt.lat, pt.lon); - path.lineTo(x, y); - } else { - recalculateLastXY = true; + path.reset(); + path.moveTo(lastX, lastY); } - lastPt = pt; + float x = tileBox.getPixXFromLatLon(pt.lat, pt.lon); + float y = tileBox.getPixYFromLatLon(pt.lat, pt.lon); + path.lineTo(x, y); + } else { + recalculateLastXY = true; } - if (!path.isEmpty()) { - canvas.drawPath(path, paint); - } - canvas.rotate(tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); + lastPt = pt; + } + if (!path.isEmpty()) { + canvas.drawPath(path, paint); } } protected void drawGradient(List pts, Paint p, Canvas canvas, RotatedTileBox tileBox) { - if (pts.size() < 2) { - return; - } - - updateLocalPaint(p); - canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); QuadRect tileBounds = tileBox.getLatLonBounds(); + Path path = new Path(); + Paint paint = new Paint(this.paint); WptPt prevPt = pts.get(0); for (int i = 1; i < pts.size(); i++) { WptPt currentPt = pts.get(i); - if (Math.min(currentPt.lon, prevPt.lon) < tileBounds.right && Math.max(currentPt.lon, prevPt.lon) > tileBounds.left - && Math.min(currentPt.lat, prevPt.lat) < tileBounds.top && Math.max(currentPt.lat, prevPt.lat) > tileBounds.bottom) { + if (arePointsInsideTile(currentPt, prevPt, tileBounds)) { float startX = tileBox.getPixXFromLatLon(prevPt.lat, prevPt.lon); float startY = tileBox.getPixYFromLatLon(prevPt.lat, prevPt.lon); float endX = tileBox.getPixXFromLatLon(currentPt.lat, currentPt.lon); @@ -195,16 +190,19 @@ public class Renderable { int prevColor = prevPt.getColor(scaleType.toColorizationType()); int currentColor = currentPt.getColor(scaleType.toColorizationType()); LinearGradient gradient = new LinearGradient(startX, startY, endX, endY, prevColor, currentColor, Shader.TileMode.CLAMP); - Paint paint = new Paint(this.paint); paint.setShader(gradient); - Path path = new Path(); + path.reset(); path.moveTo(startX, startY); path.lineTo(endX, endY); canvas.drawPath(path, paint); } prevPt = currentPt; } - canvas.rotate(tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY()); + } + + protected boolean arePointsInsideTile(WptPt first, WptPt second, QuadRect tileBounds) { + return Math.min(first.lon, second.lon) < tileBounds.right && Math.max(first.lon, second.lon) > tileBounds.left + && Math.min(first.lat, second.lat) < tileBounds.top && Math.max(first.lat, second.lat) > tileBounds.bottom; } } diff --git a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java index abb99e8428..033437d27c 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java @@ -145,6 +145,9 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM private CommonPreference currentTrackColorPref; private CommonPreference currentTrackScaleType; + private CommonPreference currentTrackSpeedGradientPalette; + private CommonPreference currentTrackAltitudeGradientPalette; + private CommonPreference currentTrackSlopeGradientPalette; private CommonPreference currentTrackWidthPref; private CommonPreference currentTrackShowArrowsPref; private CommonPreference currentTrackShowStartFinishPref; @@ -159,6 +162,9 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM currentTrackColorPref = view.getSettings().CURRENT_TRACK_COLOR; currentTrackScaleType = view.getSettings().CURRENT_TRACK_COLORIZATION; + currentTrackSpeedGradientPalette = view.getSettings().CURRENT_TRACK_SPEED_GRADIENT_PALETTE; + currentTrackAltitudeGradientPalette = view.getSettings().CURRENT_TRACK_ALTITUDE_GRADIENT_PALETTE; + currentTrackSlopeGradientPalette = view.getSettings().CURRENT_TRACK_SLOPE_GRADIENT_PALETTE; currentTrackWidthPref = view.getSettings().CURRENT_TRACK_WIDTH; currentTrackShowArrowsPref = view.getSettings().CURRENT_TRACK_SHOW_ARROWS; currentTrackShowStartFinishPref = view.getSettings().CURRENT_TRACK_SHOW_START_FINISH; @@ -694,9 +700,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM updatePaints(color, width, selectedGpxFile.isRoutePoints(), currentTrack, settings, tileBox); if (ts.renderer instanceof Renderable.RenderableSegment) { Renderable.RenderableSegment renderableSegment = (Renderable.RenderableSegment) ts.renderer; - if (scaleType != null) { - renderableSegment.setGradientScaleType(scaleType); - } + renderableSegment.setGradientScaleType(scaleType); renderableSegment.drawSegment(view.getZoom(), paint, canvas, tileBox); } } @@ -769,6 +773,16 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM private int[] getColorizationPalette(GPXFile gpxFile, GradientScaleType scaleType) { if (hasTrackDrawInfoForTrack(gpxFile)) { return trackDrawInfo.getGradientPalette(scaleType); + } else if (gpxFile.showCurrentTrack) { + String palette; + if (scaleType == GradientScaleType.SPEED) { + palette = currentTrackSpeedGradientPalette.get(); + } else if (scaleType == GradientScaleType.ALTITUDE) { + palette = currentTrackAltitudeGradientPalette.get(); + } else { + palette = currentTrackSlopeGradientPalette.get(); + } + return Algorithms.stringToArray(palette); } GpxDataItem dataItem = gpxDbHelper.getItem(new File(gpxFile.path)); if (dataItem == null) { From bbb1fd0ac6c5309dc2c4533391f5bc2aa3570b16 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Fri, 12 Mar 2021 22:46:37 +0200 Subject: [PATCH 027/250] Remove "Swap" button from RP if "Follow track" https://github.com/osmandapp/OsmAnd-Issues/issues/186 --- .../plus/routepreparationmenu/MapRouteInfoMenu.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java index 2475d70f34..e57dec6080 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java @@ -98,9 +98,9 @@ import net.osmand.plus.routepreparationmenu.cards.PublicTransportNotFoundSetting import net.osmand.plus.routepreparationmenu.cards.PublicTransportNotFoundWarningCard; import net.osmand.plus.routepreparationmenu.cards.SimpleRouteCard; import net.osmand.plus.routepreparationmenu.cards.TracksCard; +import net.osmand.plus.routing.GPXRouteParams.GPXRouteParamsBuilder; import net.osmand.plus.routing.IRouteInformationListener; import net.osmand.plus.routing.RouteCalculationResult; -import net.osmand.plus.routing.GPXRouteParams.GPXRouteParamsBuilder; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelperUtils; import net.osmand.plus.routing.TransportRoutingHelper; @@ -1831,6 +1831,13 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener }); FrameLayout fromButton = (FrameLayout) mainView.findViewById(R.id.from_button); + boolean isFollowTrack = app.getRoutingHelper().getCurrentGPXRoute() != null; + + if (isFollowTrack) { + fromButton.setVisibility(View.GONE); + } else { + fromButton.setVisibility(View.VISIBLE); + } LinearLayout fromButtonContainer = (LinearLayout) mainView.findViewById(R.id.from_button_container); setupButtonBackground(fromButton, fromButtonContainer); From d51d24ad1b380dc56ba0c74f4d9e17c08e32b06a Mon Sep 17 00:00:00 2001 From: JohnProv <67185600+JohnProv@users.noreply.github.com> Date: Sat, 13 Mar 2021 20:09:20 +0100 Subject: [PATCH 028/250] Fix typo in dutch translation --- OsmAnd/res/values-nl/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index 2aed93b35e..1ee2081a3e 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -3626,7 +3626,7 @@ Specificeer het registratie-interval voor de algemene trackregistratie (ingeschakeld via de track-widget op de kaart). Pauzeer track opname Hervat track opnemen - Beelden op srraatniveau + Beelden op straatniveau Selecteer dikte Toon start en aankomst pictogrammen Richtingaanwijzers @@ -3970,4 +3970,4 @@ Aan het opladen %1$d van %2$d Opgeladen %1$d van %2$d Selecteer de op te laden wijzigingen - \ No newline at end of file + From 7015e8d25bbbaf98ecc4de0b065ab67f890ba0a3 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Sun, 14 Mar 2021 19:04:27 +0200 Subject: [PATCH 029/250] Update --- .../audionotes/AudioVideoNotesPlugin.java | 43 ++++++++----------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 9861cfd073..73d054549d 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -776,36 +776,29 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer(); if (mapInfoLayer != null) { recordControl = new TextInfoWidget(activity) { - - private Boolean cachedRecording; - @Override public boolean updateInfo(DrawSettings drawSettings) { - boolean recording = isRecording(); - cachedRecording = recording; - if (recording) { - setText(app.getString(R.string.shared_string_control_stop), null); - setIcons(R.drawable.widget_icon_av_active, R.drawable.widget_icon_av_active_night); + Integer action = AV_DEFAULT_ACTION.get(); + boolean isVideoAction = action.equals(AV_DEFAULT_ACTION_VIDEO); + boolean isTakePictureAction = action.equals(AV_DEFAULT_ACTION_TAKEPICTURE); + boolean isAudioAction = action.equals(AV_DEFAULT_ACTION_AUDIO); + if (isRecording()) { + setText(app.getString(R.string.shared_string_control_stop), null); + setIcons(R.drawable.widget_icon_av_active, R.drawable.widget_icon_av_active_night); + } else { + setText(app.getString(R.string.shared_string_control_start), null); + if (isVideoAction) { + setIcons(R.drawable.widget_av_video_day, R.drawable.widget_av_video_night); + } else if (isTakePictureAction) { + setIcons(R.drawable.widget_av_photo_day, R.drawable.widget_av_photo_night); + } else if (isAudioAction) { + setIcons(R.drawable.widget_av_audio_day, R.drawable.widget_av_audio_night); } else { - setText(app.getString(R.string.shared_string_control_start), null); - Integer action = AV_DEFAULT_ACTION.get(); - switch (action) { - case AV_DEFAULT_ACTION_VIDEO: - setIcons(R.drawable.widget_av_video_day, R.drawable.widget_av_video_night); - break; - case AV_DEFAULT_ACTION_TAKEPICTURE: - setIcons(R.drawable.widget_av_photo_day, R.drawable.widget_av_photo_night); - break; - case AV_DEFAULT_ACTION_AUDIO: - setIcons(R.drawable.widget_av_audio_day, R.drawable.widget_av_audio_night); - break; - default: - setIcons(R.drawable.widget_icon_av_inactive_day, R.drawable.widget_icon_av_inactive_night); - break; - } + setIcons(R.drawable.widget_icon_av_inactive_day, R.drawable.widget_icon_av_inactive_night); } + } return false; - }; + } }; recordControl.setOnClickListener(new View.OnClickListener() { @Override From 44e7bf18df27f156f1f80982174ed54063198784 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 15 Mar 2021 00:25:33 +0200 Subject: [PATCH 030/250] IndexOutOfBoundsException java.lang.IndexOutOfBoundsException: Index: 3, Size: 2 at java.util.ArrayList.get(ArrayList.java:437) at net.osmand.plus.routepreparationmenu.cards.TrackEditCard.updateContent(TrackEditCard.java:92) --- .../cards/TrackEditCard.java | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java index e924b46aba..5f396eb71c 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java @@ -82,25 +82,28 @@ public class TrackEditCard extends BaseCard { } GpxUiHelper.updateGpxInfoView(view, title, gpxInfo, dataItem, false, app); - if (gpxFile.getNonEmptySegmentsCount() > 1 && routeParams != null && routeParams.getSelectedSegment() != -1) { - TextView distanceView = view.findViewById(R.id.distance); - TextView timeView = view.findViewById(R.id.time); - ImageView timeIcon = view.findViewById(R.id.time_icon); - AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_icon), false); - AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_count), false); - List segments = gpxFile.getNonEmptyTrkSegments(false); - GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment()); - double distance = TrackSelectSegmentAdapter.getDistance(segment); - long time = TrackSelectSegmentAdapter.getSegmentTime(segment); - boolean timeAvailable = time != 1; - if (timeAvailable) { - timeView.setText(Algorithms.formatDuration((int) (time / 1000), - app.accessibilityEnabled())); - } - AndroidUiHelper.updateVisibility(timeView, timeAvailable); - AndroidUiHelper.updateVisibility(timeIcon, timeAvailable); - distanceView.setText(OsmAndFormatter.getFormattedDistance((float) distance, app)); - } + if (gpxFile.getNonEmptySegmentsCount() > 1) + if (routeParams != null) + if (routeParams.getSelectedSegment() != -1) + if (gpxFile.getNonEmptySegmentsCount() > routeParams.getSelectedSegment()) { + TextView distanceView = view.findViewById(R.id.distance); + TextView timeView = view.findViewById(R.id.time); + ImageView timeIcon = view.findViewById(R.id.time_icon); + AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_icon), false); + AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_count), false); + List segments = gpxFile.getNonEmptyTrkSegments(false); + GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment()); + double distance = TrackSelectSegmentAdapter.getDistance(segment); + long time = TrackSelectSegmentAdapter.getSegmentTime(segment); + boolean timeAvailable = time != 1; + if (timeAvailable) { + timeView.setText(Algorithms.formatDuration((int) (time / 1000), + app.accessibilityEnabled())); + } + AndroidUiHelper.updateVisibility(timeView, timeAvailable); + AndroidUiHelper.updateVisibility(timeIcon, timeAvailable); + distanceView.setText(OsmAndFormatter.getFormattedDistance((float) distance, app)); + } ImageButton editButton = view.findViewById(R.id.show_on_map); editButton.setVisibility(View.VISIBLE); From ded818b0920c141d473a5d118b2f9fb65bf74763 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 15 Mar 2021 10:15:48 +0200 Subject: [PATCH 031/250] Review --- OsmAnd/src/net/osmand/plus/UiUtilities.java | 27 ++++++++++++------- .../MapContextMenuFragment.java | 3 +-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/UiUtilities.java b/OsmAnd/src/net/osmand/plus/UiUtilities.java index 918faf8fbd..548b17e16d 100644 --- a/OsmAnd/src/net/osmand/plus/UiUtilities.java +++ b/OsmAnd/src/net/osmand/plus/UiUtilities.java @@ -10,15 +10,12 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.RippleDrawable; -import android.hardware.Sensor; -import android.hardware.SensorManager; import android.os.Build; import android.text.SpannableString; import android.text.Spanned; import android.text.style.StyleSpan; import android.view.Gravity; import android.view.LayoutInflater; -import android.view.Surface; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; @@ -67,6 +64,10 @@ public class UiUtilities { private static final Log LOG = PlatformUtil.getLog(UiUtilities.class); + private static final int ORIENTATION_0 = 0; + private static final int ORIENTATION_90 = 3; + private static final int ORIENTATION_270 = 1; + private static final int ORIENTATION_180 = 2; private final TLongObjectHashMap drawableCache = new TLongObjectHashMap<>(); private final OsmandApplication app; private static final int INVALID_ID = -1; @@ -249,9 +250,15 @@ public class UiUtilities { return a << ALPHA_CHANNEL | r << RED_CHANNEL | g << GREEN_CHANNEL | b << BLUE_CHANNEL; } - public UpdateLocationViewCache getUpdateLocationViewCache(){ + public UpdateLocationViewCache getUpdateLocationViewCache() { + return getUpdateLocationViewCache(true); + } + + public UpdateLocationViewCache getUpdateLocationViewCache(boolean useScreenOrientation) { UpdateLocationViewCache uvc = new UpdateLocationViewCache(); - uvc.screenOrientation = getScreenOrientation(); + if (useScreenOrientation) { + uvc.screenOrientation = getScreenOrientation(); + } return uvc; } @@ -357,16 +364,16 @@ public class UiUtilities { public int getScreenOrientation() { int screenOrientation = ((WindowManager) app.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation(); switch (screenOrientation) { - case Surface.ROTATION_0: // Device default (normally portrait) + case ORIENTATION_0: // Device default (normally portrait) screenOrientation = 0; break; - case Surface.ROTATION_90: // Landscape right + case ORIENTATION_90: // Landscape right screenOrientation = 90; break; - case Surface.ROTATION_270: // Landscape left + case ORIENTATION_270: // Landscape left screenOrientation = 270; break; - case Surface.ROTATION_180: // Upside down + case ORIENTATION_180: // Upside down screenOrientation = 180; break; } @@ -378,7 +385,7 @@ public class UiUtilities { } return screenOrientation; } - + public static void setupSnackbar(Snackbar snackbar, boolean nightMode) { setupSnackbar(snackbar, nightMode, null, null, null, null); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index 937328e721..4182748127 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -1385,8 +1385,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo if (MapRouteInfoMenu.chooseRoutesVisible) { mapActivity.getChooseRouteFragment().dismiss(); } - updateLocationViewCache = mapActivity.getMyApplication().getUIUtilities().getUpdateLocationViewCache(); - updateLocationViewCache.setScreenOrientation(0); + updateLocationViewCache = mapActivity.getMyApplication().getUIUtilities().getUpdateLocationViewCache(false); mapActivity.getMapViewTrackingUtilities().setContextMenu(menu); mapActivity.getMapViewTrackingUtilities().setMapLinkedToLocation(false); wasDrawerDisabled = mapActivity.isDrawerDisabled(); From b2b25c31ba646c9805b97ee368da22d8ee3fd07d Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 15 Mar 2021 10:20:55 +0200 Subject: [PATCH 032/250] Minor fix --- OsmAnd/src/net/osmand/plus/UiUtilities.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/UiUtilities.java b/OsmAnd/src/net/osmand/plus/UiUtilities.java index 548b17e16d..a7c0223c22 100644 --- a/OsmAnd/src/net/osmand/plus/UiUtilities.java +++ b/OsmAnd/src/net/osmand/plus/UiUtilities.java @@ -263,10 +263,6 @@ public class UiUtilities { } public static class UpdateLocationViewCache { - public void setScreenOrientation(int screenOrientation) { - this.screenOrientation = screenOrientation; - } - int screenOrientation; public boolean paintTxt = true; public int arrowResId; From a0ce545636b9ae66fa9fed17469aa74a8e3b9b2b Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 15 Mar 2021 10:36:28 +0200 Subject: [PATCH 033/250] Review --- .../audionotes/AudioVideoNotesPlugin.java | 41 ++++++++++++------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 73d054549d..43a5179d9b 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -776,25 +776,36 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer(); if (mapInfoLayer != null) { recordControl = new TextInfoWidget(activity) { + + private Integer cachedAction; + private Boolean cachedRecording; + @Override public boolean updateInfo(DrawSettings drawSettings) { + boolean recording = isRecording(); Integer action = AV_DEFAULT_ACTION.get(); - boolean isVideoAction = action.equals(AV_DEFAULT_ACTION_VIDEO); - boolean isTakePictureAction = action.equals(AV_DEFAULT_ACTION_TAKEPICTURE); - boolean isAudioAction = action.equals(AV_DEFAULT_ACTION_AUDIO); - if (isRecording()) { - setText(app.getString(R.string.shared_string_control_stop), null); - setIcons(R.drawable.widget_icon_av_active, R.drawable.widget_icon_av_active_night); - } else { - setText(app.getString(R.string.shared_string_control_start), null); - if (isVideoAction) { - setIcons(R.drawable.widget_av_video_day, R.drawable.widget_av_video_night); - } else if (isTakePictureAction) { - setIcons(R.drawable.widget_av_photo_day, R.drawable.widget_av_photo_night); - } else if (isAudioAction) { - setIcons(R.drawable.widget_av_audio_day, R.drawable.widget_av_audio_night); + if (!Algorithms.objectEquals(recording, cachedAction) || !Algorithms.objectEquals(action, cachedRecording)) { + cachedAction = action; + cachedRecording = recording; + if (recording) { + setText(app.getString(R.string.shared_string_control_stop), null); + setIcons(R.drawable.widget_icon_av_active, R.drawable.widget_icon_av_active_night); } else { - setIcons(R.drawable.widget_icon_av_inactive_day, R.drawable.widget_icon_av_inactive_night); + setText(app.getString(R.string.shared_string_control_start), null); + switch (action) { + case AV_DEFAULT_ACTION_VIDEO: + setIcons(R.drawable.widget_av_video_day, R.drawable.widget_av_video_night); + break; + case AV_DEFAULT_ACTION_TAKEPICTURE: + setIcons(R.drawable.widget_av_photo_day, R.drawable.widget_av_photo_night); + break; + case AV_DEFAULT_ACTION_AUDIO: + setIcons(R.drawable.widget_av_audio_day, R.drawable.widget_av_audio_night); + break; + default: + setIcons(R.drawable.widget_icon_av_inactive_day, R.drawable.widget_icon_av_inactive_night); + break; + } } } return false; From f10f3dc5cf0bda53ea7c86ffbb59ccd72b587154 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 15 Mar 2021 10:42:24 +0200 Subject: [PATCH 034/250] Fix --- .../src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 43a5179d9b..f6d5f5c287 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -784,7 +784,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { public boolean updateInfo(DrawSettings drawSettings) { boolean recording = isRecording(); Integer action = AV_DEFAULT_ACTION.get(); - if (!Algorithms.objectEquals(recording, cachedAction) || !Algorithms.objectEquals(action, cachedRecording)) { + if (!Algorithms.objectEquals(recording, cachedRecording) || !Algorithms.objectEquals(action, cachedAction)) { cachedAction = action; cachedRecording = recording; if (recording) { From 175f93731960075eda29d5328d16f76511298de1 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 15 Mar 2021 10:47:31 +0200 Subject: [PATCH 035/250] Review --- .../cards/TrackEditCard.java | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java index 5f396eb71c..9c3b531d3a 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java @@ -82,28 +82,26 @@ public class TrackEditCard extends BaseCard { } GpxUiHelper.updateGpxInfoView(view, title, gpxInfo, dataItem, false, app); - if (gpxFile.getNonEmptySegmentsCount() > 1) - if (routeParams != null) - if (routeParams.getSelectedSegment() != -1) - if (gpxFile.getNonEmptySegmentsCount() > routeParams.getSelectedSegment()) { - TextView distanceView = view.findViewById(R.id.distance); - TextView timeView = view.findViewById(R.id.time); - ImageView timeIcon = view.findViewById(R.id.time_icon); - AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_icon), false); - AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_count), false); - List segments = gpxFile.getNonEmptyTrkSegments(false); - GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment()); - double distance = TrackSelectSegmentAdapter.getDistance(segment); - long time = TrackSelectSegmentAdapter.getSegmentTime(segment); - boolean timeAvailable = time != 1; - if (timeAvailable) { - timeView.setText(Algorithms.formatDuration((int) (time / 1000), - app.accessibilityEnabled())); - } - AndroidUiHelper.updateVisibility(timeView, timeAvailable); - AndroidUiHelper.updateVisibility(timeIcon, timeAvailable); - distanceView.setText(OsmAndFormatter.getFormattedDistance((float) distance, app)); + if (gpxFile.getNonEmptySegmentsCount() > 1 && routeParams != null) + if (routeParams.getSelectedSegment() != -1 && gpxFile.getNonEmptySegmentsCount() > routeParams.getSelectedSegment()) { + TextView distanceView = view.findViewById(R.id.distance); + TextView timeView = view.findViewById(R.id.time); + ImageView timeIcon = view.findViewById(R.id.time_icon); + AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_icon), false); + AndroidUiHelper.updateVisibility(view.findViewById(R.id.points_count), false); + List segments = gpxFile.getNonEmptyTrkSegments(false); + GPXUtilities.TrkSegment segment = segments.get(routeParams.getSelectedSegment()); + double distance = TrackSelectSegmentAdapter.getDistance(segment); + long time = TrackSelectSegmentAdapter.getSegmentTime(segment); + boolean timeAvailable = time != 1; + if (timeAvailable) { + timeView.setText(Algorithms.formatDuration((int) (time / 1000), + app.accessibilityEnabled())); } + AndroidUiHelper.updateVisibility(timeView, timeAvailable); + AndroidUiHelper.updateVisibility(timeIcon, timeAvailable); + distanceView.setText(OsmAndFormatter.getFormattedDistance((float) distance, app)); + } ImageButton editButton = view.findViewById(R.id.show_on_map); editButton.setVisibility(View.VISIBLE); From bf2469a05d58be737e35138ef65617ccbfbf6129 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Mon, 15 Mar 2021 10:58:40 +0200 Subject: [PATCH 036/250] Fix #9858 --- .../net/osmand/plus/views/AnimateDraggingMapThread.java | 9 +++++++++ OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java | 4 ++++ .../osmand/plus/views/layers/DownloadedRegionsLayer.java | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java b/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java index 3df649ea2b..5b9158ef1b 100644 --- a/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java +++ b/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java @@ -40,6 +40,7 @@ public class AnimateDraggingMapThread { private double targetFloatZoom = 0; private boolean isAnimatingZoom; + private boolean isAnimatingMapMove; public AnimateDraggingMapThread(OsmandMapTileView tileView) { this.tileView = tileView; @@ -158,6 +159,7 @@ public class AnimateDraggingMapThread { @Override public void run() { + isAnimatingMapMove = true; setTargetValues(zoom, zoomFP, finalLat, finalLon); boolean animateZoom = finalZoom != null && (zoom != startZoom || startZoomFP != 0); @@ -171,6 +173,7 @@ public class AnimateDraggingMapThread { } animatingMoveInThread(mMoveX, mMoveY, NAV_ANIMATION_TIME, notifyListener, null); + isAnimatingMapMove = false; } }); } @@ -217,6 +220,7 @@ public class AnimateDraggingMapThread { @Override public void run() { + isAnimatingMapMove = true; setTargetValues(endZoom, 0, finalLat, finalLon); if (moveZoom != startZoom) { @@ -243,6 +247,7 @@ public class AnimateDraggingMapThread { tileView.setFractionalZoom(endZoom, 0, notifyListener); pendingRotateAnimation(); + isAnimatingMapMove = false; } }); } @@ -373,6 +378,10 @@ public class AnimateDraggingMapThread { return isAnimatingZoom; } + public boolean isAnimatingMapMove() { + return isAnimatingMapMove; + } + public void startZooming(final int zoomEnd, final double zoomPart, final boolean notifyListener) { boolean doNotUseAnimations = tileView.getSettings().DO_NOT_USE_ANIMATIONS.get(); final float animationTime = doNotUseAnimations ? 0 : ZOOM_ANIMATION_TIME; diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index ad1a8bb190..71894cae60 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -727,6 +727,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback { return animatedDraggingThread.isAnimatingZoom(); } + public boolean isAnimatingMapMove() { + return animatedDraggingThread.isAnimatingMapMove(); + } + @SuppressLint("WrongCall") public void drawOverMap(Canvas canvas, RotatedTileBox tileBox, DrawSettings drawSettings) { if (mapRenderer == null) { diff --git a/OsmAnd/src/net/osmand/plus/views/layers/DownloadedRegionsLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/DownloadedRegionsLayer.java index cd6ba10dd4..2993a90fef 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/DownloadedRegionsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/DownloadedRegionsLayer.java @@ -253,7 +253,9 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe lastCheckMapZoom = zoom; if (app.getSettings().SHOW_DOWNLOAD_MAP_DIALOG.get() - && zoom >= ZOOM_MIN_TO_SHOW_DOWNLOAD_DIALOG && zoom <= ZOOM_MAX_TO_SHOW_DOWNLOAD_DIALOG + && zoom >= ZOOM_MIN_TO_SHOW_DOWNLOAD_DIALOG + && zoom <= ZOOM_MAX_TO_SHOW_DOWNLOAD_DIALOG + && !view.isAnimatingMapMove() && currentObjects != null) { Map selectedObjects = new LinkedHashMap<>(); From 7218e7d4b589529690a231d2995093ae285619f0 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 15 Mar 2021 11:18:02 +0200 Subject: [PATCH 037/250] Create ItineraryHelper --- .../src/net/osmand/plus/AppInitializer.java | 2 + .../net/osmand/plus/FavouritesDbHelper.java | 5 +- .../net/osmand/plus/GpxSelectionHelper.java | 6 +- .../net/osmand/plus/OsmandApplication.java | 19 ++- .../plus/itinerary/ItineraryHelper.java | 152 ++++++++++++++++++ .../editors/WptPtEditorFragment.java | 8 +- .../editors/WptPtEditorFragmentNew.java | 8 +- .../CoordinateInputDialogFragment.java | 2 +- .../mapmarkers/MapMarkersDialogFragment.java | 4 +- .../plus/mapmarkers/MapMarkersHelper.java | 135 ++-------------- ...ptCategoriesBottomSheetDialogFragment.java | 2 +- .../adapters/MapMarkersGroupsAdapter.java | 2 +- .../plus/myplaces/DeletePointsTask.java | 6 +- .../EditTrackGroupDialogFragment.java | 7 +- .../osmand/plus/views/layers/GPXLayer.java | 2 +- 15 files changed, 198 insertions(+), 162 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/itinerary/ItineraryHelper.java diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java index 819590a516..7d3afbffcd 100644 --- a/OsmAnd/src/net/osmand/plus/AppInitializer.java +++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java @@ -39,6 +39,7 @@ import net.osmand.plus.helpers.DayNightHelper; import net.osmand.plus.helpers.LockHelper; import net.osmand.plus.helpers.WaypointHelper; import net.osmand.plus.inapp.InAppPurchaseHelperImpl; +import net.osmand.plus.itinerary.ItineraryHelper; import net.osmand.plus.liveupdates.LiveUpdatesHelper; import net.osmand.plus.mapmarkers.MapMarkersDbHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper; @@ -471,6 +472,7 @@ public class AppInitializer implements IProgress { app.osmOAuthHelper = startupInit(new OsmOAuthHelper(app), OsmOAuthHelper.class); app.oprAuthHelper = startupInit(new OprAuthHelper(app), OprAuthHelper.class); app.onlineRoutingHelper = startupInit(new OnlineRoutingHelper(app), OnlineRoutingHelper.class); + app.itineraryHelper = startupInit(new ItineraryHelper(app), ItineraryHelper.class); initOpeningHoursParser(); } diff --git a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java index 9fffc074c2..151737a157 100644 --- a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java @@ -272,10 +272,9 @@ public class FavouritesDbHelper { } private void runSyncWithMarkers(FavoriteGroup favGroup) { - MapMarkersHelper helper = context.getMapMarkersHelper(); - MapMarkersGroup group = helper.getMarkersGroup(favGroup); + MapMarkersGroup group = context.getMapMarkersHelper().getMarkersGroup(favGroup); if (group != null) { - helper.runSynchronization(group); + context.getItineraryHelper().runSynchronization(group); } } diff --git a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java index 66dbb1c75e..82b101b2a1 100644 --- a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java +++ b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java @@ -31,7 +31,6 @@ import net.osmand.plus.helpers.GpxUiHelper.GPXInfo; import net.osmand.plus.helpers.SearchHistoryHelper; import net.osmand.plus.helpers.enums.MetricsConstants; import net.osmand.plus.mapmarkers.MapMarkersGroup; -import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.routing.GPXRouteParams.GPXRouteParamsBuilder; import net.osmand.plus.track.GpxSplitType; import net.osmand.util.Algorithms; @@ -823,10 +822,9 @@ public class GpxSelectionHelper { } private void syncGpxWithMarkers(GPXFile gpxFile) { - MapMarkersHelper mapMarkersHelper = app.getMapMarkersHelper(); - MapMarkersGroup group = mapMarkersHelper.getMarkersGroup(gpxFile); + MapMarkersGroup group = app.getMapMarkersHelper().getMarkersGroup(gpxFile); if (group != null) { - mapMarkersHelper.runSynchronization(group); + app.getItineraryHelper().runSynchronization(group); } } diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 8f89660c00..731960e66e 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -24,6 +24,13 @@ import android.view.View; import android.view.accessibility.AccessibilityManager; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.multidex.MultiDex; +import androidx.multidex.MultiDexApplication; + import net.osmand.AndroidUtils; import net.osmand.FileUtils; import net.osmand.IndexConstants; @@ -59,6 +66,7 @@ import net.osmand.plus.helpers.WaypointHelper; import net.osmand.plus.helpers.enums.DrivingRegion; import net.osmand.plus.helpers.enums.MetricsConstants; import net.osmand.plus.inapp.InAppPurchaseHelper; +import net.osmand.plus.itinerary.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersDbHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.measurementtool.MeasurementEditingContext; @@ -99,12 +107,6 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatDelegate; -import androidx.multidex.MultiDex; -import androidx.multidex.MultiDexApplication; import btools.routingapp.BRouterServiceConnection; import btools.routingapp.IBRouterService; @@ -166,6 +168,7 @@ public class OsmandApplication extends MultiDexApplication { OprAuthHelper oprAuthHelper; MeasurementEditingContext measurementEditingContext; OnlineRoutingHelper onlineRoutingHelper; + ItineraryHelper itineraryHelper; private Map customRoutingConfigs = new ConcurrentHashMap<>(); private File externalStorageDirectory; @@ -467,6 +470,10 @@ public class OsmandApplication extends MultiDexApplication { return onlineRoutingHelper; } + public ItineraryHelper getItineraryHelper() { + return itineraryHelper; + } + public TransportRoutingHelper getTransportRoutingHelper() { return transportRoutingHelper; } diff --git a/OsmAnd/src/net/osmand/plus/itinerary/ItineraryHelper.java b/OsmAnd/src/net/osmand/plus/itinerary/ItineraryHelper.java new file mode 100644 index 0000000000..8e3c96a08a --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/itinerary/ItineraryHelper.java @@ -0,0 +1,152 @@ +package net.osmand.plus.itinerary; + +import android.os.AsyncTask; + +import androidx.annotation.NonNull; + +import net.osmand.GPXUtilities.GPXFile; +import net.osmand.GPXUtilities.WptPt; +import net.osmand.PlatformUtil; +import net.osmand.data.FavouritePoint; +import net.osmand.data.LatLon; +import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; +import net.osmand.plus.GpxSelectionHelper; +import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.mapmarkers.MapMarker; +import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.mapmarkers.MapMarkersHelper; +import net.osmand.plus.mapmarkers.MapMarkersHelper.OnGroupSyncedListener; + +import org.apache.commons.logging.Log; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class ItineraryHelper { + + private static final Log LOG = PlatformUtil.getLog(ItineraryHelper.class); + + private OsmandApplication app; + + private MapMarkersHelper markersHelper; + + private ExecutorService executorService = Executors.newSingleThreadExecutor(); + + private Set syncListeners = new HashSet<>(); + + public ItineraryHelper(@NonNull OsmandApplication app) { + this.app = app; + markersHelper = app.getMapMarkersHelper(); + } + + public void addSyncListener(OnGroupSyncedListener listener) { + syncListeners.add(listener); + } + + public void removeSyncListener(OnGroupSyncedListener listener) { + syncListeners.remove(listener); + } + + public void runSynchronization(final @NonNull MapMarkersGroup group) { + app.runInUIThread(new Runnable() { + @Override + public void run() { + new SyncGroupTask(group).executeOnExecutor(executorService); + } + }); + } + + private class SyncGroupTask extends AsyncTask { + + private MapMarkersGroup group; + + SyncGroupTask(MapMarkersGroup group) { + this.group = group; + } + + @Override + protected void onPreExecute() { + if (!syncListeners.isEmpty()) { + app.runInUIThread(new Runnable() { + @Override + public void run() { + for (OnGroupSyncedListener listener : syncListeners) { + listener.onSyncStarted(); + } + } + }); + } + } + + @Override + protected Void doInBackground(Void... voids) { + runGroupSynchronization(); + return null; + } + + // TODO extract method from Asynctask to Helper directly + private void runGroupSynchronization() { + List groupMarkers = new ArrayList<>(group.getMarkers()); + if (group.getType() == MapMarkersGroup.FAVORITES_TYPE) { + FavoriteGroup favGroup = app.getFavorites().getGroup(group.getName()); + if (favGroup == null) { + return; + } + group.setVisible(favGroup.isVisible()); + if (!group.isVisible() || group.isDisabled()) { + markersHelper.removeGroupActiveMarkers(group, true); + return; + } + List points = new ArrayList<>(favGroup.getPoints()); + for (FavouritePoint fp : points) { + markersHelper.addNewMarkerIfNeeded(group, groupMarkers, new LatLon(fp.getLatitude(), fp.getLongitude()), fp.getName(), fp, null); + } + } else if (group.getType() == MapMarkersGroup.GPX_TYPE) { + GpxSelectionHelper gpxHelper = app.getSelectedGpxHelper(); + File file = new File(group.getId()); + if (!file.exists()) { + return; + } + + String gpxPath = group.getId(); + SelectedGpxFile selectedGpxFile = gpxHelper.getSelectedFileByPath(gpxPath); + GPXFile gpx = selectedGpxFile == null ? null : selectedGpxFile.getGpxFile(); + group.setVisible(gpx != null || group.isVisibleUntilRestart()); + if (gpx == null || group.isDisabled()) { + markersHelper.removeGroupActiveMarkers(group, true); + return; + } + + boolean addAll = group.getWptCategories() == null || group.getWptCategories().isEmpty(); + List gpxPoints = new ArrayList<>(gpx.getPoints()); + for (WptPt pt : gpxPoints) { + if (addAll || group.getWptCategories().contains(pt.category) + || (pt.category == null && group.getWptCategories().contains(""))) { + markersHelper.addNewMarkerIfNeeded(group, groupMarkers, new LatLon(pt.lat, pt.lon), pt.name, null, pt); + } + } + } + markersHelper.removeOldMarkersIfPresent(groupMarkers); + } + + @Override + protected void onPostExecute(Void aVoid) { + if (!syncListeners.isEmpty()) { + app.runInUIThread(new Runnable() { + @Override + public void run() { + for (OnGroupSyncedListener listener : syncListeners) { + listener.onSyncDone(); + } + } + }); + } + } + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java index 2d0654301b..e1c1ac3d61 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java @@ -17,8 +17,6 @@ import net.osmand.GPXUtilities.WptPt; import net.osmand.data.LatLon; import net.osmand.data.WptLocationPoint; import net.osmand.plus.GpxSelectionHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; @@ -26,6 +24,7 @@ import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.base.PointImageDrawable; import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.editors.WptPtEditor.OnDismissListener; +import net.osmand.plus.mapmarkers.MapMarkersGroup; import net.osmand.plus.track.SaveGpxAsyncTask; import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener; import net.osmand.util.Algorithms; @@ -220,10 +219,9 @@ public class WptPtEditorFragment extends PointEditorFragment { private void syncGpx(GPXFile gpxFile) { OsmandApplication app = getMyApplication(); if (app != null) { - MapMarkersHelper helper = app.getMapMarkersHelper(); - MapMarkersGroup group = helper.getMarkersGroup(gpxFile); + MapMarkersGroup group = app.getMapMarkersHelper().getMarkersGroup(gpxFile); if (group != null) { - helper.runSynchronization(group); + app.getItineraryHelper().runSynchronization(group); } } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java index ae30904896..afb86d2e5c 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java @@ -20,8 +20,6 @@ import net.osmand.data.FavouritePoint.BackgroundType; import net.osmand.data.LatLon; import net.osmand.data.WptLocationPoint; import net.osmand.plus.GpxSelectionHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; @@ -30,6 +28,7 @@ import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.base.PointImageDrawable; import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.editors.WptPtEditor.OnDismissListener; +import net.osmand.plus.mapmarkers.MapMarkersGroup; import net.osmand.plus.track.SaveGpxAsyncTask; import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener; import net.osmand.util.Algorithms; @@ -236,10 +235,9 @@ public class WptPtEditorFragmentNew extends PointEditorFragmentNew { private void syncGpx(GPXFile gpxFile) { OsmandApplication app = getMyApplication(); if (app != null) { - MapMarkersHelper helper = app.getMapMarkersHelper(); - MapMarkersGroup group = helper.getMarkersGroup(gpxFile); + MapMarkersGroup group = app.getMapMarkersHelper().getMarkersGroup(gpxFile); if (group != null) { - helper.runSynchronization(group); + app.getItineraryHelper().runSynchronization(group); } } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index 96d6f9a8f4..31e477fbf1 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -171,7 +171,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm MapMarkersHelper helper = getMyApplication().getMapMarkersHelper(); MapMarkersGroup group = helper.getMarkersGroup(gpxFile); if (group != null) { - helper.runSynchronization(group); + getMyApplication().getItineraryHelper().runSynchronization(group); } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java index f0b226dd1e..ad453d5fe5 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java @@ -218,13 +218,13 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS @Override public void onResume() { super.onResume(); - getMyApplication().getMapMarkersHelper().addSyncListener(this); + getMyApplication().getItineraryHelper().addSyncListener(this); } @Override public void onPause() { super.onPause(); - getMyApplication().getMapMarkersHelper().removeSyncListener(this); + getMyApplication().getItineraryHelper().removeSyncListener(this); } @Override diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java index 51911e8779..b8bcddbc5c 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java @@ -1,7 +1,5 @@ package net.osmand.plus.mapmarkers; -import android.os.AsyncTask; - import androidx.annotation.IntDef; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -20,7 +18,6 @@ import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.GPXDatabase; import net.osmand.plus.GeocodingLookupService; import net.osmand.plus.GeocodingLookupService.AddressLookupRequest; -import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; @@ -41,15 +38,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Date; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.TimeZone; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import static net.osmand.GPXUtilities.GPX_TIME_FORMAT; import static net.osmand.data.PointDescription.POINT_TYPE_MAP_MARKER; @@ -78,14 +72,11 @@ public class MapMarkersHelper { private OsmandApplication ctx; private MapMarkersDbHelper markersDbHelper; - private ExecutorService executorService = Executors.newSingleThreadExecutor(); - private List mapMarkers = new ArrayList<>(); private List mapMarkersHistory = new ArrayList<>(); private List mapMarkersGroups = new ArrayList<>(); private List listeners = new ArrayList<>(); - private Set syncListeners = new HashSet<>(); private MarkersPlanRouteContext planRouteContext; @@ -186,7 +177,7 @@ public class MapMarkersHelper { public void syncAllGroupsAsync() { for (MapMarkersGroup gr : mapMarkersGroups) { if (gr.getId() != null && gr.getName() != null) { - runSynchronization(gr); + ctx.getItineraryHelper().runSynchronization(gr); } } } @@ -303,15 +294,6 @@ public class MapMarkersHelper { }); } - public void runSynchronization(final @NonNull MapMarkersGroup group) { - ctx.runInUIThread(new Runnable() { - @Override - public void run() { - new SyncGroupTask(group).executeOnExecutor(executorService); - } - }); - } - public MapMarkersGroup getMarkersGroup(GPXFile gpx) { if (gpx == null || gpx.path == null) { return null; @@ -363,7 +345,7 @@ public class MapMarkersHelper { if (gr.isDisabled()) { updateGroupDisabled(gr, false); } - runSynchronization(gr); + ctx.getItineraryHelper().runSynchronization(gr); } private void addGroupInternally(MapMarkersGroup gr) { @@ -415,7 +397,7 @@ public class MapMarkersHelper { } } - private void removeGroupActiveMarkers(MapMarkersGroup group, boolean updateGroup) { + public void removeGroupActiveMarkers(MapMarkersGroup group, boolean updateGroup) { if (group != null) { markersDbHelper.removeActiveMarkersFromGroup(group.getId()); removeFromMapMarkersList(group.getActiveMarkers()); @@ -636,12 +618,12 @@ public class MapMarkersHelper { return null; } - private void addNewMarkerIfNeeded(@NonNull MapMarkersGroup group, - @NonNull List groupMarkers, - @NonNull LatLon latLon, - @NonNull String name, - @Nullable FavouritePoint favouritePoint, - @Nullable WptPt wptPt) { + public void addNewMarkerIfNeeded(@NonNull MapMarkersGroup group, + @NonNull List groupMarkers, + @NonNull LatLon latLon, + @NonNull String name, + @Nullable FavouritePoint favouritePoint, + @Nullable WptPt wptPt) { boolean exists = false; Iterator iterator = groupMarkers.iterator(); @@ -671,7 +653,7 @@ public class MapMarkersHelper { } } - private void removeOldMarkersIfPresent(List markers) { + public void removeOldMarkersIfPresent(List markers) { if (!markers.isEmpty()) { boolean needRefresh = false; for (MapMarker marker : markers) { @@ -970,14 +952,6 @@ public class MapMarkersHelper { } } - public void addSyncListener(OnGroupSyncedListener listener) { - syncListeners.add(listener); - } - - public void removeSyncListener(OnGroupSyncedListener listener) { - syncListeners.remove(listener); - } - public void addListener(MapMarkerChangedListener l) { if (!listeners.contains(l)) { listeners.add(l); @@ -1194,93 +1168,4 @@ public class MapMarkersHelper { void onSyncDone(); } - - private class SyncGroupTask extends AsyncTask { - - private MapMarkersGroup group; - - SyncGroupTask(MapMarkersGroup group) { - this.group = group; - } - - @Override - protected void onPreExecute() { - if (!syncListeners.isEmpty()) { - ctx.runInUIThread(new Runnable() { - @Override - public void run() { - for (OnGroupSyncedListener listener : syncListeners) { - listener.onSyncStarted(); - } - } - }); - } - } - - @Override - protected Void doInBackground(Void... voids) { - runGroupSynchronization(); - return null; - } - - // TODO extract method from Asynctask to Helper directly - private void runGroupSynchronization() { - List groupMarkers = new ArrayList<>(group.getMarkers()); - if (group.getType() == MapMarkersGroup.FAVORITES_TYPE) { - FavoriteGroup favGroup = ctx.getFavorites().getGroup(group.getName()); - if (favGroup == null) { - return; - } - group.setVisible(favGroup.isVisible()); - if (!group.isVisible() || group.isDisabled()) { - removeGroupActiveMarkers(group, true); - return; - } - List points = new ArrayList<>(favGroup.getPoints()); - for (FavouritePoint fp : points) { - addNewMarkerIfNeeded(group, groupMarkers, new LatLon(fp.getLatitude(), fp.getLongitude()), fp.getName(), fp, null); - } - } else if (group.getType() == MapMarkersGroup.GPX_TYPE) { - GpxSelectionHelper gpxHelper = ctx.getSelectedGpxHelper(); - File file = new File(group.getId()); - if (!file.exists()) { - return; - } - - String gpxPath = group.getId(); - SelectedGpxFile selectedGpxFile = gpxHelper.getSelectedFileByPath(gpxPath); - GPXFile gpx = selectedGpxFile == null ? null : selectedGpxFile.getGpxFile(); - group.setVisible(gpx != null || group.isVisibleUntilRestart()); - if (gpx == null || group.isDisabled()) { - removeGroupActiveMarkers(group, true); - return; - } - - boolean addAll = group.getWptCategories() == null || group.getWptCategories().isEmpty(); - List gpxPoints = new ArrayList<>(gpx.getPoints()); - for (WptPt pt : gpxPoints) { - if (addAll || group.getWptCategories().contains(pt.category) - || (pt.category == null && group.getWptCategories().contains(""))) { - addNewMarkerIfNeeded(group, groupMarkers, new LatLon(pt.lat, pt.lon), pt.name, null, pt); - } - } - } - - removeOldMarkersIfPresent(groupMarkers); - } - - @Override - protected void onPostExecute(Void aVoid) { - if (!syncListeners.isEmpty()) { - ctx.runInUIThread(new Runnable() { - @Override - public void run() { - for (OnGroupSyncedListener listener : syncListeners) { - listener.onSyncDone(); - } - } - }); - } - } - } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java index 08db4d40fc..1f86a94a1d 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java @@ -147,7 +147,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee group = mapMarkersHelper.addOrEnableGroup(gpxFile); } mapMarkersHelper.updateGroupWptCategories(group, selectedCategories); - mapMarkersHelper.runSynchronization(group); + app.getItineraryHelper().runSynchronization(group); } private boolean isAllChecked() { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java index fb74956b16..4992ee88be 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java @@ -478,7 +478,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter { } private void syncGpx(GPXFile gpxFile) { - MapMarkersHelper helper = app.getMapMarkersHelper(); - MapMarkersGroup group = helper.getMarkersGroup(gpxFile); + MapMarkersGroup group = app.getMapMarkersHelper().getMarkersGroup(gpxFile); if (group != null) { - helper.runSynchronization(group); + app.getItineraryHelper().runSynchronization(group); } } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java index 674ee76042..b3ff9b91bd 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java @@ -236,7 +236,7 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment } else { mapMarkersHelper.updateGroupWptCategories(markersGroup, selectedCategories); if (!groupCreated) { - mapMarkersHelper.runSynchronization(markersGroup); + app.getItineraryHelper().runSynchronization(markersGroup); } } } @@ -524,10 +524,9 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment } private void syncGpx(GPXFile gpxFile) { - MapMarkersHelper markersHelper = app.getMapMarkersHelper(); - MapMarkersGroup group = markersHelper.getMarkersGroup(gpxFile); + MapMarkersGroup group = app.getMapMarkersHelper().getMarkersGroup(gpxFile); if (group != null) { - markersHelper.runSynchronization(group); + app.getItineraryHelper().runSynchronization(group); } } } diff --git a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java index 339192e6b6..dfc2cbf426 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java @@ -1079,7 +1079,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM private void syncGpx(GPXFile gpxFile) { MapMarkersGroup group = view.getApplication().getMapMarkersHelper().getMarkersGroup(gpxFile); if (group != null) { - mapMarkersHelper.runSynchronization(group); + view.getApplication().getItineraryHelper().runSynchronization(group); } } } \ No newline at end of file From a40f802a7a4f4c609422eef60197e2be42065e54 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 15 Mar 2021 12:23:40 +0200 Subject: [PATCH 038/250] Move markerGroups to ItineraryHelper --- .../src/net/osmand/plus/AppInitializer.java | 2 +- .../net/osmand/plus/FavouritesDbHelper.java | 9 +- .../net/osmand/plus/GpxSelectionHelper.java | 6 +- .../EditFavoriteGroupDialogFragment.java | 6 +- .../activities/FavoritesTreeFragment.java | 2 +- .../net/osmand/plus/helpers/IntentHelper.java | 4 +- .../ItineraryGroup.java} | 12 +- .../plus/itinerary/ItineraryHelper.java | 296 ++++++++++++- .../editors/WptPtEditorFragment.java | 4 +- .../editors/WptPtEditorFragmentNew.java | 4 +- ...ouritesGroupBottomSheetDialogFragment.java | 2 +- ...dTracksGroupBottomSheetDialogFragment.java | 2 +- .../plus/mapmarkers/CategoriesSubHeader.java | 8 +- .../CoordinateInputDialogFragment.java | 10 +- .../osmand/plus/mapmarkers/GroupHeader.java | 8 +- .../net/osmand/plus/mapmarkers/MapMarker.java | 5 +- .../plus/mapmarkers/MapMarkersDbHelper.java | 13 +- .../plus/mapmarkers/MapMarkersHelper.java | 393 +++--------------- ...ptCategoriesBottomSheetDialogFragment.java | 12 +- .../adapters/MapMarkersActiveAdapter.java | 6 +- .../adapters/MapMarkersGroupsAdapter.java | 35 +- .../plus/myplaces/DeletePointsTask.java | 4 +- .../EditTrackGroupDialogFragment.java | 12 +- .../plus/myplaces/TrackPointFragment.java | 15 +- .../backup/HistoryMarkersSettingsItem.java | 8 +- .../backend/backup/MarkersSettingsItem.java | 8 +- .../backend/backup/SettingsHelper.java | 31 +- .../fragments/ExportItemsBottomSheet.java | 6 +- .../fragments/ExportSettingsAdapter.java | 6 +- .../plus/views/layers/FavouritesLayer.java | 2 +- .../osmand/plus/views/layers/GPXLayer.java | 6 +- 31 files changed, 478 insertions(+), 459 deletions(-) rename OsmAnd/src/net/osmand/plus/{mapmarkers/MapMarkersGroup.java => itinerary/ItineraryGroup.java} (91%) diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java index 7d3afbffcd..812d4bb843 100644 --- a/OsmAnd/src/net/osmand/plus/AppInitializer.java +++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java @@ -685,7 +685,7 @@ public class AppInitializer implements IProgress { // restore backuped favorites to normal file restoreBackupForFavoritesFiles(); notifyEvent(InitEvents.RESTORE_BACKUPS); - app.mapMarkersHelper.syncAllGroupsAsync(); + app.itineraryHelper.syncAllGroupsAsync(); app.searchUICore.initSearchUICore(); checkLiveUpdatesAlerts(); diff --git a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java index 151737a157..c90ecccc02 100644 --- a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java @@ -17,7 +17,7 @@ import net.osmand.data.FavouritePoint; import net.osmand.data.LatLon; import net.osmand.plus.GeocodingLookupService.AddressLookupRequest; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.api.SQLiteAPI.SQLiteConnection; import net.osmand.plus.api.SQLiteAPI.SQLiteCursor; import net.osmand.util.Algorithms; @@ -272,7 +272,7 @@ public class FavouritesDbHelper { } private void runSyncWithMarkers(FavoriteGroup favGroup) { - MapMarkersGroup group = context.getMapMarkersHelper().getMarkersGroup(favGroup); + ItineraryGroup group = context.getItineraryHelper().getMarkersGroup(favGroup); if (group != null) { context.getItineraryHelper().runSynchronization(group); } @@ -280,7 +280,7 @@ public class FavouritesDbHelper { private boolean removeFromMarkers(FavoriteGroup favGroup) { MapMarkersHelper helper = context.getMapMarkersHelper(); - MapMarkersGroup group = helper.getMarkersGroup(favGroup); + ItineraryGroup group = context.getItineraryHelper().getMarkersGroup(favGroup); if (group != null) { helper.removeMarkersGroup(group); return true; @@ -289,8 +289,7 @@ public class FavouritesDbHelper { } private void addToMarkers(FavoriteGroup favGroup) { - MapMarkersHelper helper = context.getMapMarkersHelper(); - helper.addOrEnableGroup(favGroup); + context.getItineraryHelper().addOrEnableGroup(favGroup); } private File getInternalFile() { diff --git a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java index 82b101b2a1..3c95d75e9f 100644 --- a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java +++ b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java @@ -30,7 +30,7 @@ import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType; import net.osmand.plus.helpers.GpxUiHelper.GPXInfo; import net.osmand.plus.helpers.SearchHistoryHelper; import net.osmand.plus.helpers.enums.MetricsConstants; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.routing.GPXRouteParams.GPXRouteParamsBuilder; import net.osmand.plus.track.GpxSplitType; import net.osmand.util.Algorithms; @@ -795,7 +795,7 @@ public class GpxSelectionHelper { boolean addToHistory) { GpxDataItem dataItem = app.getGpxDbHelper().getItem(new File(gpx.path)); if (canAddToMarkers && show && dataItem != null && dataItem.isShowAsMarkers()) { - app.getMapMarkersHelper().addOrEnableGroup(gpx); + app.getItineraryHelper().addOrEnableGroup(gpx); } return selectGpxFile(gpx, dataItem, show, notShowNavigationDialog, syncGroup, selectedByUser, addToHistory); } @@ -822,7 +822,7 @@ public class GpxSelectionHelper { } private void syncGpxWithMarkers(GPXFile gpxFile) { - MapMarkersGroup group = app.getMapMarkersHelper().getMarkersGroup(gpxFile); + ItineraryGroup group = app.getItineraryHelper().getMarkersGroup(gpxFile); if (group != null) { app.getItineraryHelper().runSynchronization(group); } diff --git a/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java b/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java index 001868e7b4..e625212ee7 100644 --- a/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java @@ -28,7 +28,7 @@ import net.osmand.AndroidUtils; import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; @@ -179,7 +179,7 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme final MapMarkersHelper markersHelper = app.getMapMarkersHelper(); final FavoriteGroup favGroup = this.group; - final MapMarkersGroup markersGr = markersHelper.getMarkersGroup(this.group); + final ItineraryGroup markersGr = app.getItineraryHelper().getMarkersGroup(this.group); final boolean synced = markersGr != null; BaseBottomSheetItem markersGroupItem = new SimpleBottomSheetItem.Builder() @@ -192,7 +192,7 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme if (synced) { markersHelper.removeMarkersGroup(markersGr); } else { - markersHelper.addOrEnableGroup(favGroup); + app.getItineraryHelper().addOrEnableGroup(favGroup); } dismiss(); MapActivity.launchMapActivityMoveToTop(getActivity()); diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index a24859fa30..98304247a4 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -526,7 +526,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen for (Map.Entry> entry : favoritesSelected.entrySet()) { FavoriteGroup group = helper.getGroup(entry.getKey()); if (group != null && entry.getValue().size() == group.getPoints().size()) { - markersHelper.addOrEnableGroup(group); + getMyApplication().getItineraryHelper().addOrEnableGroup(group); } else { for (FavouritePoint fp : entry.getValue()) { points.add(new LatLon(fp.getLatitude(), fp.getLongitude())); diff --git a/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java b/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java index f02b5b0961..ba48fe6899 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java @@ -19,7 +19,7 @@ import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.PluginsFragment; import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.mapsource.EditMapSourceDialogFragment; import net.osmand.plus.openplacereviews.OPRConstants; import net.osmand.plus.openplacereviews.OprAuthHelper.OprAuthorizationListener; @@ -219,7 +219,7 @@ public class IntentHelper { if (intent.hasExtra(MapMarkersDialogFragment.OPEN_MAP_MARKERS_GROUPS)) { Bundle openMapMarkersGroupsExtra = intent.getBundleExtra(MapMarkersDialogFragment.OPEN_MAP_MARKERS_GROUPS); if (openMapMarkersGroupsExtra != null) { - MapMarkersDialogFragment.showInstance(mapActivity, openMapMarkersGroupsExtra.getString(MapMarkersGroup.MARKERS_SYNC_GROUP_ID)); + MapMarkersDialogFragment.showInstance(mapActivity, openMapMarkersGroupsExtra.getString(ItineraryGroup.MARKERS_SYNC_GROUP_ID)); } mapActivity.setIntent(null); } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroup.java b/OsmAnd/src/net/osmand/plus/itinerary/ItineraryGroup.java similarity index 91% rename from OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroup.java rename to OsmAnd/src/net/osmand/plus/itinerary/ItineraryGroup.java index 2a97af91c8..595315a028 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroup.java +++ b/OsmAnd/src/net/osmand/plus/itinerary/ItineraryGroup.java @@ -1,8 +1,12 @@ -package net.osmand.plus.mapmarkers; +package net.osmand.plus.itinerary; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import net.osmand.plus.mapmarkers.CategoriesSubHeader; +import net.osmand.plus.mapmarkers.GroupHeader; +import net.osmand.plus.mapmarkers.MapMarker; +import net.osmand.plus.mapmarkers.ShowHideHistoryButton; import net.osmand.plus.wikivoyage.data.TravelArticle; import net.osmand.util.Algorithms; @@ -10,7 +14,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; -public class MapMarkersGroup { +public class ItineraryGroup { public static final int ANY_TYPE = -1; public static final int FAVORITES_TYPE = 0; @@ -34,11 +38,11 @@ public class MapMarkersGroup { private CategoriesSubHeader categoriesSubHeader; private ShowHideHistoryButton showHideHistoryButton; - public MapMarkersGroup() { + public ItineraryGroup() { } - public MapMarkersGroup(@NonNull String id, @NonNull String name, int type) { + public ItineraryGroup(@NonNull String id, @NonNull String name, int type) { this.id = id; this.name = name; this.type = type; diff --git a/OsmAnd/src/net/osmand/plus/itinerary/ItineraryHelper.java b/OsmAnd/src/net/osmand/plus/itinerary/ItineraryHelper.java index 8e3c96a08a..f89d05c1f9 100644 --- a/OsmAnd/src/net/osmand/plus/itinerary/ItineraryHelper.java +++ b/OsmAnd/src/net/osmand/plus/itinerary/ItineraryHelper.java @@ -3,31 +3,44 @@ package net.osmand.plus.itinerary; import android.os.AsyncTask; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.WptPt; +import net.osmand.IndexConstants; import net.osmand.PlatformUtil; import net.osmand.data.FavouritePoint; import net.osmand.data.LatLon; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; +import net.osmand.plus.GPXDatabase; import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.OsmandApplication; import net.osmand.plus.mapmarkers.MapMarker; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.mapmarkers.MapMarkersDbHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper.OnGroupSyncedListener; +import net.osmand.plus.wikivoyage.data.TravelArticle; +import net.osmand.plus.wikivoyage.data.TravelHelper; +import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; import java.io.File; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.HashSet; +import java.util.Iterator; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import static net.osmand.plus.mapmarkers.MapMarkersHelper.BY_DATE_ADDED_DESC; + public class ItineraryHelper { private static final Log LOG = PlatformUtil.getLog(ItineraryHelper.class); @@ -35,14 +48,150 @@ public class ItineraryHelper { private OsmandApplication app; private MapMarkersHelper markersHelper; + private MapMarkersDbHelper markersDbHelper; private ExecutorService executorService = Executors.newSingleThreadExecutor(); + private List itineraryGroups = new ArrayList<>(); private Set syncListeners = new HashSet<>(); public ItineraryHelper(@NonNull OsmandApplication app) { this.app = app; markersHelper = app.getMapMarkersHelper(); + markersDbHelper = app.getMapMarkersDbHelper(); + loadGroups(); + } + + public List getItineraryGroups() { + return itineraryGroups; + } + + public void syncAllGroupsAsync() { + for (ItineraryGroup group : itineraryGroups) { + if (group.getId() != null && group.getName() != null) { + runSynchronization(group); + } + } + } + + public void updateGroupWptCategories(@NonNull ItineraryGroup group, Set wptCategories) { + String id = group.getId(); + if (id != null) { + group.setWptCategories(wptCategories); + if (wptCategories != null) { + markersDbHelper.updateGroupCategories(id, group.getWptCategoriesString()); + } + } + } + + public void enableGroup(@NonNull ItineraryGroup gr) { + // check if group doesn't exist internally + if (!itineraryGroups.contains(gr)) { + addGroupInternally(gr); + } + if (gr.isDisabled()) { + updateGroupDisabled(gr, false); + } + runSynchronization(gr); + } + + public void updateGroups() { + for (ItineraryGroup group : itineraryGroups) { + markersHelper.updateGroup(group); + } + } + + public void updateGroupDisabled(@NonNull ItineraryGroup group, boolean disabled) { + String id = group.getId(); + if (id != null) { + markersDbHelper.updateGroupDisabled(id, disabled); + group.setDisabled(disabled); + } + } + + public List getMapMarkersFromDefaultGroups(boolean history) { + List mapMarkers = new ArrayList<>(); + for (ItineraryGroup group : itineraryGroups) { + if (group.getType() == ItineraryGroup.ANY_TYPE) { + for (MapMarker marker : group.getMarkers()) { + if (history && marker.history || !history && !marker.history) { + mapMarkers.add(marker); + } + } + } + } + return mapMarkers; + } + + private void loadGroups() { + Map groupsMap = markersDbHelper.getAllGroupsMap(); + List allMarkers = new ArrayList<>(markersHelper.getMapMarkers()); + allMarkers.addAll(markersHelper.getMapMarkersHistory()); + + Iterator> iterator = groupsMap.entrySet().iterator(); + while (iterator.hasNext()) { + ItineraryGroup group = iterator.next().getValue(); + if (group.getType() == ItineraryGroup.GPX_TYPE && !new File(group.getId()).exists()) { + markersDbHelper.removeMarkersGroup(group.getId()); + iterator.remove(); + } + } + + ItineraryGroup noGroup = null; + + for (MapMarker marker : allMarkers) { + ItineraryGroup group = groupsMap.get(marker.groupKey); + if (group == null) { + if (noGroup == null) { + noGroup = new ItineraryGroup(); + noGroup.setCreationDate(Long.MAX_VALUE); + } + noGroup.getMarkers().add(marker); + } else { + if (marker.creationDate < group.getCreationDate()) { + group.setCreationDate(marker.creationDate); + } + group.getMarkers().add(marker); + } + } + + itineraryGroups = new ArrayList<>(groupsMap.values()); + if (noGroup != null) { + markersHelper.sortMarkers(noGroup.getMarkers(), false, BY_DATE_ADDED_DESC); + addToGroupsList(noGroup); + } + + sortGroups(); + + for (ItineraryGroup group : itineraryGroups) { + markersHelper.updateGroup(group); + } + } + + public void addGroupInternally(ItineraryGroup gr) { + markersDbHelper.addGroup(gr); + markersHelper.addHistoryMarkersToGroup(gr); + addToGroupsList(gr); + } + + public void updateGpxShowAsMarkers(File file) { + GPXDatabase.GpxDataItem dataItem = app.getGpxDbHelper().getItem(file); + if (dataItem != null) { + app.getGpxDbHelper().updateShowAsMarkers(dataItem, true); + dataItem.setShowAsMarkers(true); + } + } + + public void addToGroupsList(ItineraryGroup group) { + List copyList = new ArrayList<>(itineraryGroups); + copyList.add(group); + itineraryGroups = copyList; + } + + public void removeFromGroupsList(ItineraryGroup group) { + List copyList = new ArrayList<>(itineraryGroups); + copyList.remove(group); + itineraryGroups = copyList; } public void addSyncListener(OnGroupSyncedListener listener) { @@ -53,7 +202,7 @@ public class ItineraryHelper { syncListeners.remove(listener); } - public void runSynchronization(final @NonNull MapMarkersGroup group) { + public void runSynchronization(final @NonNull ItineraryGroup group) { app.runInUIThread(new Runnable() { @Override public void run() { @@ -62,11 +211,146 @@ public class ItineraryHelper { }); } + public ItineraryGroup getMarkersGroup(GPXFile gpx) { + if (gpx == null || gpx.path == null) { + return null; + } + return getMapMarkerGroupById(getMarkerGroupId(new File(gpx.path)), ItineraryGroup.GPX_TYPE); + } + + public ItineraryGroup getMarkersGroup(FavoriteGroup favGroup) { + return getMapMarkerGroupById(getMarkerGroupId(favGroup), ItineraryGroup.FAVORITES_TYPE); + } + + public ItineraryGroup addOrEnableGpxGroup(@NonNull File file) { + updateGpxShowAsMarkers(file); + ItineraryGroup gr = getMapMarkerGroupById(getMarkerGroupId(file), ItineraryGroup.GPX_TYPE); + if (gr == null) { + gr = createGPXMarkerGroup(file); + addGroupInternally(gr); + } + enableGroup(gr); + return gr; + } + + public ItineraryGroup addOrEnableGroup(@NonNull GPXFile file) { + updateGpxShowAsMarkers(new File(file.path)); + ItineraryGroup gr = getMarkersGroup(file); + if (gr == null) { + gr = createGPXMarkerGroup(new File(file.path)); + addGroupInternally(gr); + } + enableGroup(gr); + return gr; + } + + public ItineraryGroup addOrEnableGroup(@NonNull FavoriteGroup group) { + ItineraryGroup gr = getMarkersGroup(group); + if (gr == null) { + gr = createFavMarkerGroup(group); + addGroupInternally(gr); + } + enableGroup(gr); + return gr; + } + + private ItineraryGroup createGPXMarkerGroup(File fl) { + return new ItineraryGroup(getMarkerGroupId(fl), + Algorithms.getFileNameWithoutExtension(fl.getName()), + ItineraryGroup.GPX_TYPE); + } + + private ItineraryGroup createFavMarkerGroup(FavoriteGroup favGroup) { + return new ItineraryGroup(favGroup.getName(), favGroup.getName(), ItineraryGroup.FAVORITES_TYPE); + } + + private String getMarkerGroupId(File gpx) { + return gpx.getAbsolutePath(); + } + + private String getMarkerGroupId(FavoriteGroup group) { + return group.getName(); + } + + + public void removeMarkerFromGroup(MapMarker marker) { + if (marker != null) { + ItineraryGroup itineraryGroup = getMapMarkerGroupById(marker.groupKey, marker.getType()); + if (itineraryGroup != null) { + itineraryGroup.getMarkers().remove(marker); + markersHelper.updateGroup(itineraryGroup); + } + } + } + + public void sortGroups() { + if (itineraryGroups.size() > 0) { + Collections.sort(itineraryGroups, new Comparator() { + @Override + public int compare(ItineraryGroup group1, ItineraryGroup group2) { + long t1 = group1.getCreationDate(); + long t2 = group2.getCreationDate(); + return (t1 > t2) ? -1 : ((t1 == t2) ? 0 : 1); + } + }); + } + } + + @Nullable + public ItineraryGroup getMapMarkerGroupById(String id, int type) { + for (ItineraryGroup group : itineraryGroups) { + if ((id == null && group.getId() == null) + || (group.getId() != null && group.getId().equals(id))) { + if (type == ItineraryGroup.ANY_TYPE || type == group.getType()) { + return group; + } + } + } + return null; + } + + @NonNull + public List getGroupsForDisplayedGpx() { + List res = new ArrayList<>(); + List selectedGpxFiles = app.getSelectedGpxHelper().getSelectedGPXFiles(); + for (SelectedGpxFile selected : selectedGpxFiles) { + ItineraryGroup search = getMarkersGroup(selected.getGpxFile()); + if (search == null && selected.getGpxFile() != null && selected.getGpxFile().path != null) { + ItineraryGroup group = createGPXMarkerGroup(new File(selected.getGpxFile().path)); + group.setDisabled(true); + markersHelper.createHeadersInGroup(group); + res.add(group); + } + } + return res; + } + + @NonNull + public List getGroupsForSavedArticlesTravelBook() { + List res = new ArrayList<>(); + TravelHelper travelHelper = app.getTravelHelper(); + if (travelHelper.isAnyTravelBookPresent()) { + List savedArticles = travelHelper.getBookmarksHelper().getSavedArticles(); + for (TravelArticle art : savedArticles) { + String gpxName = travelHelper.getGPXName(art); + File path = app.getAppPath(IndexConstants.GPX_TRAVEL_DIR + gpxName); + ItineraryGroup search = getMapMarkerGroupById(getMarkerGroupId(path), ItineraryGroup.GPX_TYPE); + if (search == null) { + ItineraryGroup group = createGPXMarkerGroup(path); + group.setDisabled(true); + markersHelper.createHeadersInGroup(group); + res.add(group); + } + } + } + return res; + } + private class SyncGroupTask extends AsyncTask { - private MapMarkersGroup group; + private ItineraryGroup group; - SyncGroupTask(MapMarkersGroup group) { + SyncGroupTask(ItineraryGroup group) { this.group = group; } @@ -93,7 +377,7 @@ public class ItineraryHelper { // TODO extract method from Asynctask to Helper directly private void runGroupSynchronization() { List groupMarkers = new ArrayList<>(group.getMarkers()); - if (group.getType() == MapMarkersGroup.FAVORITES_TYPE) { + if (group.getType() == ItineraryGroup.FAVORITES_TYPE) { FavoriteGroup favGroup = app.getFavorites().getGroup(group.getName()); if (favGroup == null) { return; @@ -107,7 +391,7 @@ public class ItineraryHelper { for (FavouritePoint fp : points) { markersHelper.addNewMarkerIfNeeded(group, groupMarkers, new LatLon(fp.getLatitude(), fp.getLongitude()), fp.getName(), fp, null); } - } else if (group.getType() == MapMarkersGroup.GPX_TYPE) { + } else if (group.getType() == ItineraryGroup.GPX_TYPE) { GpxSelectionHelper gpxHelper = app.getSelectedGpxHelper(); File file = new File(group.getId()); if (!file.exists()) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java index e1c1ac3d61..713b13a177 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java @@ -24,7 +24,7 @@ import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.base.PointImageDrawable; import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.editors.WptPtEditor.OnDismissListener; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.track.SaveGpxAsyncTask; import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener; import net.osmand.util.Algorithms; @@ -219,7 +219,7 @@ public class WptPtEditorFragment extends PointEditorFragment { private void syncGpx(GPXFile gpxFile) { OsmandApplication app = getMyApplication(); if (app != null) { - MapMarkersGroup group = app.getMapMarkersHelper().getMarkersGroup(gpxFile); + ItineraryGroup group = app.getItineraryHelper().getMarkersGroup(gpxFile); if (group != null) { app.getItineraryHelper().runSynchronization(group); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java index afb86d2e5c..0e583392ba 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java @@ -28,7 +28,7 @@ import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.base.PointImageDrawable; import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.editors.WptPtEditor.OnDismissListener; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.track.SaveGpxAsyncTask; import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener; import net.osmand.util.Algorithms; @@ -235,7 +235,7 @@ public class WptPtEditorFragmentNew extends PointEditorFragmentNew { private void syncGpx(GPXFile gpxFile) { OsmandApplication app = getMyApplication(); if (app != null) { - MapMarkersGroup group = app.getMapMarkersHelper().getMarkersGroup(gpxFile); + ItineraryGroup group = app.getItineraryHelper().getMarkersGroup(gpxFile); if (group != null) { app.getItineraryHelper().runSynchronization(group); } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/AddFavouritesGroupBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/AddFavouritesGroupBottomSheetDialogFragment.java index 0e6b31f4f4..52f85bf0e7 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/AddFavouritesGroupBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/AddFavouritesGroupBottomSheetDialogFragment.java @@ -56,7 +56,7 @@ public class AddFavouritesGroupBottomSheetDialogFragment extends AddGroupBottomS if (!group.isVisible()) { favouritesDbHelper.editFavouriteGroup(group, group.getName(), group.getColor(), true); } - getMyApplication().getMapMarkersHelper().addOrEnableGroup(group); + getMyApplication().getItineraryHelper().addOrEnableGroup(group); dismiss(); } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java index b01548be00..32dfd58172 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java @@ -108,7 +108,7 @@ public class AddTracksGroupBottomSheetDialogFragment extends AddGroupBottomSheet GPXFile res = GPXUtilities.loadGPXFile(gpx); selectionHelper.selectGpxFile(res, true, false, false, false, false); } - app.getMapMarkersHelper().addOrEnableGpxGroup(gpx); + app.getItineraryHelper().addOrEnableGpxGroup(gpx); } } dismiss(); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CategoriesSubHeader.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CategoriesSubHeader.java index aef2f28afd..52ea71617b 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CategoriesSubHeader.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CategoriesSubHeader.java @@ -2,13 +2,15 @@ package net.osmand.plus.mapmarkers; import androidx.annotation.DrawableRes; +import net.osmand.plus.itinerary.ItineraryGroup; + public class CategoriesSubHeader { @DrawableRes private int iconRes; - private MapMarkersGroup group; + private ItineraryGroup group; - public CategoriesSubHeader(int iconRes, MapMarkersGroup group) { + public CategoriesSubHeader(int iconRes, ItineraryGroup group) { this.iconRes = iconRes; this.group = group; } @@ -18,7 +20,7 @@ public class CategoriesSubHeader { return iconRes; } - public MapMarkersGroup getGroup() { + public ItineraryGroup getGroup() { return group; } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index 31e477fbf1..138109f126 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -71,6 +71,8 @@ import net.osmand.plus.Version; import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.activities.TrackActivity; import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.itinerary.ItineraryGroup; +import net.osmand.plus.itinerary.ItineraryHelper; import net.osmand.plus.mapmarkers.CoordinateInputBottomSheetDialogFragment.CoordinateInputFormatChangeListener; import net.osmand.plus.mapmarkers.CoordinateInputFormats.DDM; import net.osmand.plus.mapmarkers.CoordinateInputFormats.DMS; @@ -168,10 +170,10 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm } private void syncGpx(GPXFile gpxFile) { - MapMarkersHelper helper = getMyApplication().getMapMarkersHelper(); - MapMarkersGroup group = helper.getMarkersGroup(gpxFile); + ItineraryHelper helper = getMyApplication().getItineraryHelper(); + ItineraryGroup group = helper.getMarkersGroup(gpxFile); if (group != null) { - getMyApplication().getItineraryHelper().runSynchronization(group); + helper.runSynchronization(group); } } @@ -1089,7 +1091,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm public void saveGpx(final String fileName) { new SaveGpxAsyncTask(app, getGpx(),fileName, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); hasUnsavedChanges = false; - app.getMapMarkersHelper().addOrEnableGroup(getGpx()); + app.getItineraryHelper().addOrEnableGroup(getGpx()); if (listener != null) { listener.onPointsSaved(); } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/GroupHeader.java b/OsmAnd/src/net/osmand/plus/mapmarkers/GroupHeader.java index c5c97a1c2e..c760b08dee 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/GroupHeader.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/GroupHeader.java @@ -2,13 +2,15 @@ package net.osmand.plus.mapmarkers; import androidx.annotation.DrawableRes; +import net.osmand.plus.itinerary.ItineraryGroup; + public class GroupHeader { @DrawableRes private int iconRes; - private MapMarkersGroup group; + private ItineraryGroup group; - public GroupHeader(int iconRes, MapMarkersGroup group) { + public GroupHeader(int iconRes, ItineraryGroup group) { this.iconRes = iconRes; this.group = group; } @@ -18,7 +20,7 @@ public class GroupHeader { return iconRes; } - public MapMarkersGroup getGroup() { + public ItineraryGroup getGroup() { return group; } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java index 498c36f93c..e1f2c413f1 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java @@ -11,6 +11,7 @@ import net.osmand.data.LatLon; import net.osmand.data.LocationPoint; import net.osmand.data.PointDescription; import net.osmand.plus.R; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.util.Algorithms; import static net.osmand.data.PointDescription.POINT_TYPE_MAP_MARKER; @@ -46,8 +47,8 @@ public class MapMarker implements LocationPoint { public int getType() { return favouritePoint == null ? - (wptPt == null ? MapMarkersGroup.ANY_TYPE : MapMarkersGroup.GPX_TYPE) : - MapMarkersGroup.FAVORITES_TYPE; + (wptPt == null ? ItineraryGroup.ANY_TYPE : ItineraryGroup.GPX_TYPE) : + ItineraryGroup.FAVORITES_TYPE; } public PointDescription getPointDescription(Context ctx) { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java index 0b2ba5ab0c..4fe3debbb5 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java @@ -8,6 +8,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.api.SQLiteAPI.SQLiteConnection; import net.osmand.plus.api.SQLiteAPI.SQLiteCursor; import net.osmand.plus.helpers.SearchHistoryHelper; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.util.Algorithms; import java.util.ArrayList; @@ -161,7 +162,7 @@ public class MapMarkersDbHelper { } } - public void addGroup(MapMarkersGroup group) { + public void addGroup(ItineraryGroup group) { SQLiteConnection db = openConnection(false); if (db != null) { try { @@ -173,15 +174,15 @@ public class MapMarkersDbHelper { } } - public Map getAllGroupsMap() { - Map res = new LinkedHashMap<>(); + public Map getAllGroupsMap() { + Map res = new LinkedHashMap<>(); SQLiteConnection db = openConnection(true); if (db != null) { try { SQLiteCursor query = db.rawQuery(GROUPS_TABLE_SELECT, null); if (query != null && query.moveToFirst()) { do { - MapMarkersGroup group = readGroup(query); + ItineraryGroup group = readGroup(query); res.put(group.getId(), group); } while (query.moveToNext()); } @@ -195,14 +196,14 @@ public class MapMarkersDbHelper { return res; } - private MapMarkersGroup readGroup(SQLiteCursor query) { + private ItineraryGroup readGroup(SQLiteCursor query) { String id = query.getString(0); String name = query.getString(1); int type = query.getInt(2); boolean disabled = query.getInt(3) == 1; String categories = query.getString(4); - MapMarkersGroup res = new MapMarkersGroup(id, name, type); + ItineraryGroup res = new ItineraryGroup(id, name, type); res.setDisabled(disabled); res.setWptCategories(categories == null ? null : Algorithms.decodeStringSet(categories)); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java index b8bcddbc5c..1f2233b7c0 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java @@ -14,16 +14,12 @@ import net.osmand.PlatformUtil; import net.osmand.data.FavouritePoint; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; -import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; -import net.osmand.plus.GPXDatabase; import net.osmand.plus.GeocodingLookupService; import net.osmand.plus.GeocodingLookupService.AddressLookupRequest; -import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.Version; -import net.osmand.plus.wikivoyage.data.TravelArticle; -import net.osmand.plus.wikivoyage.data.TravelHelper; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; @@ -41,8 +37,6 @@ import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Locale; -import java.util.Map; -import java.util.Set; import java.util.TimeZone; import static net.osmand.GPXUtilities.GPX_TIME_FORMAT; @@ -69,12 +63,11 @@ public class MapMarkersHelper { public @interface MapMarkersSortByDef { } - private OsmandApplication ctx; + private OsmandApplication app; private MapMarkersDbHelper markersDbHelper; private List mapMarkers = new ArrayList<>(); private List mapMarkersHistory = new ArrayList<>(); - private List mapMarkersGroups = new ArrayList<>(); private List listeners = new ArrayList<>(); @@ -88,29 +81,24 @@ public class MapMarkersHelper { return mapMarkersHistory; } - public List getMapMarkersGroups() { - return mapMarkersGroups; - } - public boolean isStartFromMyLocation() { - return ctx.getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.get(); + return app.getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.get(); } public void setStartFromMyLocation(boolean startFromMyLocation) { - ctx.getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.set(startFromMyLocation); + app.getSettings().ROUTE_MAP_MARKERS_START_MY_LOC.set(startFromMyLocation); } public MarkersPlanRouteContext getPlanRouteContext() { return planRouteContext; } - public MapMarkersHelper(OsmandApplication ctx) { - this.ctx = ctx; - markersDbHelper = ctx.getMapMarkersDbHelper(); - planRouteContext = new MarkersPlanRouteContext(ctx); + public MapMarkersHelper(OsmandApplication app) { + this.app = app; + markersDbHelper = app.getMapMarkersDbHelper(); + planRouteContext = new MarkersPlanRouteContext(app); markersDbHelper.removeDisabledGroups(); loadMarkers(); - loadGroups(); } private void loadMarkers() { @@ -124,63 +112,11 @@ public class MapMarkersHelper { sortMarkers(markersHistory, true, BY_DATE_ADDED_DESC); addToMapMarkersHistoryList(markersHistory); - if (!ctx.isApplicationInitializing()) { + if (!app.isApplicationInitializing()) { lookupAddressAll(); } } - private void loadGroups() { - Map groupsMap = markersDbHelper.getAllGroupsMap(); - List allMarkers = new ArrayList<>(mapMarkers); - allMarkers.addAll(mapMarkersHistory); - - Iterator> iterator = groupsMap.entrySet().iterator(); - while (iterator.hasNext()) { - MapMarkersGroup group = iterator.next().getValue(); - if (group.getType() == MapMarkersGroup.GPX_TYPE && !new File(group.getId()).exists()) { - markersDbHelper.removeMarkersGroup(group.getId()); - iterator.remove(); - } - } - - MapMarkersGroup noGroup = null; - - for (MapMarker marker : allMarkers) { - MapMarkersGroup group = groupsMap.get(marker.groupKey); - if (group == null) { - if (noGroup == null) { - noGroup = new MapMarkersGroup(); - noGroup.setCreationDate(Long.MAX_VALUE); - } - noGroup.getMarkers().add(marker); - } else { - if (marker.creationDate < group.getCreationDate()) { - group.setCreationDate(marker.creationDate); - } - group.getMarkers().add(marker); - } - } - - mapMarkersGroups = new ArrayList<>(groupsMap.values()); - if (noGroup != null) { - sortMarkers(noGroup.getMarkers(), false, BY_DATE_ADDED_DESC); - addToGroupsList(noGroup); - } - - sortGroups(); - - for (MapMarkersGroup group : mapMarkersGroups) { - updateGroup(group); - } - } - - public void syncAllGroupsAsync() { - for (MapMarkersGroup gr : mapMarkersGroups) { - if (gr.getId() != null && gr.getName() != null) { - ctx.getItineraryHelper().runSynchronization(gr); - } - } - } public void lookupAddressAll() { for (MapMarker mapMarker : mapMarkers) { @@ -192,7 +128,7 @@ public class MapMarkersHelper { } private void lookupAddress(final MapMarker mapMarker) { - if (mapMarker != null && mapMarker.getOriginalPointDescription().isSearchingAddress(ctx)) { + if (mapMarker != null && mapMarker.getOriginalPointDescription().isSearchingAddress(app)) { cancelPointAddressRequests(mapMarker.point); AddressLookupRequest lookupRequest = new AddressLookupRequest(mapMarker.point, new GeocodingLookupService.OnAddressLookupResult() { @@ -200,7 +136,7 @@ public class MapMarkersHelper { public void geocodingDone(String address) { PointDescription pointDescription = mapMarker.getOriginalPointDescription(); if (Algorithms.isEmpty(address)) { - pointDescription.setName(PointDescription.getAddressNotFoundStr(ctx)); + pointDescription.setName(PointDescription.getAddressNotFoundStr(app)); } else { pointDescription.setName(address); } @@ -208,7 +144,7 @@ public class MapMarkersHelper { refreshMarker(mapMarker); } }, null); - ctx.getGeocodingLookupService().lookupAddress(lookupRequest); + app.getGeocodingLookupService().lookupAddress(lookupRequest); } } @@ -225,7 +161,7 @@ public class MapMarkersHelper { private void cancelPointAddressRequests(LatLon latLon) { if (latLon != null) { - ctx.getGeocodingLookupService().cancel(latLon); + app.getGeocodingLookupService().cancel(latLon); } } @@ -254,7 +190,7 @@ public class MapMarkersHelper { reorderActiveMarkersIfNeeded(); } - private void sortMarkers(List markers, final boolean visited, final @MapMarkersSortByDef int sortByMode) { + public void sortMarkers(List markers, final boolean visited, final @MapMarkersSortByDef int sortByMode) { sortMarkers(markers, visited, sortByMode, null); } @@ -286,83 +222,15 @@ public class MapMarkersHelper { return sortByMode == BY_DISTANCE_DESC ? 1 : -1; } } else { - String n1 = mapMarker1.getName(ctx); - String n2 = mapMarker2.getName(ctx); + String n1 = mapMarker1.getName(app); + String n2 = mapMarker2.getName(app); return n1.compareToIgnoreCase(n2); } } }); } - public MapMarkersGroup getMarkersGroup(GPXFile gpx) { - if (gpx == null || gpx.path == null) { - return null; - } - return getMapMarkerGroupById(getMarkerGroupId(new File(gpx.path)), MapMarkersGroup.GPX_TYPE); - } - - public MapMarkersGroup getMarkersGroup(FavoriteGroup favGroup) { - return getMapMarkerGroupById(getMarkerGroupId(favGroup), MapMarkersGroup.FAVORITES_TYPE); - } - - public MapMarkersGroup addOrEnableGpxGroup(@NonNull File file) { - updateGpxShowAsMarkers(file); - MapMarkersGroup gr = getMapMarkerGroupById(getMarkerGroupId(file), MapMarkersGroup.GPX_TYPE); - if (gr == null) { - gr = createGPXMarkerGroup(file); - addGroupInternally(gr); - } - enableGroup(gr); - return gr; - } - - public MapMarkersGroup addOrEnableGroup(@NonNull GPXFile file) { - updateGpxShowAsMarkers(new File(file.path)); - MapMarkersGroup gr = getMarkersGroup(file); - if (gr == null) { - gr = createGPXMarkerGroup(new File(file.path)); - addGroupInternally(gr); - } - enableGroup(gr); - return gr; - } - - public MapMarkersGroup addOrEnableGroup(@NonNull FavoriteGroup group) { - MapMarkersGroup gr = getMarkersGroup(group); - if (gr == null) { - gr = createFavMarkerGroup(group); - addGroupInternally(gr); - } - enableGroup(gr); - return gr; - } - - public void enableGroup(@NonNull MapMarkersGroup gr) { - // check if group doesn't exist internally - if (!mapMarkersGroups.contains(gr)) { - addGroupInternally(gr); - } - if (gr.isDisabled()) { - updateGroupDisabled(gr, false); - } - ctx.getItineraryHelper().runSynchronization(gr); - } - - private void addGroupInternally(MapMarkersGroup gr) { - markersDbHelper.addGroup(gr); - addHistoryMarkersToGroup(gr); - addToGroupsList(gr); - } - - private void updateGpxShowAsMarkers(File file) { - GPXDatabase.GpxDataItem dataItem = ctx.getGpxDbHelper().getItem(file); - if (dataItem != null) { - ctx.getGpxDbHelper().updateShowAsMarkers(dataItem, true); - dataItem.setShowAsMarkers(true); - } - } - - private void addHistoryMarkersToGroup(@NonNull MapMarkersGroup group) { + public void addHistoryMarkersToGroup(@NonNull ItineraryGroup group) { List historyMarkers = new ArrayList<>(mapMarkersHistory); for (MapMarker m : historyMarkers) { if (m.groupKey != null && group.getId() != null && m.groupKey.equals(group.getId())) { @@ -371,33 +239,15 @@ public class MapMarkersHelper { } } - public void removeMarkersGroup(MapMarkersGroup group) { + public void removeMarkersGroup(ItineraryGroup group) { if (group != null) { markersDbHelper.removeMarkersGroup(group.getId()); removeGroupActiveMarkers(group, false); - removeFromGroupsList(group); + app.getItineraryHelper().removeFromGroupsList(group); } } - public void updateGroupDisabled(@NonNull MapMarkersGroup group, boolean disabled) { - String id = group.getId(); - if (id != null) { - markersDbHelper.updateGroupDisabled(id, disabled); - group.setDisabled(disabled); - } - } - - public void updateGroupWptCategories(@NonNull MapMarkersGroup group, Set wptCategories) { - String id = group.getId(); - if (id != null) { - group.setWptCategories(wptCategories); - if (wptCategories != null) { - markersDbHelper.updateGroupCategories(id, group.getWptCategoriesString()); - } - } - } - - public void removeGroupActiveMarkers(MapMarkersGroup group, boolean updateGroup) { + public void removeGroupActiveMarkers(ItineraryGroup group, boolean updateGroup) { if (group != null) { markersDbHelper.removeActiveMarkersFromGroup(group.getId()); removeFromMapMarkersList(group.getActiveMarkers()); @@ -410,27 +260,21 @@ public class MapMarkersHelper { } } - public void updateGroups() { - for (MapMarkersGroup group : mapMarkersGroups) { - updateGroup(group); - } - } - - public void updateGroup(MapMarkersGroup mapMarkersGroup) { - if (mapMarkersGroup.getId() == null || mapMarkersGroup.getName() == null) { + public void updateGroup(ItineraryGroup itineraryGroup) { + if (itineraryGroup.getId() == null || itineraryGroup.getName() == null) { return; } - createHeadersInGroup(mapMarkersGroup); - int historyMarkersCount = mapMarkersGroup.getHistoryMarkers().size(); - ShowHideHistoryButton showHideHistoryButton = mapMarkersGroup.getShowHideHistoryButton(); + createHeadersInGroup(itineraryGroup); + int historyMarkersCount = itineraryGroup.getHistoryMarkers().size(); + ShowHideHistoryButton showHideHistoryButton = itineraryGroup.getShowHideHistoryButton(); if (showHideHistoryButton != null) { if (historyMarkersCount == 0) { - mapMarkersGroup.setShowHideHistoryButton(null); + itineraryGroup.setShowHideHistoryButton(null); } } else if (historyMarkersCount > 0) { showHideHistoryButton = new ShowHideHistoryButton(); showHideHistoryButton.showHistory = false; - mapMarkersGroup.setShowHideHistoryButton(showHideHistoryButton); + itineraryGroup.setShowHideHistoryButton(showHideHistoryButton); } } @@ -442,30 +286,30 @@ public class MapMarkersHelper { private void addMarkerToGroup(MapMarker marker) { if (marker != null) { - MapMarkersGroup mapMarkersGroup = getMapMarkerGroupById(marker.groupKey, marker.getType()); - if (mapMarkersGroup != null) { - mapMarkersGroup.getMarkers().add(marker); - updateGroup(mapMarkersGroup); - if (mapMarkersGroup.getName() == null) { - sortMarkers(mapMarkersGroup.getMarkers(), false, BY_DATE_ADDED_DESC); + ItineraryGroup itineraryGroup = app.getItineraryHelper().getMapMarkerGroupById(marker.groupKey, marker.getType()); + if (itineraryGroup != null) { + itineraryGroup.getMarkers().add(marker); + updateGroup(itineraryGroup); + if (itineraryGroup.getName() == null) { + sortMarkers(itineraryGroup.getMarkers(), false, BY_DATE_ADDED_DESC); } } else { - mapMarkersGroup = new MapMarkersGroup(marker.groupKey, marker.groupName, MapMarkersGroup.ANY_TYPE); - mapMarkersGroup.setCreationDate(Long.MAX_VALUE); - mapMarkersGroup.getMarkers().add(marker); - addToGroupsList(mapMarkersGroup); - sortGroups(); - updateGroup(mapMarkersGroup); + itineraryGroup = new ItineraryGroup(marker.groupKey, marker.groupName, ItineraryGroup.ANY_TYPE); + itineraryGroup.setCreationDate(Long.MAX_VALUE); + itineraryGroup.getMarkers().add(marker); + app.getItineraryHelper().addToGroupsList(itineraryGroup); + app.getItineraryHelper().sortGroups(); + updateGroup(itineraryGroup); } } } - private void createHeadersInGroup(@NonNull MapMarkersGroup group) { + public void createHeadersInGroup(@NonNull ItineraryGroup group) { int type = group.getType(); int headerIconId = 0; int subHeaderIconId = 0; if (type != -1) { - headerIconId = type == MapMarkersGroup.FAVORITES_TYPE + headerIconId = type == ItineraryGroup.FAVORITES_TYPE ? R.drawable.ic_action_favorite : R.drawable.ic_action_polygom_dark; subHeaderIconId = R.drawable.ic_action_filter; } @@ -476,97 +320,6 @@ public class MapMarkersHelper { group.setCategoriesSubHeader(categoriesSubHeader); } - private void removeMarkerFromGroup(MapMarker marker) { - if (marker != null) { - MapMarkersGroup mapMarkersGroup = getMapMarkerGroupById(marker.groupKey, marker.getType()); - if (mapMarkersGroup != null) { - mapMarkersGroup.getMarkers().remove(marker); - updateGroup(mapMarkersGroup); - } - } - } - - private void sortGroups() { - if (mapMarkersGroups.size() > 0) { - Collections.sort(mapMarkersGroups, new Comparator() { - @Override - public int compare(MapMarkersGroup group1, MapMarkersGroup group2) { - long t1 = group1.getCreationDate(); - long t2 = group2.getCreationDate(); - return (t1 > t2) ? -1 : ((t1 == t2) ? 0 : 1); - } - }); - } - } - - @Nullable - public MapMarkersGroup getMapMarkerGroupById(String id, int type) { - for (MapMarkersGroup group : mapMarkersGroups) { - if ((id == null && group.getId() == null) - || (group.getId() != null && group.getId().equals(id))) { - if (type == MapMarkersGroup.ANY_TYPE || type == group.getType()) { - return group; - } - } - } - return null; - } - - private MapMarkersGroup createGPXMarkerGroup(File fl) { - return new MapMarkersGroup(getMarkerGroupId(fl), - Algorithms.getFileNameWithoutExtension(fl.getName()), - MapMarkersGroup.GPX_TYPE); - } - - private MapMarkersGroup createFavMarkerGroup(FavoriteGroup favGroup) { - return new MapMarkersGroup(favGroup.getName(), favGroup.getName(), MapMarkersGroup.FAVORITES_TYPE); - } - - private String getMarkerGroupId(File gpx) { - return gpx.getAbsolutePath(); - } - - private String getMarkerGroupId(FavoriteGroup group) { - return group.getName(); - } - - @NonNull - public List getGroupsForDisplayedGpx() { - List res = new ArrayList<>(); - List selectedGpxFiles = ctx.getSelectedGpxHelper().getSelectedGPXFiles(); - for (SelectedGpxFile selected : selectedGpxFiles) { - MapMarkersGroup search = getMarkersGroup(selected.getGpxFile()); - if (search == null && selected.getGpxFile() != null && selected.getGpxFile().path != null) { - MapMarkersGroup group = createGPXMarkerGroup(new File(selected.getGpxFile().path)); - group.setDisabled(true); - createHeadersInGroup(group); - res.add(group); - } - } - return res; - } - - @NonNull - public List getGroupsForSavedArticlesTravelBook() { - List res = new ArrayList<>(); - TravelHelper travelHelper = ctx.getTravelHelper(); - if (travelHelper.isAnyTravelBookPresent()) { - List savedArticles = travelHelper.getBookmarksHelper().getSavedArticles(); - for (TravelArticle art : savedArticles) { - String gpxName = travelHelper.getGPXName(art); - File path = ctx.getAppPath(IndexConstants.GPX_TRAVEL_DIR + gpxName); - MapMarkersGroup search = getMapMarkerGroupById(getMarkerGroupId(path), MapMarkersGroup.GPX_TYPE); - if (search == null) { - MapMarkersGroup group = createGPXMarkerGroup(path); - group.setDisabled(true); - createHeadersInGroup(group); - res.add(group); - } - } - } - return res; - } - @Nullable public MapMarker getMapMarker(WptPt wptPt) { for (MapMarker marker : getMarkers()) { @@ -599,7 +352,7 @@ public class MapMarkersHelper { private List getMarkers() { List res = new ArrayList<>(mapMarkers); - if (ctx.getSettings().KEEP_PASSED_MARKERS_ON_MAP.get()) { + if (app.getSettings().KEEP_PASSED_MARKERS_ON_MAP.get()) { res.addAll(mapMarkersHistory); } return res; @@ -618,7 +371,7 @@ public class MapMarkersHelper { return null; } - public void addNewMarkerIfNeeded(@NonNull MapMarkersGroup group, + public void addNewMarkerIfNeeded(@NonNull ItineraryGroup group, @NonNull List groupMarkers, @NonNull LatLon latLon, @NonNull String name, @@ -720,7 +473,7 @@ public class MapMarkersHelper { addToMapMarkersList(markers); reorderActiveMarkersIfNeeded(); sortMarkers(mapMarkersHistory, true, BY_DATE_ADDED_DESC); - updateGroups(); + app.getItineraryHelper().updateGroups(); refresh(); } } @@ -737,7 +490,7 @@ public class MapMarkersHelper { } else { removeFromMapMarkersList(marker); } - removeMarkerFromGroup(marker); + app.getItineraryHelper().removeMarkerFromGroup(marker); if (refresh) { refresh(); } @@ -834,7 +587,7 @@ public class MapMarkersHelper { addToMapMarkersHistoryList(mapMarkers); mapMarkers = new ArrayList<>(); sortMarkers(mapMarkersHistory, true, BY_DATE_ADDED_DESC); - updateGroups(); + app.getItineraryHelper().updateGroups(); refresh(); } @@ -855,18 +608,18 @@ public class MapMarkersHelper { public void addMapMarkers(@NonNull List points, @NonNull List historyNames, - @Nullable MapMarkersGroup group) { + @Nullable ItineraryGroup group) { addMarkers(points, historyNames, group, null, null, null); } private void addMarkers(@NonNull List points, @NonNull List historyNames, - @Nullable MapMarkersGroup group, + @Nullable ItineraryGroup group, @Nullable List favouritePoints, @Nullable List wptPts, @Nullable List mapObjNames) { if (points.size() > 0) { - ctx.getSettings().SHOW_MAP_MARKERS.set(true); + app.getSettings().SHOW_MAP_MARKERS.set(true); int colorIndex = -1; List addedMarkers = new ArrayList<>(); for (int i = 0; i < points.size(); i++) { @@ -882,7 +635,7 @@ public class MapMarkersHelper { pointDescription = historyName; } if (pointDescription.isLocation() && Algorithms.isEmpty(pointDescription.getName())) { - pointDescription.setName(PointDescription.getSearchAddressStr(ctx)); + pointDescription.setName(PointDescription.getSearchAddressStr(app)); } if (colorIndex == -1) { if (mapMarkers.size() > 0) { @@ -896,7 +649,7 @@ public class MapMarkersHelper { MapMarker marker = new MapMarker(point, pointDescription, colorIndex, false, 0); if (group != null) { - marker.id = group.getId() + marker.getName(ctx) + MapUtils.createShortLinkString(marker.point.getLatitude(), marker.point.getLongitude(), 15); + marker.id = group.getId() + marker.getName(app) + MapUtils.createShortLinkString(marker.point.getLatitude(), marker.point.getLongitude(), 15); if (markersDbHelper.getMarker(marker.id) != null) { continue; } @@ -963,7 +716,7 @@ public class MapMarkersHelper { } private void refreshMarker(final MapMarker marker) { - ctx.runInUIThread(new Runnable() { + app.runInUIThread(new Runnable() { @Override public void run() { for (MapMarkerChangedListener l : listeners) { @@ -974,7 +727,7 @@ public class MapMarkersHelper { } private void refresh() { - ctx.runInUIThread(new Runnable() { + app.runInUIThread(new Runnable() { @Override public void run() { for (MapMarkerChangedListener l : listeners) { @@ -984,28 +737,14 @@ public class MapMarkersHelper { }); } - public List getMapMarkersFromDefaultGroups(boolean history) { - List mapMarkers = new ArrayList<>(); - for (MapMarkersGroup group : mapMarkersGroups) { - if (group.getType() == MapMarkersGroup.ANY_TYPE) { - for (MapMarker marker : group.getMarkers()) { - if (history && marker.history || !history && !marker.history) { - mapMarkers.add(marker); - } - } - } - } - return mapMarkers; - } - public String saveMarkersToFile(String fileName) { GPXFile gpxFile = generateGpx(); String dirName = IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR; - File dir = ctx.getAppPath(dirName); + File dir = app.getAppPath(dirName); if (!dir.exists()) { dir.mkdirs(); } - String uniqueFileName = FileUtils.createUniqueFileName(ctx, fileName, dirName, IndexConstants.GPX_FILE_EXT); + String uniqueFileName = FileUtils.createUniqueFileName(app, fileName, dirName, IndexConstants.GPX_FILE_EXT); File fout = new File(dir, uniqueFileName + IndexConstants.GPX_FILE_EXT); GPXUtilities.writeGpxFile(fout, gpxFile); @@ -1020,13 +759,13 @@ public class MapMarkersHelper { SimpleDateFormat format = new SimpleDateFormat(GPX_TIME_FORMAT, Locale.US); format.setTimeZone(TimeZone.getTimeZone("UTC")); - GPXFile gpxFile = new GPXFile(Version.getFullVersion(ctx)); + GPXFile gpxFile = new GPXFile(Version.getFullVersion(app)); for (MapMarker marker : markers) { WptPt wpt = new WptPt(); wpt.lat = marker.getLatitude(); wpt.lon = marker.getLongitude(); wpt.name = marker.getOnlyName(); - wpt.setColor(ContextCompat.getColor(ctx, MapMarker.getColorId(marker.colorIndex))); + wpt.setColor(ContextCompat.getColor(app, MapMarker.getColorId(marker.colorIndex))); if (completeBackup) { if (marker.creationDate != 0) { wpt.getExtensionsToWrite().put(CREATION_DATE, format.format(new Date(marker.creationDate))); @@ -1047,7 +786,7 @@ public class MapMarkersHelper { List mapMarkers = new ArrayList<>(); for (WptPt point : gpxFile.getPoints()) { LatLon latLon = new LatLon(point.lat, point.lon); - int colorIndex = MapMarker.getColorIndex(ctx, point.getColor()); + int colorIndex = MapMarker.getColorIndex(app, point.getColor()); PointDescription name = new PointDescription(PointDescription.POINT_TYPE_LOCATION, point.name); MapMarker marker = new MapMarker(latLon, name, colorIndex, false, 0); @@ -1138,22 +877,6 @@ public class MapMarkersHelper { mapMarkersHistory = copyList; } - // accessors to markers groups: - - private void addToGroupsList(MapMarkersGroup group) { - List copyList = new ArrayList<>(mapMarkersGroups); - copyList.add(group); - mapMarkersGroups = copyList; - } - - private void removeFromGroupsList(MapMarkersGroup group) { - List copyList = new ArrayList<>(mapMarkersGroups); - copyList.remove(group); - mapMarkersGroups = copyList; - } - - // --------------------------------------------------------------------------------------------- - // classes and interfaces: public interface MapMarkerChangedListener { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java index 1f86a94a1d..2cabb6f804 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java @@ -20,6 +20,8 @@ import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton; import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.ShortDescriptionItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem; +import net.osmand.plus.itinerary.ItineraryGroup; +import net.osmand.plus.itinerary.ItineraryHelper; import java.io.File; import java.util.ArrayList; @@ -136,18 +138,18 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee private void updateAddOrEnableGroupWptCategories() { OsmandApplication app = getMyApplication(); GpxSelectionHelper gpxSelectionHelper = app.getSelectedGpxHelper(); - MapMarkersHelper mapMarkersHelper = app.getMapMarkersHelper(); + ItineraryHelper helper = app.getItineraryHelper(); SelectedGpxFile selectedGpxFile = gpxSelectionHelper.getSelectedFileByPath(gpxFile.path); if (selectedGpxFile == null) { gpxSelectionHelper.selectGpxFile(gpxFile, true, false, false, false, false); } - MapMarkersGroup group = mapMarkersHelper.getMarkersGroup(gpxFile); + ItineraryGroup group = helper.getMarkersGroup(gpxFile); if (group == null) { - group = mapMarkersHelper.addOrEnableGroup(gpxFile); + group = helper.addOrEnableGroup(gpxFile); } - mapMarkersHelper.updateGroupWptCategories(group, selectedCategories); - app.getItineraryHelper().runSynchronization(group); + helper.updateGroupWptCategories(group, selectedCategories); + helper.runSynchronization(group); } private boolean isAllChecked() { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java index 2fa206d08f..4dfe175720 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java @@ -14,7 +14,7 @@ import com.google.android.material.snackbar.Snackbar; import net.osmand.data.LatLon; import net.osmand.plus.mapmarkers.MapMarker; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; @@ -214,8 +214,8 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter(); - MapMarkersHelper helper = app.getMapMarkersHelper(); + ItineraryHelper helper = app.getItineraryHelper(); helper.updateGroups(); - List groups = new ArrayList<>(helper.getMapMarkersGroups()); + List groups = new ArrayList<>(helper.getItineraryGroups()); groups.addAll(helper.getGroupsForDisplayedGpx()); groups.addAll(helper.getGroupsForSavedArticlesTravelBook()); for (int i = 0; i < groups.size(); i++) { - MapMarkersGroup group = groups.get(i); + ItineraryGroup group = groups.get(i); if (!group.isVisible()) { continue; } @@ -176,7 +177,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter categories = group.getWptCategories(); if (categories != null && !categories.isEmpty()) { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/DeletePointsTask.java b/OsmAnd/src/net/osmand/plus/myplaces/DeletePointsTask.java index c9d9d4c423..c7179f1091 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/DeletePointsTask.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/DeletePointsTask.java @@ -8,7 +8,7 @@ import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType; import net.osmand.plus.OsmandApplication; import net.osmand.plus.activities.SavingTrackHelper; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import java.io.File; import java.lang.ref.WeakReference; @@ -64,7 +64,7 @@ public class DeletePointsTask extends AsyncTask { } private void syncGpx(GPXFile gpxFile) { - MapMarkersGroup group = app.getMapMarkersHelper().getMarkersGroup(gpxFile); + ItineraryGroup group = app.getItineraryHelper().getMarkersGroup(gpxFile); if (group != null) { app.getItineraryHelper().runSynchronization(group); } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java index b3ff9b91bd..352e7ecc3b 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java @@ -49,7 +49,7 @@ import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem; import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.measurementtool.OptionsDividerItem; import net.osmand.plus.myplaces.DeletePointsTask.OnPointsDeleteListener; @@ -192,7 +192,7 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment } private BaseBottomSheetItem createCopyToMarkersItem(final GPXFile gpxFile) { - MapMarkersGroup markersGroup = mapMarkersHelper.getMarkersGroup(gpxFile); + ItineraryGroup markersGroup = app.getItineraryHelper().getMarkersGroup(gpxFile); final boolean synced = markersGroup != null && (Algorithms.isEmpty(markersGroup.getWptCategories()) || markersGroup.getWptCategories().contains(group.getName())); @@ -216,10 +216,10 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment selectedGpxHelper.selectGpxFile(gpxFile, true, false, false, false, false); } boolean groupCreated = false; - MapMarkersGroup markersGroup = mapMarkersHelper.getMarkersGroup(gpxFile); + ItineraryGroup markersGroup = app.getItineraryHelper().getMarkersGroup(gpxFile); if (markersGroup == null) { groupCreated = true; - markersGroup = mapMarkersHelper.addOrEnableGroup(gpxFile); + markersGroup = app.getItineraryHelper().addOrEnableGroup(gpxFile); } Set categories = markersGroup.getWptCategories(); Set selectedCategories = new HashSet<>(); @@ -234,7 +234,7 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment if (Algorithms.isEmpty(selectedCategories)) { mapMarkersHelper.removeMarkersGroup(markersGroup); } else { - mapMarkersHelper.updateGroupWptCategories(markersGroup, selectedCategories); + app.getItineraryHelper().updateGroupWptCategories(markersGroup, selectedCategories); if (!groupCreated) { app.getItineraryHelper().runSynchronization(markersGroup); } @@ -524,7 +524,7 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment } private void syncGpx(GPXFile gpxFile) { - MapMarkersGroup group = app.getMapMarkersHelper().getMarkersGroup(gpxFile); + ItineraryGroup group = app.getItineraryHelper().getMarkersGroup(gpxFile); if (group != null) { app.getItineraryHelper().runSynchronization(group); } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java index 59be8cc533..2641fe986f 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java @@ -63,7 +63,7 @@ import net.osmand.plus.base.OsmandExpandableListFragment; import net.osmand.plus.base.PointImageDrawable; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.mapmarkers.CoordinateInputDialogFragment; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.myplaces.DeletePointsTask.OnPointsDeleteListener; import net.osmand.plus.myplaces.TrackBitmapDrawer.TrackBitmapDrawerListener; @@ -399,8 +399,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItem.SHOW_AS_ACTION_NEVER, true); GPXFile gpxFile = getGpx(); if (gpxFile != null && gpxFile.path != null) { - final MapMarkersHelper markersHelper = app.getMapMarkersHelper(); - final boolean synced = markersHelper.getMarkersGroup(getGpx()) != null; + final boolean synced = app.getItineraryHelper().getMarkersGroup(getGpx()) != null; createMenuItem(menu, SELECT_MAP_MARKERS_ID, synced ? R.string.remove_from_map_markers : R.string.shared_string_add_to_map_markers, R.drawable.ic_action_flag, MenuItem.SHOW_AS_ACTION_NEVER); } @@ -501,15 +500,15 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements return; } final GPXFile gpxFile = getGpx(); - MapMarkersGroup markersSearch = markersHelper.getMarkersGroup(gpxFile); - final MapMarkersGroup markersGr; + ItineraryGroup markersSearch = app.getItineraryHelper().getMarkersGroup(gpxFile); + final ItineraryGroup markersGr; final boolean markersRemoved; if (markersSearch != null) { markersGr = markersSearch; markersHelper.removeMarkersGroup(markersGr); markersRemoved = true; } else if (gpxFile != null) { - markersGr = markersHelper.addOrEnableGroup(gpxFile); + markersGr = app.getItineraryHelper().addOrEnableGroup(gpxFile); markersRemoved = false; } else { markersRemoved = false; @@ -535,10 +534,10 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements if (trackActivity != null) { if (markersRemoved) { if (gpxFile != null) { - markersHelper.addOrEnableGroup(gpxFile); + app.getItineraryHelper().addOrEnableGroup(gpxFile); } } else { - MapMarkersGroup group = markersHelper.getMarkersGroup(gpxFile); + ItineraryGroup group = app.getItineraryHelper().getMarkersGroup(gpxFile); if (group != null) { markersHelper.removeMarkersGroup(group); } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java index ba0c3d7dc0..9cbb536177 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java @@ -12,7 +12,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarkersDbHelper; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.settings.backend.ExportSettingsType; import net.osmand.util.Algorithms; @@ -46,7 +46,7 @@ public class HistoryMarkersSettingsItem extends CollectionSettingsItem(markersHelper.getMapMarkersFromDefaultGroups(true)); + existingItems = new ArrayList<>(app.getItineraryHelper().getMapMarkersFromDefaultGroups(true)); } @NonNull @@ -122,10 +122,10 @@ public class HistoryMarkersSettingsItem extends CollectionSettingsItem { protected void init() { super.init(); markersHelper = app.getMapMarkersHelper(); - existingItems = new ArrayList<>(markersHelper.getMapMarkersFromDefaultGroups(false)); + existingItems = new ArrayList<>(app.getItineraryHelper().getMapMarkersFromDefaultGroups(false)); } @NonNull @@ -122,10 +122,10 @@ public class MarkersSettingsItem extends CollectionSettingsItem { } } - public MapMarkersGroup getMarkersGroup() { + public ItineraryGroup getMarkersGroup() { String name = app.getString(R.string.map_markers); String groupId = ExportSettingsType.ACTIVE_MARKERS.name(); - MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, MapMarkersGroup.ANY_TYPE); + ItineraryGroup markersGroup = new ItineraryGroup(groupId, name, ItineraryGroup.ANY_TYPE); markersGroup.setMarkers(items); return markersGroup; } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java index 4204fded0b..0e3b9612cc 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java @@ -30,11 +30,10 @@ import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo; import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.helpers.GpxUiHelper.GPXInfo; -import net.osmand.plus.helpers.LocaleHelper; import net.osmand.plus.helpers.SearchHistoryHelper; import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry; import net.osmand.plus.mapmarkers.MapMarker; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.onlinerouting.engine.OnlineRoutingEngine; import net.osmand.plus.osmedit.OpenstreetmapPoint; import net.osmand.plus.osmedit.OsmEditingPlugin; @@ -606,19 +605,19 @@ public class SettingsHelper { myPlacesItems.put(ExportSettingsType.MULTIMEDIA_NOTES, files); } } - List mapMarkers = app.getMapMarkersHelper().getMapMarkersFromDefaultGroups(false); + List mapMarkers = app.getItineraryHelper().getMapMarkersFromDefaultGroups(false); if (!mapMarkers.isEmpty()) { String name = app.getString(R.string.map_markers); String groupId = ExportSettingsType.ACTIVE_MARKERS.name(); - MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, MapMarkersGroup.ANY_TYPE); + ItineraryGroup markersGroup = new ItineraryGroup(groupId, name, ItineraryGroup.ANY_TYPE); markersGroup.setMarkers(mapMarkers); myPlacesItems.put(ExportSettingsType.ACTIVE_MARKERS, Collections.singletonList(markersGroup)); } - List markersHistory = app.getMapMarkersHelper().getMapMarkersFromDefaultGroups(true); + List markersHistory = app.getItineraryHelper().getMapMarkersFromDefaultGroups(true); if (!markersHistory.isEmpty()) { String name = app.getString(R.string.shared_string_history); String groupId = ExportSettingsType.HISTORY_MARKERS.name(); - MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, MapMarkersGroup.ANY_TYPE); + ItineraryGroup markersGroup = new ItineraryGroup(groupId, name, ItineraryGroup.ANY_TYPE); markersGroup.setMarkers(markersHistory); myPlacesItems.put(ExportSettingsType.HISTORY_MARKERS, Collections.singletonList(markersGroup)); } @@ -721,8 +720,8 @@ public class SettingsHelper { List favoriteGroups = new ArrayList<>(); List osmNotesPointList = new ArrayList<>(); List osmEditsPointList = new ArrayList<>(); - List markersGroups = new ArrayList<>(); - List markersHistoryGroups = new ArrayList<>(); + List markersGroups = new ArrayList<>(); + List markersHistoryGroups = new ArrayList<>(); List historyEntries = new ArrayList<>(); List onlineRoutingEngines = new ArrayList<>(); @@ -756,12 +755,12 @@ public class SettingsHelper { osmEditsPointList.add((OpenstreetmapPoint) object); } else if (object instanceof FavoriteGroup) { favoriteGroups.add((FavoriteGroup) object); - } else if (object instanceof MapMarkersGroup) { - MapMarkersGroup markersGroup = (MapMarkersGroup) object; + } else if (object instanceof ItineraryGroup) { + ItineraryGroup markersGroup = (ItineraryGroup) object; if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) { - markersGroups.add((MapMarkersGroup) object); + markersGroups.add((ItineraryGroup) object); } else if (ExportSettingsType.HISTORY_MARKERS.name().equals(markersGroup.getId())) { - markersHistoryGroups.add((MapMarkersGroup) object); + markersHistoryGroups.add((ItineraryGroup) object); } } else if (object instanceof HistoryEntry) { historyEntries.add((HistoryEntry) object); @@ -813,7 +812,7 @@ public class SettingsHelper { } if (!markersGroups.isEmpty()) { List mapMarkers = new ArrayList<>(); - for (MapMarkersGroup group : markersGroups) { + for (ItineraryGroup group : markersGroups) { mapMarkers.addAll(group.getMarkers()); } MarkersSettingsItem baseItem = getBaseItem(SettingsItemType.ACTIVE_MARKERS, MarkersSettingsItem.class, settingsItems); @@ -821,7 +820,7 @@ public class SettingsHelper { } if (!markersHistoryGroups.isEmpty()) { List mapMarkers = new ArrayList<>(); - for (MapMarkersGroup group : markersHistoryGroups) { + for (ItineraryGroup group : markersHistoryGroups) { mapMarkers.addAll(group.getMarkers()); } HistoryMarkersSettingsItem baseItem = getBaseItem(SettingsItemType.HISTORY_MARKERS, HistoryMarkersSettingsItem.class, settingsItems); @@ -911,8 +910,8 @@ public class SettingsHelper { List notesPointList = new ArrayList<>(); List editsPointList = new ArrayList<>(); List favoriteGroups = new ArrayList<>(); - List markersGroups = new ArrayList<>(); - List markersHistoryGroups = new ArrayList<>(); + List markersGroups = new ArrayList<>(); + List markersHistoryGroups = new ArrayList<>(); List historyEntries = new ArrayList<>(); List onlineRoutingEngines = new ArrayList<>(); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java index 59c7327975..5bfed7996f 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java @@ -32,7 +32,7 @@ import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo; import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.onlinerouting.engine.OnlineRoutingEngine; import net.osmand.plus.osmedit.OpenstreetmapPoint; import net.osmand.plus.osmedit.OsmEditingPlugin; @@ -355,8 +355,8 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment { GlobalSettingsItem globalSettingsItem = (GlobalSettingsItem) object; builder.setTitle(globalSettingsItem.getPublicName(app)); builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_settings, activeColorRes)); - } else if (object instanceof MapMarkersGroup) { - MapMarkersGroup markersGroup = (MapMarkersGroup) object; + } else if (object instanceof ItineraryGroup) { + ItineraryGroup markersGroup = (ItineraryGroup) object; if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) { builder.setTitle(getString(R.string.map_markers)); builder.setIcon(uiUtilities.getIcon(R.drawable.ic_action_flag, activeColorRes)); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportSettingsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportSettingsAdapter.java index 94816dbc1c..634d317b05 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportSettingsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportSettingsAdapter.java @@ -18,7 +18,7 @@ import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.OsmandBaseExpandableListAdapter; import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.settings.backend.ExportSettingsCategory; import net.osmand.plus.settings.backend.ExportSettingsType; import net.osmand.plus.settings.backend.backup.FileSettingsItem; @@ -318,8 +318,8 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter { itemsSize += ((FileSettingsItem) object).getSize(); } else if (object instanceof File) { itemsSize += ((File) object).length(); - } else if (object instanceof MapMarkersGroup) { - int selectedMarkers = ((MapMarkersGroup) object).getMarkers().size(); + } else if (object instanceof ItineraryGroup) { + int selectedMarkers = ((ItineraryGroup) object).getMarkers().size(); String itemsDescr = app.getString(R.string.shared_string_items); return app.getString(R.string.ltr_or_rtl_combine_via_colon, itemsDescr, selectedMarkers); } diff --git a/OsmAnd/src/net/osmand/plus/views/layers/FavouritesLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/FavouritesLayer.java index d011e1dc8b..c2c00bcfe5 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/FavouritesLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/FavouritesLayer.java @@ -106,7 +106,7 @@ public class FavouritesLayer extends OsmandMapLayer implements IContextMenuProvi List smallObjectsLatLon = new ArrayList<>(); for (FavoriteGroup group : favouritesDbHelper.getFavoriteGroups()) { List> fullObjects = new ArrayList<>(); - boolean synced = mapMarkersHelper.getMarkersGroup(group) != null; + boolean synced = view.getApplication().getItineraryHelper().getMarkersGroup(group) != null; for (FavouritePoint favoritePoint : group.getPoints()) { double lat = favoritePoint.getLatitude(); double lon = favoritePoint.getLongitude(); diff --git a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java index dfc2cbf426..b2a79dafb7 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java @@ -47,7 +47,7 @@ import net.osmand.plus.base.PointImageDrawable; import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint; import net.osmand.plus.mapcontextmenu.other.TrackChartPoints; import net.osmand.plus.mapmarkers.MapMarker; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.plus.itinerary.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersHelper; import net.osmand.plus.render.OsmandRenderer; import net.osmand.plus.render.OsmandRenderer.RenderingContext; @@ -512,7 +512,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM for (SelectedGpxFile g : selectedGPXFiles) { List> fullObjects = new ArrayList<>(); int fileColor = getFileColor(g); - boolean synced = mapMarkersHelper.getMarkersGroup(g.getGpxFile()) != null; + boolean synced = view.getApplication().getItineraryHelper().getMarkersGroup(g.getGpxFile()) != null; for (WptPt wpt : getListStarPoints(g)) { if (wpt.lat >= latLonBounds.bottom && wpt.lat <= latLonBounds.top && wpt.lon >= latLonBounds.left && wpt.lon <= latLonBounds.right @@ -1077,7 +1077,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM } private void syncGpx(GPXFile gpxFile) { - MapMarkersGroup group = view.getApplication().getMapMarkersHelper().getMarkersGroup(gpxFile); + ItineraryGroup group = view.getApplication().getItineraryHelper().getMarkersGroup(gpxFile); if (group != null) { view.getApplication().getItineraryHelper().runSynchronization(group); } From 1b75863569c0b19db8d6a76788b4828c55d6307d Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 15 Mar 2021 16:15:25 +0200 Subject: [PATCH 039/250] many fixes --- .../res/layout/osm_live_banner_list_item.xml | 134 +++++++++--------- .../plus/activities/LocalIndexInfo.java | 2 +- .../download/ui/UpdatesIndexFragment.java | 72 ++-------- .../LiveUpdatesClearDialogFragment.java | 2 +- .../plus/liveupdates/LiveUpdatesFragment.java | 44 ++---- .../liveupdates/LiveUpdatesFragmentNew.java | 91 ++++++------ .../LiveUpdatesSettingsDialogFragment.java | 2 +- .../LiveUpdatesSettingsDialogFragmentNew.java | 104 +++++++------- .../plus/liveupdates/LoadLiveMapsTask.java | 22 +-- .../BooleanPreferenceBottomSheet.java | 4 - 10 files changed, 189 insertions(+), 288 deletions(-) diff --git a/OsmAnd/res/layout/osm_live_banner_list_item.xml b/OsmAnd/res/layout/osm_live_banner_list_item.xml index b9f103ddd7..05d83d8da1 100644 --- a/OsmAnd/res/layout/osm_live_banner_list_item.xml +++ b/OsmAnd/res/layout/osm_live_banner_list_item.xml @@ -5,7 +5,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/list_background_color" - android:orientation="vertical" + android:minHeight="@dimen/list_item_height" + android:orientation="horizontal" android:paddingStart="@dimen/list_content_padding" android:paddingLeft="@dimen/list_content_padding" android:paddingTop="@dimen/content_padding" @@ -13,90 +14,83 @@ android:paddingRight="@dimen/list_content_padding" android:paddingBottom="@dimen/content_padding"> - + android:layout_marginEnd="@dimen/favorites_icon_right_margin" + android:layout_marginRight="@dimen/favorites_icon_right_margin" + osmand:srcCompat="@drawable/ic_action_subscription_osmand_live" /> - + + + android:text="@string/osm_live" + android:textColor="?android:textColorPrimary" + android:textSize="@dimen/default_list_text_size" /> - + android:letterSpacing="@dimen/description_letter_spacing" + android:maxLines="25" + android:text="@string/osm_live_banner_desc" + android:textColor="?android:textColorSecondary" + android:textSize="@dimen/default_desc_text_size" /> - + - - - + android:background="?attr/selectableItemBackground" + android:gravity="center_vertical" + android:minHeight="@dimen/dialog_button_height" + android:orientation="horizontal" + android:paddingStart="@dimen/content_padding_small" + android:paddingLeft="@dimen/content_padding_small" + android:paddingEnd="@dimen/content_padding_half" + android:paddingRight="@dimen/content_padding_half"> - + android:layout_weight="1" + android:letterSpacing="@dimen/description_letter_spacing" + android:text="@string/get_it" + android:textColor="?attr/colorPrimary" + android:textSize="@dimen/default_desc_text_size" /> - + - + - - - - - + diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java index 853a714d85..4b9c8fa3ac 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java @@ -174,6 +174,6 @@ public class LocalIndexInfo implements Comparable { @Override public int compareTo(LocalIndexInfo o) { - return getName().compareTo(o.getName()); + return getFileName().compareTo(o.getFileName()); } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java index 486c503842..d9e76c22bc 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java @@ -42,7 +42,6 @@ import net.osmand.plus.liveupdates.LiveUpdatesClearDialogFragment.RefreshLiveUpd import net.osmand.plus.liveupdates.LiveUpdatesFragmentNew; import net.osmand.plus.liveupdates.LoadLiveMapsTask; import net.osmand.plus.liveupdates.LoadLiveMapsTask.LocalIndexInfoAdapter; -import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.base.OsmAndListFragment; @@ -58,8 +57,8 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex; -import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; +import static net.osmand.plus.liveupdates.LiveUpdatesFragmentNew.showUpdateDialog; +import static net.osmand.plus.liveupdates.LiveUpdatesFragmentNew.updateCountEnabled; public class UpdatesIndexFragment extends OsmAndListFragment implements DownloadEvents, RefreshLiveUpdates { private static final int RELOAD_ID = 5; @@ -221,7 +220,6 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download private void startLoadLiveMapsAsyncTask(OsmandApplication app) { loadLiveMapsTask = new LoadLiveMapsTask(listAdapter, app); - loadLiveMapsTask.setUpdateCount(true); loadLiveMapsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } @@ -236,7 +234,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download if (position == 0) { DownloadActivity activity = getMyActivity(); if (activity != null) { - if (!listAdapter.isNotSubscribed()) { + if (!listAdapter.isShowOsmLivePurchaseBanner()) { LiveUpdatesFragmentNew.showInstance(activity.getSupportFragmentManager(), this); } } @@ -291,9 +289,8 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download static final int OSM_LIVE_BANNER = 1; List items; private final ArrayList mapsList = new ArrayList<>(); - private final boolean isNotSubscribed; + private final boolean showOsmLivePurchaseBanner; private TextView countView; - private int countAll = 0; private int countEnabled = 0; @Override @@ -307,34 +304,18 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download } @Override - public void sort() { + public void onDataUpdated() { + countEnabled = updateCountEnabled(countView, mapsList, settings); } - @Override - public void updateCountEnabled() { - countAll = 0; - countEnabled = 0; - if (countView != null) { - for (LocalIndexInfo map : mapsList) { - countAll++; - CommonPreference preference = preferenceForLocalIndex(map.getFileName(), settings); - if (preference.get()) { - countEnabled++; - } - } - String countText = countEnabled + "/" + countAll; - countView.setText(countText); - } - } - - public UpdateIndexAdapter(Context context, int resource, List items, boolean isNotSubscribed) { + public UpdateIndexAdapter(Context context, int resource, List items, boolean showOsmLivePurchaseBanner) { super(context, resource, items); this.items = items; - this.isNotSubscribed = isNotSubscribed; + this.showOsmLivePurchaseBanner = showOsmLivePurchaseBanner; } - public boolean isNotSubscribed() { - return isNotSubscribed; + public boolean isShowOsmLivePurchaseBanner() { + return showOsmLivePurchaseBanner; } @Override @@ -378,7 +359,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download } else if (viewType == OSM_LIVE_BANNER) { OsmandApplication app = getMyApplication(); boolean nightMode = !app.getSettings().isLightContent(); - if (isNotSubscribed) { + if (showOsmLivePurchaseBanner) { view = inflater.inflate(R.layout.osm_live_banner_list_item, parent, false); ColorStateList stateList = AndroidUtils.createPressedColorStateList(app, nightMode, R.color.switch_button_active_light, R.color.switch_button_active_stroke_light, @@ -413,7 +394,10 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download additionalButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - showUpdateDialog(); + if (!listAdapter.isShowOsmLivePurchaseBanner()) { + showUpdateDialog(getActivity(), getMyApplication().getSettings(), + listAdapter.mapsList, listAdapter.countEnabled, null); + } } }); } @@ -430,32 +414,6 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download } } - private void showUpdateDialog() { - if (!listAdapter.isNotSubscribed() && !Algorithms.isEmpty(listAdapter.mapsList)) { - if (listAdapter.countEnabled == 1) { - LocalIndexInfo li = listAdapter.mapsList.get(0); - runLiveUpdate(getActivity(), li.getFileName(), false, null); - } else if (listAdapter.countEnabled > 1) { - AlertDialog.Builder bld = new AlertDialog.Builder(getMyActivity()); - bld.setMessage(R.string.update_all_maps_now); - bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - for (LocalIndexInfo li : listAdapter.mapsList) { - CommonPreference localUpdateOn = preferenceForLocalIndex(li.getFileName(), getMyApplication().getSettings()); - if (localUpdateOn.get()) { - runLiveUpdate(getActivity(), li.getFileName(), false, null); - } - } - } - }); - bld.setNegativeButton(R.string.shared_string_no, null); - bld.show(); - } - } - } - @ColorRes public static int getDefaultIconColorId(boolean nightMode) { return nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light; diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java index 23bf471c24..2e32a3bcd5 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java @@ -28,6 +28,7 @@ import org.apache.commons.logging.Log; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLatestUpdateAvailable; +import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.LOCAL_INDEX_FILE_NAME; import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.getPrimaryTextColorId; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryTextColorId; @@ -35,7 +36,6 @@ public class LiveUpdatesClearDialogFragment extends MenuBottomSheetDialogFragmen public static final String TAG = LiveUpdatesClearDialogFragment.class.getSimpleName(); private static final Log LOG = PlatformUtil.getLog(LiveUpdatesClearDialogFragment.class); - private static final String LOCAL_INDEX_FILE_NAME = "local_index_file_name"; private OsmandApplication app; private OsmandSettings settings; diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index 4c7e814c2b..32598d0431 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -4,7 +4,6 @@ import android.app.Activity; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.content.res.Resources; import android.graphics.drawable.Drawable; @@ -26,8 +25,6 @@ import android.widget.TextView; import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AlertDialog.Builder; import androidx.appcompat.widget.SwitchCompat; import androidx.core.content.ContextCompat; import androidx.fragment.app.FragmentActivity; @@ -61,6 +58,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import static net.osmand.plus.liveupdates.LiveUpdatesFragmentNew.showUpdateDialog; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.DEFAULT_LAST_CHECK; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.UpdateFrequency; @@ -71,7 +69,6 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; -import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.setAlarmForPendingIntent; public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurchaseListener { @@ -131,11 +128,11 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { - adapter.showUpdateDialog(); + showUpdateDialog(getActivity(), getSettings(), adapter.dataShouldUpdate, adapter.dataShouldUpdate.size(), null); swipeRefresh.setRefreshing(false); } }); - + View bottomShadowView = inflater.inflate(R.layout.card_bottom_divider, listView, false); if (!showSettingsOnly) { listView.addFooterView(bottomShadowView); @@ -423,7 +420,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc } } - + }); } else { topShadowView.setVisibility(View.VISIBLE); @@ -442,32 +439,9 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc private void switchOnLiveUpdates(final OsmandSettings settings) { settings.IS_LIVE_UPDATES_ON.set(true); enableLiveUpdates(true); - showUpdateDialog(); + showUpdateDialog(getActivity(), getSettings(), adapter.dataShouldUpdate, adapter.dataShouldUpdate.size(), null); } - - private void showUpdateDialog() { - if(dataShouldUpdate.size() > 0) { - if (dataShouldUpdate.size() == 1) { - runLiveUpdate(app, dataShouldUpdate.get(0).getFileName(), false, null); - } else { - Builder bld = new AlertDialog.Builder(ctx); - bld.setMessage(R.string.update_all_maps_now); - bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - for (LocalIndexInfo li : dataShouldUpdate) { - runLiveUpdate(app, li.getFileName(), false, null); - } - notifyDataSetChanged(); - } - }); - bld.setNegativeButton(R.string.shared_string_no, null); - bld.show(); - } - } - } - private void enableLiveUpdates(boolean enable) { AlarmManager alarmMgr = (AlarmManager) ctx.getSystemService(Context.ALARM_SERVICE); for (LocalIndexInfo li : dataShouldUpdate) { @@ -491,7 +465,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc public int getChildrenCount(int groupPosition) { if (showSettingsOnly) { return 0; - }else if (groupPosition == SHOULD_UPDATE_GROUP_POSITION) { + } else if (groupPosition == SHOULD_UPDATE_GROUP_POSITION) { return dataShouldUpdate.size(); } else if (groupPosition == SHOULD_NOT_UPDATE_GROUP_POSITION) { return dataShouldNotUpdate.size(); @@ -602,11 +576,11 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc final long timestamp = changesManager.getTimestamp(fileNameWithoutExtension); final long lastCheck = preferenceLastCheck(item, fragment.getSettings()).get(); CommonPreference liveUpdateOn = preferenceLiveUpdatesOn(item, fragment.getSettings()); - if(liveUpdateOn.get() && lastCheck != DEFAULT_LAST_CHECK) { - String lastCheckString = formatDateTime(fragment.getActivity(), lastCheck ); + if (liveUpdateOn.get() && lastCheck != DEFAULT_LAST_CHECK) { + String lastCheckString = formatDateTime(fragment.getActivity(), lastCheck); descriptionTextView.setText(context.getString(R.string.last_update, lastCheckString)); } else { - String lastCheckString = formatDateTime(fragment.getActivity(), timestamp ); + String lastCheckString = formatDateTime(fragment.getActivity(), timestamp); descriptionTextView.setText(context.getString(R.string.last_map_change, lastCheckString)); } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index 45ccf2b3fa..a8e573176c 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -1,5 +1,6 @@ package net.osmand.plus.liveupdates; +import android.app.Activity; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; @@ -24,6 +25,7 @@ import android.widget.TextView; import androidx.annotation.ColorRes; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.widget.AppCompatImageView; import androidx.appcompat.widget.SwitchCompat; @@ -105,6 +107,13 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements private GetLastUpdateDateTask getLastUpdateDateTask; private LoadLiveMapsTask loadLiveMapsTask; + private final LiveUpdateListener liveUpdateListener = new LiveUpdateListener() { + @Override + public void processFinish() { + adapter.notifyDataSetChanged(); + } + }; + public static void showInstance(@NonNull FragmentManager fragmentManager, Fragment target) { if (!fragmentManager.isStateSaved()) { LiveUpdatesFragmentNew fragment = new LiveUpdatesFragmentNew(); @@ -182,7 +191,8 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements @Override public void onRefresh() { if (settings.IS_LIVE_UPDATES_ON.get()) { - showUpdateDialog(); + showUpdateDialog(getActivity(), settings, adapter.mapsList, adapter.countEnabled, liveUpdateListener); + startUpdateDateAsyncTask(); } swipeRefresh.setRefreshing(false); } @@ -255,7 +265,6 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements private void startLoadLiveMapsAsyncTask() { if (loadLiveMapsTask == null) { loadLiveMapsTask = new LoadLiveMapsTask(adapter, app); - loadLiveMapsTask.setSort(true); loadLiveMapsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } @@ -303,32 +312,28 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements private void switchOnLiveUpdates() { settings.IS_LIVE_UPDATES_ON.set(true); enableLiveUpdates(true); - showUpdateDialog(); + showUpdateDialog(getMyActivity(), settings, adapter.mapsList, adapter.countEnabled, liveUpdateListener); + startUpdateDateAsyncTask(); } - private void showUpdateDialog() { - startUpdateDateAsyncTask(); - if (!Algorithms.isEmpty(adapter.mapsList)) { - final LiveUpdateListener listener = new LiveUpdateListener() { - @Override - public void processFinish() { - adapter.notifyDataSetChanged(); - } - }; - if (adapter.countEnabled == 1) { - LocalIndexInfo li = adapter.mapsList.get(0); - runLiveUpdate(getActivity(), li.getFileName(), false, listener); - } else if (adapter.countEnabled > 1) { - AlertDialog.Builder bld = new AlertDialog.Builder(getMyActivity()); + public static void showUpdateDialog(final Activity context, final OsmandSettings settings, + final ArrayList mapsList, int countEnabled, + @Nullable final LiveUpdateListener listener) { + if (!Algorithms.isEmpty(mapsList)) { + if (countEnabled == 1) { + LocalIndexInfo li = mapsList.get(0); + runLiveUpdate(context, li.getFileName(), false, listener); + } else if (countEnabled > 1) { + AlertDialog.Builder bld = new AlertDialog.Builder(context); bld.setMessage(R.string.update_all_maps_now); bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - for (LocalIndexInfo li : adapter.mapsList) { + for (LocalIndexInfo li : mapsList) { CommonPreference localUpdateOn = preferenceForLocalIndex(li.getFileName(), settings); if (localUpdateOn.get()) { - runLiveUpdate(getActivity(), li.getFileName(), false, listener); + runLiveUpdate(context, li.getFileName(), false, listener); } } } @@ -375,6 +380,21 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements } } + public static int updateCountEnabled(TextView countView, ArrayList mapsList, OsmandSettings settings) { + int countEnabled = 0; + if (countView != null) { + for (LocalIndexInfo map : mapsList) { + CommonPreference preference = preferenceForLocalIndex(map.getFileName(), settings); + if (preference.get()) { + countEnabled++; + } + } + String countText = countEnabled + "/" + mapsList.size(); + countView.setText(countText); + } + return countEnabled; + } + protected class LiveMapsAdapter extends OsmandBaseExpandableListAdapter implements LocalIndexInfoAdapter { private final ArrayList mapsList = new ArrayList<>(); private int countEnabled = 0; @@ -387,19 +407,16 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements @Override public void clearData() { + mapsList.clear(); } @Override - public void sort() { - countEnabled = 0; - for (LocalIndexInfo map : mapsList) { - CommonPreference preference = preferenceForLocalIndex(map.getFileName(), getSettings()); - if (preference.get()) { - countEnabled++; - } - } - updateCountEnabled(); + public void onDataUpdated() { + sort(); + countEnabled = updateCountEnabled(countView, mapsList, settings); + } + public void sort() { Collections.sort(mapsList); Collections.sort(mapsList, new Comparator() { @Override @@ -412,14 +429,6 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements notifyDataSetInvalidated(); } - @Override - public void updateCountEnabled() { - if (countView != null) { - String countText = countEnabled + "/" + mapsList.size(); - countView.setText(countText); - } - } - @Override public LocalIndexInfo getChild(int groupPosition, int childPosition) { return mapsList.get(childPosition); @@ -433,15 +442,10 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements @Override public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { - LiveMapsViewHolder viewHolder; -// if (convertView == null) { LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); convertView = inflater.inflate(R.layout.list_item_triple_row_icon_and_menu, parent, false); - viewHolder = new LiveMapsViewHolder(convertView); + LiveMapsViewHolder viewHolder = new LiveMapsViewHolder(convertView); convertView.setTag(viewHolder); -// } else { -// viewHolder = (LiveMapsViewHolder) convertView.getTag(); -// } viewHolder.bindLocalIndexInfo(getChild(groupPosition, childPosition).getFileName()); return convertView; } @@ -466,7 +470,6 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements countView = ((TextViewEx) view.findViewById(R.id.description)); AndroidUtils.setTextSecondaryColor(app, countView, nightMode); - updateCountEnabled(); return view; } @@ -688,7 +691,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements @Override public void runSort() { if (adapter != null) { - adapter.sort(); + adapter.onDataUpdated(); } } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java index 242f44f83a..05df1f91ec 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java @@ -48,10 +48,10 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayT import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.setAlarmForPendingIntent; +import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.LOCAL_INDEX_FILE_NAME; public class LiveUpdatesSettingsDialogFragment extends DialogFragment { private static final Log LOG = PlatformUtil.getLog(LiveUpdatesSettingsDialogFragment.class); - private static final String LOCAL_INDEX_FILE_NAME = "local_index_file_name"; private TextView sizeTextView; diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java index a51a9ada28..1992a36afc 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java @@ -13,6 +13,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.ColorRes; +import androidx.annotation.DimenRes; import androidx.annotation.NonNull; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.AppCompatImageView; @@ -52,6 +53,7 @@ import org.apache.commons.logging.Log; import java.util.Arrays; +import static net.osmand.plus.UiUtilities.CompoundButtonType.TOOLBAR; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatHelpDateTime; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatShortDateTime; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay; @@ -69,7 +71,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF public static final String TAG = LiveUpdatesSettingsDialogFragmentNew.class.getSimpleName(); private static final Log LOG = PlatformUtil.getLog(LiveUpdatesSettingsDialogFragmentNew.class); - private static final String LOCAL_INDEX_FILE_NAME = "local_index_file_name"; + public static final String LOCAL_INDEX_FILE_NAME = "local_index_file_name"; private OsmandApplication app; private OsmandSettings settings; @@ -80,8 +82,6 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF private String fileName; private int indexLastCheckItem = -1; private int indexSwitchLiveUpdateItem = -1; - private int indexFrequencyButtonsItem = -1; - private int indexTimeOfDayButtonsItem = -1; private int indexFrequencyHelpMessageItem = -1; private int indexClearItem = -1; private int indexViaWiFiItem = -1; @@ -110,14 +110,10 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF CommonPreference downloadViaWiFiPreference = preferenceDownloadViaWiFi(fileName, settings); CommonPreference frequencyPreference = preferenceUpdateFrequency(fileName, settings); CommonPreference timeOfDayPreference = preferenceTimeOfDayToUpdate(fileName, settings); - int dp10 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_medium); - int dp12 = getResources().getDimensionPixelSize(R.dimen.content_padding_small); - int dp16 = getResources().getDimensionPixelSize(R.dimen.content_padding); - int dp20 = getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_large); - int dp36 = getResources().getDimensionPixelSize(R.dimen.measurement_tool_button_height); - int dp40 = getResources().getDimensionPixelSize(R.dimen.list_header_height); - int dp48 = getResources().getDimensionPixelSize(R.dimen.context_menu_buttons_bottom_height); - int dp56 = getResources().getDimensionPixelSize(R.dimen.bottom_sheet_selected_item_title_height); + int dp12 = getDimen(R.dimen.content_padding_small); + int dp16 = getDimen(R.dimen.content_padding); + int dp40 = getDimen(R.dimen.list_header_height); + int dp48 = getDimen(R.dimen.context_menu_buttons_bottom_height); items.add(new SimpleBottomSheetItem.Builder() .setTitle(getNameToDisplay(fileName, app)) @@ -135,7 +131,9 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF View itemLiveUpdate = getCustomButtonView(app, null, localUpdatePreference.get(), nightMode); View itemLiveUpdateButton = itemLiveUpdate.findViewById(R.id.button_container); - itemLiveUpdateButton.setMinimumHeight(dp56); + CompoundButton button = (CompoundButton) itemLiveUpdateButton.findViewById(R.id.compound_button); + UiUtilities.setupCompoundButton(button, nightMode, TOOLBAR); + itemLiveUpdateButton.setMinimumHeight(getDimen(R.dimen.bottom_sheet_selected_item_title_height)); items.add(new BottomSheetItemWithCompoundButton.Builder() .setChecked(localUpdatePreference.get()) .setTitle(getStateText(localUpdatePreference.get())) @@ -151,18 +149,9 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF && onLiveUpdatesForLocalChange.onUpdateLocalIndex(fileName, button.isChecked(), new Runnable() { @Override public void run() { - if (indexLastCheckItem != -1 && items.size() > 0) { - ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) - .setDescription(getLastCheckString()); - } - if (indexFrequencyHelpMessageItem != -1 && items.size() > 0) { - ((BottomSheetItemWithDescription) items.get(indexFrequencyHelpMessageItem)) - .setDescription(getFrequencyHelpMessage()); - } - if (indexClearItem != -1 && items.size() > 0) { - ((BottomSheetItemWithDescription) items.get(indexClearItem)) - .setDescription(getUpdatesSizeStr()); - } + updateLastCheck(); + updateFrequencyHelpMessage(); + updateFileSize(); } })) { if (indexSwitchLiveUpdateItem != -1 && items.size() > 0) { @@ -209,7 +198,6 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF items.add(new BaseBottomSheetItem.Builder() .setCustomView(itemFrequencyButtons) .create()); - indexFrequencyButtonsItem = items.size() - 1; TextViewEx timeOfDayTitle = (TextViewEx) inflater.inflate(R.layout.bottom_sheet_item_title, null); timeOfDayTitle.setHeight(dp40); @@ -223,7 +211,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF LinearLayout itemTimeOfDayButtons = (LinearLayout) inflater.inflate(R.layout.custom_radio_buttons, null); LinearLayout.MarginLayoutParams itemTimeOfDayParams = new LinearLayout.MarginLayoutParams(LinearLayout.MarginLayoutParams.MATCH_PARENT, LinearLayout.MarginLayoutParams.WRAP_CONTENT); - AndroidUtils.setMargins(itemTimeOfDayParams, dp16, 0, dp16, dp10); + AndroidUtils.setMargins(itemTimeOfDayParams, dp16, 0, dp16, getDimen(R.dimen.context_menu_padding_margin_medium)); itemTimeOfDayButtons.setLayoutParams(itemTimeOfDayParams); String morning = getString(R.string.morning); @@ -246,7 +234,6 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF .setCustomView(itemTimeOfDayButtons) .create() ); - indexTimeOfDayButtonsItem = items.size() - 1; items.add(new ShortDescriptionItem.Builder() .setDescription(getFrequencyHelpMessage()) @@ -256,7 +243,8 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF indexFrequencyHelpMessageItem = items.size() - 1; LinearLayout itemUpdateNowButton = (LinearLayout) inflater.inflate(R.layout.bottom_sheet_button_with_icon_center, null); - LinearLayout.MarginLayoutParams itemUpdateNowParams = new LinearLayout.MarginLayoutParams(LinearLayout.MarginLayoutParams.MATCH_PARENT, dp36); + LinearLayout.MarginLayoutParams itemUpdateNowParams = new LinearLayout.MarginLayoutParams( + LinearLayout.MarginLayoutParams.MATCH_PARENT, getDimen(R.dimen.measurement_tool_button_height)); AndroidUtils.setMargins(itemUpdateNowParams, dp12, dp12, dp16, dp12); itemUpdateNowButton.setLayoutParams(itemUpdateNowParams); ((AppCompatImageView) itemUpdateNowButton.findViewById(R.id.button_icon)).setImageDrawable( @@ -276,18 +264,9 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF onLiveUpdatesForLocalChange.forceUpdateLocal(fileName, true, new Runnable() { @Override public void run() { - if (indexLastCheckItem != -1 && items.size() > 0) { - ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) - .setDescription(getLastCheckString()); - } - if (indexFrequencyHelpMessageItem != -1 && items.size() > 0) { - ((BottomSheetItemWithDescription) items.get(indexFrequencyHelpMessageItem)) - .setDescription(getFrequencyHelpMessage()); - } - if (indexClearItem != -1 && items.size() > 0) { - ((BottomSheetItemWithDescription) items.get(indexClearItem)) - .setDescription(getUpdatesSizeStr()); - } + updateLastCheck(); + updateFrequencyHelpMessage(); + updateFileSize(); } }); } @@ -347,8 +326,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF ); indexViaWiFiItem = items.size() - 1; - items.add(new DividerSpaceItem(app, dp20)); - + items.add(new DividerSpaceItem(app, getDimen(R.dimen.context_menu_padding_margin_large))); } @@ -386,6 +364,27 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF } } + private void updateLastCheck() { + if (indexLastCheckItem != -1 && items.size() > 0) { + ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) + .setDescription(getLastCheckString()); + } + } + + private void updateFrequencyHelpMessage() { + if (indexFrequencyHelpMessageItem != -1 && items.size() > 0) { + ((BottomSheetItemWithDescription) items.get(indexFrequencyHelpMessageItem)) + .setDescription(getFrequencyHelpMessage()); + } + } + + private void updateFileSize() { + if (indexClearItem != -1 && items.size() > 0) { + ((BottomSheetItemWithDescription) items.get(indexClearItem)) + .setDescription(getUpdatesSizeStr()); + } + } + protected SpannableString getLastCheckString() { final long lastUpdate = preferenceLatestUpdateAvailable(fileName, settings).get(); String updatedTimeStr = getString(R.string.updated, formatShortDateTime(app, lastUpdate)); @@ -401,7 +400,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF spanStr.setSpan(new CustomTypefaceSpan(typeface), start, end, 0); start = updatedTimeStr.lastIndexOf(" — "); if (start != -1) { - end = updatedTimeStr.length() - 1; + end = updatedTimeStr.length(); spanStr.setSpan(new CustomTypefaceSpan(typeface), start, end, 0); } } @@ -488,10 +487,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF if (!Algorithms.isEmpty(Arrays.asList(timeOfDayLayouts))) { refreshTimeOfDayLayout(newValue, timeOfDayLayouts); } - if (indexFrequencyHelpMessageItem != -1 && items.size() > 0) { - ((BottomSheetItemWithDescription) items.get(indexFrequencyHelpMessageItem)) - .setDescription(getFrequencyHelpMessage()); - } + updateFrequencyHelpMessage(); OnLiveUpdatesForLocalChange confirmationInterface = (OnLiveUpdatesForLocalChange) getTargetFragment(); if (confirmationInterface != null) { confirmationInterface.updateList(); @@ -505,14 +501,8 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF if (confirmationInterface != null) { confirmationInterface.updateList(); } - if (indexLastCheckItem != -1 && items.size() > 0) { - ((BottomSheetItemWithDescription) items.get(indexLastCheckItem)) - .setDescription(getLastCheckString()); - } - if (indexClearItem != -1 && items.size() > 0) { - ((BottomSheetItemWithDescription) items.get(indexClearItem)) - .setDescription(getUpdatesSizeStr()); - } + updateLastCheck(); + updateFileSize(); } public interface OnLiveUpdatesForLocalChange { @@ -526,6 +516,10 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF void updateList(); } + public int getDimen(@DimenRes int id) { + return getResources().getDimensionPixelSize(id); + } + public String getStateText(boolean isEnabled) { return getString(isEnabled ? R.string.shared_string_enabled : R.string.shared_string_disabled); } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java b/OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java index a02a3d298f..baccf138b4 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java @@ -14,29 +14,16 @@ public class LoadLiveMapsTask implements AbstractLoadLocalIndexTask { public interface LocalIndexInfoAdapter { - void addData(LocalIndexInfo localIndexInfo); void clearData(); - void sort(); - - void updateCountEnabled(); + void onDataUpdated(); } //private List result; private final LocalIndexInfoAdapter adapter; private final LocalIndexHelper helper; - private boolean updateCount = false; - private boolean sort = false; - - public void setUpdateCount(boolean updateCount) { - this.updateCount = updateCount; - } - - public void setSort(boolean sort) { - this.sort = sort; - } public LoadLiveMapsTask(LocalIndexInfoAdapter adapter, OsmandApplication app) { this.adapter = adapter; @@ -73,11 +60,6 @@ public class LoadLiveMapsTask @Override protected void onPostExecute(List result) { //this.result = result; - if (sort) { - adapter.sort(); - } - if (updateCount) { - adapter.updateCountEnabled(); - } + adapter.onDataUpdated(); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java index dca16a278f..08a4e34b6b 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java @@ -131,10 +131,6 @@ public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet { public static View getCustomButtonView(OsmandApplication app, ApplicationMode mode, boolean checked, boolean nightMode) { View customView = UiUtilities.getInflater(app, nightMode).inflate(R.layout.bottom_sheet_item_preference_switch, null); updateCustomButtonView(app, mode, customView, checked, nightMode); - if (mode == null) { - CompoundButton button = (CompoundButton) customView.findViewById(R.id.compound_button); - UiUtilities.setupCompoundButton(button, nightMode, TOOLBAR); - } return customView; } From 6d87a3353590be25496c06e13c0bf334ce84c77e Mon Sep 17 00:00:00 2001 From: cepprice Date: Mon, 15 Mar 2021 19:49:31 +0500 Subject: [PATCH 040/250] Fix summary of Dialogs and notifications preference --- OsmAnd/res/xml/global_settings.xml | 1 - .../fragments/GlobalSettingsFragment.java | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/xml/global_settings.xml b/OsmAnd/res/xml/global_settings.xml index 1cb0e2e93d..98ad2a1312 100644 --- a/OsmAnd/res/xml/global_settings.xml +++ b/OsmAnd/res/xml/global_settings.xml @@ -48,7 +48,6 @@ android:layout="@layout/preference_with_descr" android:persistent="false" android:title="@string/dialogs_and_notifications_title" - android:summary="@string/shared_string_all" app:fragment="net.osmand.plus.settings.fragments.DialogsAndNotificationsSettingsFragment" tools:icon="@drawable/ic_action_notification" /> diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java index b9e398aa07..4cf57ce66b 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java @@ -21,6 +21,8 @@ import net.osmand.plus.profiles.SelectProfileBottomSheet; import net.osmand.plus.profiles.SelectProfileBottomSheet.DialogMode; import net.osmand.plus.profiles.SelectProfileBottomSheet.OnSelectProfileCallback; import net.osmand.plus.settings.backend.ApplicationMode; +import net.osmand.plus.settings.backend.BooleanPreference; +import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.datastorage.DataStorageHelper; import net.osmand.plus.settings.datastorage.item.StorageItem; @@ -38,6 +40,8 @@ public class GlobalSettingsFragment extends BaseSettingsFragment private static final String SEND_ANONYMOUS_DATA_PREF_ID = "send_anonymous_data"; private static final String DIALOGS_AND_NOTIFICATIONS_PREF_ID = "dialogs_and_notifications"; + private static final String DONT_SHOW_STARTUP_MESSAGES = "do_not_show_startup_messages"; + private static final String SHOW_DOWNLOAD_MAP_DIALOG = "show_download_map_dialog"; @Override protected void setupPreferences() { @@ -213,6 +217,20 @@ public class GlobalSettingsFragment extends BaseSettingsFragment private void setupDialogsAndNotificationsPref() { Preference dialogsAndNotifications = (Preference) findPreference(DIALOGS_AND_NOTIFICATIONS_PREF_ID); dialogsAndNotifications.setIcon(getPersistentPrefIcon(R.drawable.ic_action_notification)); + if (getSettings() == null) { + return; + } + CommonPreference startupMessages = (BooleanPreference) getSettings().getPreference(DONT_SHOW_STARTUP_MESSAGES); + CommonPreference downloadMapDialog = (BooleanPreference) getSettings().getPreference(SHOW_DOWNLOAD_MAP_DIALOG); + String summary; + if (!startupMessages.get() && downloadMapDialog.get()) { + summary = app.getString(R.string.shared_string_all); + } else if (!startupMessages.get() || downloadMapDialog.get()) { + summary = "1/2"; + } else { + summary = app.getString(R.string.shared_string_disabled); + } + dialogsAndNotifications.setSummary(summary); } private void setupEnableProxyPref() { From 27bd894e56a9cb3a2d9a60d7c196db826b3a6e72 Mon Sep 17 00:00:00 2001 From: ivanPyrohivskyi Date: Mon, 15 Mar 2021 17:34:17 +0200 Subject: [PATCH 041/250] Fix reverse geocoding for building only --- .../main/java/net/osmand/binary/GeocodingUtilities.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/GeocodingUtilities.java b/OsmAnd-java/src/main/java/net/osmand/binary/GeocodingUtilities.java index a372f12aa1..934672c95b 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/GeocodingUtilities.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/GeocodingUtilities.java @@ -282,10 +282,12 @@ public class GeocodingUtilities { } else { Collections.sort(streetsList, DISTANCE_COMPARATOR); double streetDistance = 0; + boolean isBuildingFound = knownMinBuildingDistance > 0; for (GeocodingResult street : streetsList) { - if (streetDistance == 0) { + boolean skipStreet = streetDistance > 0 && street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME; + if (streetDistance == 0 || !isBuildingFound) { streetDistance = street.getDistance(); - } else if (street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME) { + } else if (skipStreet) { continue; } street.connectionPoint = road.connectionPoint; @@ -307,6 +309,9 @@ public class GeocodingUtilities { res.add(nextBld); } } + if (skipStreet) { + continue; + } res.add(street); } } From 98a0829d5a4095aa4d87cbed0352c721270d4fec Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 15 Mar 2021 16:57:47 +0100 Subject: [PATCH 042/250] Small code improvement --- .../java/net/osmand/binary/GeocodingUtilities.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/GeocodingUtilities.java b/OsmAnd-java/src/main/java/net/osmand/binary/GeocodingUtilities.java index 934672c95b..02f9e88098 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/GeocodingUtilities.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/GeocodingUtilities.java @@ -284,10 +284,10 @@ public class GeocodingUtilities { double streetDistance = 0; boolean isBuildingFound = knownMinBuildingDistance > 0; for (GeocodingResult street : streetsList) { - boolean skipStreet = streetDistance > 0 && street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME; - if (streetDistance == 0 || !isBuildingFound) { + if (streetDistance == 0) { streetDistance = street.getDistance(); - } else if (skipStreet) { + } else if (streetDistance > 0 && street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME && + isBuildingFound) { continue; } street.connectionPoint = road.connectionPoint; @@ -298,6 +298,7 @@ public class GeocodingUtilities { if (knownMinBuildingDistance == 0) { GeocodingResult firstBld = it.next(); knownMinBuildingDistance = firstBld.getDistance(); + isBuildingFound = true; res.add(firstBld); } while (it.hasNext()) { @@ -309,9 +310,6 @@ public class GeocodingUtilities { res.add(nextBld); } } - if (skipStreet) { - continue; - } res.add(street); } } From 6e40cd7913086aadd16c9e65676daaf8ccc058d8 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 15 Mar 2021 18:21:52 +0200 Subject: [PATCH 043/250] Enable transliteration by default for english --- .../plus/settings/backend/CommonPreference.java | 2 +- .../plus/settings/backend/OsmandSettings.java | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/CommonPreference.java b/OsmAnd/src/net/osmand/plus/settings/backend/CommonPreference.java index 28b71f4383..d58b35d0c6 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/CommonPreference.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/CommonPreference.java @@ -156,7 +156,7 @@ public abstract class CommonPreference extends PreferenceWithListener { return cachedValue; } cachedPreference = getPreferences(); - cachedValue = getValue(cachedPreference, getProfileDefaultValue(settings.APPLICATION_MODE.get())); + cachedValue = getValue(cachedPreference, getDefaultValue()); return cachedValue; } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 01758f60b2..ec7d2b067f 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -11,6 +11,10 @@ import android.net.NetworkInfo; import android.os.Build; import android.os.Environment; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.util.Pair; + import net.osmand.FileUtils; import net.osmand.IndexConstants; import net.osmand.PlatformUtil; @@ -77,10 +81,6 @@ import java.util.Map; import java.util.Set; import java.util.StringTokenizer; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.core.util.Pair; - import static net.osmand.aidlapi.OsmAndCustomizationConstants.CONFIGURE_MAP_ITEM_ID_SCHEME; import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_ITEM_ID_SCHEME; import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ACTIONS; @@ -1119,7 +1119,13 @@ public class OsmandSettings { public final OsmandPreference PREFERRED_LOCALE = new StringPreference(this, "preferred_locale", "").makeGlobal().makeShared(); public final OsmandPreference MAP_PREFERRED_LOCALE = new StringPreference(this, "map_preferred_locale", "").makeGlobal().makeShared().cache(); - public final OsmandPreference MAP_TRANSLITERATE_NAMES = new BooleanPreference(this, "map_transliterate_names", false).makeGlobal().makeShared().cache(); + public final OsmandPreference MAP_TRANSLITERATE_NAMES = new BooleanPreference(this, "map_transliterate_names", false) { + + protected Boolean getDefaultValue() { + return usingEnglishNames(); + } + + }.makeGlobal().makeShared().cache(); public boolean usingEnglishNames() { return MAP_PREFERRED_LOCALE.get().equals("en"); From c640e6a79a2222031559192e8779c3e040503af4 Mon Sep 17 00:00:00 2001 From: cepprice Date: Mon, 15 Mar 2021 21:28:06 +0500 Subject: [PATCH 044/250] Small edit --- .../fragments/GlobalSettingsFragment.java | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java index 4cf57ce66b..2646218e50 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/GlobalSettingsFragment.java @@ -6,11 +6,6 @@ import android.os.Bundle; import android.util.Pair; import android.widget.ImageView; -import androidx.fragment.app.FragmentManager; -import androidx.preference.Preference; -import androidx.preference.PreferenceViewHolder; -import androidx.preference.SwitchPreferenceCompat; - import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.dialogs.ConfigureMapMenu; @@ -21,14 +16,17 @@ import net.osmand.plus.profiles.SelectProfileBottomSheet; import net.osmand.plus.profiles.SelectProfileBottomSheet.DialogMode; import net.osmand.plus.profiles.SelectProfileBottomSheet.OnSelectProfileCallback; import net.osmand.plus.settings.backend.ApplicationMode; -import net.osmand.plus.settings.backend.BooleanPreference; -import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.datastorage.DataStorageHelper; import net.osmand.plus.settings.datastorage.item.StorageItem; import net.osmand.plus.settings.preferences.ListPreferenceEx; import net.osmand.plus.settings.preferences.SwitchPreferenceEx; +import androidx.fragment.app.FragmentManager; +import androidx.preference.Preference; +import androidx.preference.PreferenceViewHolder; +import androidx.preference.SwitchPreferenceCompat; + import static net.osmand.plus.profiles.SelectProfileBottomSheet.PROFILE_KEY_ARG; import static net.osmand.plus.profiles.SelectProfileBottomSheet.USE_LAST_PROFILE_ARG; @@ -40,8 +38,6 @@ public class GlobalSettingsFragment extends BaseSettingsFragment private static final String SEND_ANONYMOUS_DATA_PREF_ID = "send_anonymous_data"; private static final String DIALOGS_AND_NOTIFICATIONS_PREF_ID = "dialogs_and_notifications"; - private static final String DONT_SHOW_STARTUP_MESSAGES = "do_not_show_startup_messages"; - private static final String SHOW_DOWNLOAD_MAP_DIALOG = "show_download_map_dialog"; @Override protected void setupPreferences() { @@ -220,15 +216,15 @@ public class GlobalSettingsFragment extends BaseSettingsFragment if (getSettings() == null) { return; } - CommonPreference startupMessages = (BooleanPreference) getSettings().getPreference(DONT_SHOW_STARTUP_MESSAGES); - CommonPreference downloadMapDialog = (BooleanPreference) getSettings().getPreference(SHOW_DOWNLOAD_MAP_DIALOG); + boolean showStartupMessages = !getSettings().DO_NOT_SHOW_STARTUP_MESSAGES.get(); + boolean showDownloadMapDialog = getSettings().SHOW_DOWNLOAD_MAP_DIALOG.get(); String summary; - if (!startupMessages.get() && downloadMapDialog.get()) { - summary = app.getString(R.string.shared_string_all); - } else if (!startupMessages.get() || downloadMapDialog.get()) { - summary = "1/2"; + if (showStartupMessages && showDownloadMapDialog) { + summary = getString(R.string.shared_string_all); + } else if (showStartupMessages || showDownloadMapDialog) { + summary = getString(R.string.ltr_or_rtl_combine_via_slash, "1", "2"); } else { - summary = app.getString(R.string.shared_string_disabled); + summary = getString(R.string.shared_string_disabled); } dialogsAndNotifications.setSummary(summary); } From 58b690ba7cec3b5b816949ea070cf7dd01d84de7 Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 15 Mar 2021 18:37:04 +0200 Subject: [PATCH 045/250] small fixes --- OsmAnd/src/net/osmand/AndroidUtils.java | 20 ++++++++++++++----- .../LiveUpdatesClearDialogFragment.java | 6 +++--- .../liveupdates/LiveUpdatesFragmentNew.java | 10 +++++----- .../LiveUpdatesSettingsDialogFragment.java | 2 +- .../LiveUpdatesSettingsDialogFragmentNew.java | 10 +++------- .../plus/liveupdates/LoadLiveMapsTask.java | 13 +++++------- .../TripRecordingActiveBottomSheet.java | 6 +----- 7 files changed, 33 insertions(+), 34 deletions(-) diff --git a/OsmAnd/src/net/osmand/AndroidUtils.java b/OsmAnd/src/net/osmand/AndroidUtils.java index f385a4af8e..42b4a60919 100644 --- a/OsmAnd/src/net/osmand/AndroidUtils.java +++ b/OsmAnd/src/net/osmand/AndroidUtils.java @@ -92,12 +92,12 @@ public class AndroidUtils { public static final MessageFormat formatKb = new MessageFormat("{0, number,##.#}", Locale.US); public static final MessageFormat formatGb = new MessageFormat("{0, number,#.##}", Locale.US); public static final MessageFormat formatMb = new MessageFormat("{0, number,##.#}", Locale.US); - + /** * @param context * @return true if Hardware keyboard is available */ - + public static boolean isHardwareKeyboardAvailable(Context context) { return context.getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS; } @@ -480,6 +480,16 @@ public class AndroidUtils { : ctx.getResources().getColor(R.color.text_color_secondary_light)); } + @ColorRes + public static int getPrimaryTextColorId(boolean nightMode) { + return nightMode ? R.color.text_color_primary_dark : R.color.text_color_primary_light; + } + + @ColorRes + public static int getSecondaryTextColorId(boolean nightMode) { + return nightMode ? R.color.text_color_secondary_dark : R.color.text_color_secondary_light; + } + public static int getTextMaxWidth(float textSize, List titles) { int width = 0; for (String title : titles) { @@ -761,7 +771,7 @@ public class AndroidUtils { tv.setTextDirection(textDirection); } } - + public static int getLayoutDirection(@NonNull Context ctx) { Locale currentLocale = ctx.getResources().getConfiguration().locale; return TextUtilsCompat.getLayoutDirectionFromLocale(currentLocale); @@ -909,7 +919,7 @@ public class AndroidUtils { public static boolean isRTL() { return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL; } - + public static String createNewFileName(String oldName) { int firstDotIndex = oldName.indexOf('.'); String nameWithoutExt = oldName.substring(0, firstDotIndex); @@ -931,7 +941,7 @@ public class AndroidUtils { i--; } while (i >= 0); int newNumberValue = Integer.parseInt(hasNameNumberSection ? numberSection.toString() : "0") + 1; - + String newName; if (newNumberValue == 1) { newName = nameWithoutExt + " " + newNumberValue + ext; diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java index 2e32a3bcd5..c54daada1a 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesClearDialogFragment.java @@ -25,17 +25,17 @@ import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; +import static net.osmand.AndroidUtils.getPrimaryTextColorId; +import static net.osmand.AndroidUtils.getSecondaryTextColorId; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLatestUpdateAvailable; -import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.LOCAL_INDEX_FILE_NAME; -import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.getPrimaryTextColorId; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryTextColorId; public class LiveUpdatesClearDialogFragment extends MenuBottomSheetDialogFragment { public static final String TAG = LiveUpdatesClearDialogFragment.class.getSimpleName(); private static final Log LOG = PlatformUtil.getLog(LiveUpdatesClearDialogFragment.class); + private static final String LOCAL_INDEX_FILE_NAME = "local_index_file_name"; private OsmandApplication app; private OsmandSettings settings; diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index a8e573176c..92877d6e2c 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -72,6 +72,7 @@ import java.util.Date; import java.util.Locale; import java.util.TimeZone; +import static net.osmand.AndroidUtils.getSecondaryTextColorId; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatShortDateTime; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getNameToDisplay; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent; @@ -86,7 +87,6 @@ import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.g import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getActiveTextColorId; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getOsmandIconColorId; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryIconColorId; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryTextColorId; public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements OnLiveUpdatesForLocalChange { @@ -614,7 +614,7 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements descriptionTime.setText(dest.format(parsed)); } } catch (ParseException e) { - e.printStackTrace(); + LOG.error(e.getMessage()); } } } @@ -630,13 +630,13 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements final long lastUpdate = preferenceLatestUpdateAvailable(fileName, settings).get(); String lastUpdateString = formatShortDateTime(app, lastUpdate); - String description = app.getResources().getString(R.string.updated, lastUpdateString); + String description = app.getString(R.string.updated, lastUpdateString); if (lastTimeChecked) { final long lastCheck = preferenceLastCheck(fileName, settings).get(); String lastCheckString = formatShortDateTime(app, lastCheck); - if (!lastUpdateString.equals(app.getResources().getString(R.string.shared_string_never))) { - description = description.concat("\n" + app.getResources().getString(R.string.last_time_checked, lastCheckString)); + if (!lastUpdateString.equals(app.getString(R.string.shared_string_never))) { + description = description.concat("\n" + app.getString(R.string.last_time_checked, lastCheckString)); } } return description; diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java index 05df1f91ec..242f44f83a 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragment.java @@ -48,10 +48,10 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayT import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.setAlarmForPendingIntent; -import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.LOCAL_INDEX_FILE_NAME; public class LiveUpdatesSettingsDialogFragment extends DialogFragment { private static final Log LOG = PlatformUtil.getLog(LiveUpdatesSettingsDialogFragment.class); + private static final String LOCAL_INDEX_FILE_NAME = "local_index_file_name"; private TextView sizeTextView; diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java index 1992a36afc..bf9839eef0 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java @@ -53,6 +53,8 @@ import org.apache.commons.logging.Log; import java.util.Arrays; +import static net.osmand.AndroidUtils.getPrimaryTextColorId; +import static net.osmand.AndroidUtils.getSecondaryTextColorId; import static net.osmand.plus.UiUtilities.CompoundButtonType.TOOLBAR; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatHelpDateTime; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.formatShortDateTime; @@ -63,7 +65,6 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLatestUpdateAvailable; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryTextColorId; import static net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.getCustomButtonView; import static net.osmand.plus.settings.bottomsheets.BooleanPreferenceBottomSheet.updateCustomButtonView; @@ -71,7 +72,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF public static final String TAG = LiveUpdatesSettingsDialogFragmentNew.class.getSimpleName(); private static final Log LOG = PlatformUtil.getLog(LiveUpdatesSettingsDialogFragmentNew.class); - public static final String LOCAL_INDEX_FILE_NAME = "local_index_file_name"; + private static final String LOCAL_INDEX_FILE_NAME = "local_index_file_name"; private OsmandApplication app; private OsmandSettings settings; @@ -524,11 +525,6 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF return getString(isEnabled ? R.string.shared_string_enabled : R.string.shared_string_disabled); } - @ColorRes - public static int getPrimaryTextColorId(boolean nightMode) { - return nightMode ? R.color.text_color_primary_dark : R.color.text_color_primary_light; - } - @ColorRes public static int getActiveTabTextColorId(boolean nightMode) { return nightMode ? R.color.text_color_tab_active_dark : R.color.text_color_tab_active_light; diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java b/OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java index baccf138b4..77f8b2ece5 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LoadLiveMapsTask.java @@ -7,10 +7,8 @@ import net.osmand.plus.activities.LocalIndexHelper; import net.osmand.plus.activities.LocalIndexInfo; import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask; -import java.util.List; - public class LoadLiveMapsTask - extends AsyncTask> + extends AsyncTask implements AbstractLoadLocalIndexTask { public interface LocalIndexInfoAdapter { @@ -21,7 +19,6 @@ public class LoadLiveMapsTask void onDataUpdated(); } - //private List result; private final LocalIndexInfoAdapter adapter; private final LocalIndexHelper helper; @@ -36,8 +33,9 @@ public class LoadLiveMapsTask } @Override - protected List doInBackground(Void... params) { - return helper.getLocalFullMaps(this); + protected Void doInBackground(Void... params) { + helper.getLocalFullMaps(this); + return null; } @Override @@ -58,8 +56,7 @@ public class LoadLiveMapsTask } @Override - protected void onPostExecute(List result) { - //this.result = result; + protected void onPostExecute(Void result) { adapter.onDataUpdated(); } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java index e2e0522e42..00a9c0e8c0 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java @@ -65,6 +65,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static net.osmand.AndroidUtils.getSecondaryTextColorId; import static net.osmand.plus.UiUtilities.CompoundButtonType.PROFILE_DEPENDENT; public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragment { @@ -612,11 +613,6 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen return nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light; } - @ColorRes - public static int getSecondaryTextColorId(boolean nightMode) { - return nightMode ? R.color.text_color_secondary_dark : R.color.text_color_secondary_light; - } - @ColorRes public static int getActiveIconColorId(boolean nightMode) { return nightMode ? R.color.icon_color_active_dark : R.color.icon_color_active_light; From e05aab4211f408e9486bb82097285ef6073ded72 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Mon, 15 Mar 2021 17:41:49 +0100 Subject: [PATCH 046/250] Update CommonPreference.java --- .../osmand/plus/settings/backend/CommonPreference.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/CommonPreference.java b/OsmAnd/src/net/osmand/plus/settings/backend/CommonPreference.java index d58b35d0c6..eed0121d99 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/CommonPreference.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/CommonPreference.java @@ -89,7 +89,6 @@ public abstract class CommonPreference extends PreferenceWithListener { defaultValues.put(mode, defValue); } - // TODO final @Override public boolean setModeValue(ApplicationMode mode, T obj) { if (global) { @@ -106,7 +105,6 @@ public abstract class CommonPreference extends PreferenceWithListener { return valueSaved; } - // TODO final public T getProfileDefaultValue(ApplicationMode mode) { if (global) { return defaultValue; @@ -129,7 +127,6 @@ public abstract class CommonPreference extends PreferenceWithListener { return defaultValues != null && defaultValues.containsKey(mode); } - // TODO final protected T getDefaultValue() { return getProfileDefaultValue(settings.APPLICATION_MODE.get()); } @@ -139,7 +136,6 @@ public abstract class CommonPreference extends PreferenceWithListener { this.defaultValue = newDefaultValue; } - // TODO final @Override public T getModeValue(ApplicationMode mode) { if (global) { @@ -149,7 +145,6 @@ public abstract class CommonPreference extends PreferenceWithListener { return getValue(settings.getProfilePreferences(mode), defaultV); } - // TODO final @Override public T get() { if (cache && cachedValue != null && cachedPreference == getPreferences()) { @@ -181,7 +176,6 @@ public abstract class CommonPreference extends PreferenceWithListener { } } - // TODO final @Override public boolean set(T obj) { Object prefs = getPreferences(); @@ -210,7 +204,6 @@ public abstract class CommonPreference extends PreferenceWithListener { return shared; } - // TODO final @Override public boolean writeToJson(JSONObject json, ApplicationMode appMode) throws JSONException { if (appMode != null) { @@ -231,7 +224,6 @@ public abstract class CommonPreference extends PreferenceWithListener { return false; } - // TODO final @Override public void readFromJson(JSONObject json, ApplicationMode appMode) throws JSONException { if (appMode != null) { @@ -256,4 +248,4 @@ public abstract class CommonPreference extends PreferenceWithListener { T v = getModeValue(m); return toString(v); } -} \ No newline at end of file +} From f692339a367c103f5a423816c55054bf4b37a6a2 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 15 Mar 2021 20:57:34 +0200 Subject: [PATCH 047/250] Fix #10988 --- .../src/net/osmand/plus/dialogs/RenameFileBottomSheet.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/RenameFileBottomSheet.java b/OsmAnd/src/net/osmand/plus/dialogs/RenameFileBottomSheet.java index f2bfe0e6e7..aa60bc0426 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/RenameFileBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/RenameFileBottomSheet.java @@ -131,7 +131,10 @@ public class RenameFileBottomSheet extends MenuBottomSheetDialogFragment { File dest; int index = file.getName().lastIndexOf('.'); String ext = index == -1 ? "" : file.getName().substring(index); - String newName = Algorithms.getFileNameWithoutExtension(selectedFileName); + String newName = selectedFileName; + if (selectedFileName.endsWith(ext)) { + newName = selectedFileName.substring(0, selectedFileName.lastIndexOf(ext)); + } if (SQLiteTileSource.EXT.equals(ext)) { dest = renameSQLiteFile(app, file, newName + ext, null); } else if (IndexConstants.GPX_FILE_EXT.equals(ext)) { From e794f3f028cefd751770e9aa6d93aec15bdfaedb Mon Sep 17 00:00:00 2001 From: R3gi CZ Date: Mon, 15 Mar 2021 18:14:33 +0000 Subject: [PATCH 048/250] Translated using Weblate (Czech) Currently translated at 99.6% (3881 of 3894 strings) --- OsmAnd/res/values-cs/phrases.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OsmAnd/res/values-cs/phrases.xml b/OsmAnd/res/values-cs/phrases.xml index a1c73a522c..62402909c7 100644 --- a/OsmAnd/res/values-cs/phrases.xml +++ b/OsmAnd/res/values-cs/phrases.xml @@ -3881,4 +3881,13 @@ Delegace Pobočka Vedená velvyslancem + + + + + + + + + \ No newline at end of file From d6bd0e414567faa358d9d09d7d724a7acca1c935 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 15 Mar 2021 22:45:02 +0200 Subject: [PATCH 049/250] init --- .../GpxApproximationFragment.java | 10 +++++++++ .../MeasurementToolFragment.java | 6 ++++-- .../FollowTrackFragment.java | 21 +++++++++++-------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java index 132f48b6a5..cea8ff65a4 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java @@ -21,6 +21,7 @@ import net.osmand.GPXUtilities.WptPt; import net.osmand.LocationsHolder; import net.osmand.PlatformUtil; import net.osmand.ResultMatcher; +import net.osmand.plus.LockableScrollView; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; @@ -157,6 +158,15 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment updateCardsLayout(); } updateCards(); + final LockableScrollView profileContainer = mainView.findViewById(R.id.route_menu_bottom_scroll); + profileContainer.postDelayed(new Runnable() { + @Override + public void run() { + if (snapToRoadAppMode.getOrder() > 4) { + profileContainer.fullScroll(View.FOCUS_DOWN); + } + } + }, 100); updateButtons(mainView); progressBar = mainView.findViewById(R.id.progress_bar); diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 74f636802a..fcc7f0ca03 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -554,7 +554,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route }); initMeasurementMode(gpxData, savedInstanceState == null); - if (savedInstanceState == null) { if (fileName != null) { addNewGpxData(getGpxFile(fileName)); @@ -1959,10 +1958,13 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } public static boolean showInstance(FragmentManager fragmentManager, MeasurementEditingContext editingCtx, - boolean followTrackMode) { + boolean followTrackMode, boolean isShowSnapWarning) { MeasurementToolFragment fragment = new MeasurementToolFragment(); fragment.setEditingCtx(editingCtx); fragment.setMode(FOLLOW_TRACK_MODE, followTrackMode); + Bundle bundle = new Bundle(); + bundle.putBoolean("isShowSnapWarning", isShowSnapWarning); + fragment.setArguments(bundle); return showFragment(fragment, fragmentManager); } diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java index b5abb80b65..a5209eac18 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java @@ -446,15 +446,18 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca if (mapActivity != null) { if (card instanceof ImportTrackCard) { importTrack(); - } else if (card instanceof TrackEditCard || card instanceof AttachTrackToRoadsCard) { - openPlanRoute(); + } else if (card instanceof AttachTrackToRoadsCard) { + openPlanRoute(true); + close(); + } else if (card instanceof TrackEditCard) { + openPlanRoute(false); close(); - } else if (card instanceof SelectTrackCard) { - updateSelectionMode(true); - } else if (card instanceof ReverseTrackCard - || card instanceof NavigateTrackOptionsCard) { - updateMenu(); } + } else if (card instanceof SelectTrackCard) { + updateSelectionMode(true); + } else if (card instanceof ReverseTrackCard + || card instanceof NavigateTrackOptionsCard) { + updateMenu(); } } @@ -574,7 +577,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca } } - public void openPlanRoute() { + public void openPlanRoute(boolean showSnapWarning) { MapActivity mapActivity = getMapActivity(); if (mapActivity != null && gpxFile != null) { editingTrack = true; @@ -583,7 +586,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca editingContext.setGpxData(gpxData); editingContext.setAppMode(app.getRoutingHelper().getAppMode()); editingContext.setSelectedSegment(app.getSettings().GPX_ROUTE_SEGMENT.get()); - MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager(), editingContext, true); + MeasurementToolFragment.showInstance(mapActivity.getSupportFragmentManager(), editingContext, true, showSnapWarning); } } From d347ae32b580fcdc4026ef7c561c8b37d09c5b11 Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 15 Mar 2021 23:31:35 +0200 Subject: [PATCH 050/250] fix drawables on older versions of Android --- .../plus/liveupdates/LiveUpdatesFragmentNew.java | 12 ++++-------- .../LiveUpdatesSettingsDialogFragmentNew.java | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index 92877d6e2c..756f6a3551 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -27,6 +27,7 @@ import androidx.annotation.ColorRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.AppCompatImageView; import androidx.appcompat.widget.SwitchCompat; import androidx.appcompat.widget.Toolbar; @@ -374,12 +375,6 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements } } - public void notifyLiveUpdatesChanged() { - if (getActivity() != null) { - runSort(); - } - } - public static int updateCountEnabled(TextView countView, ArrayList mapsList, OsmandSettings settings) { int countEnabled = 0; if (countView != null) { @@ -544,12 +539,13 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements subTitleText += " • " + getString(timeOfDay.getLocalizedId()); }*/ subTitle.setText(subTitleText); - subTitle.setTextColor(ContextCompat.getColor(app, liveUpdateOn ? getActiveTextColorId(nightMode) : getSecondaryTextColorId(nightMode))); + subTitle.setTextColor(ContextCompat.getColor(app, liveUpdateOn + ? getActiveTextColorId(nightMode) : getSecondaryTextColorId(nightMode))); Typeface typeface = FontCache.getFont(app, getString(R.string.font_roboto_medium)); subTitle.setTypeface(typeface); } - Drawable statusDrawable = ContextCompat.getDrawable(app, R.drawable.ic_map); + Drawable statusDrawable = AppCompatResources.getDrawable(app, R.drawable.ic_map); int resColorId = !localUpdateOn.get() ? getSecondaryIconColorId(nightMode) : !liveUpdateOn ? getDefaultIconColorId(nightMode) : getOsmandIconColorId(nightMode); int statusColor = ContextCompat.getColor(app, resColorId); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java index bf9839eef0..776368e6a7 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java @@ -249,7 +249,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF AndroidUtils.setMargins(itemUpdateNowParams, dp12, dp12, dp16, dp12); itemUpdateNowButton.setLayoutParams(itemUpdateNowParams); ((AppCompatImageView) itemUpdateNowButton.findViewById(R.id.button_icon)).setImageDrawable( - ContextCompat.getDrawable(app, R.drawable.ic_action_update)); + AppCompatResources.getDrawable(app, R.drawable.ic_action_update)); UiUtilities.setupDialogButton(nightMode, itemUpdateNowButton, UiUtilities.DialogButtonType.SECONDARY, getString(R.string.update_now)); itemUpdateNowButton.setMinimumHeight(AndroidUtils.dpToPx(app, app.getResources().getDimension(R.dimen.dialog_button_height))); From a8719b542fef323dcc2af7923590653ed71273b4 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 15 Mar 2021 23:56:14 +0200 Subject: [PATCH 051/250] Navigation > Follow track > select simplified track > edit > open "Route between points" --- .../MeasurementToolFragment.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index fcc7f0ca03..34fde58555 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -132,6 +132,8 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route private ImageView mainIcon; private String fileName; private OnBackPressedCallback onBackPressedCallback; + private boolean isShowSnapWarning; + private static final String SHOW_SNAP_WARNING = "show_snap_warning"; private InfoType currentInfoType; @@ -235,6 +237,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route if (mapActivity == null) { return null; } + if (savedInstanceState != null) { + restoreState(savedInstanceState); + } else if (getArguments() != null) { + restoreState(getArguments()); + } final MeasurementToolLayer measurementLayer = mapActivity.getMapLayers().getMeasurementToolLayer(); final OsmandApplication app = mapActivity.getMyApplication(); @@ -349,7 +356,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } }); - View applyPointBeforeAfterButton = mainView.findViewById(R.id.apply_point_before_after_point_button); UiUtilities.setupDialogButton(nightMode, applyPointBeforeAfterButton, UiUtilities.DialogButtonType.PRIMARY, R.string.shared_string_apply); @@ -553,6 +559,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } }); + isShowSnapWarning = getArguments().getBoolean(SHOW_SNAP_WARNING); initMeasurementMode(gpxData, savedInstanceState == null); if (savedInstanceState == null) { if (fileName != null) { @@ -1963,7 +1970,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route fragment.setEditingCtx(editingCtx); fragment.setMode(FOLLOW_TRACK_MODE, followTrackMode); Bundle bundle = new Bundle(); - bundle.putBoolean("isShowSnapWarning", isShowSnapWarning); + bundle.putBoolean(SHOW_SNAP_WARNING, isShowSnapWarning); fragment.setArguments(bundle); return showFragment(fragment, fragmentManager); } @@ -2107,7 +2114,9 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route manager.beginTransaction() .hide(this).commit(); layer.setTapsDisabled(true); - SnapTrackWarningFragment.showInstance(mapActivity.getSupportFragmentManager(), this); + if (isShowSnapWarning) { + SnapTrackWarningFragment.showInstance(mapActivity.getSupportFragmentManager(), this); + } AndroidUiHelper.setVisibility(mapActivity, View.GONE, R.id.map_ruler_container); } } @@ -2132,4 +2141,8 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route public interface OnUpdateInfoListener { void onUpdateInfo(); } + + public void restoreState(Bundle bundle) { + isShowSnapWarning = bundle.getBoolean(SHOW_SNAP_WARNING); + } } \ No newline at end of file From d108a818ad8f35c4a9b70c7327bf81a0664c1257 Mon Sep 17 00:00:00 2001 From: Verdulo Date: Tue, 16 Mar 2021 02:15:48 +0000 Subject: [PATCH 052/250] Translated using Weblate (Esperanto) Currently translated at 100.0% (3683 of 3683 strings) --- OsmAnd/res/values-eo/strings.xml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml index 4527d0bd13..33f3022d0e 100644 --- a/OsmAnd/res/values-eo/strings.xml +++ b/OsmAnd/res/values-eo/strings.xml @@ -2162,7 +2162,6 @@ Montri punktojn kaj kurbojn de profundo. Maraj profundec-kurboj Uzi datumojn pri altitudo - Kursa altitudo Malsupreniro Supreniro @@ -4005,4 +4004,27 @@ Ekstervoje Motorciklo Aŭto + %1$s enhavas almenaŭ unu segmenton, vi devas elekti la necesan parton por navigi. + Uzi vojajn limigojn, kiuj estas nun aktivaj sur la mapo + Elekti inter pli mallonga, pli rapida aŭ pli sekura kursoj + Proksimigas emblemon de via pozicio al la nune navigata vojo + Aŭtomate turni la mapon nur kiam rapido estas pli alta ol la sojlo + Ĉesigi sen konservi + Konservi kaj ĉesigi registri + Registrado de spuro ĉesigita + Ĉu vi certe volas ĉesigi registradon\? +\nĈiuj nekonservitaj datumoj perdiĝos. + Paŭzigita + Restarto de aplikaĵo estas necesa por apliki kelkajn agordojn. + Eviti krutajn deklivojn dum navigi. + Ŝaltilo por montri aŭ kaŝi la fenestraĵon de koordinatoj sur la mapo. + Distanco je frapeto + Kontrolos pri map‑ĝisdatigoj ĉiusemajne. Sekva ĝisdatigo okazos %1$s je %2$s. + Kontrolos pri map‑ĝisdatigoj ĉiutage. Sekva ĝisdatigo okazos %1$s je %2$s. + Kontrolos pri map‑ĝisdatigoj ĉiuhore. Sekva ĝisdatigo okazos %1$s je %2$s. + Ĉu vi certe volas forigi ĉiujn %s ĝisdatigojn OsmAnd Live\? + La registrado pluos. + La spuro ne enhavas datumojn pri altitudo. + La spuro ne enhavas datumojn pri rapido. + Elektu alian specon de kolorigo. \ No newline at end of file From 2a93f055784672196a2b8982bc55afc5a5cfa0af Mon Sep 17 00:00:00 2001 From: phlostically Date: Mon, 15 Mar 2021 20:28:07 +0000 Subject: [PATCH 053/250] Translated using Weblate (Esperanto) Currently translated at 100.0% (3683 of 3683 strings) --- OsmAnd/res/values-eo/strings.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml index 33f3022d0e..93d1133076 100644 --- a/OsmAnd/res/values-eo/strings.xml +++ b/OsmAnd/res/values-eo/strings.xml @@ -4027,4 +4027,20 @@ La spuro ne enhavas datumojn pri altitudo. La spuro ne enhavas datumojn pri rapido. Elektu alian specon de kolorigo. + Optimumigita pli mallonga kurso (energiŝpara) + Lasta disponebla ĝisdatigo de OpenStreetMap: + Lastfoje kontrolita: %s + Segmento %1$d + Elektu segmentojn + Ĉu forigi %1$d dosierojn\? + Elektu kategorion aŭ aldonu novan + Kopii nomon de interesejo + Ofteco de ĝisdatigoj + Ĝisdatigita: %s + Forigi ĝisdatigojn + Restartigi + Ĉiuj regionoj + Aĉetoj + Montri/kaŝi + Intervalo \ No newline at end of file From 388630714c00c482632b7656b420fe8e0068bcec Mon Sep 17 00:00:00 2001 From: xmd5a Date: Tue, 16 Mar 2021 10:58:02 +0300 Subject: [PATCH 054/250] Add strings --- OsmAnd/res/values/strings.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index e6eca20f52..899beda35c 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,10 +11,11 @@ Thx - Hardy --> - Please select another type of colorization. The track does not contain speed data. The track does not contain altitude data. + Nature boundaries + Hide nature reserve, protected areas and national park boundaries Interval Show/hide Copy POI name From 2ab0c034c7bd469248d821165cb5d64fc2ef9df4 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 16 Mar 2021 10:04:45 +0200 Subject: [PATCH 055/250] Fix #5958 --- .../main/java/net/osmand/osm/MapPoiTypes.java | 2 ++ .../src/main/java/net/osmand/osm/PoiType.java | 32 +++++++++++++++---- .../net/osmand/plus/osmedit/AddPOIAction.java | 3 ++ .../plus/osmedit/AdvancedEditPoiFragment.java | 4 ++- .../net/osmand/plus/osmedit/EditPoiData.java | 11 ++++--- .../plus/osmedit/EditPoiDialogFragment.java | 4 +++ .../plus/osmedit/OpenstreetmapLocalUtil.java | 3 ++ 7 files changed, 48 insertions(+), 11 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/MapPoiTypes.java b/OsmAnd-java/src/main/java/net/osmand/osm/MapPoiTypes.java index e273fa4e7f..869cf7d962 100644 --- a/OsmAnd-java/src/main/java/net/osmand/osm/MapPoiTypes.java +++ b/OsmAnd-java/src/main/java/net/osmand/osm/MapPoiTypes.java @@ -658,6 +658,8 @@ public class MapPoiTypes { tp.setOsmValue(parser.getAttributeValue("", "value")); tp.setOsmEditTagValue(parser.getAttributeValue("", "edit_tag"), parser.getAttributeValue("", "edit_value")); + tp.setOsmEditTagValue2(parser.getAttributeValue("", "edit_tag2"), + parser.getAttributeValue("", "edit_value2")); tp.setOsmTag2(parser.getAttributeValue("", "tag2")); tp.setOsmValue2(parser.getAttributeValue("", "value2")); diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/PoiType.java b/OsmAnd-java/src/main/java/net/osmand/osm/PoiType.java index 5651cf0e03..a3a905fb80 100644 --- a/OsmAnd-java/src/main/java/net/osmand/osm/PoiType.java +++ b/OsmAnd-java/src/main/java/net/osmand/osm/PoiType.java @@ -16,9 +16,10 @@ public class PoiType extends AbstractPoiType { private String editTag; private String editValue; + private String editTag2; + private String editValue2; private boolean filterOnly; - private String nameTag; private boolean text; private boolean nameOnly; @@ -68,27 +69,46 @@ public class PoiType extends AbstractPoiType { this.editTag = osmTag; this.editValue = editValue; } - + + public void setOsmEditTagValue2(String osmTag, String editValue) { + this.editTag2 = osmTag; + this.editValue2 = editValue; + } + public String getEditOsmTag() { - if(isReference()) { + if (isReference()) { return referenceType.getEditOsmTag(); } - if(editTag == null) { + if (editTag == null) { return getOsmTag(); } return editTag; } public String getEditOsmValue() { - if(isReference()) { + if (isReference()) { return referenceType.getEditOsmValue(); } - if(editValue == null) { + if (editValue == null) { return getOsmValue(); } return editValue; } + public String getEditOsmTag2() { + if (isReference()) { + return referenceType.getEditOsmTag2(); + } + return editTag2; + } + + public String getEditOsmValue2() { + if (isReference()) { + return referenceType.getEditOsmValue2(); + } + return editValue2; + } + public void setOsmTag(String osmTag) { this.osmTag = osmTag; } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AddPOIAction.java b/OsmAnd/src/net/osmand/plus/osmedit/AddPOIAction.java index a46ddb0ba1..1404815c4c 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AddPOIAction.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AddPOIAction.java @@ -147,6 +147,9 @@ public class AddPOIAction extends QuickAction { if (poiType.getOsmTag2() != null) { newNode.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2()); } + if (poiType.getEditOsmTag2() != null) { + newNode.putTagNoLC(poiType.getEditOsmTag2(), poiType.getEditOsmValue2()); + } } else if (!Algorithms.isEmpty(tag.getValue())) { PoiCategory category = editPoiData.getPoiCategory(); if (category != null) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java index a99afa7a22..4ebf968c24 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java @@ -323,7 +323,9 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment if (poiType.getOsmTag2() != null) { stringSet.add(poiType.getOsmTag2()); } - + if (poiType.getEditOsmTag2() != null) { + stringSet.add(poiType.getEditOsmTag2()); + } } if (poiType.getEditOsmValue() != null) { values.add(poiType.getEditOsmValue()); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java index 7dab7780b0..77f8acace0 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java @@ -237,11 +237,13 @@ public class EditPoiData { private void removeTypeTagWithPrefix(boolean needRemovePrefix) { if (currentPoiType != null) { if (needRemovePrefix) { - tagValues.put(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag(), REMOVE_TAG_VALUE); tagValues.put(Entity.REMOVE_TAG_PREFIX + currentPoiType.getOsmTag2(), REMOVE_TAG_VALUE); + tagValues.put(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag(), REMOVE_TAG_VALUE); + tagValues.put(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag2(), REMOVE_TAG_VALUE); } else { - tagValues.remove(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag()); tagValues.remove(Entity.REMOVE_TAG_PREFIX + currentPoiType.getOsmTag2()); + tagValues.remove(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag()); + tagValues.remove(Entity.REMOVE_TAG_PREFIX + currentPoiType.getEditOsmTag2()); } removeCurrentTypeTag(); } @@ -249,9 +251,10 @@ public class EditPoiData { private void removeCurrentTypeTag() { if (currentPoiType != null) { - tagValues.remove(currentPoiType.getEditOsmTag()); tagValues.remove(currentPoiType.getOsmTag2()); - changedTags.removeAll(Arrays.asList(currentPoiType.getEditOsmTag(), currentPoiType.getOsmTag2())); + tagValues.remove(currentPoiType.getEditOsmTag()); + tagValues.remove(currentPoiType.getEditOsmTag2()); + changedTags.removeAll(Arrays.asList(currentPoiType.getEditOsmTag(),currentPoiType.getEditOsmTag2(), currentPoiType.getOsmTag2())); } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index 946d79ca18..6ea10fe5ef 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -515,6 +515,10 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { entity.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2()); entity.removeTag(Entity.REMOVE_TAG_PREFIX + poiType.getOsmTag2()); } + if (poiType.getEditOsmTag2() != null) { + entity.putTagNoLC(poiType.getEditOsmTag2(), poiType.getEditOsmValue2()); + entity.removeTag(Entity.REMOVE_TAG_PREFIX + poiType.getEditOsmTag2()); + } } else if (!Algorithms.isEmpty(poiTypeTag)) { PoiCategory category = editPoiData.getPoiCategory(); if (category != null) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java index 4d42026026..fc0c62d263 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OpenstreetmapLocalUtil.java @@ -127,6 +127,9 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil { if (poiType.getOsmTag2() != null) { entity.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2()); } + if (poiType.getEditOsmTag2() != null) { + entity.putTagNoLC(poiType.getEditOsmTag2(), poiType.getEditOsmValue2()); + } } if (!Algorithms.isEmpty(mapObject.getName())) { entity.putTagNoLC(OSMTagKey.NAME.getValue(), mapObject.getName()); From 7b6eef7cb2550ce09b676d578b7d11bedcbfc887 Mon Sep 17 00:00:00 2001 From: Ahmad Alfrhood Date: Tue, 16 Mar 2021 09:55:02 +0000 Subject: [PATCH 056/250] Translated using Weblate (Arabic) Currently translated at 100.0% (3683 of 3683 strings) --- OsmAnd/res/values-ar/strings.xml | 40 +++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-ar/strings.xml b/OsmAnd/res/values-ar/strings.xml index eddda38785..863f778c47 100644 --- a/OsmAnd/res/values-ar/strings.xml +++ b/OsmAnd/res/values-ar/strings.xml @@ -2302,7 +2302,6 @@ التضاريس المفضلة : مسطحة أو تلال. الانحدار نقل - إظهار نقاط ومعالم العمق. بدء مقطع جديدة بعد فارق 6 دقائق، مسار جديد بعد فارق 2 ساعة، أو ملف جديد بعد فارق أطول إذا تغير التاريخ. متوقف مؤقتاً @@ -4074,4 +4073,43 @@ الطرق الوعرة دراجة نارية سيارة + نسخ اسم POI + الرجاء اختيار أنواع أخرى من التلوين + سيتم التقاط الرمز إلى مسار التنقل الحالي + حدد الجزء + %1$s يحتوي على أكثر من مقطع ، تحتاج إلى تحديد الجزء المطلوب للتنقل. + الجزء %1$d + استخدم قيود الطريق النشطة الآن على الخريطة + الطريق الأقصر الأمثل (توفير الطاقة) + حدد غرض القيادة للحصول على مسار أقصر أو أسرع أو أكثر أمانًا + إذا كانت السرعة أقل من الحد ، لا تقم بتدويرالخريطة + إعادة التشغيل + كل المناطق + حذف %1$d ملفات؟ + توقف بدون حفظ + حفظ و إيقاف التسجيل + توقف تسجيل المسار + هل أنت متأكد أنك تريد إيقاف التسجيل؟ +\nستفقد جميع البيانات غير المحفوظة. + عند الإيقاف المؤقت + يلزم إعادة تشغيل التطبيق لتطبيق بعض الإعدادات. + التوجيه يمكن أن يتجنب المرتفعات القوية. + تبديل لإظهار أو إخفاء أداة الإحداثيات على الخريطة. + المسافة عن طريق الضغط + آخر تحديث خريطة الشارع المفتوح المتاحة: + تحديث: %s + آخر مرة تم التحقق منها: %s + تحديث التردد + سيتم فحص تحديثات الخريطة كل أسبوع. المرة القادمة %1$s في %2$s. + سيتم التحقق من تحديثات الخرائط كل يوم. في المرة القادمة%1$s في %2$s. + سيتم التحقق من تحديثات الخرائط كل ساعة. في المرة القادمة%1$s في %2$s. + هل أنت متأكد من أنك تريد حذف كافة %s التحديثات المباشرة؟ + حذف التحديثات + المشتريات + حدد فئة أو أضف فئة جديدة + سيستمر التسجيل. + إظهار/ إخفاء + الفاصل الزمني + لا يحتوي المسار على بيانات الارتفاع. + لا يحتوي المسار على بيانات السرعة. \ No newline at end of file From b7bf39d76da74daaa149f8c37c95bf878725c772 Mon Sep 17 00:00:00 2001 From: Ldm Public Date: Mon, 15 Mar 2021 22:19:34 +0000 Subject: [PATCH 057/250] Translated using Weblate (French) Currently translated at 99.8% (3677 of 3683 strings) --- OsmAnd/res/values-fr/strings.xml | 34 +++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 4dda03c224..6ab881dca2 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -2154,7 +2154,6 @@ Afficher les lignes et points de sonde. Lignes de sonde maritimes Utiliser les données d\'altitude - Altitude moyenne Distance totale Durée @@ -3995,4 +3994,37 @@ \n \nPour en savoir, consultez http://openplacereviews.org. Course automobile + Utilisez les limitations routières actuellement actives sur la carte + Êtes-vous certain de vouloir interrompre l\'enregistrement \? +\nToutes les données non sauvegardées seront perdues. + Êtes-vous certain de vouloir supprimer %s mises à jour temps réel \? + Ne pas pivoter la carte si la vitesse est inférieure à un seuil + En pause + Un redémarrage de l\'application est nécessaire pour appliquer certains paramètres. + Le routage peut éviter de fortes montées. + Distance par appui + Dernière mise à jour d\'OpenStreetMap disponible : + Mis à jour : %s + Dernière vérification : %s + Segment %1$d + Redémarrer + Toutes les régions + Supprimer %1$d fichiers \? + Arrêter sans enregistrer + Enregistrer et arrêter l\'enregistrement + Enregistrement de la trace arrêté + Sélectionnez les segments + Fréquence de mise à jour + Les cartes seront vérifiées chaque semaine. La prochaine vérification de mise à jour s\'effectuera à %1$s dans %2$s. + Les cartes seront vérifiées tous les jours. La prochaine vérification de mise à jour s\'effectuera à %1$s dans %2$s. + Les cartes seront vérifiées toutes les heures. La prochaine vérification de mise à jour s\'effectuera à %1$s dans %2$s. + Supprimer les mises à jour + Achats + Sélectionnez la catégorie ou ajoutez-en une nouvelle + L\'enregistrement se poursuivra. + Copier le nom du PI + Afficher / masquer + Intervalle + La trace ne contient aucune donnée d\'altitude. + La trace ne contient aucune donnée de vitesse. \ No newline at end of file From 9b9d47238dd672d6ad4c1c8732fc9858331aa4da Mon Sep 17 00:00:00 2001 From: Hakuchi Date: Mon, 15 Mar 2021 23:58:36 +0000 Subject: [PATCH 058/250] Translated using Weblate (German) Currently translated at 99.3% (3659 of 3683 strings) --- OsmAnd/res/values-de/strings.xml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 73ae09b097..fb530c131e 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -2167,7 +2167,6 @@ Offener Standortcode (OLC) Eine Schaltfläche, um durch die Liste unten zu blättern. Höhendaten berücksichtigen - Nautische Tiefenlinien Tiefenlinien und -punkte einblenden. Routenhöhenprofil @@ -4010,4 +4009,20 @@ sek Rennsport Erste Ankündigung (größere Distanz) - + Neustart + Alle Regionen + %1$d Dateien löschen\? + Stoppen ohne zu speichern + Speichern und Beenden der Aufzeichnung + Track-Aufnahme gestoppt + Aktualisiert: %s + Updates löschen + Käufe + Die Aufzeichnung wird fortgesetzt. + POI-Namen kopieren + Ein-/Ausblenden + Intervall + Der Track enthält keine Höhendaten. + Der Track enthält keine Geschwindigkeitsdaten. + Bitte wähle eine andere Art der Einfärbung aus. + \ No newline at end of file From eb57dc34d46071693d156ace6d581266c1a0f11d Mon Sep 17 00:00:00 2001 From: Ihor Hordiichuk Date: Tue, 16 Mar 2021 02:02:16 +0000 Subject: [PATCH 059/250] Translated using Weblate (Ukrainian) Currently translated at 100.0% (3683 of 3683 strings) --- OsmAnd/res/values-uk/strings.xml | 48 ++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index ecbdddd2b2..09ec130fd0 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -551,7 +551,7 @@ Почати супровід Режим пересування: Вкажіть точку призначення - Маршрут + Напрямки Робочі години Відкривається набір змін… Закривається набір змін… @@ -1427,7 +1427,7 @@ Налаштуйте ім’я госту Вашого проксі-сервера (наприклад, 127.0.0.1). Порт проксі-сервера Вкажіть номер порту Вашого проксі-сервера (наприклад, 8118). - Голосові повідомлення + Голосові оголошення Експорт Вимкнено Увімкнено @@ -2126,7 +2126,6 @@ Час Загальна відстань Використовувати дані висоти - Показати контури глибини і точки. Контури морських глибин Авто-розрив запису після перерви @@ -3154,7 +3153,7 @@ Вага, висота, довжина, швидкість Параметри транспортного засобу Голосові повідомлення відтворюються лише під час навігації. - Навігаційні оголошення + Голосові оголошення Екранні сповіщення Налаштування параметрів маршруту Параметри маршруту @@ -3466,7 +3465,7 @@ Виберіть відстань, після якого маршрут буде перераховано. Перерахунок маршруту у випадку відхилення Хв - Місцевість + Рельєф Мапа пагорбів використовує темні відтінки для показу схилів, вершин і низин. У режимі Схил, рельєф місцевості візуалізується за допомогою кольорів. Встановіть найменший та найбільший рівні масштабування, при якому шар буде відображатися. @@ -4004,4 +4003,43 @@ Біг Автомобіль Мотоцикл + Вибір сегментів + %1$s містить більше ніж один сегмент, потрібно вибрати необхідну частину для навігації. + Сегмент %1$d + Застосовувати дорожні обмеження, які зараз діють на мапі + Оптимізований коротший маршрут (енергоощадження) + Виберіть мету водіння, щоб отримати коротший, швидший або безпечніший маршрут + Піктограма поточного місцеперебування буде прив\'язана до поточного маршруту навігації + Не обертати, якщо швидкість менше граничної + Перезапустити + Всі регіони + Видалити %1$d файли\? + Зупинити без збереження + Зберегти і зупинити запис + Запис треку зупинено + Ви дійсно бажаєте припинити записування\? +\nУсі незбережені дані буде втрачено. + Під час паузи + Щоб застосувати деякі налаштування, потрібно перезапустити програму. + Маршрут може уникнути крутих підйомів. + Перемикач, щоб показати або приховати віджет Координати на мапі. + Відстань дотиком + Доступне найновіше оновлення OpenStreetMap: + Оновлено: %s + Востаннє перевірено: %s + Частота оновлень + Наявність оновлень мап перевірятиметься щотижня. Наступного разу%1$s в %2$s. + Наявність оновлень мап перевірятиметься щогодини. Наступного разу%1$s в %2$s. + Наявність оновлень мап перевірятиметься щодня. Наступного разу%1$s в %2$s. + Видалити оновлення + Ви впевнені, що хочете видалити всі %s поточні оновлення\? + Покупки + Виберіть категорію або додайте нову + Записування буде продовжено. + Копіювати назву POI + Показати/сховати + Інтервал + Трек не містить даних про висоту. + Трек не містить даних про швидкість. + Виберіть інший тип забарвлення. \ No newline at end of file From 6ad83e8f3d026c36e2c211b77b76fcd5ba7f1cd0 Mon Sep 17 00:00:00 2001 From: Franco Date: Mon, 15 Mar 2021 19:45:31 +0000 Subject: [PATCH 060/250] Translated using Weblate (Spanish) Currently translated at 97.9% (3607 of 3683 strings) --- OsmAnd/res/values-es/strings.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OsmAnd/res/values-es/strings.xml b/OsmAnd/res/values-es/strings.xml index 1c21bdf4f0..8ac570602c 100644 --- a/OsmAnd/res/values-es/strings.xml +++ b/OsmAnd/res/values-es/strings.xml @@ -2160,7 +2160,6 @@ Tiempo Distancia total Usar datos de elevación - Mostrar curvas y puntos de profundidad. Curvas de profundidad náuticas División automática de grabaciones en intervalos @@ -3698,7 +3697,7 @@ Traza simplificada Sólo se grabará la línea de la ruta, los puntos intermedios (waypoints) se borrarán. Nombre de archivo - %s archivo(s) de trazas marcado(s) + %s archivos de trazas marcados Grabar Especifica el intervalo de grabación general para trazas (activado a través del widget de grabación en el mapa). Pausar grabación del viaje From 7a84a66bdbe5c5a2108e199f2dfc30cb12e5a13f Mon Sep 17 00:00:00 2001 From: jan madsen Date: Mon, 15 Mar 2021 20:19:40 +0000 Subject: [PATCH 061/250] Translated using Weblate (Danish) Currently translated at 91.6% (3376 of 3683 strings) --- OsmAnd/res/values-da/strings.xml | 60 +++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/OsmAnd/res/values-da/strings.xml b/OsmAnd/res/values-da/strings.xml index 6ae0917dba..7a6398afca 100644 --- a/OsmAnd/res/values-da/strings.xml +++ b/OsmAnd/res/values-da/strings.xml @@ -443,9 +443,10 @@ " \n \nTryk og hold for valgmuligheder" - OsmAnd (OSM Automated Navigation Directions) + OsmAnd (OSM Automated Navigation Directions) +\n +\nOsmAnd er et open source-navigationsprogram med adgang til en lang række af globale OpenStreetMap (OSM)-data. Alle kortdata (vektorkort eller kortbrikker) kan gemmes på enhedens hukommelseskort til offline-brug. OsmAnd tilbyder også offline- og online-rutefunktionalitet inklusive sving-for-sving tale vejledning. \n -\nOsmAnd er et open source-navigationsprogram med adgang til en lang række af globale OpenStreetMap (OSM)-data. Alle kortdata (vektorkort eller kortbrikker) kan gemmes på enhedens hukommelseskort til offline-brug. OsmAnd tilbyder også offline- og online-rutefunktionalitet inklusive sving-for-sving tale vejledning. \n \nNogle af hovedfunktionerne: \n - Komplet offlinefunktionalitet (gemme hentede vektorkort eller kortbrikker i enhedens lager) @@ -460,7 +461,7 @@ \n - valgfri automatisk kortrotation efter kompas eller bevægelsesretning \n - valgfri vognbaneassistent \n - visning af hastighedsgrænse -\n - optagede stemmer og tale syntese stemmer (tekst-til-tale) +\n - optagede stemmer og talesyntese stemmer (tekst-til-tale) \n \n Begrænsninger i den gratis version af OsmAnd: \n - Antallet af kort der kan hentes er begrænset @@ -937,7 +938,7 @@ OSM-modifikationer Ikke forbundet til Wi-Fi. Brug den aktuelle forbindelse til internettet for at hente? Stop navigation - Annuller rute + Annuller rute\? Slet destinationen Fuldversion Andre @@ -2168,7 +2169,6 @@ Vis dybdekonturer og -punkter. Havdybdekonturer Brug højdedata - Rutehøjde Fald Stigning @@ -3787,4 +3787,54 @@ Motorcykel Bil + Meddelelsestid + Vis spor på kort + Vandring + Landevejscykling + Scooter + MTB + Navnet findes allerede + Slet online routing-motor\? + Slet rutepunkt + Kopier til kortmarkører + Kopier til favoritter + Vælg segmenter + %1$s indeholder mere end et segment, vælg den nødvendige del til navigationen. + Segment %1$d + Vælg redigeringer til overførsel + OpenPlaceReviews + Log på OpenPlaceReviews + Vand + Snescooter + Mountainbike + Vandring + Off-road + Optimeret kortere rute (energibesparelser) + Vælg kørselsformål for at få en kortere, hurtigere eller mere sikker rute + Det aktuelle placeringsikon fastgøres til den aktuelle navigationsrute + Genstart + Alle regioner + Slet %1$d filer\? + Stop uden at gemme + Gem og stop optagelse + Optagelse af spor stoppet + Programgenstart kræves for at anvende nogle indstillinger. + En til/fra-knap for at vise eller skjule Koordinat modul på kortet. + Seneste OpenStreetMap opdatering tilgængelig: + Opdateret: %s + Sidst kontrolleret: %s + Opdateringsfrekvens + Kortopdateringer kontrolleres hver uge. Næste gang %1$s i %2$s. + Kortopdateringer kontrolleres hver dag. Næste gang %1$s i %2$s. + Kortopdateringer kontrolleres hver time. Næste gang %1$s i %2$s. + Slet opdateringer + Køb + Vælg kategori, eller tilføj en ny + Optagelsen fortsættes. + Kopier IP-navn + Vis/skjul + Interval + Sporet indeholder ikke højdedata. + Sporet indeholder ikke hastighedsdata. + Vælg en anden type farvelægning. \ No newline at end of file From f3ff1f239cd80839e100e9a0ffb9d8c63424242d Mon Sep 17 00:00:00 2001 From: Yaron Shahrabani Date: Tue, 16 Mar 2021 07:41:17 +0000 Subject: [PATCH 062/250] Translated using Weblate (Hebrew) Currently translated at 99.3% (3660 of 3683 strings) --- OsmAnd/res/values-iw/strings.xml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-iw/strings.xml b/OsmAnd/res/values-iw/strings.xml index c299b049d4..55eda8a396 100644 --- a/OsmAnd/res/values-iw/strings.xml +++ b/OsmAnd/res/values-iw/strings.xml @@ -2705,7 +2705,6 @@ \n ניתן לקבל נווט אמין למדינה שלך - בין אם זו ישראל, צרפת, גרמניה, מקסיקו, אנגליה, ספרד, הולנד, ארה״ב, רוסיה, ברזיל או כל מדינה אחרת. מייל ימי עיבוד מסלולים לפי עקבות OSMC. - תוסף זה מעשיר את המפה ואת הניווט של יישומון OsmAnd ומאפשר לייצר מפות ימיות לחתירה, הפלגה וסוגים נוספים של ספורט ימי. \n \nתוסף מפה מיוחד ל־OsmAnd יספק את כל סימוני הניווט הימיים והסימנים הימיים המוסכמים, לניווט במקווי מים פנימיים לרבות ניווט באזורים הקרובים לחוף. התיאור של כל סימון ניווט מספק את הפרטים הנדרשים כדי לזהות אותם ואת המשמעות שלהם (קטגוריה, צורה, צבע, רצף, הפניה וכו׳). @@ -4008,4 +4007,20 @@ שטח אופנוע מכונית + עדכון: %s + מועד הבדיקה האחרונה: %s + תדירות עדכון + בכל שבוע יתבצע חיפוש לעדכוני מפה. הפעם הבאה%1$s ב־%2$s. + בכל יום יתבצע חיפוש לעדכוני מפה. הפעם הבאה%1$s ב־%2$s. + בכל שעה יתבצע חיפוש לעדכוני מפה. הפעם הבאה%1$s ב־%2$s. + מחיקת עדכונים + רכישות + נא לבחור קטגוריה או להוסיף אחת חדשה + ההקלטה תמשיך. + העתק שם הנ״ע + הצגה/הסתרה + הפרש + המסלול אינו מכיל נתוני גובה. + המסלול אינו מכיל מהירות גבוהה. + נא לבחור סוג אחר של צביעה. \ No newline at end of file From f4ea02a698ca0133130b02de1430de3672fc5732 Mon Sep 17 00:00:00 2001 From: Zmicer Turok Date: Tue, 16 Mar 2021 09:21:15 +0000 Subject: [PATCH 063/250] Translated using Weblate (Belarusian) Currently translated at 99.0% (3649 of 3683 strings) --- OsmAnd/res/values-be/strings.xml | 91 +++++++++++++++++--------------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml index ba1b8d5015..544b2187a7 100644 --- a/OsmAnd/res/values-be/strings.xml +++ b/OsmAnd/res/values-be/strings.xml @@ -1355,7 +1355,7 @@ Немагчыма спампаваць. Калі ласка, праверце вашае Інтэрнэт-злучэнне. Усе спампоўкі Абнаўленні - Лакальныя + Мясцовыя Зона Па шыраце Па даўгаце @@ -2190,7 +2190,6 @@ Час Агульная даўжыня Выкарыстоўваць даныя вышыні - Аўтаматычнае дзяленне запісаў пасля перапынку Пачаць новы сегмент пасля 6-хвіліннага перапынку, новы след — пасля 2-гадзіннага перапынку, ці новы файл пасля доўгага перапынку (як змяніляся дата). Берберская @@ -3898,54 +3897,54 @@ Увайсці ў OpenStreetMap Увайсці ў OpenStreetMap.org Увайсці з дапамогай OpenStreetMap - Вам неабходна ўвайсці ў сістэму, каб загрузіць новыя або адрэдагаваныя змены. + Вам неабходна ўвайсці ў сістэму, каб адправіць змены. \n -\nВы можаце ўвайсці, выкарыстоўваючы бяспечны метад OAuth, або з дапамогай сваіх імя карыстальніка і пароля. - Выкарыстоўваць імя карыстальніка і пароль - Уліковы запіс - Аўтарызавацца +\nВы можаце ўвайсці з дапамогай OAuth або лагіна і пароля. + Выкарыстоўваць лагін і пароль + Акаўнт + Увайсці Кіраванне падпіскай Націсніце кнопку, каб перайсці ў налады падпіскі Google Play і выправіць спосаб аплаты. - Мінуў тэрмін дзеяння падпіскі OsmAnd Live - Падпіска OsmAnd Live была прыпынена - Падпіска OsmAnd Live прыпынена - Гісторыя маркераў + Тэрмін дзеяння падпіскі OsmAnd Live сышоў + Падпіска OsmAnd Live была прыпыненая + Падпіска OsmAnd Live прыпыненая + Гісторыя адзнак Адправіць файл GPX на OpenStreetMap - Увадзіце тэгі праз коску. - \"Агульнадаступны\" азначае, што трасіроўка публічна адлюстроўваецца ў вашых GPS-трасіроўках і ў агульнадаступных спісах GPS-трасіровак, а таксама ў агульнадаступным спісе трасіровак з пазнакамі часу ў неапрацаваным выглядзе. Даныя, прадстаўленыя праз API, не спасылаюцца на вашу старонку трасіроўкі. Меткі часу трасіроўкі недаступныя праз агульнадаступны API GPS і не размяшчаюцца ў храналагічным парадку. - \"Прыватны\" азначае, што след не з\'явіцца ў любым агульнадаступным спісе, але кантрольныя пункты з яго даступныя ў адвольным парадку праз агульнадаступны GPS API без пазнак часу. - \"Ідэнтыфікаваны\" азначае, што трасіроўка будзе публічна адлюстроўвацца ў вашай GPS-трасіроўкі і ў агульнадаступных спісах GPS-трасіровак, гэта значыць, што іншыя карыстальнікі змогуць загрузіць неапрацаваны след і звязаць яго з вашым імем карыстальніка. Агульнадаступныя даныя трасіроўкі з GPS API, якія абслугоўваюцца з дапамогай API пунктаў адсочвання, спасылаюцца на пачатковую старонку трасіроўкі. - \"Адсочванне\" азначае, што трэк не з\'явіцца ў любым агульнадаступным спісе, але апрацоўка маршрутных пунктаў з яго (якія не могуць быць непасрэдна звязаны з вамі) ажыццяўляецца з выкарыстаннем загрузак з агульнадаступнага API GPS. + Увадзіце пазнакі праз коску. + \"Публічны\" азначае, што след публічна адлюстроўваецца ў вашых слядах і ў агульнадаступных спісах слядоў, а таксама ў агульнадаступным спісе слядоў з пазнакамі часу ў неапрацаваным выглядзе. Даныя з API, не спасылаюцца на вашу старонку слядоў. Пазнакі часу недаступныя праз агульнадаступны API GPS і не размяшчаюцца ў храналагічным парадку. + \"Прыватны\" азначае, што след не з\'явіцца ў любым агульнадаступным спісе, але пункты следу з яго даступныя ў адвольным парадку праз агульнадаступны GPS API без пазнак часу. + \"Можна ідэнтыфікаваць\" азначае, што след будзе публічна адлюстроўвацца ў вашых слядах і ў агульнадаступных спісах слядоў. Гэта азначае, што іншыя карыстальнікі змогуць спампаваць неапрацаваны след і звязаць яго з вашым імем карыстальніка. Агульнадаступныя даныя следу з GPS API, якія абслугоўваюцца з дапамогай API пунктаў следу, будуць спасылацца на пачатковую старонку следу. + \"Можна адсачыць\" азначае, што след не з\'явіцца ў любым агульнадаступным спісе, але яго пункты (якія не могуць быць непасрэдна звязаныя з вамі) адпраўляюцца праз агульнадаступны API GPS. Закрыць нататку OSM Каментаваць нататку OSM - Вы можаце ўвайсці, выкарыстоўваючы бяспечны метад OAuth або з дапамогай сваіх імя карыстальніка і пароля. + Вы можаце ўвайсці з дапамогай OAuth або лагіна і пароля. Дадаць фотаздымак Зарэгістравацца на \nOpenPlaceReviews.org - Фотаздымкі прадастаўлены праектам з адкрытымі данымі OpenPlaceReviews.org. Каб загрузіць фатаграфіі, зарэгіструйцеся на іх сайце. - Стварыць уліковы запіс - У мяне ўжо ёсць уліковы запіс + Фотаздымкі падаюцца праектам з адкрытымі данымі OpenPlaceReviews.org. Каб запампаваць фотаздымкі, зарэгіструйцеся на іх сайце. + Стварыць акаўнт + У мяне ўжо ёсць акаўнт Гісторыя пошуку Каяк Маторная лодка - Немагчыма загрузіць выяву, паўтарыце спробу пазней - Выберыце выявы + Немагчыма адправіць выяву, паўтарыце спробу пазней + Абярыце выявы Рэсурсы Прыблізны памер файла - Выберыце даныя, якія вы хочаце экспартаваць у файл. + Абярыце даныя, якія вы хочаце экспартаваць у файл. Неабходна для імпартавання - На вашай прыладзе свабодна толькі %1$s. Вызваліце месца альбо зніміце пазнаку з некаторых элементаў для экспартавання. - Недастаткова месца - Выберыце групы, якія трэба імпартаваць. - Выберыце элементы, якія трэба імпартаваць. + На вашай прыладзе свабодна толькі %1$s. Вызваліце месца альбо прыбярыце пазнаку з некаторых элементаў. + Не стае вольнага месца + Абярыце групы, якія трэба імпартаваць. + Абярыце элементы, якія трэба імпартаваць. Дадаць да Mapillary Дадаць да OpenPlaceReviews - Пераключыцца на выкарыстанне dev.openstreetmap.org замест openstreetmap.org для тэсціравання адпраўкі нататак OSM / POI / GPX. + Пераключыцца на выкарыстанне dev.openstreetmap.org замест openstreetmap.org для тэставання адпраўлення нататак OSM / POI / GPX. Выкарыстоўваць dev.openstreetmap.org OsmAnd паказвае фотаздымкі з некалькіх крыніц; \nOpenPlaceReviews - фотаздымкі POI; \nMapillary - выявы вуліц; -\nWeb / Wikimedia - фотаздымкі POI паводле дадзеных з OpenStreetMap. +\nWeb / Wikimedia - фотаздымкі POI паводле даных з OpenStreetMap. %1$s * %2$s Вы можаце выкарыстоўваць даныя пра вышыні, каб улічыць ўздымы/спускі падчас вашай паездкі Лёгкі самалёт @@ -3964,16 +3963,16 @@ \n \n Вярнуць назад усе пункты - Выберыце профіль, які будзе выкарыстоўвацца падчас запуску прыкладання. + Абярыце профіль, які будзе выкарыстоўвацца падчас запуску праграмы. Апошні раз выкарыстоўвалася Аддаваць перавагу пешаходным маршрутам Аддаваць перавагу пешаходным маршрутам - Дазвольце ручаі і меліярацыйныя каналы - Дазвольце ручаі і меліярацыйныя каналы - Дазволіць перарывістыя водныя маршруты - Дазволіць перарывістыя водныя маршруты - Дадаць анлайн-маршрутызатар - Рэдагаваць анлайн-маршрутызатар + Дазволіць ручаі і меліярацыйныя каналы + Дазволіць ручаі і меліярацыйныя каналы + Дазволіць перапынныя водныя маршруты + Дазволіць перапынныя водныя маршруты + Дадаць сеціўную сістэму маршрутызацыі + Рэдагаваць сеціўную сістэму маршрутызацыі Падтып Транспартны сродак Ключ API @@ -3981,17 +3980,17 @@ Увядзіце параметр Пакінуць пустым, калі не URL-адрас з усімі параметрамі будзе выглядаць так: - Тэст разліку маршруту - Ваджэнне + Тэставы разлік маршруту + Кіраванне Пешшу Ровар Аўтамабіль - Капіраваць адрас - Анлайн-маршрутызатар - Анлайн-маршрутызатары - Папкі - Выберыце папку - Выберыце папку або стварыце новую + Скапіяваць адрас + Сеціўная сістэма маршрутызацыі + Сеціўныя сістэмы маршрутызацыі + Каталогі + Абраць каталог + Абярыце каталог або стварыце новы Пуста Аналіз паводле інтэрвалаў Адправіць на OpenStreetMap @@ -4060,4 +4059,8 @@ Пазадарожнік Матацыкл Аўтамабіль + Аптымальны карацейшы маршрут + Значок бягучага месцазнаходжання будзе прыаязвацца да бягучага маршруту навігацыі + Разлік маршруту дапаможа пазбегнуць вялікіх схілаў. + Куплі \ No newline at end of file From 71919904703acf4d812de4cddaa5449986d3383b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Kotr=C4=8D?= Date: Mon, 15 Mar 2021 20:09:51 +0000 Subject: [PATCH 064/250] Translated using Weblate (Czech) Currently translated at 100.0% (3683 of 3683 strings) --- OsmAnd/res/values-cs/strings.xml | 55 ++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml index b03ed5cf61..67137eb49a 100644 --- a/OsmAnd/res/values-cs/strings.xml +++ b/OsmAnd/res/values-cs/strings.xml @@ -1401,7 +1401,7 @@ Soukromí Body Moje poloha - Spustit navigaci po trase? + Spustit navigaci podle stopy\? Vynutit náhradní trasu označením cest, kterým je nutné se vyhnout Záznam tras na vyžádání Povolit HTTP proxy @@ -2170,7 +2170,6 @@ Čas Celková vzdálenost Použít údaje o nadmořské výšce - Styl jízdy Vyberte složku pro soubor GPX Soubor se nepodařilo přesunout. @@ -3992,4 +3991,56 @@ OpenPlaceReviews Použít test.openplacereviews.org Přihlásit se do OpenPlaceReviews + Vybrat úseky + %1$s obsahuje více než jeden úsek, musíte vybrat potřebnou část pro navigaci. + Úsek %1$d + Voda + Zima + Sněžný skútr + Jízda na koni + Závody + Horské kolo + Jízda na kole + Turistika + Běh + Chůze + Terénní jízda + Motocykl + Automobil + Použít omezení, která jsou nyní aktivní na mapě + Optimalizovaná kratší trasa (úspora energie) + Vyberte účel řízení pro získání kratší, rychlejší nebo bezpečnější trasy + Ikona aktuální polohy bude zachycena na aktuální navigační trasu. + Neotáčet mapu, pokud rychlost je nižší než určitá mez + Restartovat + Všechny oblasti + Smazat %1$d souborů\? + Zastavit bez uložení + Uložit a zastavit záznam + Záznam stopy zastaven + Opravdu chcete ukončit záznam\? +\nVeškerá neuložená data budou ztracena. + Při pozastavení + Některá nastavení vyžadují restart aplikace. + Algoritmus výpočtu trasy se může vyhnout strmým svahům. + Přepínač pro zobrazení nebo skrytí nástroje Souřadnice na mapě. + Vzdálenost klepnutím + Dostupná nejnovější aktualizace OpenStreetMap: + Aktualizováno: %s + Poslední kontrola: %s + Frekvence aktualizací + Aktualizace mapy budou kontrolovány každý týden. Příští kontrola %1$s v %2$s. + Aktualizace mapy budou kontrolovány každý den. Příští kontrola %1$s v %2$s. + Aktualizace mapy budou kontrolovány každou hodinu. Příští kontrola %1$s v %2$s. + Smazat aktualizace + Opravdu chcete smazat všechny živé aktualizace (%s)\? + Nákupy + Vyberte kategorii nebo přidejte novou + Záznam bude pokračovat. + Kopírovat název bodu zájmu + Zobrazit/skrýt + Interval + Stopa neobsahuje údaje o nadmořské výšce. + Stopa neobsahuje údaje o rychlosti. + Vyberte prosím jiný typ obarvení. \ No newline at end of file From c3ddc79f91e36a9516c4a39befdd2a59a3d6d72d Mon Sep 17 00:00:00 2001 From: R3gi CZ Date: Mon, 15 Mar 2021 18:27:59 +0000 Subject: [PATCH 065/250] Translated using Weblate (Czech) Currently translated at 100.0% (3683 of 3683 strings) --- OsmAnd/res/values-cs/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml index 67137eb49a..ad80c28459 100644 --- a/OsmAnd/res/values-cs/strings.xml +++ b/OsmAnd/res/values-cs/strings.xml @@ -367,7 +367,7 @@ Smazat POI Směr kompasu Směr pohybu - Neotáčet (sever vždy nahoru) + Neotáčet (sever vždy nahoře) Směr natočení mapy: Natočení mapy Ukázat cestu From 04ff9585120a71504a52a24b41df5e51ebbc1e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Allan=20Nordh=C3=B8y?= Date: Mon, 15 Mar 2021 21:58:46 +0000 Subject: [PATCH 066/250] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegi?= =?UTF-8?q?an=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 58.6% (2161 of 3683 strings) --- OsmAnd/res/values-nb/strings.xml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml index 5324099e36..75fc2ea21e 100644 --- a/OsmAnd/res/values-nb/strings.xml +++ b/OsmAnd/res/values-nb/strings.xml @@ -2011,7 +2011,6 @@ Legg til ny mappe Spor Bruk høydedata - Melding Tillatelser Kunne ikke importere filen. Kontroller at OsmAnd har tillatelse til å lese den. @@ -3905,4 +3904,27 @@ Rediger beskrivelse Kopier til kartmarkører Kopier til favoritter + Laster opp %1$d av %2$d + Velg segmenter + Segment %1$d + Bruk test.openplacereviews.org + Vann + Vinter + Snøskuter + Terrengsykkel + Sykling + Motorsykkel + Bil + Slett %1$d filer\? + Oppdatert: %s + Slett oppdateringer + Kjøp + Velg kategori eller legg til en ny + Opptaket vil fortsette. + Kopier POI-navn + Vis/skjul + Intervall + Sporet inneholder ikke høydedata. + Sporet inneholder ikke hastighetsdata. + Velg en annen type fargelegging. \ No newline at end of file From 591f81169bafcca3f0b1c600cd184a00163186b8 Mon Sep 17 00:00:00 2001 From: Ammuu5 Date: Mon, 15 Mar 2021 21:21:17 +0000 Subject: [PATCH 067/250] Translated using Weblate (Finnish) Currently translated at 64.3% (2369 of 3683 strings) --- OsmAnd/res/values-fi/strings.xml | 88 +++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 29 deletions(-) diff --git a/OsmAnd/res/values-fi/strings.xml b/OsmAnd/res/values-fi/strings.xml index e2ecb5d234..d2bf0b233e 100644 --- a/OsmAnd/res/values-fi/strings.xml +++ b/OsmAnd/res/values-fi/strings.xml @@ -37,7 +37,7 @@ OsmAnd on avoimen lähdekoodin navigointisovellus offline ja online kartoille OsmAnd on avoimen lähdekoodin navigointisovellus offline ja online kartoille Liikennemuoto: - Valitse liikennemuoto + Liikennemuoto: Auringon nousu : %1$s \nAuringon lasku : %2$s Päivä/yö info @@ -201,7 +201,7 @@ Paikat Muut Nimi - Kategoria + Luokka Ei kiitos Päivä @@ -542,7 +542,7 @@ Muut kartat Tallenna videota Tallenna ääntä - Valitse videon tallennusformaatti + Videon tallennusformaatti: Videon tallennusformaatti Käytä ulkoista nauhoitinta Muuta ääni- ja videoasetuksia @@ -708,7 +708,7 @@ A-GPS tiedot Hallinta Valitse ajoalue, jotta liikennemerkit ja -määräykset ovat oikein: - OsmAnd tarjoaa maailmanlaajuisen offline karttaselailun, ja maailmanlaajuisen offline navigoinnin! + OsmAnd tarjoaa maailmanlaajuisen offline karttaselailun, ja offline navigoinnin. OSM muutokset lisätty paikalliseen muutosjoukkoon Haluatko varmasti lähettää %1$d muutosta(ksia) OSMiin\? Tyhjennetäänkö historia\? @@ -975,7 +975,8 @@ Maailmanlaajuiset tiedot (välillä 70 astetta pohjoista ja 70 astetta eteläist Kuukausimaksu Ei aktiivinen Ole hyvä ja anna julkinen nimi - Kiitos live-päivitysten tilauksesta! + Kiitos, että tuet OsmAndia! +\nAktivodaksesi kaikki uudet ominaisuudet, sinun on käynnistettävä OsmAnd uudelleen. Osa lahjoituksestasi lähetetään OSM-käyttäjille, jotka ovat lähettäneet muutoksia haluamallesi alueelle Osta OSM Live -tilaus ensin Tiedostonimi sisältää virheellisiä merkkejä @@ -1008,9 +1009,8 @@ Maailmanlaajuiset tiedot (välillä 70 astetta pohjoista ja 70 astetta eteläist Tilaa ei ole tarpeeksi! \n{3} Mt tarvitaan väliaikaisesti, {1} Mt pysyvästi. \n(Vain {2} Mt on käytettävissä.) - Lataa {0} tiedosto(a)? - Tallennnustilaa käytetään {3} Mt hetkellisesti, {1} Mt pysyvästi. - (Vapaata tilaa on {2} Mt.) + Lataa {0} tiedosto(a)\? +\nTallennnustilaa käytetään {3} Mt hetkellisesti, {1} Mt pysyvästi. (Vapaata tilaa on {2} Mt.) Lähetä OSM-huomautus Työkalupalkki Työkalut @@ -1317,7 +1317,7 @@ Maailmanlaajuiset tiedot (välillä 70 astetta pohjoista ja 70 astetta eteläist Vene Lentokone Laske reitti ensin - "Simuloi laskettua reittiä " + Simuloi käyttämällä laskettua reittiä Simuloi käyttäen GPX jälkeä Ei automaattista zoomausta Lähennä @@ -1413,7 +1413,7 @@ Maailmanlaajuiset tiedot (välillä 70 astetta pohjoista ja 70 astetta eteläist Ole hyvä ja odota kunnes nykyinen toiminto on suoritettu %1$d tiedostoa jäljellä Täydellinen versio - Keskeytä reitti + Hylätäänkö reitti\? Keskeytä suunnistus Poista määränpää Katunimi @@ -1448,7 +1448,7 @@ Maailmanlaajuiset tiedot (välillä 70 astetta pohjoista ja 70 astetta eteläist \nsovelluksen suoritus taustalta Pienoisreittikartta Aseta virkistyksen aikaväli: - Aseta nopeus reitin simuloinnille + Reitin simulointinopeus: Muistia varattu %1$s MB (Android raja %2$s MB, Dalvik %3$s MB). Jaa reitti GPX-tiedostona OsmAndista jaettu reitti @@ -1460,7 +1460,7 @@ Maailmanlaajuiset tiedot (välillä 70 astetta pohjoista ja 70 astetta eteläist Näytä lisää kartan yksityiskohtia Reititystiedot Online ja kuvakekartat - Käytä komentoja valitulla äänellä + Valitse ääni ja testaa toistamalla ilmoituksia: Testaa ääniohjeita Lahjoita nähdäksesi uusia ominaisuuksia totetettavaksi sovellutukseen Ota käyttöön esteettömyysominaisuudet @@ -1718,9 +1718,9 @@ Maailmanlaajuiset tiedot (välillä 70 astetta pohjoista ja 70 astetta eteläist " \n \nPaina pitkään nähdäksesi kartalla" - - -Paina ja pidä nähdäksesi kartalla + " +\n +\nPaina pitkään nähdäksesi vaihtoehdot" Alas/Ylös: %1$s OsmAnd reittisegmentin laskeminen ilman internettiä Laske OsmAnd reitti ensimmäiselle ja viimeiselle reitin segmentille @@ -1732,10 +1732,10 @@ Paina ja pidä nähdäksesi kartalla Mistä: Wi-Fi ei ole nyt yhdistetty. Haluatko käyttää nykyistä internet yhteytttä lataukseen? Ota käyttöön laskenta tarkalle reitille ilman pikkuvirheitä. Vielä etäisyysrajoitteinen ja hidas. - Valitse käytettäessä - Valitse oletustyökalutoiminto + Pyynnöstä\? + Oletustyökalutoiminto: Oletustyökalutoiminto - Käytä järjestelmän nauhoitinta videolle + Käytä järjestelmän nauhoitinta videolle. Käytä järjestelmän sovellutusta kuvalle Käytä kamerasovellutusta Audio/video on nauhoituksessa. Lopettaaksesi sen paina AV työkalua. @@ -1765,7 +1765,7 @@ Paina ja pidä nähdäksesi kartalla Keskeytä automaattiset ilmoitukset Reittiohjaus (äänipalautteena) Reittiohjaus (värinäpalautteena) - "Datahakemisto on vaihdettu sisäiseen muistiin, sillä valittu hakemisto on vain luku -tilassa. Ole hyvä ja valitse sopiva datahakemisto." + Vaihdettu sisäiseen muistiin, sillä valittu tallennushakemisto on kirjoitussuojattu. Ole hyvä ja valitse tallennushakemisto johon voi kirjoittaa. Tarvitsemme sen huolehtiaksemme tiedostasi maksuosuuksia varten Translitteroi, jos nimi puuttuu kielellä %1$s Translitteroi nimet @@ -1776,7 +1776,7 @@ Jos pidät OsmAndista ja OSMsta ja haluat tukea niitä, on tämä täydellinen t Aseta suurin sallittu odotusaika jokaiselle taustan paikanmäritykselle. Maksimi aika paikanmääritykselle Taustapalvelun käyttämä virkistyksen väliaika: - Valitse taustapalvelun käyttämä sijainnin tarjoaja + Taustapalvelun käyttämä sijaintitapa: Sijainnin tarjoaja Taustasuunnistuspalvelu tarvitsee sijainnin tarjoajan asetettavaksi päälle. Liikenne @@ -1815,7 +1815,7 @@ Jos pidät OsmAndista ja OSMsta ja haluat tukea niitä, on tämä täydellinen t Käytä magneetista sensoria Harkitse ostavasi Korkeuskäyrä laajennuksen Kaupasta tukeaksesi jatkokehitystä. Audio halutusta nauhoituksesta soitetaan. -%1$s +\n%1$s Tee audio muistiinpano Alppivaelluksen mittakaava (SAC) Hahmota polut SAC mittakaavan mukaisesti @@ -1898,7 +1898,6 @@ Jos pidät OsmAndista ja OSMsta ja haluat tukea niitä, on tämä täydellinen t Aika Kokonaisetäisyys Käytä korkeustietoja - Jaa automaattisesti nauhoitukset tauon jälkeen Piilota vesi Toiminnon nimi @@ -2063,7 +2062,7 @@ Jos pidät OsmAndista ja OSMsta ja haluat tukea niitä, on tämä täydellinen t Matkaoppaat Välietapit poistettu karttamarkkereista Mitään ei löydetty: - Lisää kaikki jäljen välietapit tai valitse erilliset kategoriat. + Lisää kaikki jäljen välietapit tai valitse erilliset luokat. Yhteensä Poista kaikki välipisteet Ryhmä poistettu @@ -2081,7 +2080,7 @@ Jos pidät OsmAndista ja OSMsta ja haluat tukea niitä, on tämä täydellinen t Lisää välipysähdys Lisää ensimmäisen pysähdys Näytä suljetut huomautukset - Näytä/piilota OSM-huomautukset kartalla. + Näytä tai piilota OSM-huomautukset kartalla. GPX - soveltuu vietäväksi JOSM:iin tai muihin OSM-editoreihin. OSC - soveltuu vietäväksi OpenStreetMappiin. GPX-tiedosto @@ -2132,7 +2131,7 @@ Jos pidät OsmAndista ja OSMsta ja haluat tukea niitä, on tämä täydellinen t Näytä suuntaviiva sijainnistasi aktiivisten markkerien sijainteihin. Näytä yksi tai kaksi nuolta ilmaisemaan suunta aktiivisiin markkereihin. Valitse, kuinka etäisyys aktiivisiin pisteisiin näytetään. - Määritä suuntailmaisimien lukumäärä: + Määritä suuntailmaisimien lukumäärä. Desimaalien määrä Muokkaa toimintoja DD°MM′SS″ @@ -2207,8 +2206,8 @@ Jos pidät OsmAndista ja OSMsta ja haluat tukea niitä, on tämä täydellinen t Valitse postinumero Kartan automaattinen tarkennus päälle/pois Tämän toimintonappulan koskettaminen ottaa käyttöön/poistaa käytöstä nopeuteesi perustuvan kartan automaattisen tarkennuksen. - "Ota kartan automaattinen tarkennus käyttöön " - "Poista kartan automaattinen tarkennus käytöstä " + Ota automaattinen tarkennus käyttöön + Poista automaattinen tarkennus käytöstä Aseta määränpää Korvaa määränpää Lisää ensimmäinen välietappi @@ -2223,7 +2222,7 @@ Jos pidät OsmAndista ja OSMsta ja haluat tukea niitä, on tämä täydellinen t Näytä artikkeli selaimessa. Kuinka avata Wikipedia artikkelit? Kiitos palautteestasi - Lisää lähtö- ja maalipisteet + Lisää lähtö ja määränpää Lisää lähtöpiste Valitse lähtöpiste Päällystämätön @@ -2508,7 +2507,7 @@ Jos pidät OsmAndista ja OSMsta ja haluat tukea niitä, on tämä täydellinen t Kartan symboliikkaopas. Navigointiprofiilit baškiiri - Voit siirtää kohteita vain tämän kategorian sisällä. + Voit siirtää kohteita vain tämän luokan sisällä. Moottorikelkka Kielet Kieli @@ -2730,4 +2729,35 @@ Jos pidät OsmAndista ja OSMsta ja haluat tukea niitä, on tämä täydellinen t Lähetetty %1$d muutosta %2$d muutoksesta Lähetettiin %1$d muutosta %2$d muutoksesta Valitse lähetettävät muutokset + Ei hakutuloksia\? +\nAntaa palautetta + Suosi vaellusreittejä + Suosi vaellusreittejä + Järjestä luokat uudelleen + Valitse luokka tai lisää uusi + Valitse valinnainen luokka. + Lajittele luokan mukaan + Lisää oma luokka + Näytä/piilota + Harkitse väliaikaisia rajoituksia + Aloita nauhottaminen + Tallenna ja lopeta nauhoitus + Haluatko varmasti lopettaa nauhoituksen\? +\nKaikki tallentamattomat tiedot menetetään. + Nauhoitusta jatketaan. + Laajennuksen lisäämät profiilit + Lisätyt profiilit + Profiilin ulkoasu + Lisätäänkö uusi profiili \'%1$s\'\? + Pääprofiili + Palautetaanko kaikki profiiliasetukset\? + Mukautettu profiili + Profiilin varmuuskopiointi epäonnistui. + Tallennetaan uutta profiilia + Palautetaanko kaikki profiiliasetukset\? + Lisää profiili + Vaihda sovelluksen profiilia + Tällaisia profiileja ei löytynyt. + OsmAnd-profiili + Käyttäjäprofiili \ No newline at end of file From 3a1e5b92f3e0fe1bdb8c11a45f66ec409b4ed04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Kotr=C4=8D?= Date: Mon, 15 Mar 2021 19:47:35 +0000 Subject: [PATCH 068/250] Translated using Weblate (Czech) Currently translated at 99.6% (3882 of 3894 strings) --- OsmAnd/res/values-cs/phrases.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/OsmAnd/res/values-cs/phrases.xml b/OsmAnd/res/values-cs/phrases.xml index 62402909c7..5183bec826 100644 --- a/OsmAnd/res/values-cs/phrases.xml +++ b/OsmAnd/res/values-cs/phrases.xml @@ -3881,13 +3881,13 @@ Delegace Pobočka Vedená velvyslancem - - - - - - - - - + + + + + + + + + Skoky na lyžích \ No newline at end of file From 104f644dcd06bd97ef398d77e44445833f599fb7 Mon Sep 17 00:00:00 2001 From: jan madsen Date: Mon, 15 Mar 2021 19:26:40 +0000 Subject: [PATCH 069/250] Translated using Weblate (Danish) Currently translated at 98.6% (3843 of 3894 strings) --- OsmAnd/res/values-da/phrases.xml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-da/phrases.xml b/OsmAnd/res/values-da/phrases.xml index aaa4b1ff7c..df087a8bda 100644 --- a/OsmAnd/res/values-da/phrases.xml +++ b/OsmAnd/res/values-da/phrases.xml @@ -3604,7 +3604,7 @@ Adgang for køretøjer: militær Adgang for køretøjer: levering Adgang for køretøjer: skovbrug - Adgang for biler: + Adgang for biler: ja Adgang for biler: privat Adgang for biler: nej Adgang for biler: destination @@ -3861,4 +3861,23 @@ Vandtank Vaccination: COVID19 Vaccination + Lokal reference + Konferencecenter + Pistestatus: lukket + Pistestatus: åben + Patruljeret: nej + Patruljeret: ja + Pistenavn + Skihop + Flagermustunnel + Flagermusbro + Svømmeområde + Vægtbro + Rangerstation + Brønd + Motordrevet pumpe + Vandhane + Vandværk + Rørformet brønd + Livredderbase \ No newline at end of file From f1cbbf6de515f7960090f074f10a01b3cafcb41e Mon Sep 17 00:00:00 2001 From: Hakuchi Date: Mon, 15 Mar 2021 19:50:12 +0000 Subject: [PATCH 070/250] Translated using Weblate (German) Currently translated at 99.9% (3891 of 3894 strings) --- OsmAnd/res/values-de/phrases.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-de/phrases.xml b/OsmAnd/res/values-de/phrases.xml index 8b22b3c094..e1ec97249b 100644 --- a/OsmAnd/res/values-de/phrases.xml +++ b/OsmAnd/res/values-de/phrases.xml @@ -209,7 +209,7 @@ Markthalle Furt Festung - Brunnen + Zierbrunnen Bilderrahmengeschäft Tankstelle;Tankanlage;Tankstation Bestatter @@ -3213,7 +3213,7 @@ Chlor Umkehrosmose Aquatabs - Brunnen + Ziehbrunnen Rohrleitung Fließendes Wasser Pumpe From 699772a63364cd876262b11318e2fd5deb5eee32 Mon Sep 17 00:00:00 2001 From: letypequividelespoubelles Date: Mon, 15 Mar 2021 20:00:46 +0000 Subject: [PATCH 071/250] Translated using Weblate (French) Currently translated at 99.7% (3886 of 3894 strings) --- OsmAnd/res/values-fr/phrases.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-fr/phrases.xml b/OsmAnd/res/values-fr/phrases.xml index a1c8bd97c5..ec8b6a2227 100644 --- a/OsmAnd/res/values-fr/phrases.xml +++ b/OsmAnd/res/values-fr/phrases.xml @@ -2737,7 +2737,7 @@ Poissons Balise de chemin Seulement quand la traversée est autorisée - Arrière-pays + Non damée Cabine/Siège/capacité de voiture Cartes de comptes Cartes de compte non acceptées @@ -3881,4 +3881,9 @@ Station de traitement des déchets Pont de levage Poste de garde forestier + Centre de conférence + Statut de la piste : fermée + Statut de la piste : ouvert + Nom de la piste + Saut à ski \ No newline at end of file From c35f9c58676bda43e6fc666b70d7996abd2dbca3 Mon Sep 17 00:00:00 2001 From: Ihor Hordiichuk Date: Tue, 16 Mar 2021 00:34:30 +0000 Subject: [PATCH 072/250] Translated using Weblate (Ukrainian) Currently translated at 100.0% (3894 of 3894 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 eacfb07e4b..015cddb2a8 100644 --- a/OsmAnd/res/values-uk/phrases.xml +++ b/OsmAnd/res/values-uk/phrases.xml @@ -3891,4 +3891,7 @@ Реєстр вершин: так Розчищена поляна: так Місце зупинка мобільної бібліотеки + Локальне посилання + Геодезист + Конференц-центр \ No newline at end of file From d6e8232793fddecc1f5e1d9139652dbdd0ae51f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Babos=20G=C3=A1bor?= Date: Tue, 16 Mar 2021 07:59:21 +0000 Subject: [PATCH 073/250] Translated using Weblate (Hungarian) Currently translated at 99.9% (3892 of 3894 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 a793df4b0c..8176745fa7 100644 --- a/OsmAnd/res/values-hu/phrases.xml +++ b/OsmAnd/res/values-hu/phrases.xml @@ -3889,4 +3889,7 @@ Pálya állapota: nyitva Pálya neve Síugrósánc + Vágány / kocsiállás + Földmérő + Konferencia-központ \ No newline at end of file From 499d14371a4708a9322a4332c4067c69834b5b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristjan=20R=C3=A4ts?= Date: Mon, 15 Mar 2021 22:24:53 +0000 Subject: [PATCH 074/250] Translated using Weblate (Estonian) Currently translated at 100.0% (3894 of 3894 strings) --- OsmAnd/res/values-et/phrases.xml | 35 ++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/OsmAnd/res/values-et/phrases.xml b/OsmAnd/res/values-et/phrases.xml index c5f52140db..bedf904c3f 100644 --- a/OsmAnd/res/values-et/phrases.xml +++ b/OsmAnd/res/values-et/phrases.xml @@ -406,7 +406,7 @@ Ehitus Töökoht Kaevandusšaht - Adit + Stoll Naftakaev Vaatluspunkt Tuuleveski @@ -457,9 +457,9 @@ Verepank Ämmaemand Tööterapeut - Optometrist + Silmaarst Füsioterapeut - Podiatrist + Jalaarst Psühhoterapeut Taastusravi Kõneterapeut @@ -676,7 +676,7 @@ Traavivõistlused Uisutamine Jäävaru - Korfball + Korfpall Orienteerumine Mõlatennis Paraliuglemine @@ -1154,7 +1154,7 @@ Bahaism Saientologism Paganlus - Tenrikyo + Tenrikyō Zoroastrism Katoliku Baptist @@ -1177,7 +1177,7 @@ Uus apostliku Inglismaa kirik Piiskoplik - Shia + Šiism Ühine Kreeka katoliku Tiibeti @@ -1197,7 +1197,7 @@ Koguduse Vanausulised Serbia õigeusu - Spiritist + Spiritistlik Armeenia apostellik Hollandi reformitud Apostellik @@ -2959,7 +2959,7 @@ Brasserie Mullitee Yakitori - Sagardotegia + Siidrimaja Liha Tiivad Vahvlid @@ -3252,7 +3252,7 @@ Veekaev Torustik Jooksev vesi - Pump + Veepump Puurauk Veetransport Veemahuti @@ -3726,7 +3726,7 @@ Postfinance kaart Migros pank Girocard - Postbank + Postipank Kuumaveeallikas Onsen Hammam @@ -3750,7 +3750,7 @@ URL Liik Olek - Scoria + Räbu Kihtvulkaan Kilp Maar @@ -3881,4 +3881,17 @@ Tunnel nahkhiirtele Sild nahkhiirtele Metsloomade teeületuskoht + Kohalik viide + Geodeetik + Konverentsikeskus + Mobiilse raamatukogu peatus + Tipu register: ei + Tipu register: jah + Nõlva olek: suletud + Nõlva olek: avatud + Patrullitud: ei + Patrullitud: jah + Lagendikega: jah + Nõlva nimi + Suusahüpped \ No newline at end of file From 7fe957c712c92ab1723d7d15521361497ca76afd Mon Sep 17 00:00:00 2001 From: Franco Date: Tue, 16 Mar 2021 01:26:57 +0000 Subject: [PATCH 075/250] Translated using Weblate (Spanish (Argentina)) Currently translated at 99.9% (3682 of 3683 strings) --- OsmAnd/res/values-es-rAR/strings.xml | 64 ++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml index b00f05b3e8..4646f1e575 100644 --- a/OsmAnd/res/values-es-rAR/strings.xml +++ b/OsmAnd/res/values-es-rAR/strings.xml @@ -2056,11 +2056,11 @@ Grabar Sin datos Activar la grabación rápida - Muestra una notificación del sistema que permite iniciar la grabación del viaje. + Muestra una notificación del sistema que permite iniciar la grabación de viaje. Notificaciones Sin archivos de trazas aún También puedes añadir archivos de trazas a la carpeta - Añadir más… + Añadir Aspecto Muy fino Cálculo de la ruta @@ -2171,7 +2171,6 @@ Tiempo Distancia total Usar datos de elevación - Estilo de conducción Marcar la carpeta del archivo GPX No se pudo mover el archivo. @@ -2305,11 +2304,11 @@ \n • (Opcional) Muestra la velocidad y altitud \n • Activa la visualización de las curvas de nivel y el sombreado de colinas (mediante un complemento adicional) Contribuye directamente con OSM -\n • Informa sobre problemas de datos en el mapa -\n • Sube trazas GPX a OSM directamente desde la aplicación -\n • Añade PDI y súbelos directamente a OSM (o más tarde, si no estás conectado) -\n • (Opcional) Grabación del viaje en modo reposo (mientras el dispositivo está bloqueado) -\n OsmAnd es un software de código abierto, activamente desarrollado. Cualquiera puede contribuir con la aplicación informando sobre errores, mejorando las traducciones o desarrollando nuevas funciones. Además, el proyecto también depende de contribuciones financieras para desarrollar y probar nuevas funcionalidades. +\n• Informa sobre problemas de datos en el mapa +\n• Sube trazas GPX a OSM directamente desde la aplicación +\n• Añade PDI y súbelos directamente a OSM (o más tarde, si no estás conectado) +\n• (Opcional) Grabación de viaje en modo reposo (mientras el dispositivo está bloqueado) +\nOsmAnd es un software de código abierto, activamente desarrollado. Cualquiera puede contribuir con la aplicación informando sobre errores, mejorando las traducciones o desarrollando nuevas funciones. Además, el proyecto también depende de contribuciones financieras para desarrollar y probar nuevas funcionalidades. \n Cobertura y calidad aproximada del mapa: \n • Europa Occidental: **** @@ -3323,7 +3322,7 @@ Tamaño de imagen, calidad de audio y video Inicio de sesión, contraseña, edición sin conexión Elegir icono, color y nombre - Permite compartir la ubicación actual utilizando la grabación del viaje. + Permite compartir la ubicación actual utilizando la grabación de viaje. Seguimiento en línea Precisión de registro Puedes encontrar todas tus trazas grabadas en «%1$s» o en la carpeta OsmAnd usando el administrador de archivos. @@ -3742,7 +3741,7 @@ Añadir archivos de traza Añadir punto de referencia de la traza Añadir punto de referencia de la traza - Grabación del viaje + Grabación de viaje Guardar como archivo de traza Seguir traza Elige el archivo de la traza a seguir @@ -3765,8 +3764,8 @@ Grabar La grabación de la traza se pausará al cerrar la aplicación (mediante aplicaciones recientes). (La indicación de fondo de OsmAnd, desaparecerá de la barra de notificaciones de Android.) Intervalo de registro para la grabación general de trazas (activado desde el widget «Grabación de viaje» en el mapa). - Pausar grabación del viaje - Reanudar grabación del viaje + Pausar grabación de viaje + Reanudar grabación de viaje Predefinido del sistema Todos los segmentos posteriores Segmento anterior @@ -3777,7 +3776,7 @@ Abrir traza guardada está guardado Sólo se guardará la línea de la ruta, los puntos de referencia serán borrados. - %s archivo(s) de trazas marcado(s) + Se muestran %s trazas Añade al menos dos puntos. Rehacer • Se ha actualizado la función «Planificar ruta»: permite utilizar diferentes tipos de navegación por segmento y la inclusión de trazas @@ -4007,4 +4006,43 @@ Todo terreno Motocicleta Automóvil + Distancia al pulsar + Mostrar/Ocultar + Elegir segmentos + «%1$s» contiene más de un segmento, debe marcar la parte necesaria para la navegación. + Segmento %1$d + Usar las restricciones viales que están activas ahora en el mapa + Ruta optimizada más corta (bajo consumo) + Elige el propósito de la conducción para obtener la ruta más corta, más rápida o más segura + El icono de la ubicación actual se ajustará a la ruta de navegación actual + No girar la vista del mapa si la velocidad es inferior a un umbral + Reiniciar + Todas las regiones + ¿Borrar %1$d archivos\? + Parar sin guardar + Guardar y parar la grabación + Grabación de la traza detenida + ¿Dejar de grabar\? +\nTodos los datos no guardados se perderán. + En pausa + Es necesario reiniciar la aplicación para aplicar algunos ajustes. + La ruta podría evitar las fuertes subidas. + Alternar para mostrar u ocultar el widget de coordenadas en el mapa. + Última actualización de OpenStreetMap disponible: + Actualizado: %s + Última comprobación: %s + Frecuencia de actualización + Las actualizaciones del mapa serán comprobadas cada semana. La próxima vez %1$s en %2$s. + Las actualizaciones del mapa serán comprobadas cada día. La próxima vez %1$s en %2$s. + Las actualizaciones del mapa serán comprobadas cada hora. La próxima vez %1$s en %2$s. + Borrar actualizaciones + ¿Borrar todas las actualizaciones en vivo de «%s»\? + Compras + Marca una categoría o añade una nueva + La grabación continuará. + Copiar nombre del PDI + Intervalo + La traza no contiene datos de altitud. + La traza no contiene datos de velocidad. + Elige otro tipo de color. \ No newline at end of file From 51eb0098d316127a57779ff523190148e7af159a Mon Sep 17 00:00:00 2001 From: Franco Date: Mon, 15 Mar 2021 19:24:35 +0000 Subject: [PATCH 076/250] Translated using Weblate (Spanish (Argentina)) Currently translated at 100.0% (3894 of 3894 strings) --- OsmAnd/res/values-es-rAR/phrases.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-es-rAR/phrases.xml b/OsmAnd/res/values-es-rAR/phrases.xml index ebc5155a51..7d21230273 100644 --- a/OsmAnd/res/values-es-rAR/phrases.xml +++ b/OsmAnd/res/values-es-rAR/phrases.xml @@ -3813,7 +3813,7 @@ Municipio Flecha: no Ascensor - A horario + Tabla de horarios En tiempo real Con retraso @@ -3891,4 +3891,7 @@ Arboleda: sí Nombre de la pista Salto con esquís + Referencia local + Geodésico + Centro de conferencias \ No newline at end of file From b8d16fe441547236bb686125ba6a6f360f47c495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristjan=20R=C3=A4ts?= Date: Tue, 16 Mar 2021 06:23:23 +0000 Subject: [PATCH 077/250] Translated using Weblate (Estonian) Currently translated at 100.0% (3683 of 3683 strings) --- OsmAnd/res/values-et/strings.xml | 147 ++++++++++++++++++++++++++++--- 1 file changed, 136 insertions(+), 11 deletions(-) diff --git a/OsmAnd/res/values-et/strings.xml b/OsmAnd/res/values-et/strings.xml index a258173a70..1a5bd7a987 100644 --- a/OsmAnd/res/values-et/strings.xml +++ b/OsmAnd/res/values-et/strings.xml @@ -643,7 +643,7 @@ Tänav Teenindus Jalgtee - Rada + Teekond Ratsutamistee Trepiastmed Rada @@ -1212,7 +1212,7 @@ Vahendusserver Määra vahendusserver. Privaatsus - Alusta navigeerimist mööda rada\? + Alusta teekonna navigeerimist\? Jalakäijate ülekäigurajad Tee stiil Vaikimisi @@ -2176,7 +2176,7 @@ Muud Määra kiiruse ühik. Kiiruse ühik - nmi + M Meremiilid Kilomeetrit tunnis Miili tunnis @@ -2492,7 +2492,6 @@ Kuva sügavuskontuurid ja -punktid. Meresügavuse kontuurid Kasuta kõrgusandmeid - Laskumine Tõus Kõrgusevahe @@ -3306,7 +3305,7 @@ Luba ekspertmarsruudid Äärmiselt rasked marsruudid ohtlike takistuste ja ümbrusega. Luba ainult uisutamismarsruudid - Rajad, mis on hooldatud vabastiilis või ainult klassikaliste radadeta uisutamiseks. + Rajad, mis on hooldatud vabastiilis või ainult klassikaliseks radadeta uisutamiseks. Luba ainult klassikalisi marsruute Klassikalises stiilis hooldatud marsruudid ainult ilma uisuradadeta. See hõlmab väiksema mootorsaaniga hooldatud marsruute ja suusatajate käsitsi tehtud radu. Eelistatud raskusaste @@ -3481,7 +3480,7 @@ Suunanooled Viimati muudetud Impordi rada - Ava olemasolev rada + Ava olemasolev teekond Vali avatav rajafail. Loo uus marsruut Valmis @@ -3611,7 +3610,7 @@ Nendele toimingutele pääsed ligi klõpsides nuppu „%1$s“. Juriidiline teave Pööra marsruut teistpidi - Terve rada + Kogu teekond Järgmine segment Navigeerimisprofiil Vali rajafail, millele lisame uue segmendi. @@ -3650,10 +3649,10 @@ Lisa rajale teekonnapunkt Teekonna salvestamine Salvesta rada failina - Jälgi rada + Järgi teekonda Vali rajafail, mida soovid kasutada Vali rajafail, mida soovid kasutada või impordi see oma nutiseadmest. - Vali muu rada + Vali muu teekond Navigeeri minu asukohast rajale Asukoht rajal, kuhu me liigume Raja algus @@ -3661,7 +3660,7 @@ Kustuta aadress Lisa aadress Sisesta aadress - Lihtsustatud rada + Lihtsustatud teekond Salvestatakse ainult üldine marsruut, teekonnapunktid kustutatakse. Faili nimi %s rajafaili valitud @@ -3674,7 +3673,7 @@ Ainult valitud segment arvutatakse ümber vastavalt valitud profiilile. Kõik järgnevad segmendid arvutatakse ümber vastavalt valitud profiilile. Kõik eelmised segmendid arvutatakse ümber vastavalt valitud profiilile. - Ava salvestatud rada + Ava salvestatud teekond on salvestatud SALVESTA Toimingunupp lülitub valitud profiilide vahel. @@ -3925,4 +3924,130 @@ Laadin üles muudatusi %1$d/%2$d Sai üleslaaditud Laadin üles + Maastikul + Kaardi värskendusi kontrollitakse kord nädalas. Järgmine kord %1$s %2$s. + Kaardi värskendusi kontrollitakse kord päevas. Järgmine kord %1$s %2$s. + Kaardi värskendusi kontrollitakse kord tunnis. Järgmine kord %1$s %2$s. + Häälteavituste ajad + Eelista matkaradu + Eelista matkaradu + Luba ojad ja kraavid + Luba ojad ja kraavid + Luba vahele jäävad veeteed + Luba vahele jäävad veeteed + Lisa võrgus olev marsruutimissüsteem + Muuda võrgus olevat marsruutimissüsteemi + Alamliik + Sõiduk + API võti + Serveri aadress + Sisesta parameeter + Vastasel korral jäta tühjaks + Kohaviit võigi parameetritega näeb välja nii: + Proovi marsruudi arvutust + Sõites + Jalgsi + Jalgratas + Auto + Kopeeri aadress + Marsruutimissüsteem võrgus + Kas kustutada see võrgus olev marsruutimissüsteem\? + Marsruutimissüsteemid võrgus + Kaustad + Vali kaust + Vali kaust või loo uus + Tühi + Analüüsi poolitamise intervalle + OpenStreetMap teenusesse laadimine + Vaheta kaust + sek + Möödasõit + Lähenemine + Pikk ettevalmistus + Ettevalmistus + Kõrvalekalle marsruudist + Sihtkohta saabumine + Aja ja kauguse intervallid + Erinevate häälteavituste esitamise aeg sõltub tevituse tüübist, navigeerimise kiirusest hetkel ja vaikimisi navigeerimise kiirusest. + Teavitamise aeg + Alusta salvestamist + Ratastool + Matkamine + Kõndimine + Elektrirattasõit + Mägirattasõit + Maanterattasõit + Harilik rattasõit + Raskeveokid + Väikeveok + Veoauto + Tõukeratas + Maanteeratas + Mägiratas (MTB) + Loe kõik + Muuda kirjeldust + Kustuta kontollpunktid + Kopeeri kaardi markeritesse + Kopeeri lemmikutesse + Vali segmendid + %1$s sisaldab enam kui ühe segmendi. Navigeerimiseks pead sa valima vajaliku osa. + Segment %1$d + Reljeefi varjutus / Nõlv / Kontuurjooned + OpenPlaceReviews on kogukonna juhitud projekt avalikest kohtadest nagu restoranid, hotellid, muuseumid ja kontrollpunktid. See kogub nende kohta igasugu avalikku teavet nagu fotod, ülevaated ja viited teistesse süsteemidesse nagu OpenStreetMap või Wikipeedia. +\n +\nKõik OpenPlaceReview andmed on avalikud ja kõigile kättesaadavad aadressil http://openplacereviews.org/data. +\n +\nTäiendavalt saad lugeda aadressil http://openplacereviews.org + OpenPlaceReviews + Kasuta teenust test.openplacereviews.org + OpenPlaceReviews login + Vesi + Talv + Mootorsaan + Ratsutamine + Võistlus + Mägirattasõit + Rattasõit + Matkamine + Jooksmine + Kõndimine + Mootorratas + Auto + Kasuta tee piiranguid, mis on kaardil hetkel aktiivsed + Vali sõidu eesmärk, et leida lühem, kiirem või turvalisem marsruut + Muuda teekonda + Nimeta teekond ümber + Kuva teekond kaardil + Ära pööra kaardivaadet, kui kiirus on täpsuse lävest madalam + Taaskäivita + Kõik regioonid + Kas kustutada %1$d filai\? + Peata salvestamata + Salvesta ja peata salvestamine + Kas sa soovid kindlasti salvestamise peatada\? +\nSalvestamata andmed kaotatakse. + Teekonna salvestamine peatatud + Peatatud + Mõningate seadete rakendamiseks on vajalik rakenduse taaskäivitamine. + Lüliti, mis kuvab või peidab koordinaatide vidina kaardil. + Uusimad OpenStreetMap värskendused on saadaval: + Värskendatud: %s + Viimane kontroll: %s + Värskenduste kontrolli sagedus + Kustuta värskendused + Kas sa tõesti soovid kustutada kõik %s reaalaja värskendust\? + Vali kategooria või lisa uus + Salvestamist jätkatakse. + Kopeeri huvipunkti nimi + Kuva/peida + Intervall + Teekond ei sisalda kõrguse andmeid. + Teekond ei sisalda kiiruse andmeid. + Palun vali muud moodi värvimine. + Optimeeritud lühem marsruut (energiat säästev) + Hetkeasukoha ikoon seotakse aktiivse navigeerimismarsruudiga + Marsruudi loomisel võiks vältida raskeid tõuse. + Pööra + Ostud + Kaugus toksamise järgi \ No newline at end of file From 1ee03a6d0b9f335524bb8bf1e19bc295d326b283 Mon Sep 17 00:00:00 2001 From: Ammuu5 Date: Mon, 15 Mar 2021 21:28:43 +0000 Subject: [PATCH 078/250] Translated using Weblate (Finnish) Currently translated at 38.9% (1515 of 3894 strings) --- OsmAnd/res/values-fi/phrases.xml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-fi/phrases.xml b/OsmAnd/res/values-fi/phrases.xml index 7751c5bb95..9ca9614c57 100644 --- a/OsmAnd/res/values-fi/phrases.xml +++ b/OsmAnd/res/values-fi/phrases.xml @@ -395,7 +395,7 @@ 91UL polttoaine 100LL polttoaine Jet A-1 polttoaine - AdBlue polttoaine + Diesel-pakokaasuneste Polttoaine: puu Polttoaine: puuhiili Polttoaine: hiili @@ -1233,7 +1233,7 @@ Ei korjaamoa Sähköajoneuvojen korjaamo Moottoripyöräkorjaamo - Ei itsepalvelua + Ei Ei automaattinen Täysi palvelu Ei harjatonta pesua @@ -1253,7 +1253,7 @@ Vauvan vaihtopöytä Ei vauvan vaihtopöytää Vaipanvaihtohuone - Ei autopesua + Ei Maksimipysäköintiaika Pysäköintilippuja Savukkeita @@ -1522,4 +1522,11 @@ Vieras talo Majapaikka Vuoristorata + Yrttikauppa + Konsulaatti + Nuoli + Tärinä + Paine + Erityinen rakennus + Rakennustarvikkeet \ No newline at end of file From e33affa764696cc8b220b71274e55cf8a19b43e5 Mon Sep 17 00:00:00 2001 From: Franco Date: Tue, 16 Mar 2021 01:21:41 +0000 Subject: [PATCH 079/250] Translated using Weblate (Spanish (American)) Currently translated at 98.9% (3645 of 3683 strings) --- OsmAnd/res/values-es-rUS/strings.xml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/OsmAnd/res/values-es-rUS/strings.xml b/OsmAnd/res/values-es-rUS/strings.xml index d645598dec..8bc855c80d 100644 --- a/OsmAnd/res/values-es-rUS/strings.xml +++ b/OsmAnd/res/values-es-rUS/strings.xml @@ -2056,11 +2056,11 @@ Grabar Sin datos Activar la grabación rápida - Muestra una notificación del sistema que permite iniciar la grabación del viaje. + Muestra una notificación del sistema que permite iniciar la grabación de viaje. Notificaciones Sin archivos de trazas aún También puedes añadir archivos de trazas a la carpeta - Añadir más… + Añadir Aspecto Muy fino Cálculo de la ruta @@ -2171,7 +2171,6 @@ Tiempo Distancia total Usar datos de elevación - Estilo de conducción Marcar la carpeta del archivo GPX No se pudo mover el archivo. @@ -2305,11 +2304,11 @@ \n • (Opcional) Muestra la velocidad y altitud \n • Activa la visualización de las curvas de nivel y el sombreado de colinas (mediante un complemento adicional) Contribuye directamente con OSM -\n • Informa sobre problemas de datos en el mapa -\n • Sube trazas GPX a OSM directamente desde la aplicación -\n • Añade PDI y súbelos directamente a OSM (o más tarde, si no estás conectado) -\n • (Opcional) Grabación del viaje en modo reposo (mientras el dispositivo está bloqueado) -\n OsmAnd es un software de código abierto, activamente desarrollado. Cualquiera puede contribuir con la aplicación informando sobre errores, mejorando las traducciones o desarrollando nuevas funciones. Además, el proyecto también depende de contribuciones financieras para desarrollar y probar nuevas funcionalidades. +\n• Informa sobre problemas de datos en el mapa +\n• Sube trazas GPX a OSM directamente desde la aplicación +\n• Añade PDI y súbelos directamente a OSM (o más tarde, si no estás conectado) +\n• (Opcional) Grabación de viaje en modo reposo (mientras el dispositivo está bloqueado) +\nOsmAnd es un software de código abierto, activamente desarrollado. Cualquiera puede contribuir con la aplicación informando sobre errores, mejorando las traducciones o desarrollando nuevas funciones. Además, el proyecto también depende de contribuciones financieras para desarrollar y probar nuevas funcionalidades. \n Cobertura y calidad aproximada del mapa: \n • Europa Occidental: **** @@ -3322,7 +3321,7 @@ Tamaño de imagen, calidad de audio y video Inicio de sesión, contraseña, edición sin conexión Elegir icono, color y nombre - Permite compartir la ubicación actual utilizando la grabación del viaje. + Permite compartir la ubicación actual utilizando la grabación de viaje. Seguimiento en línea Precisión de registro Puedes encontrar todas tus trazas grabadas en «%1$s» o en la carpeta OsmAnd usando el administrador de archivos. @@ -3708,7 +3707,7 @@ Go-kart Añadir a una traza El punto añadido no será visible en el mapa, ya que el grupo elegido está oculto, se puede encontrar en «%s». - %s archivo(s) de trazas marcado(s) + Se muestran %s trazas Traza completa Distancia de umbral Predefinido del sistema @@ -3757,12 +3756,12 @@ Navegar desde mi ubicación a la traza Grabar Guardar como archivo de traza - Grabación del viaje + Grabación de viaje Trazas En caso de dirección inversa Elige el archivo de la traza a seguir o impórtala desde el dispositivo. - Pausar grabación del viaje - Reanudar grabación del viaje + Pausar grabación de viaje + Reanudar grabación de viaje Elige el archivo de la traza a seguir Seguir traza Importa o graba archivos de trazas From 45d3a68b4a251ce0728d568b450843ccc2c62d2b Mon Sep 17 00:00:00 2001 From: Franco Date: Tue, 16 Mar 2021 01:30:09 +0000 Subject: [PATCH 080/250] Translated using Weblate (Spanish (American)) Currently translated at 100.0% (3894 of 3894 strings) --- OsmAnd/res/values-es-rUS/phrases.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-es-rUS/phrases.xml b/OsmAnd/res/values-es-rUS/phrases.xml index 7241c7f79b..1eb2e19c0f 100644 --- a/OsmAnd/res/values-es-rUS/phrases.xml +++ b/OsmAnd/res/values-es-rUS/phrases.xml @@ -3891,4 +3891,7 @@ Patrullado: no Biblioteca móvil (parada) Arboleda: sí + Referencia local + Geodésico + Centro de conferencias \ No newline at end of file From b832e07ca16a683f59c09b27b5e1a64869fa1383 Mon Sep 17 00:00:00 2001 From: Verdulo Date: Tue, 16 Mar 2021 02:26:05 +0000 Subject: [PATCH 081/250] Translated using Weblate (Esperanto) Currently translated at 100.0% (3683 of 3683 strings) --- OsmAnd/res/values-eo/strings.xml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml index 93d1133076..b3537b5d78 100644 --- a/OsmAnd/res/values-eo/strings.xml +++ b/OsmAnd/res/values-eo/strings.xml @@ -3,7 +3,7 @@ Supra breto Rekalkuli kurson Donacoj - Nombro da ricevontoj + Nombro de ricevontoj Redaktoj: %1$s, rango: %2$s, ĉiuj redaktoj: %3$s Ranglisto de OSM-redaktantoj Abono al OsmAnd-Live @@ -458,7 +458,7 @@ En/eliga eraro okazis Neatendita eraro okazis Agado {0} - Montri en mapo + Montri sur mapo Maletendi Aldoni al “ŝatataj” Mia pozicio @@ -1876,14 +1876,14 @@ Kontaktaj informoj Aldoni horojn de malfermo Speco de interesejo - Nombro da linioj sur ĉefekrano %1$s + Nombro de linioj sur ĉefekrano %1$s Bonvolu precizigi specon de interesejo. Labortagoj Lastaj ejoj Ŝatataj ejoj Konservita je: %1$s Interesejo estos forigita kiam vi alŝutos viajn ŝanĝojn - Nombro da linioj + Nombro de linioj Ĉu vi certas? Ĉiuj nekonservitaj ŝanĝoj estos forigitaj. Ĉu pluigi? ankoraŭ %1$s elŝutoj @@ -1901,7 +1901,7 @@ %.1f MB Ĝisdatigi ĉiujn (%1$s MB) Senpagaj elŝutoj uzitaj - Montras nombron da pluaj senpagaj elŝutoj. + Montras nombron de pluaj senpagaj elŝutoj. Bonvolu elekti kie vi volas konservi mapoj kaj aliaj datum-dosieroj. Enigu nomon de lando Nova versio @@ -1941,8 +1941,8 @@ Matene Nokte Monato kaj lando: - Nombro da kontribuintoj - Nombro da redaktoj + Nombro de kontribuintoj + Nombro de redaktoj Raportoj por Malpermesata signo en dosiernomo {0} elemento(j) elektita(j) @@ -2536,7 +2536,7 @@ Plenekrana reĝimo Marki kiel pasigitan Alinomi markon - Nombro da dekumaj pozicioj + Nombro de dekumaj pozicioj Dekstre Maldekstre Montri nombran klavaron @@ -2559,7 +2559,7 @@ Vidigi direktantan linion el via pozicio al pozicioj de aktivaj map-markoj. Vidigi unu aŭ du sagetojn indikantajn direkton al map-markoj. Elekti kiel vidigi distancon al aktivaj map-markoj. - Nombro da indikiloj de direkto por vidigi. + Nombro de indikiloj de direkto por vidigi. Serĉado de kursoj kun navigadpunktoj Pli Krei aŭ redakti OSM-objektojn @@ -3059,8 +3059,8 @@ Elekti agordojn pri mapo por la profilo Elekti agordojn pri ekrano por la profilo Elekti agordojn pri navigado por la profilo - Difini maksimuman nombron da ŝanĝoj de transportiloj - Nombro da transveturiliĝoj + Difini maksimuman nombron de ŝanĝoj de transportiloj + Nombro de transveturiliĝoj Teni ekranon ŝaltita Agordi por kiom longe la ekrano estos ŝaltita. Uzi proksimec‑sentilon @@ -4042,5 +4042,5 @@ Ĉiuj regionoj Aĉetoj Montri/kaŝi - Intervalo + Intertempo \ No newline at end of file From 5b7bd83b83d40a341d13aa54c3895a318a43314d Mon Sep 17 00:00:00 2001 From: Verdulo Date: Tue, 16 Mar 2021 02:30:50 +0000 Subject: [PATCH 082/250] Translated using Weblate (Esperanto) Currently translated at 100.0% (3894 of 3894 strings) --- OsmAnd/res/values-eo/phrases.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-eo/phrases.xml b/OsmAnd/res/values-eo/phrases.xml index e4b503ca8f..51c2b11059 100644 --- a/OsmAnd/res/values-eo/phrases.xml +++ b/OsmAnd/res/values-eo/phrases.xml @@ -3891,4 +3891,7 @@ Movebla biblioteko (haltloko) Pint‑taglibro: ne Pint‑taglibro: jes + Loka referenco + Oficejo de geodeziisto + Konferenca centro \ No newline at end of file From ac088dd2172d1cff76455c919d7d51a732fad700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sveinn=20=C3=AD=20Felli?= Date: Mon, 15 Mar 2021 20:36:12 +0000 Subject: [PATCH 083/250] Translated using Weblate (Icelandic) Currently translated at 100.0% (3683 of 3683 strings) --- OsmAnd/res/values-is/strings.xml | 47 ++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-is/strings.xml b/OsmAnd/res/values-is/strings.xml index 09b929262e..d01ba5643b 100644 --- a/OsmAnd/res/values-is/strings.xml +++ b/OsmAnd/res/values-is/strings.xml @@ -1990,7 +1990,6 @@ Letur fyrir kort Ekið á hægri akrein Sjálfvirkt - Skipta skráningu sjálfvirkt eftir bil Stigvaxandi leit í borg Veldu þegar birta á kort einungis með vegum: @@ -3684,7 +3683,7 @@ Leið milli punkta Næsti bútur Sækja Wikipedia-kort - Götumyndir + Myndefni í götuhæð Takmörk á lengd Skipuleggja leið Vista sem nýjan feril @@ -4005,4 +4004,48 @@ Utanvegaakstur Vélhjól Akandi + Leiðagerð gæti forðast miklar brekkur upp í mót. + Veldu flokk eða bættu við nýjum + OpenPlaceReviews er samfélagsdrifið verkefni um opinbera staði eins og veitingastaði, hótel, söfn og ýmsa merkisstaði. Það safnar saman um þetta öllum opinberum upplýsingum á borð við ljósmyndir, umsagnir, tenglum í aðrar veitur eins og OpenStreetMap, Wikipedia, o.fl.. +\n +\nÖll gögn OpenPlaceReview eru opin og öllum aðgengileg: http://openplacereviews.org/data. +\n +\nÞú getur lesið meira um verkefnið hér: http://openplacereviews.org + Vegalengd með því að ýta + %1$s inniheldur meira en einn bút, þú þarft að velja þann sem er nauðsynlegur fyrir leiðsögnina. + Veldu tilgang aksturs til að fá styttri, hraðari eða öruggari leið + Táknið fyrir núverandi staðsetningu mun grípa í leiðina sem leiðsögn fylgir + Ekki snúa ásýnd á kortið ef hraði fer niður fyrir ákveðin mörk + Víxlnappur til að birta eða fela hnitaglugga á kortinu. + Veldu búta + Bútur %1$d + Nota vegtakmarkanir sem núna eru virkar á kortinu + Bestuð styttri leið (orkusparandi) + Endurræsa + Öll svæði + Eyða %1$d skrám\? + Stöðva án þess að vista + Vista og stöðva upptöku + Upptaka ferils stöðvuð + Ertu viss um að þú viljir stöðva þessa upptöku\? +\nÖll óvistuð gögn munu tapast. + Við bið + Endurræsingar forrits er krafist til að virkja sumar stillingar. + Síðasta tiltæka uppfærsla OpenStreetMap: + Uppfært: %s + Síðast athugað: %s + Uppfærslutíðni + Uppfærslur korta verða athugaðar í hverri viku. Næsta skipti%1$s eftir %2$s. + Uppfærslur korta verða athugaðar á hverjum degi. Næsta skipti%1$s eftir %2$s. + Uppfærslur korta verða athugaðar á klukkustundar fresti. Næsta skipti%1$s eftir %2$s. + Eyða uppfærslum + Ertu viss um að þú viljir eyða öllum %s raunuppfærslum\? + Innkaup + Upptökunni verður haldið áfram. + Afrita heiti POI-merkisstaðar + Birta/Fela + Millibil + Ferillinn inniheldur ekki hæðargögn. + Ferillinn inniheldur ekki hraðagögn. + Veldu aðra tegund litunar. \ No newline at end of file From ed06aaa6b6a8ebc9829fba1e4bb4dadc6a286cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sveinn=20=C3=AD=20Felli?= Date: Mon, 15 Mar 2021 20:37:12 +0000 Subject: [PATCH 084/250] Translated using Weblate (Icelandic) Currently translated at 99.9% (3893 of 3894 strings) --- OsmAnd/res/values-is/phrases.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-is/phrases.xml b/OsmAnd/res/values-is/phrases.xml index 6ff4bb61fb..87e5c434ea 100644 --- a/OsmAnd/res/values-is/phrases.xml +++ b/OsmAnd/res/values-is/phrases.xml @@ -3891,4 +3891,6 @@ Skafið: já Heiti brautar Skíðastökk + Staðvær tilvísun + Ráðstefnumiðstöð \ No newline at end of file From 6659b8658007a07e09e69eec30b0a64e16968474 Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Tue, 16 Mar 2021 06:10:01 +0000 Subject: [PATCH 085/250] Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (3683 of 3683 strings) --- OsmAnd/res/values-zh-rTW/strings.xml | 61 +++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index d980706693..2b9c674ceb 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -2157,7 +2157,6 @@ 顯示等深線和標記。 航海等深線 使用海拔資料 - 路線的海拔 下坡 上坡 @@ -3977,4 +3976,64 @@ 已上傳 %1$d,共 %2$d 選取要上傳的檔案 地形陰影/斜坡/等高線 + 選取線段 + %1$s 包含了多於一段,您必須為導航選取必要的部份。 + 線段 %1$d + OpenPlaceReviews 是一個社群驅動的專案,其蒐集關於餐廳、飯店、博物館、航點等公共場所的資訊。其蒐集的資訊包含了照片、評論、其他系統的連結(如 OpenStreetMap、維基百科)。 +\n +\n所有 OpenPlaceReview 資料都是開放的,並提供給所有人:http://openplacereviews.org/data +\n +\n您可以在此取得更多資訊:http://openplacereviews.org + OpenPlaceReviews + 使用 test.openplacereviews.org + 登入至 OpenPlaceReviews + + 冬天 + 雪地摩托車 + 騎乘 + 競速 + 山地腳踏車 + 腳踏車 + 健行 + 跑步 + 步行 + 越野 + 摩托車 + 汽車 + 使用道路限制目前在地圖上已啟用 + 最佳化的較短路線(節能) + 選取駕駛目的來取得較短、較快或較安全的路線 + 目前位置圖示將會貼齊到目前導航的路線 + 如果速度低於閾值時,不要旋轉地圖 + 重新啟動 + 所有區域 + 刪除 %1$d 檔案? + 停止而不儲存 + 儲存並停止錄製 + 軌跡錄製已停止 + 您確定您想要停止錄製嗎? +\n所有未儲存的資料都將會遺失。 + 暫停 + 需要重新啟動應用程式才能套用某些設定。 + 路線安排可以避免上坡。 + 在地圖上顯示或隱藏「座標」小工具的開關。 + 點擊距離 + 可用的最新 OpenStreetMap 更新: + 已更新:%s + 上次檢查時間:%s + 更新頻率 + 地圖更新將每週檢查一次。下次 %1$s 於 %2$s。 + 地圖更新將每天檢查一次。下次 %1$s 於 %2$s。 + 地圖更新將每小時檢查一次。下次 %1$s 於 %2$s。 + 刪除更新 + 您確定您要刪除所有 %s 即時更新嗎? + 購買 + 選取分類或加入新的 + 錄製將繼續。 + 複製 POI 名稱 + 顯示/隱藏 + 間隔 + 軌跡不包含海拔資料。 + 軌跡不包含速度資料。 + 請選擇另一種顏色。 \ No newline at end of file From e377a1e44d6d040b248f7173ee5154c59dec1c25 Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Tue, 16 Mar 2021 06:28:30 +0000 Subject: [PATCH 086/250] Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (3894 of 3894 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 5d06809042..56516b9292 100644 --- a/OsmAnd/res/values-zh-rTW/phrases.xml +++ b/OsmAnd/res/values-zh-rTW/phrases.xml @@ -3891,4 +3891,7 @@ 林間空地:是 滑雪道名稱 跳台滑雪 + 月台/站牌編號 + 土地測量師 + 會議中心 \ No newline at end of file From 83884d49582c507956bd02af8cc724787496722f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Kotr=C4=8D?= Date: Mon, 15 Mar 2021 20:28:03 +0000 Subject: [PATCH 087/250] Translated using Weblate (Czech) Currently translated at 27.3% (74 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/cs/ --- OsmAnd-telegram/res/values-cs/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd-telegram/res/values-cs/strings.xml b/OsmAnd-telegram/res/values-cs/strings.xml index cd32a46403..2dc9b2936b 100644 --- a/OsmAnd-telegram/res/values-cs/strings.xml +++ b/OsmAnd-telegram/res/values-cs/strings.xml @@ -74,4 +74,5 @@ Vzhled Zásobník logcat Zkontrolovat a sdílet podrobné záznamy aplikace + Podle názvu \ No newline at end of file From ce4150b4806abdc48686193d98d426ba5eccd973 Mon Sep 17 00:00:00 2001 From: Ammuu5 Date: Mon, 15 Mar 2021 21:10:46 +0000 Subject: [PATCH 088/250] Translated using Weblate (Finnish) Currently translated at 15.1% (41 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/fi/ --- OsmAnd-telegram/res/values-fi/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd-telegram/res/values-fi/strings.xml b/OsmAnd-telegram/res/values-fi/strings.xml index 0016e0f284..b83e748f72 100644 --- a/OsmAnd-telegram/res/values-fi/strings.xml +++ b/OsmAnd-telegram/res/values-fi/strings.xml @@ -41,4 +41,5 @@ Ota käyttöön Valitse Käytä + Lajittele \ No newline at end of file From 91f72c1f6bec41bd58067e9a68a2812246f965ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristjan=20R=C3=A4ts?= Date: Mon, 15 Mar 2021 21:31:18 +0000 Subject: [PATCH 089/250] Translated using Weblate (Estonian) Currently translated at 100.0% (271 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/et/ --- OsmAnd-telegram/res/values-et/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd-telegram/res/values-et/strings.xml b/OsmAnd-telegram/res/values-et/strings.xml index 0ddb7950a7..ee3ac2ee7b 100644 --- a/OsmAnd-telegram/res/values-et/strings.xml +++ b/OsmAnd-telegram/res/values-et/strings.xml @@ -69,7 +69,7 @@ mi km m - nmi + M min/m min/km m/s @@ -249,7 +249,7 @@ Autoriseerimine Palun sisesta oma Telegrami telefoninumber rahvusvahelises formaadis Tere tulemast - nmi/h + sõlme Meremiili tunnis (sõlm) h min From be68eefcaf539ef85c9eded5c565b6dd8e941a00 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Tue, 16 Mar 2021 12:10:38 +0200 Subject: [PATCH 090/250] Fix --- .../net/osmand/plus/dialogs/ConfigureMapMenu.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index 5a69f5b2cd..08d37e556a 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -33,17 +33,17 @@ import net.osmand.plus.ContextMenuItem; import net.osmand.plus.DialogListItemAdapter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.helpers.enums.DayNightMode; -import net.osmand.plus.settings.backend.OsmandPreference; -import net.osmand.plus.settings.backend.OsmandSettings; -import net.osmand.plus.settings.backend.CommonPreference; -import net.osmand.plus.settings.backend.ListStringPreference; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.enums.DayNightMode; import net.osmand.plus.inapp.InAppPurchaseHelper; import net.osmand.plus.poi.PoiUIFilter; import net.osmand.plus.render.RendererRegistry; +import net.osmand.plus.settings.backend.CommonPreference; +import net.osmand.plus.settings.backend.ListStringPreference; +import net.osmand.plus.settings.backend.OsmandPreference; +import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.srtmplugin.SRTMPlugin; import net.osmand.plus.transport.TransportLinesMenu; import net.osmand.plus.views.OsmandMapTileView; @@ -504,7 +504,7 @@ public class ConfigureMapMenu { } } selectedLanguageIndex = selected; - transliterateNames = view.getSettings().MAP_TRANSLITERATE_NAMES.get(); + transliterateNames = settings.MAP_TRANSLITERATE_NAMES.get(); final OnCheckedChangeListener translitChangdListener = new OnCheckedChangeListener() { @Override @@ -530,7 +530,7 @@ public class ConfigureMapMenu { TextView switchText = (TextView) v.findViewById(R.id.switchText); switchText.setText(activity.getString(R.string.translit_name_if_miss, txtValues[position])); SwitchCompat check = (SwitchCompat) v.findViewById(R.id.check); - check.setChecked(transliterateNames); + check.setChecked(settings.MAP_TRANSLITERATE_NAMES.isSet() ? transliterateNames : txtIds[position].equals("en")); check.setOnCheckedChangeListener(translitChangdListener); UiUtilities.setupCompoundButton(nightMode, selectedProfileColor, check); } else { From 9f23adeebfea38040292a32a7c4baf240fc94483 Mon Sep 17 00:00:00 2001 From: MaartenDeen Date: Tue, 16 Mar 2021 11:40:35 +0100 Subject: [PATCH 091/250] Update strings.xml typofix --- OsmAnd/res/values-nl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index 1ee2081a3e..87a51a3c3d 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -2678,7 +2678,7 @@ Zeekaartstijl. Toont boeien, vuurtorens, rivieren, vaargeulen en -markeringen, havens, bakens, dieptelijnen. Skistijl. Toont pistes, skiliften en andere ski-gerelateerde elementen. Overige kaartelementen worden verduisterd. Eenvoudige stijl voor autonavigatie. Zachte nachtmodus, hoogtelijnen, contrasterende wegen in oranje stijl, verduistert overige kaartelementen. - Voor wandelaars, trektochten en fietsenrs in de natuur. Buiten goed leesbaar. Contrasterende wegen en natuurlijke objecten, verschillende routetypen, geavanceerde hoogtelijn opties, extra details. Aanpassing van de oppervlakte-integriteit onderscheidt de kwaliteit van de weg. Geen nachtmodus. + Voor wandelaars, trektochten en fietsen in de natuur. Buiten goed leesbaar. Contrasterende wegen en natuurlijke objecten, verschillende routetypen, geavanceerde hoogtelijn opties, extra details. Aanpassing van de oppervlakte-integriteit onderscheidt de kwaliteit van de weg. Geen nachtmodus. Oude \'Mapnik\'-standaardstijl. Kleuren vergelijkbaar met \'Mapnik\'. Stijl met hoog contrast en maximaal detail. Deze bevat alle opties van de standaardstijl van OsmAnd, met zoveel mogelijk details, specifiek wegen, paden en andere reismogelijkheden. Geen verschil tussen “wegenkaart”-wegtypes. Geschikt voor dag, nacht en outdoor gebruik. Universele stijl. Vereenvoudigde weergave dichtbevolkte steden. Hoogtelijnen, routes, oppervlakkwaliteit, toegangsrestricties, wegnummers, weergave van paden volgens de SAC-schaal, wildwatersportelementen. From 03e632a6d00acc33780a54fbaf0586fb718c3f93 Mon Sep 17 00:00:00 2001 From: Zmicer Turok Date: Tue, 16 Mar 2021 10:31:13 +0000 Subject: [PATCH 092/250] Translated using Weblate (Belarusian) Currently translated at 99.0% (3649 of 3685 strings) --- OsmAnd/res/values-be/strings.xml | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml index 544b2187a7..109b223e99 100644 --- a/OsmAnd/res/values-be/strings.xml +++ b/OsmAnd/res/values-be/strings.xml @@ -514,7 +514,7 @@ Флюарэсцэнтныя пласты Ужываць флюарэсцэнтныя колеры для слядоў і шляхоў. Пазасеціўнае рэдагаванне - Калі выкарыстоўваецца рэдагаванне на прыладзе, то змены будуць захаваныя лакальна і загружаныя на сервер толькі па запыце, інакш яны будуць загружацца неадкладна. + Калі ўключана пазасеціўнае рэдагаванне, то змены будуць захоўвацца на прыладзе і адпраўляцца на сервер толькі па запыце, інакш будуць адпраўляцца неадкладна. Змены цікавых пунктаў (POI) у праграме не паўплываюць на cпампаваныя файлы мапаў, змены захоўваюцца як файлы на вашай прыладзе. Запампоўка… {0} POI/нататкі запампаваныя @@ -1573,7 +1573,7 @@ Абмежаванне па вышыні Пазначыць вышыню транспартнага сродку для разліку маршруту. Разумны пераразлік маршруту - Пераразлічваць толькі пачатак маршруту. Карысна для доўгіх паездак. + Пераразлічваецца толькі пачатковы адрэзак маршруту. Карысна для доўгіх паездак. Выйсці Выключана Афарбоўка па пешаходнаму сімвалу OSMC @@ -1984,7 +1984,7 @@ Адносны азімут Магнітны азімут Навігацыя OsmAnd Live - Убудова спецыяльных магчымасцей: Пункт прызначэння не зададзены + Убудова адмысловых магчымасцяў: пункт прызначэння не вызначаны Сачыце за намі Гукавая напрамкі Індыцыраваць гукам кірунак на мэтавы пункт. @@ -2313,7 +2313,7 @@ Каляровая схема Дазволіць прыватны доступ Дазволіць доступ на прыватную тэрыторыю. - Спампуйце мапу \"Покрыва зацянення рэльефу\" для адлюстравання вертыкальнага зацянення гэтага рэгіёна. + Спампуйце мапу зацянення рэльефу для адлюстравання вертыкальнага зацянення гэтага рэгіёна. Усталюйце убудову \"Контурныя лініі\" для адлюстравання градыентаў вертыкальных абласцей. Схаваць ад узроўню маштабавання Спампуйце мапу \"Контурныя лініі\" для выкарыстання ў гэтым рэгіёне. @@ -2473,7 +2473,7 @@ Сярэдняя %1$d з %2$d Пад\'ём/Cпуск - Час у руху + Час руху Макс/Мін Мін/Макс Паўпразрысты ружовы @@ -3148,7 +3148,7 @@ Дадаць прынамсі адзін элемент у спіс \"Хуткае дзеянне\" у наладах Альпійскія і горныя лыжы Схілы для горных лыжаў і доступ да пад\'ёмнікаў. - Бегавыя і скандынаўскія лыжы + Лыжныя гонкі і скандынаўскія тыпы Трасы для лыжных гонак і іх паўночных тыпаў. Дазволіць прамежкавыя маршруты Больш складаныя трасы са стромкімі ўчасткамі. Пэўныя перашкоды, якіх варта пазбягаць. @@ -3410,7 +3410,7 @@ Пакупкі OsmAnd Даведка па знаках мапы. Профілі навігацыі - Стварыць ці Рэдагаваць POI + Стварыць ці змяніць POI Месца паркоўкі Дадаць ці рэдагаваць улюбёнае Аднавіць прадвызначаны парадак элементаў @@ -3521,8 +3521,8 @@ Адкрыць захаваны след захавана Аўтаматычна запісваць след падчас навігацыі - Спыненне запісу GPX, падчас прымусовага спынення (праз апошнія прыкладанні). (Апавяшчэнне ў вобласці падказак Android пра фонавы рэжым OsmAnd знікне.) - Вызначце інтэрвал запісу трэка (уключаецца праз віджэт \"Запіс паездкі\" на мапе). + Спыненне запісу GPX падчас прымусовага спынення (праз нядаўнія праграмы). (Значок на прасторы апавяшчэнняў Android пра фонавы рэжым OsmAnd знікне.) + Вызначце інтэрвал запісу следу (уключаецца праз віджэт \"Запіс паездкі\" на мапе). ЗАПІС Завершана Захаваць як новы файл следу @@ -3627,7 +3627,7 @@ Папярэдні сегмент Усе папярэднія сегменты Толькі абраны сегмент пералічыцца з выкарыстаннем абранага профілю. - Прагледзець усе вашы яшчэ не загружаныя паўкі OSM або памылкі ў %1$s. Ужо загружаныя змены больш не будуць паказвацца. + Тут паказваюцца ўсе вашыя неадпраўленыя праўкі і хібы OSM, яшчэ не адпраўленыя ў %1$s. Адпраўленыя змены не паказваюцца. Пазначце сеціўны адрас з наступнымі параметрамі: lat={0}, lon={1}, timestamp={2}, hdop={3}, altitude={4}, speed={5}, bearing={6}. Рэкамендацыя: наладка ў 5 метраў можа вас задаволіць, калі вам не патрэбна фіксаваць больш кароткія перамяшчэнні, і вы не хочаце відавочна збіраць даныя ў стане спакою. Пабочныя эфекты: перыяды ў стане спакою не запісваюцца наогул альбо па адным пункце кожны. Невялікія (у рэальным свеце) перамяшчэнні (напрыклад, убок, што адзначаюць магчымы паварот у вашай паездцы) могуць быць адфільтраваныя. Файл змяшчае менш інфармацыі для наступнай апрацоўкі і мае горшую статыстыку, адфільтроўваючы відавочна лішнія пункты падчас запісу. Пры гэтым патэнцыйна захоўваюцца артэфакты, выкліканыя дрэнным прыёмам альбо эфектамі модуля GPS. @@ -3852,7 +3852,7 @@ Што новага Дзякуй за набыццё ўбудовы «Контурныя лініі» Плата за падпіску спаганяецца за абраны перыяд. Скасаваць яе на AppGallery можна у любы момант. - Пры пацвярджэнні пакупкі аплата будзе спаганяцца з рахунка, звязанага з вашым акаўнтам AppGallery. + Пры пацвярджэнні куплі аплата будзе спаганяцца з рахунка, звязанага з вашым акаўнтам AppGallery. \n \nПадпіска аўтаматычна працягваецца, калі вы не скасуеце яе да даты працягу. З вашага рахунка будзе адзін раз спаганяцца аплата за перыяд працягу (месяц/тры месяцы/год). \n @@ -3867,7 +3867,7 @@ Перайсці на разлік маршруту грамадскага транспарту з дапамогай Java (бяспечны) Файл ужо імпартаваны ў OsmAnd Значкі старту і фінішу - Выканайце ўваход з дапамогай OAuth, каб выкарыстоўваць функцыі osmedit + Увайдзіце з дапамогай OAuth, каб выкарыстоўваць функцыі osmedit Ачысціць токен OpenStreetMap OAuth Вы выйшлі Даныя OsmAnd Live @@ -3879,24 +3879,24 @@ MGRS OsmAnd выкарыстоўвае MGRS, які падобны да фармату UTM NATO. Графік - Даныя %1$s даступныя толькі для дарог, разлічылі маршрут, выкарыстоўваючы \"Маршрут паміж кропкамі\", каб убачыць графікі. - Калі ласка пачакайце. + Даныя %1$s даступныя толькі для дарог. Разлічыце маршрут, з дапамогай \"Маршрут паміж пунктамі\", каб убачыць графікі. + Калі ласка, пачакайце. \nГрафік будзе даступны пасля пераразліку маршруту. Лакальныя мапы %1$s — %2$s Разрыў - Выгады - Спецыяльныя + Выгоды + Адмысловыя Транспарт Паслугі Сімвалы Спорт - Экстраныя службы + Экстранныя службы Вандроўка Дадайце прынамсі два пункты Увайсці ў OpenStreetMap Увайсці ў OpenStreetMap.org - Увайсці з дапамогай OpenStreetMap + Увайсці праз OpenStreetMap Вам неабходна ўвайсці ў сістэму, каб адправіць змены. \n \nВы можаце ўвайсці з дапамогай OAuth або лагіна і пароля. From c2276920e158ae612be63a3685838c0eadb8257d Mon Sep 17 00:00:00 2001 From: Zmicer Turok Date: Tue, 16 Mar 2021 10:48:34 +0000 Subject: [PATCH 093/250] Translated using Weblate (Belarusian) Currently translated at 99.1% (3859 of 3894 strings) --- OsmAnd/res/values-be/phrases.xml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-be/phrases.xml b/OsmAnd/res/values-be/phrases.xml index 5856703494..bfed82a704 100644 --- a/OsmAnd/res/values-be/phrases.xml +++ b/OsmAnd/res/values-be/phrases.xml @@ -3832,7 +3832,7 @@ Амбасада Вярхоўны камісарыят Дэлегацыя - Аддзяленне + Філіял На чале з амбасадарам Сувязь Амбасада @@ -3841,4 +3841,22 @@ Навесы Дах Пункт GPX + Не + Так + Не + Так + Не + Так + Субнацыянальны + Прадстаўніцтва + Офіс + Ганаровы консул + Генеральнае консульства + Консульскі офіс + Консульскае агенцтва + На чале з консулам + Рэзідэнцыя + Нунцыятура + Місія + Аддзел інтарэсаў \ No newline at end of file From 81f367eacb22d4707889291dbc5c2ce673e5cf5a Mon Sep 17 00:00:00 2001 From: cepprice Date: Tue, 16 Mar 2021 19:12:02 +0500 Subject: [PATCH 094/250] Fix ClassCastException --- .../MeasurementToolFragment.java | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 779dd6f2e1..c777f3bdb0 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -307,6 +307,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route @Override public void onGlobalLayout() { updateCardContainerSize(); + mainView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } }); } @@ -676,19 +677,36 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } private void updateCardContainerSize() { + if (portrait) { + return; + } View measureModeControls = mainView.findViewById(R.id.measure_mode_controls); int width = mainView.getWidth() - measureModeControls.getWidth(); - FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(width, -1); int bottomMargin = measureModeControls.getHeight(); bottomMargin = progressBarVisible ? bottomMargin + mainView.findViewById(R.id.snap_to_road_progress_bar).getHeight() : bottomMargin; - params.setMargins(0, 0, 0, bottomMargin); - cardsContainer.setLayoutParams(params); + if (mainView.getParent() instanceof FrameLayout) { + FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(width, -1); + params.setMargins(0, 0, 0, bottomMargin); + cardsContainer.setLayoutParams(params); + } else if (mainView.getParent() instanceof LinearLayout) { + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, -1); + params.setMargins(0, 0, 0, bottomMargin); + cardsContainer.setLayoutParams(params); + } } private void shiftBottomMapControls(boolean toInitialPosition) { + if (portrait) { + return; + } int leftMargin = toInitialPosition ? 0 : cardsContainer.getWidth(); - LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) bottomMapControls.getLayoutParams(); - params.setMargins(leftMargin, 0, 0, 0); + if (bottomMapControls.getParent() instanceof LinearLayout) { + LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) bottomMapControls.getLayoutParams(); + params.setMargins(leftMargin, 0, 0, 0); + } else if (bottomMapControls.getParent() instanceof FrameLayout) { + FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) bottomMapControls.getLayoutParams(); + params.setMargins(leftMargin, 0, 0, 0); + } } public boolean isInEditMode() { From e826a195b5899bdbc353193b35c2c197797adcfb Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Tue, 16 Mar 2021 16:38:01 +0200 Subject: [PATCH 095/250] Plan route issues Move point screen: fix "Apply" button width in landscape and portrait. + Fix Add button width in landscape --- .../layout-land/fragment_measurement_tool.xml | 17 ++++++++++------- OsmAnd/res/layout/fragment_measurement_tool.xml | 9 +++++---- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/OsmAnd/res/layout-land/fragment_measurement_tool.xml b/OsmAnd/res/layout-land/fragment_measurement_tool.xml index 3331d72dee..4ed0e425e3 100644 --- a/OsmAnd/res/layout-land/fragment_measurement_tool.xml +++ b/OsmAnd/res/layout-land/fragment_measurement_tool.xml @@ -195,11 +195,13 @@ + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + android:minWidth="@dimen/measurement_tool_button_width" /> + + android:layout_marginEnd="@dimen/measurement_tool_button_margin" + android:layout_marginRight="@dimen/measurement_tool_button_margin" + android:minWidth="@dimen/measurement_tool_button_width" /> + android:layout_marginEnd="@dimen/measurement_tool_button_margin" + android:layout_marginRight="@dimen/measurement_tool_button_margin" + android:minWidth="@dimen/measurement_tool_button_width" /> Date: Tue, 16 Mar 2021 17:16:26 +0200 Subject: [PATCH 096/250] Remove deprecated method --- .../MeasurementToolFragment.java | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index c777f3bdb0..38a24b37a5 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -11,7 +11,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; @@ -20,6 +19,18 @@ import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; +import androidx.activity.OnBackPressedCallback; +import androidx.annotation.DrawableRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.core.content.ContextCompat; +import androidx.core.widget.TextViewCompat; +import androidx.fragment.app.FragmentManager; +import androidx.recyclerview.widget.ItemTouchHelper; +import androidx.recyclerview.widget.RecyclerView; + +import com.github.ksoichiro.android.observablescrollview.ScrollUtils; import com.google.android.material.snackbar.Snackbar; import net.osmand.AndroidUtils; @@ -85,17 +96,6 @@ import java.util.Date; import java.util.List; import java.util.Locale; -import androidx.activity.OnBackPressedCallback; -import androidx.annotation.DrawableRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.content.res.AppCompatResources; -import androidx.core.content.ContextCompat; -import androidx.core.widget.TextViewCompat; -import androidx.fragment.app.FragmentManager; -import androidx.recyclerview.widget.ItemTouchHelper; -import androidx.recyclerview.widget.RecyclerView; - import static net.osmand.IndexConstants.GPX_FILE_EXT; import static net.osmand.IndexConstants.GPX_INDEX_DIR; import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationMode; @@ -303,11 +303,10 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } else { cardsContainer = mapActivity.findViewById(R.id.left_side_menu); bottomMapControls = mapActivity.findViewById(R.id.bottom_controls_container); - mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + ScrollUtils.addOnGlobalLayoutListener(mainView, new Runnable() { @Override - public void onGlobalLayout() { + public void run() { updateCardContainerSize(); - mainView.getViewTreeObserver().removeGlobalOnLayoutListener(this); } }); } From 49aab1eb219236ac94576d3b2610487790172934 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Tue, 16 Mar 2021 18:44:08 +0200 Subject: [PATCH 097/250] Added icon for online help links --- OsmAnd/res/drawable/ic_action_help_online.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 OsmAnd/res/drawable/ic_action_help_online.xml diff --git a/OsmAnd/res/drawable/ic_action_help_online.xml b/OsmAnd/res/drawable/ic_action_help_online.xml new file mode 100644 index 0000000000..cca035dcf4 --- /dev/null +++ b/OsmAnd/res/drawable/ic_action_help_online.xml @@ -0,0 +1,18 @@ + + + + + + From eab60bed463ae7b5eb727ce9d693117346a4099e Mon Sep 17 00:00:00 2001 From: clementcontet Date: Tue, 16 Mar 2021 17:49:57 +0100 Subject: [PATCH 098/250] Compute obstaclesTime before adding final segment Fix https://github.com/osmandapp/OsmAnd/issues/10867 --- .../src/main/java/net/osmand/router/BinaryRoutePlanner.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java index 0769e1390c..4c85058fa3 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java @@ -457,10 +457,10 @@ public class BinaryRoutePlanner { directionAllowed = false; continue; } - boolean alreadyVisited = checkIfOppositeSegmentWasVisited(ctx, reverseWaySearch, graphSegments, segment, oppositeSegments, - segmentPoint, segmentDist, obstaclesTime); obstaclesTime += obstacle; obstaclesTime += heightObstacle; + boolean alreadyVisited = checkIfOppositeSegmentWasVisited(ctx, reverseWaySearch, graphSegments, segment, oppositeSegments, + segmentPoint, segmentDist, obstaclesTime); if (alreadyVisited) { directionAllowed = false; continue; From 288cb6d91727aad340546c87be7be98b768387aa Mon Sep 17 00:00:00 2001 From: aceman444 Date: Wed, 17 Mar 2021 01:55:26 +0100 Subject: [PATCH 099/250] Fix space after "Next time" in strings.xml Add probably missing space after "Next time" that all translators have added into their localized strings. --- OsmAnd/res/values/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 899beda35c..2bc271e8dd 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -24,9 +24,9 @@ Purchases Are you sure you want to delete all %s live updates? Delete updates - Map updates will be checked every hour. Next time%1$s in %2$s. - Map updates will be checked every day. Next time%1$s in %2$s. - Map updates will be checked every week. Next time%1$s in %2$s. + Map updates will be checked every hour. Next time %1$s in %2$s. + Map updates will be checked every day. Next time %1$s in %2$s. + Map updates will be checked every week. Next time %1$s in %2$s. Update frequency Last time checked: %s Updated: %s From 04663ec2fcb7cb020da475b198599de3bb452db1 Mon Sep 17 00:00:00 2001 From: Gilbert Lowel Date: Tue, 16 Mar 2021 15:59:22 +0000 Subject: [PATCH 100/250] Translated using Weblate (Dutch) Currently translated at 95.6% (3525 of 3685 strings) --- OsmAnd/res/values-nl/strings.xml | 76 +++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index 87a51a3c3d..fc156bdfba 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -1432,7 +1432,7 @@ Start Stop Importeren - Exporteer naar OSM + Exporteer Meer… Meer acties Toon niet meer @@ -2173,7 +2173,6 @@ Tijd in beweging Rijstijl Hoogtegegevens gebruiken - Track Rechts rijdend Automatisch @@ -3359,7 +3358,7 @@ Routering Bijkomende gegevens insluiten Het geïmporteerde profiel bevat aanvullende gegevens. Tik \"Importeren\" om enkel de profielgegevens te importeren of kies aanvullende gegevens om te importeren. - Je kan bijkomende gegevens om mee met het profiel te exporteren. + Je kan bijkomende gegevens toevoegen om mee met het profiel te exporteren. App Standaardwaarde (%s) Niet herberekenen Minimale afstand om route te herbereken @@ -3579,7 +3578,7 @@ Opslagformaat Stel een minimum en maximum zoomniveau in om de online kaart te tonen of te laden. Alles wissen\? - Sneltoetsen kunnen geëxporteerd of geïmporteerd worden met app-profielen. + Snelle acties kunnen geëxporteerd of geïmporteerd worden met app-profielen. Weet je zeker dat je %d sneltoetsen onherroepelijk wil verwijderen\? In sommige landen of regio’s is het gebruik van toepassingen om te waarschuwen voor snelheidscamera’s in strijd met de wet. \n @@ -3898,7 +3897,7 @@ MGRS MGRS OsmAnd gebruikt MGRS, die sterk lijkt op het UTM-NATO-formaat. - Resources + Middelen Zoekgeschiedenis Kajak Motorboot @@ -3938,7 +3937,7 @@ Vooraankondiging Afwijking van de route Aankomst op bestemming - Bocht + Afslag Tijd- en afstandsintervallen De aankondigingstijd van verschillende aankondigen hangt af van type en huidige snelheid. Aankondigingstijd @@ -3970,4 +3969,67 @@ Aan het opladen %1$d van %2$d Opgeladen %1$d van %2$d Selecteer de op te laden wijzigingen - + Weet u zeker dat u de opname wilt stoppen\? +\n(Alle niet opgeslagen gegevens gaan verloren.). + Selecteer segmenten + %1$s meer dan één segment bevat, moet u het nodigde deel van de navigatie selecteren. + Segment %1$d + Hillshade / Helling / Contourlijnen + OpenPlaceReviews is een gemeenschaps gestuurd project over openbare plaatsen zoals restaurants, hotels, musea, way-points. Het verzamelt alle openbare informatie over hen, zoals foto\'s, recensies, links naar andere systemen die OpenStreetMap, Wikipedia linken. +\n +\nAlle OpenPlaceReview-gegevens zijn open en voor iedereen beschikbaar: http://openplacereviews.org/data. +\n +\nU kunt meer lezen op: http://openplacereviews.org + OpenPlaceReviews + Gebruik test.openplacereviews.org + Inloggen op OpenPlaceReviews + Water + Winter + Sneeuwscooter + Rijden + Racen + Mountainbike + Fietsen + Trektocht + Joggen + Wandelen + Off-road + Bromfiets + Auto\'s + Gebruik wegbeperkingen die nu actief zijn op de kaart + Geoptimaliseerde kortere route (energiebesparing) + Selecteer een tussenpunt om een kortere, snellere of veiligere route te krijgen + Het huidige locatiepictogram wordt vastgeklikt aan de huidige navigatieroute + Draai de kaartweergave niet als de snelheid lager is dan een drempelwaarde + Herstart + Alle regio\'s + Wis %1$d bestanden\? + Stop zonder opslaan + Bewaar en stop met opnemen + Trackopname gestopt + Pauze + Opnieuw opstarten van applicatie vereist om bepaalde instellingen toe te passen. + Routebepaling kan sterke hellingen vermijden. + Een schuifschakelaar om de coördinaten-widget op de kaart weer te geven of te verbergen. + Afstand bij het tikken + Nieuwste OpenStreetMap update beschikbaar: + Geüpdatet: %s + Laatste keer gecontroleerd: %s + Update frequentie + Kaartupdates worden elke week gecontroleerd. Volgende keer %1$s over %2$s. + Kaartupdates worden elke dag gecontroleerd. Volgende keer %1$s over %2$s. + Kaartupdates worden elk uur gecontroleerd. Volgende keer %1$s over %2$s. + Wis alle updates + Weet u zeker dat u alle %s live updates wilt verwijderen\? + Aankopen + Selecteer een categorie of voeg een nieuwe toe + De opname wordt voortgezet. + Kopieer POI-naam + Tonen/verbergen + Interval + Verberg natuurreservaten, beschermde gebieden en grenzen van nationale parken + Natuurlijke grenzen + De track bevat geen hoogtegegevens. + De track bevat geen snelheidsgegevens. + Selecteer een ander inkleuring. + \ No newline at end of file From de228ac8debc83091dd64ea299244e41113906e8 Mon Sep 17 00:00:00 2001 From: Ldm Public Date: Tue, 16 Mar 2021 21:53:46 +0000 Subject: [PATCH 101/250] Translated using Weblate (French) Currently translated at 99.8% (3680 of 3685 strings) --- OsmAnd/res/values-fr/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 6ab881dca2..6ccab62d05 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -4027,4 +4027,7 @@ Intervalle La trace ne contient aucune donnée d\'altitude. La trace ne contient aucune donnée de vitesse. + Itinéraire court optimisé (plus économe en énergie) + Masquer les limites des réserves naturelles, des zones protégées et des parcs nationaux + Limites naturelles \ No newline at end of file From b713b23002331946ac2859734a9c068bc3c7c314 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 16 Mar 2021 18:44:47 +0000 Subject: [PATCH 102/250] Translated using Weblate (German) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-de/strings.xml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index fb530c131e..2ba741af13 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -3163,7 +3163,7 @@ Profile erstellen, importieren, bearbeiten App-Profile verwalten … Die gesamte App betreffend - OsmAnd-Einstellungen + OsmAnd Einstellungen Aus anderem Profil kopieren Bildschirm einschalten Karte während Navigation @@ -4025,4 +4025,29 @@ Der Track enthält keine Höhendaten. Der Track enthält keine Geschwindigkeitsdaten. Bitte wähle eine andere Art der Einfärbung aus. + Entfernung durch Antippen + Segmente auswählen + %1$s enthält mehr als ein Segment, Sie müssen den benötigten Teil für die Navigation auswählen. + Segment %1$d + Verwenden Sie Straßeneinschränkungen, die jetzt in der Karte aktiv sind + Optimierte kürzere Route (energiesparend) + Wählen Sie den Fahrzweck, um eine kürzere, schnellere oder sicherere Route zu erhalten + Das Symbol für den aktuellen Standort wird an die aktuelle Navigationsroute angehängt + Kartenansicht nicht drehen, wenn die Geschwindigkeit kleiner als ein Schwellenwert ist + Sind Sie sicher, dass Sie die Aufnahme beenden wollen\? +\nAlle nicht gespeicherten Daten gehen verloren. + Pausiert + Neustart der Anwendung erforderlich, um einige Einstellungen zu übernehmen. + Die Streckenführung könnte starke Steigungen vermeiden. + Ein Umschalter zum Ein- und Ausblenden des Koordinaten-Widgets auf der Karte. + Aktuelles OpenStreetMap Update verfügbar: + Zuletzt geprüft: %s + Aktualisierungsintervall + Die Kartenaktualisierung wird wöchentlich überprüft. Das nächste Mal%1$s in %2$s. + Die Kartenaktualisierung wird täglich überprüft. Das nächste Mal%1$s in %2$s. + Die Kartenaktualisierung wird stündlich überprüft. Das nächste Mal%1$s in %2$s. + Sind Sie sicher, dass Sie alle %s Live-Updates löschen möchten\? + Kategorie auswählen oder neue hinzufügen + Grenzen von Naturschutzgebieten, Schutzgebieten und Nationalparks ausblenden + Grenzen von Schutzgebieten \ No newline at end of file From ac0364ce9c4cb2375ea6d54a097b61a3beceeeb9 Mon Sep 17 00:00:00 2001 From: Evgenii Martynenko Date: Wed, 17 Mar 2021 06:40:51 +0000 Subject: [PATCH 103/250] Translated using Weblate (Russian) Currently translated at 99.2% (3658 of 3685 strings) --- OsmAnd/res/values-ru/strings.xml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 0bfdc0b4b1..c1c4a05d9c 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -139,7 +139,6 @@ Стиль езды Колебания высоты ландшафта Использовать данные о высотах - Действие переименовано в %1$s, чтобы избежать дублирования. Обнаружен дубликат имени Переключатель, чтобы показать или скрыть избранные точки на карте. @@ -3999,4 +3998,17 @@ \n \nВы можете узнать больше на: http://openplacereviews.org Гонки + Для применения некоторых настроек необходимо перезапустить приложение. + Расстояние по нажатию + Последнее доступное обновление OpenStreetMap: + Обновлено: %s + Последний раз проверено: %s + Частота обновления + Обновления карт будут проверяться каждую неделю. В следующий раз%1$s в %2$s. + Обновления карт будут проверяться каждый день. Следующий раз%1$s в %2$s. + Обновления карт будут проверяться каждый час. Следующий раз%1$s в %2$s. + Удалить обновления + Вы уверены, что хотите удалить все live обновления для %s\? + Покупки + Показать/скрыть \ No newline at end of file From f23497d70bae4a4bc83351e451da779ff86630ab Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 16 Mar 2021 15:17:27 +0000 Subject: [PATCH 104/250] Translated using Weblate (Russian) Currently translated at 99.2% (3658 of 3685 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 c1c4a05d9c..7ff2dec3fe 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -4011,4 +4011,5 @@ Вы уверены, что хотите удалить все live обновления для %s\? Покупки Показать/скрыть + Природные границы \ No newline at end of file From 87bc4d7718f8d95ef1123b814a7408d9ad791fea Mon Sep 17 00:00:00 2001 From: solokot Date: Tue, 16 Mar 2021 14:13:33 +0000 Subject: [PATCH 105/250] Translated using Weblate (Russian) Currently translated at 99.2% (3658 of 3685 strings) --- OsmAnd/res/values-ru/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 7ff2dec3fe..03ce82f6fa 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -4012,4 +4012,7 @@ Покупки Показать/скрыть Природные границы + Трек не содержит данных о высоте. + Трек не содержит данных о скорости. + Выберите другой тип окраски. \ No newline at end of file From b5545983fd9ead5f166128fabbd6bcd52fbcc7c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Babos=20G=C3=A1bor?= Date: Tue, 16 Mar 2021 21:57:52 +0000 Subject: [PATCH 106/250] Translated using Weblate (Hungarian) Currently translated at 99.9% (3682 of 3685 strings) --- OsmAnd/res/values-hu/strings.xml | 63 +++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index fe6e171440..0367e8b812 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -1161,7 +1161,7 @@ Európa – Olaszország Európa – Nagy-Britannia OsmAnd útvonalszakasz számítása offline - OsmAnd útvonal számítása az első és utolsó útszakaszra + OsmAnd útvonal számítása az első és az utolsó útszakaszra Pozíció megjelenítése mindig középen Hang Egyebek @@ -1366,7 +1366,7 @@ Zóna Frissítések Letöltés - Helyi + Telepítve A letöltés nem lehetséges, ellenőrizze az internetkapcsolatot. Bezárás Minden fájl naprakész @@ -1396,7 +1396,7 @@ Adatvédelem Pontok Saját pozícióm - Elindítod a navigációt a nyomvonal mentén? + Elindítja a navigációt a nyomvonal mentén\? Elkerülendő utak kijelölésével aktiválhat alternatív útvonalakat HTTP proxy engedélyezése HTTP proxy beállítása minden hálózati kéréshez. @@ -1430,7 +1430,7 @@ Jegyzet megosztása Exportálás Turistatérkép-nézet - Nyomvonal szakaszok + Nyomvonalszakaszok Nyomvonal pontok Kijelölve Az átnevezés nem sikerült. @@ -2164,11 +2164,10 @@ Idő Teljes táv Magasságadatok használata - Mélységvonalak és pontok megjelenítése. Tengeri mélységvonalak Felvételek automatikus szétvágása szünet után - Új szakasz kezdése 6 perc szünet után, új nyomvonal 2 óra szünet után, vagy új fájl hosszabb szünet után ha a dátum megváltozott. + Új szakasz kezdése 6 perc szünet után, új nyomvonal 2 óra szünet után vagy új fájl hosszabb szünet után ha a dátum megváltozott. Maximum sebesség Átlagsebesség Mozgásban töltött idő @@ -2313,7 +2312,7 @@ Csak az általa hozzáadott képek megtekintése: Felhasználónév A képek szűrése feltöltő, dátum vagy típus szerint. Csak magas nagyítási szinteknél lépnek érvénybe. - Sugaras vonalzó + Sugárirányú vonalzó Átlag %1$d / %2$d Emelkedő/Lejtő @@ -2914,8 +2913,8 @@ Az ..osmand/routing mappában hozzáadhatja a routing.xml fájl saját módosított verzióját Síelés Síelés - Iránytűvonalzó megjelenítése - Iránytűvonalzó elrejtése + Iránytű megjelenítése + Iránytű elrejtése Ikon kijelölése Mód: %s Felhasználói mód, eredete: %s @@ -3202,7 +3201,7 @@ Bővítmény által hozzáadott profilok Kikapcsolás Új bővítmény hozzáadva - Szegmensek összekapcsolása + Szakaszok egyesítése Irány belefoglalása Felvételkor az egyes útpontok irányát is menti. Pozíció ikon haladás közben @@ -3479,7 +3478,7 @@ OsmAnd helymegosztás OsmAnd + Mapillary Gyorsművelet - Sugaras vonalzó + Sugárirányú vonalzó Távolságmérés Utazás (Wikivoyage és Wikipédia) Térképjelölők @@ -3716,7 +3715,7 @@ Nyomvonal automatikus felvétele navigáció közben Mellékhatás: A nyomvonalból hiányozni fog minden olyan szakasz, ahol a legkisebb sebesség feltétele nem teljesült (pl. egy meredek dombra tolja fel a kerékpárt). Nem lesz információ az állásokról sem, például a pihenőkről. Ez hatással van minden elemzésre és utófeldolgozásra, például amikor megpróbálja meghatározni az utazás teljes hosszát, a mozgásban töltött időt vagy az átlagsebességét. Adjon hozzá legalább két pontot. - Csatolás az utakhoz + Utakhoz igazítás Mentés nyomvonalfájlként Másik nyomvonal kiválasztása Elmentett nyomvonal megnyitása @@ -3888,7 +3887,7 @@ Könnyű légi jármű Elvágás előtte Elvágás utána - Szakaszok egyesítése + Szakaszok összekapcsolása Új szakasz hozzáadása • Lehetőség az összes adat exportálására és importálására, beleértve a beállításokat, erőforrásokat és a saját helyeket is \n @@ -3999,4 +3998,42 @@ Terepjáró Motorkerékpár Személyautó + Távolságmérés koppintással + Intervallum + Frissítés gyakorisága + Frissítésve: %s + Legutóbb ellenőrizve: %s + Legutóbbi elérhető OpenStreetMap-frissítés: + A térképen lévő koordináta-widgetet megjelenítő vagy elrejtő kapcsoló. + Az útvonaltervezés elkerülhetné a meredek emelkedőket. + Egyes beállítások alkalmazásához újra kell indítani az alkalmazást. + Szüneteltetve + Biztosan megszakítja a felvételt\? +\nMinden el nem mentett adat el fog veszni. + Nyomvonal felvétele leállítva + Mentés és felvétel leállítása + Leállítás mentés nélkül + Töröl %1$d fájlt\? + Az összes régió + Újraindítás + Küszöbérték alatti sebességnél ne forogjon a térkép + A jelenlegi helyet jelző ikon bepattan az aktuális navigációs útvonalba + Vezetési mód kiválasztása rövidebb, gyorsabb vagy biztonságosabb útvonal tervezéséhez + Optimalizált rövidebb útvonal (energiamegtakarítás) + A térképen jelenleg aktív forgalomkorlátozások figyelembe vétele + %1$d szakasz + %1$s több szakaszt is tartalmaz. Válassza ki a navigációhoz szükséges részt. + Szakaszok kijelölése + Frissítések törlése + Biztosan törölni szeretné az összes (%s) élő frissítést\? + Vásárlások + Kategória kiválasztása vagy új hozzáadása + A felvétel folytatódni fog. + Érdekes pont nevének másolása + Megjelenítés / elrejtés + Természetvédelmi területek, védett területek és nemzeti parkok határainak elrejtése + Természetvédelmi területek határai + A nyomvonal nem tartalmaz magassági adatokat. + A nyomvonal nem tartalmaz sebességadatokat. + Kérjük, válasszon másik színezést. \ No newline at end of file From 2fe5a6dafdb79240264fe753322792ab6ebb8709 Mon Sep 17 00:00:00 2001 From: Ihor Hordiichuk Date: Tue, 16 Mar 2021 18:58:37 +0000 Subject: [PATCH 107/250] Translated using Weblate (Ukrainian) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-uk/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index 09ec130fd0..3d057b7e4e 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -4042,4 +4042,6 @@ Трек не містить даних про висоту. Трек не містить даних про швидкість. Виберіть інший тип забарвлення. + Сховати природні заповідники, заповідні території та межі національних парків + Межі природи \ No newline at end of file From 1c057904c731da9a14771d7774c6352f3c9ee5cc Mon Sep 17 00:00:00 2001 From: ace shadow Date: Wed, 17 Mar 2021 03:35:17 +0000 Subject: [PATCH 108/250] Translated using Weblate (Slovak) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-sk/strings.xml | 44 ++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index 5b2e98d67b..eacbe24df2 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -1956,7 +1956,7 @@ Posuňte mapu pre zmenu pozície značky Maďarsky (formálne) - Súčasná stopa + Aktuálna stopa Zmeniť polohu značky Španielsky (Americká) Bielorusky (Latinka) @@ -2161,7 +2161,6 @@ Zobraziť hĺbkové úrovne a body. Námorné hĺbkové vrstevnice Použiť údaje nadmorskej výšky - Prevýšenie trasy Klesanie Stúpanie @@ -4000,4 +3999,45 @@ Jazda mimo cesty Motorka Auto + Zvoliť úseky + %1$s obsahuje viac než jeden segment, pre navigáciu musíte zvoliť potrebnú časť. + Úsek %1$d + Použiť cestné obmedzenia, ktoré sú teraz aktívne na mape + Zvoľte účel jazdy pre získanie kratšej, rýchlejšej alebo bezpečnejšej trasy + Neotáčať mapu, ak je rýchlosť nižšia ako hranica + Reštartovať + Všetky regióny + Zmazať %1$d súborov\? + Zastaviť bez uloženia + Uložiť a zastaviť záznam + Záznam stopy zastavený + Naozaj chcete zastaviť záznam\? +\nVšetky neuložené údaje budú stratené. + Pri pozastavení + Niektoré nastavenia vyžadujú reštart aplikácie. + Prepínať na zobrazenie alebo skrytie nástroja Súradnice na mape. + Vzdialenosť stlačením + Najnovšia dostupná aktualizácia OpenStreetMap: + Aktualizované: %s + Posledná kontrola: %s + Frekvencia aktualizácií + Aktualizácie mapy budú kontrolované každý týždeň. Nasledujúca kontrola %1$s o %2$s. + Aktualizácie mapy budú kontrolované každý deň. Nasledujúca kontrola %1$s o %2$s. + Aktualizácie mapy budú kontrolované každú hodinu. Nasledujúca kontrola %1$s o %2$s. + Odstrániť aktualizácie + Naozaj chcete zmazať všetky živé aktualizácie (%s)\? + Zvoľte kategóriu alebo pridajte novú + Záznam bude pokračovať. + Kopírovať názov POI + Zobraziť/skryť + Interval + Skryť hranice prírodných rezervácií, národných parkov a chránených oblastí + Hranice prírodných oblastí + Stopa neobsahuje údaje o nadmorskej výške. + Stopa neobsahuje údaje o rýchlosti. + Prosím zvoľte iný typ zafarbenia. + Nákupy + Optimalizovaná kratšia trasa (úspora energie) + Ikona aktuálnej polohy bude prichytená k navigačnej trase + Výpočet trasy sa môže vyhnúť strmým stúpaniam. \ No newline at end of file From 769f1b82a2573212b17cf60938bab9d26d3db539 Mon Sep 17 00:00:00 2001 From: Yaron Shahrabani Date: Wed, 17 Mar 2021 06:47:47 +0000 Subject: [PATCH 109/250] Translated using Weblate (Hebrew) Currently translated at 99.5% (3667 of 3685 strings) --- OsmAnd/res/values-iw/strings.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OsmAnd/res/values-iw/strings.xml b/OsmAnd/res/values-iw/strings.xml index 55eda8a396..0a62aad514 100644 --- a/OsmAnd/res/values-iw/strings.xml +++ b/OsmAnd/res/values-iw/strings.xml @@ -4023,4 +4023,12 @@ המסלול אינו מכיל נתוני גובה. המסלול אינו מכיל מהירות גבוהה. נא לבחור סוג אחר של צביעה. + הפעלה מחדש + כל האזורים + למחוק %1$d קבצים\? + לעצור בלי לשמור + לשמור ולעצור את ההקלטה + הקלטת המסלול נעצרה + לעצור את ההקלטה\? +\nכל הנתונים שלא יישמרו יאבדו. \ No newline at end of file From fb8f812bc47ea014a2912c3f5abde2778c51fb64 Mon Sep 17 00:00:00 2001 From: Ahmad Alfrhood Date: Tue, 16 Mar 2021 14:51:29 +0000 Subject: [PATCH 110/250] Translated using Weblate (Arabic) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-ar/strings.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-ar/strings.xml b/OsmAnd/res/values-ar/strings.xml index 863f778c47..4be8c83219 100644 --- a/OsmAnd/res/values-ar/strings.xml +++ b/OsmAnd/res/values-ar/strings.xml @@ -4099,7 +4099,7 @@ آخر تحديث خريطة الشارع المفتوح المتاحة: تحديث: %s آخر مرة تم التحقق منها: %s - تحديث التردد + معدل التحديث سيتم فحص تحديثات الخريطة كل أسبوع. المرة القادمة %1$s في %2$s. سيتم التحقق من تحديثات الخرائط كل يوم. في المرة القادمة%1$s في %2$s. سيتم التحقق من تحديثات الخرائط كل ساعة. في المرة القادمة%1$s في %2$s. @@ -4112,4 +4112,6 @@ الفاصل الزمني لا يحتوي المسار على بيانات الارتفاع. لا يحتوي المسار على بيانات السرعة. + إخفاء المحميات الطبيعية والمناطق المحمية وحدود المتنزهات الوطنية + حدود الطبيعة \ No newline at end of file From d721baa0f998adcedc93b223fe1ae6b27cde4671 Mon Sep 17 00:00:00 2001 From: iman Date: Tue, 16 Mar 2021 16:46:05 +0000 Subject: [PATCH 111/250] Translated using Weblate (Persian) Currently translated at 96.9% (3573 of 3685 strings) --- OsmAnd/res/values-fa/strings.xml | 301 ++++++++++++++++--------------- 1 file changed, 160 insertions(+), 141 deletions(-) diff --git a/OsmAnd/res/values-fa/strings.xml b/OsmAnd/res/values-fa/strings.xml index 01a39b1c6a..356d8f0308 100644 --- a/OsmAnd/res/values-fa/strings.xml +++ b/OsmAnd/res/values-fa/strings.xml @@ -7,7 +7,7 @@ ارتفاع نقطه نام فایل GPX - فایل GPX ذخیره شد + فایل GPX ذخیره شد در \n{0} دوباره نشان نده شروع ویرایش @@ -223,7 +223,7 @@ ساختمان ساختمان تقاطع - به‌روزرسانی نقشه + روزآمدسازی نقشه ایجاد POI بله لغو @@ -379,7 +379,7 @@ آپلود ویرایش به OSM حذف ویرایش ویرایش ناهمزمان OSM: - شما می‌توانید %1$s نقشه دانلود یا به‌روز کنید. + شما می‌توانید %1$s نقشه دانلود یا روزآمد کنید. نسخهٔ رایگان نمایش توضیحات POI. آمریکای شمالی @@ -454,8 +454,8 @@ مقصد میانی %1$s از نزدیک‌ترین جاده خیلی دور است. به مقصد میانی رسیدید افزودن به‌عنوان مقصد میانی - نقطهٔ بین‌راهی GPX‏ ، ‏«{0}»، افزوده شد - افزودن نقطهٔ بین‌راهی به GPX ضبط‌شده + راه‌نشان GPX، ‏«{0}»، افزوده شد + افزودن راه‌نشان به GPX ضبط‌شده اداری مانع آموزشی @@ -538,7 +538,7 @@ داده تنظیمات تنظیمات دیگر - به‌روزرسانی نقشه + روزآمدسازی نقشه برای محاسبهٔ مسیر از اینترنت استفاده شود. استفاده از مسیریابی آنلاین ذخیره‌سازی فایل GPX ناموفق بود. @@ -548,7 +548,7 @@ در حال بارکردن شهرها… محاسبهٔ مسیر ناموفق بود. جست‌وجوی آنلاین: شهر، خیابان، پلاک - به‌روزرسانی POI + روزآمدسازی POI کارت حافظه در دسترس نیست. \nقادر به دیدن نقشه یا یافتن جزئیات نخواهید بود. به راست بپیچید و بروید @@ -712,11 +712,9 @@ برعکس‌کردن جهت رد از مقصد جاری استفاده کن گذر از سرتاسر رد - برای این محل نقشهٔ بُرداری آفلاین وجود دارد. -\n -\n\t«منو» ← «پیکربندی نقشه» ← «منبع نقشه…» ← «نقشه‌های بُرداری آفلاین». -\n -\nبرای فعال‌سازی این مسیر را دنبال کنید. + برای این محل نقشهٔ بُرداری آفلاین وجود دارد. +\n\t +\n\tبرای استفاده، فعال کنید: «منو» ← «پیکربندی نقشه» ← «منبع نقشه…» ← «نقشه‌های بُرداری آفلاین». خروجی راهنمای گفتاری نقشهٔ زیری… نقشهٔ زیری @@ -725,7 +723,7 @@ هیچ‌کدام نقشهٔ رویی نقشهٔ رویی را انتخاب کنید - نقشه قبلاً نصب شده است، تنظیمات به‌روز خواهد شد. + نقشه قبلاً نصب شده است، تنظیمات روزآمد خواهد شد. برای انجام این عملیات باید به اینترنت وصل باشید. نصب بیشتر… در زوم‌های فراتر از این سطح، از نقشه‌های شطرنجی(raster) استفاده شود. @@ -807,12 +805,12 @@ خیابان: {0}، {1} تقاطع: {0} x {1} به {2} شهر: {0} - دادهٔ محلی از طریق اینترنت به‌روز شود؟ + دادهٔ محلی از اینترنت روزآمد شود؟ بارکردن داده از سرور ناموفق بود. برای این ناحیه هیچ POIای به‌صورت آفلاین موجود نیست نرم‌افزار ناوبری OsmAnd دادهٔ نقاط توجه روزآمد شد ({0} مورد بار شد) - به‌روزرسانی لیست محلی POI ناموفق بود. + روزآمدسازی لیست محلی POI ناموفق بود. خُب حمل‌ونقل مسافت سفر @@ -942,28 +940,28 @@ \n* ما فعالانه در حال توسعهٔ OsmAnd هستیم و این پروژه و پیشرفت پیوستهٔ آن نیازمند کمک‌های مالی شماست تا برای توسعه و افزودن قابلیت‌های تازه هزینه کنیم. \n \n* لطفاً OsmAnd+‎ را بخرید یا برای ویژگی‌های تازه و خاص سرمایه‌گذاری کنید. همچنین می‌توانید از طریق سایت https://osmand.net مبلغی هدیه کنید. - برنامهٔ OsmAnd (مخفف OSM Automated Navigation Directions به‌معنی راهنمای خودکار ناوبری بر پایهٔ OSM) یک نرم‌افزار ناوبری متن‌باز است که به گسترهٔ وسیعی از دادهٔ جهانی OSM دسترسی دارد. -\n -\nتمام داده‌ٔ نقشه (بُرداری یا کاشی) را می‌توانید برای استفادهٔ آفلاین روی کارت حافظه ذخیره کنید. -\nهمچنین OsmAnd می‌تواند به‌صورت آنلاین و آفلاین مسیریابی کند و با راهنمای گفتاری شما را گام‌به‌گام هدایت کند. -\n -\n‏OsmAnd+‎ نسخهٔ پولی این برنامه است. با خریدن آن از این پروژه حمایت می‌کنید، سرمایه‌ای برای توسعهٔ قابلیت‌های جدید فراهم می‌کنید و آخرین به‌روزرسانی‌ها در اختیارتان قرار می‌گیرد. -\n -\n* از ویژگی‌های مهم: -\n- کارایی کامل در حالت آفلاین (قابلیت ذخیره‌سازی نقشه‌های بُرداری یا کاشی در حافظهٔ دستگاه) -\n- وجود نقشه‌های برداری و آفلاینِ سراسر جهان به‌صورت فشرده -\n- امکان دانلود نامحدود نقشه‌های کشوری یا منطقه‌ای مستقیماً از طریق برنامه -\n- دسترسی به ویکی‌پدیا به‌صورت آفلاین (دانلود POIهای ویکی‌پدیا) که برای گردشگری بسیار مفید است -\n -\n- امکان قراردادن نقشه‌های مختلف بر روی هم در چند لایه؛ مانند ردهای GPX یا مسیرپیمایی، مکان‌های پرکاربرد یا POI، علاقه‌مندی‌ها، منحنی‌های میزان، ایستگاه‌های حمل‌ونقل عمومی، نقشه‌های دیگر با درصد شفافیت دلخواه -\n -\n- جست‌وجوی آفلاین نقاط توجه (POIها) و نشانی‌ها -\n- مسیریابی آفلاین برای مسافت‌های متوسط -\n- نمایه‌های خودرو، دوچرخه و پیاده با قابلیت‌های اختیاری: -\n- نمای خودکار شب یا روز؛ -\n -\n- زوم وابسته به سرعت؛ -\n- میزان‌کردن نقشه در جهت قطب‌نما یا در جهت حرکت؛ + برنامهٔ OsmAnd (مخفف OSM Automated Navigation Directions به‌معنی راهنمای خودکار ناوبری بر پایهٔ OSM) یک نرم‌افزار ناوبری متن‌باز است که به گسترهٔ وسیعی از دادهٔ جهانی OSM دسترسی دارد. +\n +\nتمام داده‌ٔ نقشه (بُرداری یا کاشی) را می‌توانید برای استفادهٔ آفلاین روی کارت حافظه ذخیره کنید. +\nهمچنین OsmAnd می‌تواند به‌صورت آنلاین و آفلاین مسیریابی کند و با راهنمای گفتاری شما را گام‌به‌گام هدایت کند. +\n +\n‏OsmAnd+‎ نسخهٔ پولی این برنامه است. با خریدن آن از این پروژه حمایت می‌کنید، سرمایه‌ای برای توسعهٔ قابلیت‌های جدید فراهم می‌کنید و آخرین روزآمدسازه‌ها در اختیارتان قرار می‌گیرد. +\n +\n* از ویژگی‌های مهم: +\n- کارایی کامل در حالت آفلاین (قابلیت ذخیره‌سازی نقشه‌های بُرداری یا کاشی در حافظهٔ دستگاه) +\n- وجود نقشه‌های برداری و آفلاینِ سراسر جهان به‌صورت فشرده +\n- امکان دانلود نامحدود نقشه‌های کشوری یا منطقه‌ای مستقیماً از طریق برنامه +\n- دسترسی به ویکی‌پدیا به‌صورت آفلاین (دانلود POIهای ویکی‌پدیا) که برای گردشگری بسیار مفید است +\n +\n- امکان قراردادن نقشه‌های مختلف بر روی هم در چند لایه؛ مانند ردهای GPX یا مسیرپیمایی، مکان‌های پرکاربرد یا POI، علاقه‌مندی‌ها، منحنی‌های میزان، ایستگاه‌های حمل‌ونقل عمومی، نقشه‌های دیگر با درصد شفافیت دلخواه +\n +\n- جست‌وجوی آفلاین نقاط توجه (POIها) و نشانی‌ها +\n- مسیریابی آفلاین برای مسافت‌های متوسط +\n- نمایه‌های خودرو، دوچرخه و پیاده با قابلیت‌های اختیاری: +\n- نمای خودکار شب یا روز؛ +\n +\n- زوم وابسته به سرعت؛ +\n- میزان‌کردن نقشه در جهت قطب‌نما یا در جهت حرکت؛ \n- راهنمای خط عبوری، نمایش محدودیت سرعت، راهنمای گفتاری با صدای انسانی یا ماشینی \n دراسرع‌وقت @@ -1011,7 +1009,7 @@ شفافیت لایهٔ رویی شفافیت نقشهٔ پایه را تنظیم کنید. شفافیت نقشهٔ پایه - نقشه‌ها(ی کاشی‌وار) را برای نصب یا به‌روزرسانی انتخاب کنید. + نقشه‌ها(ی کاشی‌وار) را برای نصب یا روزآمدسازی انتخاب کنید. کمترین سطح زوم بُرداری جست‌وجو با مختصات جغرافیایی برای مشاهدهٔ مکان، پیوند اینترنتی %1$s یا پیوند اندرویدی %2$s را باز کنید @@ -1036,7 +1034,7 @@ ایستگاهی را که پیاده می‌شوید انتخاب کنید مسافت قبلی مسافت بعدی - با زوم بیشتر می‌توانید POIها را به‌روز کنید + با زوم بیشتر می‌توانید POIها را روزآمد کنید در حال ثبت نقطه… POI DDD.DDDDD @@ -1213,14 +1211,14 @@ رنگ نمایش روز اتصال - داده را در قالب فایل GPX ذخیره می‌کنید یا نقاط بین‌راهی آن را در علاقه‌مندی‌ها درون‌برد می‌کنید؟ + داده را در قالب فایل GPX ذخیره می‌کنید یا راه‌نشان‌های آن را به «علاقه‌مندی‌ها» درون‌برد می‌کنید؟ فایل GPX خالی ردها علاقه‌مندی‌ها مکان‌های من در حال بارکردن %1$s… زمان جاری - نقطهٔ بین‌راهی + راه‌نشان‌ها " \n \nبرای نمایش روی نقشه لمس طولانی کنید" @@ -1228,7 +1226,7 @@ انتخاب بازهٔ تقسیم زیررَدها: %1$s - نقاط بین‌راهی: %1$s + راه‌نشان‌ها: %1$s مسافت: %1$s (%2$s نقطه) زمان شروع: %1$tF, %1$tT زمان پایان: %1$tF, %1$tT @@ -1275,7 +1273,7 @@ مسافت سفرها همه - نقاط بین‌راهی + راه‌نشان‌ها هشدارهای ترافیکی نقاط علاقه‌مندی نزدیک نقاط توجه نزدیک @@ -1371,7 +1369,7 @@ همهٔ فایل‌ها به‌روز است خانه مسیر دیگری یافت نشد - برای %1$s نقشه به‌روزرسانی وجود دارد + برای %1$s نقشه روزآمدسازه وجود دارد جست‌وجو نمایش همه مختصات @@ -1429,7 +1427,7 @@ به‌طرف شمال به‌طرف شرق همهٔ دانلودها - به‌روز‌رسانی‌ها + روزآمدسازی‌ها بی‌خیال استفاده از رندرگیری OpenGL از رندرگیری سرعت‌یافتهٔ سخت‌افزاری OpenGL استفاده کن (شاید مصرف باتری افزایش یابد یا روی دستگاه‌های خیلی قدیمی کار نکند). @@ -1521,8 +1519,8 @@ \n- گروه‌ها و دستگاه‌ها را با سرور همگام کنند؛ \n- گروه‌ها و دستگاه‌ها را در یک پیشخوان شخصی روی وبسایت مدیریت کنند. اروپا - هلند - به‌روزرسانی وجود ندارد - به‌روزرسانی‌های زنده + روزآمدسازه‌ای وجود ندارد + روزآمدسازی‌های زنده پیش‌فرض (۱۳) پیش‌فرض (فیروزه‌ای شفاف) رنگ GPX @@ -1609,7 +1607,7 @@ نقشه را جابه‌جا کنید تا موقعیت نشانه عوض شود مرتب‌سازی - برای اطلاع‌رسانی دربارهٔ مشارکت‌های شما. + برای اطلاع‌رسانی به شما دربارهٔ مشارکت‌هایتان لازم است. آیا {0} فایل را دانلود می‌کنید؟ \n {3} مگابایت برای ذخیره‌سازی موقت و {1} مگابایت برای ذخیره‌سازی دائمی لازم دارید. (از {2} مگابایت) نوع @@ -1626,11 +1624,11 @@ هزینهٔ اشتراک مطابق دورهٔ انتخابی است. هر زمان که خواستید، اشتراک خود را در گوگل‌پلی لغو کنید. کمک مالی به جامعهٔ OSM بخشی از کمک‌های مالی به مشارکت‌کنندگان OSM داده می‌شود. هزینهٔ اشتراک تغییری نمی‌کند. - این اشتراک، به‌روزرسانی‌های ساعتی، روزانه و هفتگی و نیز امکان دانلود نامحدود همهٔ نقشه‌ها را فعال می‌کند. + این اشتراک، روزآمدسازی‌های ساعتی، روزانه و هفتگی و نیز امکان دانلود نامحدود همهٔ نقشه‌ها را فعال می‌کند. دریافت خرید با %1$s - دانلود نامحدود نقشه‌ها و به‌روزرسانی هفتگی، روزانه یا حتی ساعتی اضافه می‌شود. - دانلود نامحدود نقشه‌ها، به‌روزرسانی‌های نامحدود و افزونهٔ ویکی‌پدیا. + دانلود نامحدود نقشه‌ها و روزآمدسازی هفتگی، روزانه یا حتی ساعتی اضافه می‌شود. + دانلود نامحدود نقشه‌ها، روزآمدسازی‌های نامحدود و افزونهٔ ویکی‌پدیا. مایل/متر صرف‌نظر از دانلود نقشه‌ها شما نقشهٔ آفلاینی را نصب نکرده‌اید. نقشه‌ای را از لیست انتخاب کنید یا اینکه بعداً از طریق «منو ← %1$s»، آن را دانلود کنید. @@ -1647,7 +1645,7 @@ اجازهٔ دسترسی به موقعیتتان را بدهید مسیریابی و کشف جاهای تازه بدون اتصال به اینترنت موقعیت من را پیدا کن - اکنون همهٔ نقشه‌ها را به‌روز می‌کنید؟ + اکنون همهٔ نقشه‌ها را روزآمد می‌کنید؟ پاک‌کردن همهٔ کاشی‌ها راه صرفه‌جویی سوخت آیا این نقطهٔ جدید را جانشین «%1$s» می‌کنید؟ @@ -1710,7 +1708,7 @@ متوسط ضخیم لطفاً نشانه‌ها را از طریق نقشه اضافه کنید - هیچ نقطهٔ بین‌راهی پیدا نشد + هیچ راه‌نشانی پیدا نشد گزارش اکنون برنامه مجاز به نوشتن در ذخیره‌گاه خارجی است اما نیاز است برنامه را ببندید و دوباره اجرا کنید. به ↑ @@ -1799,7 +1797,7 @@ اولویت ساختار زمین: هموار یا پرتپه. شیب آیا از حذف این %1$d نقطه مطمئن هستید؟ - نقاط بین‌راهی، نقاط توجه(POI)، عارضه‌های نام‌دار + راه‌نشان‌ها، نقاط توجه، عارضه‌های نام‌دار رد مدت‌زمان پوشهٔ فایل GPX را انتخاب کنید @@ -1811,7 +1809,6 @@ میانگین ارتفاع مسافت کل استفاده از دادهٔ ارتفاعی - نمایش نقاط و منحنی‌های میزان عمقی. منحنی‌های میزان عمق دریا تراکم منحنی میزان @@ -1881,7 +1878,7 @@ گزینه‌ها نقطه‌ها را به‌عنوان نقاط مسیر یا در قالب یک خط ذخیره کنید. لطفاً ابتدا اشتراک OsmAnd Live را بخرید - با خرید این اشتراک نقشه‌های سراسر جهان را به‌صورت ساعتی به‌روز کنید. + با خرید این اشتراک می‌توانید نقشهٔ هر جایی را ساعتی روزآمد کنید. \n بخشی از درآمد حاصله به جامعهٔ OSM برمی‌گردد‌‌ و صرف همکاری‌ها با OSM می‌شود. \n اگر دوستدار OSM و OsmAnd هستید و مایلید حامی آن‌ها باشید و از خدمات پشتیبانی‌شان بهره‌مند شوید، بهترین راه همین تهیهٔ اشتراک است. نشانهٔ نقشه را انتخاب کنید @@ -1916,7 +1913,7 @@ اطلاعات وجود ندارد حذف بیشتر بخوانید - به‌روزرسانی‌های دانلودشده را حذف کنید تا به نسخهٔ اولیهٔ نقشه برگردید + روزآمدسازه‌های دانلودشده را حذف کنید تا به نسخهٔ اولیهٔ نقشه برگردید جاده مسدود است انتخاب تعویض مبدأ و مقصد @@ -1929,7 +1926,7 @@ مدت‌زمان کلیپ‌های ضبط‌شده را مشخص کنید. حجم فضای ذخیره‌سازی مقدار فضای قابل‌تصرف برای همهٔ کلیپ‌های ضبط‌شده را مشخص کنید. - به‌روزرسانی‌های زنده + روزآمدسازی‌های زنده نقشه‌های موجود راهنمای گفتاری را انتخاب کنید راهنمای گفتاری به زبان خود را انتخاب یا دانلود کنید. @@ -1958,7 +1955,7 @@ آلمانی فرودین بیشتر بخوانید امکانات جدید در - به‌روزرسانی + روزآمدسازی آپلود نقشهٔ پایهٔ جهان (که سرتاسر جهان را در زوم کم پوشش می‌دهد) وجود ندارد یا قدیمی شده. لطفاً برای داشتن نمایی کلی از جهان آن را دانلود کنید. کد QR @@ -2024,8 +2021,8 @@ کدِ مکانی باز (OLC) کد OLC نامعتبر است \n - کد OLC کوتاه است؛ -\nلطفاً کد کامل را بنویسید. + کد کوتاه است؛ +\nلطفاً کد OLC کامل را بنویسید کد OLC کامل و معتبر است؛ \nپهنهٔ متناظر: %1$s × %2$s محدودهٔ جست‌وجو را بزرگ‌تر کن @@ -2105,7 +2102,7 @@ نقشهٔ فقط-جاده لازم نیست، زیرا نقشهٔ استاندارد (کامل) را دارید. هنوز مایلید که دانلودش کنید؟ %1$.1f از %2$.1f مگابایت %.1f مگابایت - به‌روزرسانی همه (%1$s مگابایت) + روزآمدسازی همه (%1$s مگابایت) دانلودهای رایگان استفاده‌شده تعداد دانلودهای رایگان باقیمانده را نشان می‌دهد. محل ذخیره‌سازی نقشه‌ها و فایل‌های دیگر را مشخص کنید. @@ -2128,12 +2125,12 @@ دکمهٔ پیشخوان یا منو دو انتخاب دارید که بتوانید از طریق پیشخوانِ قابل‌تنظیم یا منوی ثابت، برنامه را کنترل کنید. همواره می‌توانید این انتخاب را در تنظیمات پیشخوان تغییر دهید. فقط با وای‌فای دانلود کن - به‌روزرسانی زنده - الآن به‌روز کن + روزآمدسازی زنده + الآن روزآمد کن برنامه اجازهٔ دسترسی به کارت حافظه ندارد - آخرین به‌روزرسانی: %s - زمان به‌روزرسانی - حجم به‌روزرسانی + آخرین روزآمدسازی: %s + زمان روزآمدسازی + حجم روزآمدسازه آخرین تغییر نقشه: %s ساعتی روزانه @@ -2278,9 +2275,9 @@ نمای خیابانی را از دید خود به‌وسیلهٔ مپیلاری هم‌رسانی کنید. ابزارک مپیلاری به‌وسیلهٔ این ابزارک با مپیلاری سریع‌تر کار کنید. - تصاویر خیابانی آنلاین برای همه. مکان‌ها را کشف کنید، همکاری کنید و جهان را به‌تصویر درآورید. + تصاویر آنلاین سطح خیابان برای همه. مکان‌ها را کشف کنید، همکاری کنید و جهان را به‌تصویر درآورید. مپیلاری - تصاویر خیابانی آنلاین برای همه. مکان‌ها را کشف کنید، همکاری کنید و جهان را به‌تصویر درآورید. + تصاویر آنلاین سطح خیابان برای همه. مکان‌ها را کشف کنید، همکاری کنید و جهان را به‌تصویر درآورید. مقصد شما در ناحیه‌ای با دسترسی خصوصی قرار دارد. دسترسی به جاده‌های خصوصی برای این سفر مجاز شود؟ شروع مجدد جست‌وجو چیزی پیدا نشد @@ -2425,27 +2422,27 @@ \n • شیوهٔ نمایش نام‌های روی نقشه را انتخاب کنید: انگلیسی، محلی یا نویسه‌گردانی‌شده \n • نمایش نقشه‌های تخصصی آنلاین، تصاویر ماهواره‌ای (بینگ) و رولایه‌های مختلف مانند ردهای GPX گردشگردی یا ناوبری با امکان تنظیم شفافیت \n - نقطهٔ بین‌راهی GPX را حذف می‌کنید؟ - ویرایش نقطهٔ بین‌راهی GPX + راه‌نشان GPX را حذف می‌کنید؟ + ویرایش راه‌نشان GPX زرد تیره پیش‌تنظیم نام - دکمه‌ای برای ایجاد یک نقطهٔ بین‌راهی GPX در مرکز صفحه. - افزودن نقطهٔ بین‌راهی - ذخیره‌کردن نقطهٔ بین‌راهی GPX - نقطهٔ بین‌راهی ۱ - در فایل %1$s هیچ نقطهٔ بین‌راهی وجود ندارد. در قالب یک رد درون‌برد شود؟ + دکمه‌ای برای افزودن یک راه‌نشان GPX در مرکز صفحه. + افزودن راه‌نشان + ذخیره‌کردن راه‌نشانِ GPX + راه‌نشان ۱ + در فایل %1$s هیچ راه‌نشانی وجود ندارد. در قالب یک رد درون‌برد شود؟ نشان‌دادن نقشه مسیر محاسبه شد سفر رفت‌وبرگشتی برای استفاده از این قابلیت باید حداقل یک نشانه اضافه کنید. جاده فایل GPX از موقعیت‌ها. - برنامهٔ OsmAnd+‎ (مخفف OSM Automated Navigation Directions به‌معنی راهنمای خودکار ناوبری بر پایهٔ OSM) یک نرم‌افزار نقشه و ناوبری است که به گسترهٔ وسیعی از دادهٔ OSM دسترسی دارد. این دادهٔ رایگان و جهانی با بالاترین کیفیت ارائه می‌شود. -\n -\nراهبر دیداری و شنیداری، مشاهدهٔ نقاط توجه (POIها یا Points of interest)، ایجاد و مدیریت ردهای GPX، استفاده از تصویرسازی منحنی‌های میزان و اطلاعات ارتفاع، انتخاب حالت‌های پیاده، دوچرخه، خودرو، امکان ویرایش مکان‌ها و... چیزهایی هستند که تجربهٔ مؤثر و لذت‌بخشی را در کار با نقشه برایتان به ارمغان می‌آورد. -\n -\n‏OsmAnd+‎ نسخهٔ پولی این برنامه است. با خریدن آن از این پروژه حمایت می‌کنید، سرمایه‌ای برای توسعهٔ قابلیت‌های جدید فراهم می‌کنید و آخرین به‌روزرسانی‌ها در اختیارتان قرار می‌گیرد. -\n + برنامهٔ OsmAnd+‎ (مخفف OSM Automated Navigation Directions به‌معنی راهنمای خودکار ناوبری بر پایهٔ OSM) یک نرم‌افزار نقشه و ناوبری است که به گسترهٔ وسیعی از دادهٔ OSM دسترسی دارد. این دادهٔ رایگان و جهانی با بالاترین کیفیت ارائه می‌شود. +\n +\nراهبر دیداری و شنیداری، مشاهدهٔ نقاط توجه (POIها یا Points of interest)، ایجاد و مدیریت ردهای GPX، استفاده از تصویرسازی منحنی‌های میزان و اطلاعات ارتفاع، انتخاب حالت‌های پیاده، دوچرخه، خودرو، امکان ویرایش مکان‌ها و... چیزهایی هستند که تجربهٔ مؤثر و لذت‌بخشی را در کار با نقشه برایتان به ارمغان می‌آورد. +\n +\n‏OsmAnd+‎ نسخهٔ پولی این برنامه است. با خریدن آن از این پروژه حمایت می‌کنید، سرمایه‌ای برای توسعهٔ قابلیت‌های جدید فراهم می‌کنید و آخرین روزآمدسازه‌ها در اختیارتان قرار می‌گیرد. +\n \nاز ویژگی‌های مهم برنامه: با فعال‌کردن این نما سبک نقشهٔ OsmAnd به نمای گردشگری (Touring view) تغییر می‌کند که سبکی با جزئیات فراوان و مناسب برای مسافران و رانندگان حرفه‌ای است. \n @@ -2524,12 +2521,12 @@ \n • نمایش نقشه‌های تخصصی آنلاین، تصاویر ماهواره‌ای (بینگ) و رولایه‌های مختلف مانند ردهای GPX گردشگردی یا ناوبری با امکان تنظیم شفافیت \n • شیوهٔ نمایش نام‌های روی نقشه را انتخاب کنید: انگلیسی، محلی یا نویسه‌گردانی‌شده \n - استفاده از اطلاعات ویکی‌پدیا و OSM -\n • ارائهٔ اطلاعات درجه‌یک از طریق بهترین پروژه‌های گروهی در سرتاسر جهان -\n • دسترسی به اطلاعات OSM بر اساس منطقه یا کشور -\n • مکان‌های ویکی‌پدیا که برای گردشگری بسیار مفید است -\n • دانلود نامحدود مستقیماً از طریق برنامه -\n • نقشه‌های بُرداری فشرده که حداقل ماهی یک بار به‌روز می‌شود + استفاده از اطلاعات ویکی‌پدیا و OSM +\n • ارائهٔ اطلاعات درجه‌یک از طریق بهترین پروژه‌های گروهی در سرتاسر جهان +\n • دسترسی به اطلاعات OSM بر اساس منطقه یا کشور +\n • مکان‌های ویکی‌پدیا که برای گردشگری بسیار مفید است +\n • دانلود نامحدود مستقیماً از طریق برنامه +\n • نقشه‌های بُرداری فشرده که حداقل ماهی یک بار روزآمد می‌شود \n • امکان انتخاب میان نقشهٔ کامل یا فقط شبکهٔ راه‌های یک منطقه (مثلاً نقشهٔ کامل ژاپن ۷۰۰ مگابایت است و نقشهٔ راه‌های ژاپن ۲۰۰ مگابایت است) امکانات ایمنی \n • تغییر خودکار بین حالت شب یا روز @@ -2557,7 +2554,7 @@ نام جدیدی بنویسید عقب نما - نقاط بین‌راهی به نشانه‌های نقشه اضافه شد + راه‌نشان‌ها به نشانه‌های نقشه اضافه شد را می‌توانید در قالب یک فایل GPX یا علاقه‌مندی‌ها درون‌برد کنید. درون‌برد در قالب فایل GPX درون‌برد به‌عنوان علاقه‌مندی‌ها @@ -2579,19 +2576,19 @@ مشخص کنید مسافت شما تا نشانه‌های فعال کجا نشان داده شود. تعداد جهت‌نماها را مشخص کنید. تنظیمات ظاهری - ردّی را انتخاب کنید تا نقاط بین‌راهیِ آن را به نشانه‌ها اضافه کنید. + ردّی را انتخاب کنید تا راه‌نشان‌های آن را به نشانه‌ها اضافه کنید. دسته‌ای از علاقه‌مندی‌ها را انتخاب کنید تا به نشانه‌ها اضافه شود. - نقاط بین‌راهی رد + راه‌نشان‌های رد گروه علاقه‌مندی‌ها افزودن گروه - گروهی از علاقه‌مندی‌ها یا نقاط بین‌راهی GPX را درون‌برد کنید. + گروهی از علاقه‌مندی‌ها یا راه‌نشان‌های GPX را درون‌برد کنید. روی نقشه نشانه‌گذاری کنید! مکان‌ها را به‌صورت کوتاه یا طولانی لمس کنید و سپس دکمهٔ پرچم را بزنید. گروه درون‌برد کنید - گروه‌های علاقه‌مندی یا نقاط بین‌راهی را در قالب نشانه درون‌برد کنید. + گروهی از علاقه‌مندی‌ها یا راه‌نشان‌ها را به‌عنوان نشانه درون‌برد کنید. نشانه‌هایی که به‌عنوان گذرانده مشخص شود در این صفحه نشان داده می‌شود. بیشتر - در حال جست‌وجوی ردهای دارای نقطهٔ بین‌راهی + در حال جست‌وجوی ردهای دارای راه‌نشان اشیای OSM را بسازید یا ویرایش کنید ‏POIها را اضافه یا ویرایش کنید، یادداشت‌های OSMای اضافه کنید یا روی آن‌ها نظر بدهید و فایل‌های GPX ضبط‌شده را آپلود کنید. حذف‌شده(ها) @@ -2676,10 +2673,10 @@ گروه حذف شد ورزش‌‌های آب‌های خروشان پاک‌کردن همهٔ نقاط میانی - همهٔ نقاط بین‌راهی رد را بیفزایید یا دسته‌های جداگانه انتخاب کنید. + همهٔ راه‌نشان‌های رد را اضافه نمایید یا دسته‌های جداگانه انتخاب کنید. کل چیزی پیدا نشد: - نقاط بین‌راهی از نشانه‌های نقشه حذف شد + راه‌نشان‌ها از نشانه‌های نقشه حذف شدند راهنماهای مسافرت نتیجه طول جغرافیایی دورقمی @@ -2720,7 +2717,7 @@ قفل‌گشایی از همهٔ قابلیت‌های OsmAnd برنامهٔ پولی افزونهٔ پولی - دادهٔ تازهٔ ویکی‌سفر منتشر شده است. به‌روز کنید و لذت ببرید. + برای ویکی‌سفر دادهٔ تازه منتشر شده است. روزآمد کنید و لذت ببرید. راهنمای مسافرت از ویکی‌سفر را دانلود کنید تا بدون نیاز به اینترنت دربارهٔ مناطق مختلف جهان مطالعه کنید. به‌روزرسانی وجود دارد دانلود فایل @@ -2767,7 +2764,7 @@ زمان رسیدن به میانی مدت تا میانی اصلاح‌یافتهٔ سبک پیشفرض برای ایجاد پادنمایی بیشتر در راه‌های پیاده و دوچرخه. از رنگ‌بندی مپنیک استفاده می‌کند. - ‏‏OsmAnd Live را تهیه کنید تا همهٔ این قابلیت‌ها باز شود: به‌روزآوری روزانهٔ نقشه و دانلودهای نامحدود، همهٔ افزونه‌های رایگان و پولی، ویکی‌پدیا، ویکی‌سفر و... + ‏‏OsmAnd Live را تهیه کنید تا همهٔ این قابلیت‌ها باز شود: روزآمدسازی روزانهٔ نقشه با دانلودهای نامحدود، همهٔ افزونه‌های رایگان و پولی، ویکی‌پدیا، ویکی‌سفر و چیزهای دیگر. ویرایش کنش‌ها لطفاً یک نماگرفت از این اعلان به support@osmand.net بفرستید اصلاح نقطه @@ -2788,7 +2785,7 @@ جست‌وجوی خیابان ابتدا شهر/محل را انتخاب کنید بازیابی - نشانه‌هایی که در قالب گروهی از علاقه‌مندی‌ها یا نقاط بین‌راهی GPX وارد شده‌اند و از آن‌ها گذشته‌اید روی نقشه باقی می‌مانند. اگر گروه مربوط به آن‌ها را غیرفعال کنید، نشانه‌ها از روی نقشه محو می‌شوند. + نشانه‌هایی که در قالب گروهی از علاقه‌مندی‌ها یا راه‌نشان‌های GPX وارد شده‌اند و از آن‌ها گذشته‌اید روی نقشه باقی می‌مانند. اگر گروه مربوط به آن‌ها را غیرفعال کنید، نشانه‌ها از روی نقشه محو می‌شوند. نشانه‌های پشت سر گذاشته را روی نقشه نگه دار نشانهٔ %s حذف شود؟ ویرایش نشانه @@ -3249,22 +3246,22 @@ سایه‌روشن و منحنی‌های میزان ترجیح جاده‌های روسازی‌نشده اولویت را به جاده‌های روسازی‌نشده می‌دهد. - به‌روزرسانی همهٔ نقشه‌ها - آیا همهٔ نقشه‌ها (%1$d) را به‌روز می‌کنید؟ - • تنظیمات برنامه و پروفایل‌ها به‌روز شد: تنظیمات بر اساس نوع مرتب شده‌اند و امکان شخصی‌سازی هر پروفایل اضافه شده است. -\n -\n• کادر جدیدی برای دانلود نقشه اضافه شده که هنگام مرور، نقشه‌ها را پیشنهاد می‌کند. -\n -\n• اصلاحاتی در پوستهٔ تیره انجام شد. -\n -\n• چند ایراد مسیریابی در سراسر جهان رفع شد. -\n -\n• نقشهٔ پایه با جزئیات بیشتر از شبکهٔ راه‌ها به‌روز شد. -\n -\n• مناطق آب‌گرفته در سراسر جهان اصلاح شد. -\n -\n• مسیریابی اسکی: پروفایل ارتفاعی و دشواری مسیر به جزئیات مسیرها افزوده شد. -\n + روزآمدسازی همهٔ نقشه‌ها + آیا همهٔ نقشه‌ها (%1$d) را روزآمد می‌کنید؟ + • تنظیمات برنامه و پروفایل‌ها روزآمد شد: تنظیمات بر اساس نوع مرتب شده‌اند و امکان شخصی‌سازی هر پروفایل اضافه شده است. +\n +\n• کادر جدیدی برای دانلود نقشه اضافه شده که هنگام مرور، نقشه‌ها را پیشنهاد می‌کند. +\n +\n• اصلاحاتی در پوستهٔ تیره انجام شد. +\n +\n• چند ایراد مسیریابی در سراسر جهان رفع شد. +\n +\n• نقشهٔ پایه با جزئیات بیشتر از شبکهٔ راه‌ها روزآمد شد. +\n +\n• مناطق آب‌گرفته در سراسر جهان اصلاح شد. +\n +\n• مسیریابی اسکی: پروفایل ارتفاعی و دشواری مسیر به جزئیات مسیرها افزوده شد. +\n \n• اصلاح سایر باگ‌ها \n \n @@ -3278,8 +3275,8 @@ شروع موتور متن به گفتار ناموفق بود. موقعیت خود را با استفاده از یک رد GPX ضبط‌شده شبیه‌سازی کنید. پروفایل OsmAnd:‏ %1$s - به‌روزرسانی‌های ماهانهٔ نقشه - به‌روزرسانی‌های ساعتی نقشه + روزآمدسازی‌های ماهانهٔ نقشه + روزآمدسازی‌های ساعتی نقشه عبارت جستجوی شما «%1$s» و همچنین مکان شما ارسال خواهد شد. \n \nاطلاعات خصوصی جمع‌آوری نمی‌شود. فقط دادهٔ جست‌وجو برای بهبود الگوریتم جست‌وجو موردنیاز است. @@ -3497,7 +3494,7 @@ ناهمواری‌ها نقشهٔ سایه‌روشن که شیب‌ها، بلندی‌ها و پستی‌ها را با استفاده از سایه‌های تیره نمایان می‌کند. کمینه و بیشینهٔ زوم برای نمایش لایه را مشخص کنید. - "باید نقشهٔ دیگری را نیز دانلود کنید تا سایه‌روشن‌ها را روی نقشه ببینید." + باید نقشهٔ دیگری را نیز دانلود کنید تا سایه‌روشن‌ها را روی نقشه ببینید. برای مشاهدهٔ شیب‌ها روی نقشه باید نقشهٔ دیگری را نیز دانلود کنید. دربارهٔ شیب‌ها می‌توانید در %1$s بیشتر بخوانید. شفافیت @@ -3556,8 +3553,8 @@ کنش پشتیبانی‌نشده %1$s %1$s / %2$s هنگام تأیید خرید، بها از حساب گوگل‌پلی شما پرداخت می‌شود. -\n -\nاگر پیش از پایان زمان اشتراک، اشتراک خود را از تنظیمات گوگل‌پلی لغو کرده باشید، اشتراک شما به‌طور خودکار تمدید نخواهد شد. فقط در موعد تمدید اشتراک، برای دورهٔ اشتراک (ماهانه/سه‌ماهه/سالانه) از حسابتان برداشت می‌شود. +\n +\nاگر اشتراک خود را پیش از پایان زمان اشتراک از تنظیمات گوگل‌پلی لغو کرده باشید، اشتراک شما به‌طور خودکار تمدید نخواهد شد. فقط در موعد تمدید اشتراک، برای دورهٔ (ماهانه/سه‌ماهه/سالانه) از حسابتان برداشت می‌شود. \n \nبرای مدیریت یا لغو اشتراک خود، به تنظیمات گوگل‌پلی بروید. OsmAnd tracker @@ -3596,22 +3593,22 @@ سیسیلی قزاقی پنجابی - • نقشه‌های آفلاین جدید شیب -\n -\n • شخصی‌سازی کامل علاقه‌مندی‌ها و نقاط بین‌راهی GPX - رنگ، نماد و شکل دلخواه -\n -\n • شخصی‌سازی ترتیب آیتم‌های منوی زمینه، پیکربندی نقشه و کشو -\n -\n • برای ویکی‌پدیا لایهٔ جداگانه‌ای در «پیکربندی نقشه» اضافه شد. فقط زبان‌های موردنیاز را برگزینید -\n -\n • نقشه/پالایهٔ POI خود را با نهایت انعطاف‌پذیری بسازید -\n -\n • گزینه‌هایی برای بازیابی تنظیمات پروفایل‌های سفارشی اضافه شد -\n -\n • مسیرهای GPX کامل که از ناوبری تولید می‌شود، تمام فرمان‌های گردش و خطوط عبوری را پشتیبانی می‌کنند. -\n -\n • اندازه‌های رابط کاربری برای تبلت‌ها اصلاح شد -\n + • نقشه‌های آفلاین جدید شیب +\n +\n • شخصی‌سازی کامل علاقه‌مندی‌ها و راه‌نشان‌های GPX - رنگ، نماد و شکل دلخواه +\n +\n • شخصی‌سازی ترتیب آیتم‌های منوی زمینه، پیکربندی نقشه و کشو +\n +\n • برای ویکی‌پدیا لایهٔ جداگانه‌ای در «پیکربندی نقشه» اضافه شد. فقط زبان‌های موردنیاز را برگزینید +\n +\n • نقشه/پالایهٔ POI خود را با نهایت انعطاف‌پذیری بسازید +\n +\n • گزینه‌هایی برای بازیابی تنظیمات پروفایل‌های سفارشی اضافه شد +\n +\n • مسیرهای GPX کامل که از ناوبری تولید می‌شود، تمام فرمان‌های گردش و خطوط عبوری را پشتیبانی می‌کنند. +\n +\n • اندازه‌های رابط کاربری برای تبلت‌ها اصلاح شد +\n \n • مشکلاتی مربوط به RTL اصلاح شد \n \n @@ -3776,7 +3773,7 @@ در ادامه برای استفاده از این گزینه، با یکی از پروفایل‌های ناوبری‌تان رد خود را به نزدیک‌ترین جادهٔ مجاز بچسبانید. پروفایل ناوبری یک فایل رد انتخاب کنید تا پارهٔ جدید را به آن بیفزایید. - تصاویر نمای خیابان + تصاویر سطح خیابان آیا می‌خواهید همهٔ تغییرات در مسیر طراحی‌شده از بین برود؟ اگر برعکس حرکت کردم ابتدای رد @@ -3793,7 +3790,7 @@ افزودن نشانی حذف نشانی ردِ ساده‌شده - فقط خط مسیر ذخیره می‌شود. نقاط بین‌راهی حذف خواهند شد. + فقط خط مسیر ذخیره می‌شود. راه‌نشان‌ها حذف خواهند شد. نام فایل پیشفرض سیستم فقط پارهٔ انتخاب‌شده با استفاده از پروفایل انتخابی بازمحاسبه می‌شود. @@ -3809,8 +3806,8 @@ ضبط رد در فایل GPX فایل رد اضافه کنید فایل رد درون‌برد یا ضبط کنید - افزودن نقطهٔ بین‌راهی رد - افزودن نقطهٔ بین‌راهی رد + افزودن راه‌نشان رد + افزودن راه‌نشان رد ضبط سفر ذخیره در قالب فایل رد %s فایل رد انتخاب شده است @@ -3891,7 +3888,7 @@ \nاز وب و ویکی‌پدیا برای عکس‌های نقاط توجه متناسب با داده‌های اوپن‌استریت‌مپ. هواپیمای سبک اتصال بخش‌ها - "تقطیع از این جا به قبل" + تقطیع از اینجا به قبل تقطیع از این جا به بعد افزودن یک بخش جدید نمایهٔ OsmAnd @@ -3926,4 +3923,26 @@ پا دوچرخه خودرو + برای اینکه برخی تنظیمات به کار بسته شود، لازم است برنامه را ببندید و دوباره باز کنید. + پنهان‌کردن مرز ذخیره‌گاه‌های طبیعی، مناطق حفاظت‌شده و پارک‌های ملی + آخرین زمان بررسی: %s + آخرین روزآمدسازهٔ اوپن‌استریت‌مپ: + روزآمدشده: %s + برای روزآمدسازی نقشه هر هفته بررسی می‌شود. زمان بعدی %1$s در %2$s. + برای روزآمدسازی نقشه هر روز بررسی می‌شود. زمان بعدی %1$s در %2$s. + برای روزآمدسازی نقشه هر ساعت بررسی می‌شود. زمان بعدی %1$s در %2$s. + حذف روزآمدسازه‌ها + آیا از حذف هر %s روزآمدسازهٔ زنده مطمئن هستید؟ + تکرار روزآمدسازی + دسته را انتخاب نمایید یا یکی جدید اضافه کنید + ضبط ادامه می‌یابد. + کپی نام نقطهٔ توجه + آشکار/پنهان‌سازی + مرزهای حفاظت محیط‌زیست + رد فاقد دادهٔ ارتفاع است. + رد فاقد دادهٔ سرعت است. + مسیر کوتاه‌ترِ بهینه (صرفه‌جویی انرژی) + نماد موقعیتِ کنونی به مسیر ناوبریِ جاری می‌چسبد + مسیریاب از سربالایی‌های شدید دوری می‌کند. + خریدها \ No newline at end of file From 4de561bc95ef542b949ea5d8ffe933e74547d6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Kotr=C4=8D?= Date: Tue, 16 Mar 2021 18:51:19 +0000 Subject: [PATCH 112/250] Translated using Weblate (Czech) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-cs/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml index ad80c28459..be9db73a65 100644 --- a/OsmAnd/res/values-cs/strings.xml +++ b/OsmAnd/res/values-cs/strings.xml @@ -4043,4 +4043,6 @@ Stopa neobsahuje údaje o nadmořské výšce. Stopa neobsahuje údaje o rychlosti. Vyberte prosím jiný typ obarvení. + Skrýt hranice přírodních rezervací, chráněných území a národních parků + Hranice přírody \ No newline at end of file From 444c5b968dbcafdd9c7bef17d28bdb7643d66f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1ns?= Date: Tue, 16 Mar 2021 14:07:09 +0000 Subject: [PATCH 113/250] Translated using Weblate (Galician) Currently translated at 99.3% (3660 of 3685 strings) --- OsmAnd/res/values-gl/strings.xml | 34 +++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-gl/strings.xml b/OsmAnd/res/values-gl/strings.xml index f12b12da6c..2f3d46f62b 100644 --- a/OsmAnd/res/values-gl/strings.xml +++ b/OsmAnd/res/values-gl/strings.xml @@ -2565,7 +2565,6 @@ Lon %2$s O OsmAnd recompila información sobre as lapelas que abres na aplicación. Non estamos a recompilar datos da localización, datos inseridos na aplicación ou datos relacionados coas áreas que ollas, procuras ou baixas. Agocha os descontos da aplicación e as mensaxes especiais dos acontecementos locais. Escoller variación da altitude - Amosar curvas e puntos do afundimento. Curvas do afundimento náuticos División automática das gravacións en intres @@ -4001,4 +4000,37 @@ Lon %2$s OpenPlaceReviews Empregar test.openplacereviews.org Iniciar sesión ao OpenPlaceReviews + A icona da localización actual será axustada á ruta de navegación actual + Non xirar a vista do mapa se a velocidade é inferior a un limiar + Reiniciar + Todas as rexións + Eliminar %1$d ficheiros\? + Deter ser gardar + Gardar e deter a gravación + Gravación da pista detida + Deixar de gravar\? +\nTodos os datos non gardados serán perdidos. + Detido + É necesario reiniciar a aplicación para aplicar algúns axustes. + A ruta podería evitar as fortes pendentes. + Trocar para amosar ou agochar o trebello de coordenadas no mapa. + Distancia ao premer + Última actualización do OpenStreetMap dispoñíbel: + Actualizado: %s + Última comprobación: %s + Frecuencia de actualización + As actualizacións do mapa serán comprobadas cada semana. A seguinte vez %1$s en %2$s. + As actualizacións do mapa serán comprobadas cada día. A seguinte vez %1$s en %2$s. + Eliminar actualizacións + Eliminar todas as actualizacións ao vivo de %s\? + Compras + Escolle categoría ou engade unha nova + A gravación continuará. + Copiar nome do PDI + Amosar/Agochar + Intre + Espazos naturais + A pista non contén datos de altitude. + A pista non contén datos de velocidade. + Escolle outro tipo de cor. \ No newline at end of file From 9ef50a14bf5303881fd548fbeddc52d56a57e677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Kotr=C4=8D?= Date: Tue, 16 Mar 2021 18:59:15 +0000 Subject: [PATCH 114/250] Translated using Weblate (Czech) Currently translated at 100.0% (3894 of 3894 strings) --- OsmAnd/res/values-cs/phrases.xml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/OsmAnd/res/values-cs/phrases.xml b/OsmAnd/res/values-cs/phrases.xml index 5183bec826..8c1af67063 100644 --- a/OsmAnd/res/values-cs/phrases.xml +++ b/OsmAnd/res/values-cs/phrases.xml @@ -3881,13 +3881,17 @@ Delegace Pobočka Vedená velvyslancem - - - - - - - - + Místo zastavení mobilní knihovny + Vrcholová kniha: ne + Vrcholová kniha: ano + Stav sjezdovky: zavřená + Stav sjezdovky: otevřená + Hlídané: ne + Hlídané: ano + Název sjezdovky Skoky na lyžích + Místní reference + Geodet + Konferenční centrum + Ve volném terénu: ano \ No newline at end of file From 89573996962a847a8f30c142a46a95a0c75ac49e Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 16 Mar 2021 18:36:12 +0000 Subject: [PATCH 115/250] Translated using Weblate (German) Currently translated at 100.0% (3894 of 3894 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 e1ec97249b..c143b4967b 100644 --- a/OsmAnd/res/values-de/phrases.xml +++ b/OsmAnd/res/values-de/phrases.xml @@ -3891,4 +3891,7 @@ Geglättet: ja Pistenname Skispringen + Lokale Referenz + Geodät + Konferenzzentrum \ No newline at end of file From 1a0aa569fbb0097d79a40811382cdf23e3e5eacc Mon Sep 17 00:00:00 2001 From: ace shadow Date: Wed, 17 Mar 2021 00:44:26 +0000 Subject: [PATCH 116/250] Translated using Weblate (Slovak) Currently translated at 95.1% (3704 of 3894 strings) --- OsmAnd/res/values-sk/phrases.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OsmAnd/res/values-sk/phrases.xml b/OsmAnd/res/values-sk/phrases.xml index 4052b3f5ec..da5fec65f7 100644 --- a/OsmAnd/res/values-sk/phrases.xml +++ b/OsmAnd/res/values-sk/phrases.xml @@ -29,7 +29,7 @@ Delikatesy Poľnonákup Ovocie/Zelenina - Ryby + Ryby a morské plody Sladkosti Zmrzlina Supermarket @@ -237,9 +237,9 @@ Vládne orgány Lokálne úrady Colná správa - Mesto (nad 100 tis.obyv.) - Mesto (10 tis.-100 tis.obyv.) - Obec (200-10 tis.obyv.) + Veľkomesto + Mesto + Obec Osada Samota/kopanica Mestský obvod @@ -269,7 +269,7 @@ Právnik Telekomunikácie Nezisková organizácia - Radnica + Radnica/Obecný úrad Personálna agentúra Výskumný ústav Informačné technológie @@ -2013,7 +2013,7 @@ Rampa pre bicykle: nie Rampa pre batožinu: nie Defibrilátor - Mesto + Veľkomesto Bývalý väzenský tábor Typ: koncentračný tábor Typ: tábor vojnových zajatcov From 030e2c29824451d27cdddbc4edb4cbc144600bc4 Mon Sep 17 00:00:00 2001 From: Eduardo Addad de Oliveira Date: Tue, 16 Mar 2021 19:36:18 +0000 Subject: [PATCH 117/250] Translated using Weblate (Portuguese (Brazil)) Currently translated at 99.9% (3683 of 3685 strings) --- OsmAnd/res/values-pt-rBR/strings.xml | 44 ++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-pt-rBR/strings.xml b/OsmAnd/res/values-pt-rBR/strings.xml index c142233a7a..543748fcb5 100644 --- a/OsmAnd/res/values-pt-rBR/strings.xml +++ b/OsmAnd/res/values-pt-rBR/strings.xml @@ -2204,7 +2204,6 @@ Altitude da rota Selecionar a flutuação de altimetria Usar dados altimétricos - Mostrar curvas e pontos batimétricos. Batimetria náutica Densidade das curvas de nível @@ -2802,7 +2801,7 @@ Mostrar ao longo da rota Simular navegação Escolha o arquivo de trilha para seguir - Avisos por voz + Instruções de voz Destinos intermediários Chega às %1$s Guarani @@ -3159,7 +3158,7 @@ Outros Anúncios de voz ocorrem apenas durante a navegação. Instruções e anúncios de navegação - Avisos por voz + Instruções de voz Configurar parâmetros de rota Parâmetros de rota Perfil do aplicativo alterado para \"%s\" @@ -4000,4 +3999,43 @@ A pé Fora de estrada Carro + Selecionar os segmentos + %1$s contém mais de um segmento, você precisa selecionar a parte necessária para a navegação. + Use as restrições de estrada que estão ativas agora no mapa + Rota mais curta otimizada (economia de energia) + Selecione o propósito de condução para obter um trajeto mais curto, mais rápido ou mais seguro + O ícone de localização atual será ajustado à rota de navegação atual + Não gire a visualização do mapa se a velocidade for inferior a um limite + Reiniciar + Todas as regiões + Excluir %1$d arquivos\? + Pare sem salvar + Salvar e parar a gravação + Gravação de trilha interrompida + Tem certeza de que deseja interromper a gravação\? +\nTodos os dados não salvos serão perdidos. + Em pausa + É necessário reiniciar o aplicativo para aplicar algumas configurações. + O roteamento pode evitar subidas fortes. + Uma alternância para mostrar ou ocultar o widget de coordenadas no mapa. + Última atualização do OpenStreetMap disponível: + Atualizado: %s + Última vez verificado: %s + Frequência de atualização + As atualizações do mapa serão verificadas todas as semanas. Próxima vez %1$s em %2$s. + As atualizações do mapa serão verificadas todos os dias. Próxima vez %1$s em %2$s. + As atualizações do mapa serão verificadas a cada hora. Da próxima vez, %1$s em %2$s. + Apagar atualizações + Tem certeza de que deseja excluir todas as atualizações ao vivo de %s\? + Compras + Selecione a categoria ou adicione uma nova + A gravação continuará. + Copiar nome de POI + Mostrar/Ocultar + Intervalo + Ocultar reserva natural, áreas protegidas e limites de parque nacional + Distância por toque + A trilha não contém dados de altitude. + A trilha não contém dados de velocidade. + Selecione outro tipo de colorização. \ No newline at end of file From 8b6613f8546306cd444a1de2e4c452fa648ea226 Mon Sep 17 00:00:00 2001 From: Eduardo Addad de Oliveira Date: Tue, 16 Mar 2021 19:21:19 +0000 Subject: [PATCH 118/250] Translated using Weblate (Portuguese (Brazil)) Currently translated at 99.9% (3892 of 3894 strings) --- OsmAnd/res/values-pt-rBR/phrases.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-pt-rBR/phrases.xml b/OsmAnd/res/values-pt-rBR/phrases.xml index f8d9acfe17..37cd897bcd 100644 --- a/OsmAnd/res/values-pt-rBR/phrases.xml +++ b/OsmAnd/res/values-pt-rBR/phrases.xml @@ -3891,4 +3891,5 @@ Satisfeito: sim Nome da pista Salto de esqui + Centro de conferências \ No newline at end of file From 37ff5c485cb0cdf9d6be83468e1f42f36bdb7079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristjan=20R=C3=A4ts?= Date: Tue, 16 Mar 2021 19:30:24 +0000 Subject: [PATCH 119/250] Translated using Weblate (Estonian) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-et/strings.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-et/strings.xml b/OsmAnd/res/values-et/strings.xml index 1a5bd7a987..f212d41299 100644 --- a/OsmAnd/res/values-et/strings.xml +++ b/OsmAnd/res/values-et/strings.xml @@ -2005,7 +2005,7 @@ Kas läheme valitud keele alla laadimiseks rakendusepoodi\? Raja vastupidine suund Kasuta olemasoleva sihtkohta - Mööda kogu rada + Järgi teekonda täielikult Hääljuhiste väljund Vali kõlar hääljuhiste esitamiseks. Telefonikõne hääl (et katkestada auto Bluetooth raadioid) @@ -4050,4 +4050,6 @@ Pööra Ostud Kaugus toksamise järgi + Peida (loodus)kaitsealade ja rahvusparkide piirid + Looduse piirid \ No newline at end of file From 45309ac2da715cc54e999fd92cd41af024ea01e6 Mon Sep 17 00:00:00 2001 From: Verdulo Date: Tue, 16 Mar 2021 14:04:00 +0000 Subject: [PATCH 120/250] Translated using Weblate (Esperanto) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-eo/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml index b3537b5d78..9583371a8e 100644 --- a/OsmAnd/res/values-eo/strings.xml +++ b/OsmAnd/res/values-eo/strings.xml @@ -4043,4 +4043,6 @@ Aĉetoj Montri/kaŝi Intertempo + Kaŝi limojn de naturaj rezervejoj, protektataj areoj kaj naciaj parkoj + Limoj de rezervejoj \ No newline at end of file From 0f41bcfad5332f60234d6c7dfe21c62348742d7f Mon Sep 17 00:00:00 2001 From: abdullah abdulrhman Date: Tue, 16 Mar 2021 14:29:53 +0000 Subject: [PATCH 121/250] Translated using Weblate (Arabic) Currently translated at 93.2% (3631 of 3894 strings) --- OsmAnd/res/values-ar/phrases.xml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-ar/phrases.xml b/OsmAnd/res/values-ar/phrases.xml index 88a19d0e1e..0c42643a7a 100644 --- a/OsmAnd/res/values-ar/phrases.xml +++ b/OsmAnd/res/values-ar/phrases.xml @@ -824,7 +824,7 @@ نحات إسكافي مبلط - حفرة + دِحل/خفس/هبوط أرضي ماء أراضي رطبة خشب و غابة @@ -3689,4 +3689,17 @@ الكنيسة الميثودية الخمسينية المشيخية + مركز مؤتمرات + موقف المكتبة المتنقلة + تسجيل للوصول للقمة: لا + تسجيل للوصول للقمة: نعم + حالة الزحلقة: مغلقة + حالة الزحلقة: مفتوحة + محروس : لا + محروس: نعم + التزلج عبر الأشجار + اسم الزحلقة + القفز على الجليد + الجيوديسيا (شكل الأرض ومساحتها) + المرجع المحلي \ No newline at end of file From 61869d8b607925f059816153d6f5837b654c586a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sveinn=20=C3=AD=20Felli?= Date: Tue, 16 Mar 2021 14:24:08 +0000 Subject: [PATCH 122/250] Translated using Weblate (Icelandic) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-is/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-is/strings.xml b/OsmAnd/res/values-is/strings.xml index d01ba5643b..6a5f04adec 100644 --- a/OsmAnd/res/values-is/strings.xml +++ b/OsmAnd/res/values-is/strings.xml @@ -4048,4 +4048,6 @@ Ferillinn inniheldur ekki hæðargögn. Ferillinn inniheldur ekki hraðagögn. Veldu aðra tegund litunar. + Fela mörk friðlanda, verndaðra svæða og þjóðgarða + Mörk náttúru \ No newline at end of file From bfb3b9934b9390a316c6a0b07ba235edee450d6a Mon Sep 17 00:00:00 2001 From: Boyuan Yang <073plan@gmail.com> Date: Tue, 16 Mar 2021 14:30:56 +0000 Subject: [PATCH 123/250] Translated using Weblate (Chinese (Simplified)) Currently translated at 77.9% (2874 of 3685 strings) --- OsmAnd/res/values-zh-rCN/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-zh-rCN/strings.xml b/OsmAnd/res/values-zh-rCN/strings.xml index b1afb6439f..50d24bae53 100644 --- a/OsmAnd/res/values-zh-rCN/strings.xml +++ b/OsmAnd/res/values-zh-rCN/strings.xml @@ -1379,7 +1379,6 @@ 平均海拔 选择海拔波动 使用标高数据 - 显示等深线和标记。 航海等深线 自动拆分录音后的间隙 @@ -3447,4 +3446,5 @@ OsmAnd GPX 格式不正确,请联系支持团队进一步调查。 只有路线线会被保存,航点会被删除。 文件名 + 三个月 \ No newline at end of file From 756bf183b27e40df15e145cd2cc18ac566904654 Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Wed, 17 Mar 2021 05:26:09 +0000 Subject: [PATCH 124/250] Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-zh-rTW/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index 2b9c674ceb..4ffbbadc5c 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -4036,4 +4036,6 @@ 軌跡不包含海拔資料。 軌跡不包含速度資料。 請選擇另一種顏色。 + 隱藏自然保留區、保護區與國家公園界線 + 自然界線 \ No newline at end of file From 9fd80543d6092584ad6375eac7e4ea80c8419309 Mon Sep 17 00:00:00 2001 From: iman Date: Tue, 16 Mar 2021 16:32:28 +0000 Subject: [PATCH 125/250] Translated using Weblate (Persian) Currently translated at 30.2% (82 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/fa/ --- OsmAnd-telegram/res/values-fa/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-telegram/res/values-fa/strings.xml b/OsmAnd-telegram/res/values-fa/strings.xml index 092218d713..577fea7240 100644 --- a/OsmAnd-telegram/res/values-fa/strings.xml +++ b/OsmAnd-telegram/res/values-fa/strings.xml @@ -59,7 +59,7 @@ نقشه میانگین ارتفاع میانگین سرعت - به‌روزرسانی + روزآمدسازی خُب جست‌وجو ارتفاع From ef1ca9efe3afb06b7fc75f15f2dc5e81b6fe0664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Kotr=C4=8D?= Date: Tue, 16 Mar 2021 19:10:13 +0000 Subject: [PATCH 126/250] Translated using Weblate (Czech) Currently translated at 28.0% (76 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/cs/ --- OsmAnd-telegram/res/values-cs/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd-telegram/res/values-cs/strings.xml b/OsmAnd-telegram/res/values-cs/strings.xml index 2dc9b2936b..7666251a53 100644 --- a/OsmAnd-telegram/res/values-cs/strings.xml +++ b/OsmAnd-telegram/res/values-cs/strings.xml @@ -75,4 +75,6 @@ Zásobník logcat Zkontrolovat a sdílet podrobné záznamy aplikace Podle názvu + Vzdálenost + Později \ No newline at end of file From 2a445a106288c1f5e991a6f430961526c40640a1 Mon Sep 17 00:00:00 2001 From: Gilbert Lowel Date: Tue, 16 Mar 2021 14:32:45 +0000 Subject: [PATCH 127/250] Translated using Weblate (Dutch) Currently translated at 93.3% (253 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/nl/ --- OsmAnd-telegram/res/values-nl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-telegram/res/values-nl/strings.xml b/OsmAnd-telegram/res/values-nl/strings.xml index ebddf36454..c9d98347a2 100644 --- a/OsmAnd-telegram/res/values-nl/strings.xml +++ b/OsmAnd-telegram/res/values-nl/strings.xml @@ -258,7 +258,7 @@ Definieer de eenheid voor snelheid. Eenheid van snelheid Stuur rapport - Exporteer naar OSM + Exporteer Logcat buffer Controleer en deel gedetailleerde logs van de app \ No newline at end of file From fae316efa4b42b20db1de814dc902535457ae4b9 Mon Sep 17 00:00:00 2001 From: MaartenDeen Date: Wed, 17 Mar 2021 08:24:04 +0000 Subject: [PATCH 128/250] Translated using Weblate (Dutch) Currently translated at 96.7% (3567 of 3685 strings) --- OsmAnd/res/values-nl/strings.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index fc156bdfba..4c8f8a5fc0 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -3666,7 +3666,7 @@ Voeg toe aan een track Voeg toe aan een trackbestand Vereenvoudigde track - Alleen de routelijn wordt opgeslagen, de waypoints worden verwijderd. + Alleen de routetrack wordt opgeslagen, de waypoints worden verwijderd. Bewaar Route omkeren Selecteer een track waaraan je een nieuw segment wil toevoegen. @@ -3676,9 +3676,9 @@ Alles wegknippen na dit punt Wijzig het routetype voor Wijzig het routetype na - • Bijgewerkt Plan een route functie: maakt het mogelijk om verschillende navigatietypes per segment te gebruiken en tracks op te nemen + • Bijgewerkte Plan een route functie: maakt het mogelijk om verschillende navigatietypes per segment te gebruiken en tracks te gebruiken \n -\n • Nieuw menu voor tracks: selecteer kleur, dikte, weergeven van richtingspijlen, start / finish-pictogrammen. +\n • Nieuw weergavemenu voor tracks: selecteer kleur, dikte, weergeven van richtingspijlen, start / finish-pictogrammen. \n \n • Verbeterde zichtbaarheid van fietsknooppunten. \n @@ -3768,15 +3768,15 @@ Kies een trackbestand om te volgen Selecteer een andere track Navigeer vanaf mijn positie naar de track - Track starten + Begin van de track Dichtstbijzijnde punt Aan wegen koppelen Adres verwijderen - Adres ingeven - Adres ingeven + Geef adres in + Geef adres in Bestandsnaam %s trackbestanden geselecteerd - Zal trackregistratie onderbreken wanneer de app wordt uitgeschakeld (via recente apps). (OsmAnd-achtergrondindicatie verdwijnt uit de Android-berichtenbalk.) + Trackregistratie wordt onderbroken als de app wordt uitgeschakeld (via recente apps). (OsmAnd-achtergrondindicatie verdwijnt uit de Android-berichtenbalk.) Vorig segment Alle voorgaande segmenten Alleen het geselecteerde segment wordt opnieuw berekend met het geselecteerde profiel. @@ -3786,7 +3786,7 @@ Voeg ten minste twee punten toe. Opnieuw doen Laatst gewijzigd - Naam: A – Z + Naam: Z - A Naam: A – Z Start/stop iconen Bedankt voor het kopen van \'Contourlijnen\' @@ -3801,7 +3801,7 @@ Ontwikkeling OsmAnd Live gegevens OsmAnd Live gegevens - Twee stappen routeberekening voor autonavigatie. + Twee-staps routeberekening voor autonavigatie. Eigen ontwikkeling van het openbaar vervoer Schakel over naar Java (veilige) routeberekening voor het openbaar vervoer Inloggen via OAuth From a49d87de36baf23ce730ff23dad5eda47403f111 Mon Sep 17 00:00:00 2001 From: Gilbert Lowel Date: Wed, 17 Mar 2021 08:23:01 +0000 Subject: [PATCH 129/250] Translated using Weblate (Dutch) Currently translated at 96.7% (3567 of 3685 strings) --- OsmAnd/res/values-nl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index 4c8f8a5fc0..33a0994358 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -47,7 +47,7 @@ zuid-zuidwest zuidwest west-zuidwest - west + westen west-noordwest noordwest Rechtuit From bce07417c6a3bfc0829a89a85a6e67cde2ebce2c Mon Sep 17 00:00:00 2001 From: Gilbert Lowel Date: Wed, 17 Mar 2021 08:29:00 +0000 Subject: [PATCH 130/250] Translated using Weblate (Dutch) Currently translated at 96.7% (3565 of 3685 strings) --- OsmAnd/res/values-nl/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index 33a0994358..04322381ac 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -495,7 +495,7 @@ Start route begeleiding Soort vervoer: Kies eerst een bestemming - Route + Routebeschrijving Openingstijden Wijzigingenset openen… Wijzigingenset sluiten… @@ -1341,7 +1341,7 @@ Stel een proxy voor Internetcommunicatie in. Privacy Punten - Navigatie langs GPX-track starten? + Navigatie langs GPX-track starten\? Je kan een alternatieve route vinden door aan te geven welke wegen niet gebruikt mogen worden GPX-tracks opnemen op aanvraag HTTP-proxy aanzetten @@ -1912,7 +1912,7 @@ Dun Gemiddeld Vet - Dag-Nacht stijl + Dag/Nacht stijl Standaardkleur Kies categorie Voer naam in From 4064e1af985b9b51a974f3367e9e687c48a42e50 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Wed, 17 Mar 2021 13:24:08 +0200 Subject: [PATCH 131/250] Travel: Maps you need card, popular articles jumping For more smoothy update recycle view notifyItemRangeChanged(getNeededMapsCardPosition(), items.size()); --- .../net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java index d39e228abb..3f2db48f0c 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java @@ -158,8 +158,6 @@ public class ExploreRvAdapter extends RecyclerView.Adapter Date: Wed, 17 Mar 2021 13:25:00 +0100 Subject: [PATCH 132/250] Update combine srtm files --- OsmAnd-java/src/main/java/net/osmand/IndexConstants.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java b/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java index 554eb7ced3..d8ff7ba61b 100644 --- a/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java +++ b/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java @@ -27,6 +27,7 @@ public class IndexConstants { public static final String BINARY_ROAD_MAP_INDEX_EXT = ".road.obf"; //$NON-NLS-1$ public static final String BINARY_ROAD_MAP_INDEX_EXT_ZIP = ".road.obf.zip"; //$NON-NLS-1$ public static final String BINARY_SRTM_MAP_INDEX_EXT = ".srtm.obf"; //$NON-NLS-1$ + public static final String BINARY_SRTM_FEET_MAP_INDEX_EXT = ".srtmf.obf"; //$NON-NLS-1$ public static final String BINARY_SRTM_MAP_INDEX_EXT_ZIP = ".srtm.obf.zip"; //$NON-NLS-1$ public static final String EXTRA_EXT = ".extra"; public static final String EXTRA_ZIP_EXT = ".extra.zip"; From 3db082bc822ba47a3359aaa42364c1b0a877df46 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 17 Mar 2021 13:51:13 +0100 Subject: [PATCH 133/250] Add constant --- OsmAnd-java/src/main/java/net/osmand/IndexConstants.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java b/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java index d8ff7ba61b..7548b52ab9 100644 --- a/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java +++ b/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java @@ -29,6 +29,7 @@ public class IndexConstants { public static final String BINARY_SRTM_MAP_INDEX_EXT = ".srtm.obf"; //$NON-NLS-1$ public static final String BINARY_SRTM_FEET_MAP_INDEX_EXT = ".srtmf.obf"; //$NON-NLS-1$ public static final String BINARY_SRTM_MAP_INDEX_EXT_ZIP = ".srtm.obf.zip"; //$NON-NLS-1$ + public static final String BINARY_SRTM_FEET_MAP_INDEX_EXT_ZIP = ".srtmf.obf.zip"; //$NON-NLS-1$ public static final String EXTRA_EXT = ".extra"; public static final String EXTRA_ZIP_EXT = ".extra.zip"; From a6bc3b969195c6286d6c6554a9610c080b1a61f5 Mon Sep 17 00:00:00 2001 From: cepprice Date: Wed, 17 Mar 2021 18:00:00 +0500 Subject: [PATCH 134/250] Fix #11031 --- .../plus/track/GpxBlockStatisticsBuilder.java | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java b/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java index 09adb88117..b66877ab63 100644 --- a/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java +++ b/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java @@ -8,15 +8,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; -import androidx.annotation.ColorInt; -import androidx.annotation.ColorRes; -import androidx.annotation.DrawableRes; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.AppCompatImageView; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - import net.osmand.AndroidUtils; import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.GPXTrackAnalysis; @@ -39,6 +30,15 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import androidx.annotation.ColorInt; +import androidx.annotation.ColorRes; +import androidx.annotation.DrawableRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.widget.AppCompatImageView; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + public class GpxBlockStatisticsBuilder { private static final Log log = PlatformUtil.getLog(GpxBlockStatisticsBuilder.class); @@ -116,12 +116,22 @@ public class GpxBlockStatisticsBuilder { public void initItems() { GPXFile gpxFile = getGPXFile(); - GpxDisplayItem gpxDisplayItem = getDisplayItem(gpxFile); + if (app == null || gpxFile == null) { + return; + } GPXTrackAnalysis analysis = null; boolean withoutGaps = true; - if (gpxDisplayItem != null) { - analysis = gpxDisplayItem.analysis; - withoutGaps = !selectedGpxFile.isJoinSegments() && gpxDisplayItem.isGeneralTrack(); + if (gpxFile.equals(app.getSavingTrackHelper().getCurrentGpx())) { + GPXFile currentGpx = app.getSavingTrackHelper().getCurrentTrack().getGpxFile(); + analysis = currentGpx.getAnalysis(0); + withoutGaps = !selectedGpxFile.isJoinSegments() + && (Algorithms.isEmpty(currentGpx.tracks) || currentGpx.tracks.get(0).generalTrack); + } else { + GpxDisplayItem gpxDisplayItem = getDisplayItem(gpxFile); + if (gpxDisplayItem != null) { + analysis = gpxDisplayItem.analysis; + withoutGaps = !selectedGpxFile.isJoinSegments() && gpxDisplayItem.isGeneralTrack(); + } } if (analysis != null) { float totalDistance = withoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance; From 307b302899977cd9573066794d04dd6642bb3d77 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Wed, 17 Mar 2021 17:20:52 +0200 Subject: [PATCH 135/250] Update ExploreRvAdapter.java --- .../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 3f2db48f0c..becc599ced 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java @@ -158,6 +158,8 @@ public class ExploreRvAdapter extends RecyclerView.Adapter Date: Wed, 17 Mar 2021 18:45:18 +0300 Subject: [PATCH 136/250] Fix huawei build --- OsmAnd/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index b4516d335e..ad12988def 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -91,7 +91,7 @@ android { java.srcDirs = ["src-nogms", "src-google"] } huawei { - java.srcDirs = ["src-nogms", "src-google"] + java.srcDirs = ["src-nogms", "src-huawei"] manifest.srcFile "AndroidManifest-huawei.xml" } From 1bdc56d52a450132b3d172284d8c66d2ba908ad9 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Wed, 17 Mar 2021 18:59:52 +0300 Subject: [PATCH 137/250] Fix huawei build --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e59a694b17..48bcc21248 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ buildscript { classpath 'com.google.gms:google-services:3.0.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - if (gradle.startParameter.taskNames.toString().contains("huawei")) { + if (gradle.startParameter.taskNames.toString().toLowerCase().contains("huawei")) { classpath 'com.huawei.agconnect:agcp:1.4.1.300' } } From c4cf068f1b4ea83fe1802bdcd226850468e7893f Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 17 Mar 2021 18:52:17 +0200 Subject: [PATCH 138/250] Fix compilation --- .../plus/inapp/InAppPurchaseHelperImpl.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java b/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java index 7a16429bd5..3fc73e6f1d 100644 --- a/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java +++ b/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java @@ -31,7 +31,6 @@ import net.osmand.plus.inapp.InAppPurchases.InAppSubscription; import net.osmand.plus.inapp.InAppPurchases.InAppSubscriptionIntroductoryInfo; import net.osmand.plus.inapp.InAppPurchasesImpl.InAppPurchaseLiveUpdatesOldSubscription; import net.osmand.plus.settings.backend.OsmandSettings; -import net.osmand.plus.settings.backend.OsmandPreference; import net.osmand.util.Algorithms; import java.lang.ref.WeakReference; @@ -268,7 +267,7 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper { InAppSubscription s = (InAppSubscription) inAppPurchase; try { s.setIntroductoryInfo(new InAppSubscriptionIntroductoryInfo(s, introductoryPrice, - introductoryPriceAmountMicros, introductoryPricePeriod, String.valueOf(introductoryPriceCycles))); + introductoryPriceAmountMicros, introductoryPricePeriod, introductoryPriceCycles)); } catch (ParseException e) { LOG.error(e); } @@ -542,20 +541,12 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper { } } } - OsmandPreference subscriptionCancelledTime = ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_TIME; 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.set(false); - if (!isDepthContoursPurchased(ctx)) { - ctx.getSettings().getCustomRenderBooleanProperty("depthContours").set(false); - } + ctx.getSettings().LIVE_UPDATES_PURCHASED.set(false); + if (!isDepthContoursPurchased(ctx)) { + ctx.getSettings().getCustomRenderBooleanProperty("depthContours").set(false); } } else if (subscribedToLiveUpdates) { - subscriptionCancelledTime.set(0L); ctx.getSettings().LIVE_UPDATES_PURCHASED.set(true); } From c90a74956a514a6b8088a11f1fdd6b14c2eb7c4d Mon Sep 17 00:00:00 2001 From: Skalii Date: Wed, 17 Mar 2021 20:16:44 +0200 Subject: [PATCH 139/250] redesign trip recording start dialog --- ...tn_background_active_transparent_light.xml | 6 + ...btn_background_active_transparent_dark.xml | 6 + ...h_switch_divider_and_additional_button.xml | 124 ++++--- .../layout/preference_button_with_icon.xml | 47 +++ .../preference_button_with_icon_quadruple.xml | 57 ++++ .../preference_button_with_icon_triple.xml | 46 +++ ...l => trip_recording_starting_fragment.xml} | 91 +++-- OsmAnd/res/values/sizes.xml | 1 + OsmAnd/res/values/strings.xml | 1 + .../osmand/plus/activities/MapActivity.java | 7 +- .../plus/activities/MapActivityActions.java | 4 +- .../monitoring/OsmandMonitoringPlugin.java | 4 +- .../TripRecordingActiveBottomSheet.java | 113 ++++--- .../monitoring/TripRecordingBottomSheet.java | 306 ----------------- .../TripRecordingStartingBottomSheet.java | 314 ++++++++++++++++++ .../fragments/BaseSettingsFragment.java | 29 +- .../plus/track/TrackAppearanceFragment.java | 6 +- 17 files changed, 712 insertions(+), 450 deletions(-) create mode 100644 OsmAnd/res/drawable-hdpi/btn_background_active_transparent_light.xml create mode 100644 OsmAnd/res/drawable/btn_background_active_transparent_dark.xml create mode 100644 OsmAnd/res/layout/preference_button_with_icon.xml create mode 100644 OsmAnd/res/layout/preference_button_with_icon_quadruple.xml create mode 100644 OsmAnd/res/layout/preference_button_with_icon_triple.xml rename OsmAnd/res/layout/{trip_recording_fragment.xml => trip_recording_starting_fragment.xml} (57%) delete mode 100644 OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java create mode 100644 OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java diff --git a/OsmAnd/res/drawable-hdpi/btn_background_active_transparent_light.xml b/OsmAnd/res/drawable-hdpi/btn_background_active_transparent_light.xml new file mode 100644 index 0000000000..add11f80f7 --- /dev/null +++ b/OsmAnd/res/drawable-hdpi/btn_background_active_transparent_light.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/OsmAnd/res/drawable/btn_background_active_transparent_dark.xml b/OsmAnd/res/drawable/btn_background_active_transparent_dark.xml new file mode 100644 index 0000000000..14ae96d07a --- /dev/null +++ b/OsmAnd/res/drawable/btn_background_active_transparent_dark.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml b/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml index 6953783885..a10a9eef42 100644 --- a/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml +++ b/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml @@ -4,80 +4,96 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginStart="@dimen/content_padding" + android:layout_marginLeft="@dimen/content_padding" + android:layout_marginEnd="@dimen/content_padding" + android:layout_marginRight="@dimen/content_padding" android:baselineAligned="false" android:gravity="center_vertical" - android:minHeight="@dimen/bottom_sheet_selected_item_title_height"> + android:minHeight="@dimen/bottom_sheet_list_item_height"> - + android:gravity="center_vertical" + app:cardBackgroundColor="?attr/switch_button_active" + app:cardCornerRadius="4dp" + app:cardElevation="0dp"> + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="?attr/selectableItemBackground" + android:orientation="horizontal"> - + + + android:layout_gravity="center_vertical" + android:layout_marginStart="@dimen/bottom_sheet_content_margin" + android:layout_marginLeft="@dimen/bottom_sheet_content_margin" + android:layout_marginEnd="@dimen/bottom_sheet_content_margin" + android:layout_marginRight="@dimen/bottom_sheet_content_margin" + android:clickable="false" + android:focusable="false" + android:focusableInTouchMode="false" + tools:checked="true" /> - + - - - + app:cardBackgroundColor="?attr/switch_button_active" + app:cardCornerRadius="4dp" + app:cardElevation="0dp"> - + android:background="?android:attr/selectableItemBackground" + android:clickable="true" + android:focusable="true" + android:gravity="center"> - + - + + + diff --git a/OsmAnd/res/layout/preference_button_with_icon.xml b/OsmAnd/res/layout/preference_button_with_icon.xml new file mode 100644 index 0000000000..1c6b6770fd --- /dev/null +++ b/OsmAnd/res/layout/preference_button_with_icon.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/preference_button_with_icon_quadruple.xml b/OsmAnd/res/layout/preference_button_with_icon_quadruple.xml new file mode 100644 index 0000000000..4105dbb2bc --- /dev/null +++ b/OsmAnd/res/layout/preference_button_with_icon_quadruple.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/preference_button_with_icon_triple.xml b/OsmAnd/res/layout/preference_button_with_icon_triple.xml new file mode 100644 index 0000000000..22d68ff090 --- /dev/null +++ b/OsmAnd/res/layout/preference_button_with_icon_triple.xml @@ -0,0 +1,46 @@ + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/trip_recording_fragment.xml b/OsmAnd/res/layout/trip_recording_starting_fragment.xml similarity index 57% rename from OsmAnd/res/layout/trip_recording_fragment.xml rename to OsmAnd/res/layout/trip_recording_starting_fragment.xml index f69e4eb4c7..809cc015ac 100644 --- a/OsmAnd/res/layout/trip_recording_fragment.xml +++ b/OsmAnd/res/layout/trip_recording_starting_fragment.xml @@ -1,11 +1,11 @@ + android:orientation="vertical" + android:paddingBottom="@dimen/content_padding"> + app:typeface="@string/font_roboto_medium" /> + android:paddingRight="@dimen/content_padding" + android:paddingBottom="@dimen/bottom_sheet_content_margin"> + - + android:layout_height="wrap_content" + app:cardBackgroundColor="?attr/switch_button_active" + app:cardCornerRadius="4dp" + app:cardElevation="0dp"> + + + + + + + + + + + + + - + android:layout_height="@dimen/content_padding" /> + + - - - diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index dae06fed05..79fa32d1c3 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -418,4 +418,5 @@ 3sp 80dp + 160dp \ No newline at end of file diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 899beda35c..93cfd93231 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,6 +11,7 @@ Thx - Hardy --> + Logging interval set time period in which OsmAnd will ask for the current location position data. Please select another type of colorization. The track does not contain speed data. The track does not contain altitude data. diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 7e0a07e40c..487f4d902f 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -93,7 +93,6 @@ import net.osmand.plus.importfiles.ImportHelper; import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment; import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.builders.cards.dialogs.ContextMenuCardDialogFragment; -import net.osmand.plus.mapcontextmenu.editors.SelectFavoriteCategoryBottomSheet; import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu; import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu; import net.osmand.plus.mapmarkers.MapMarker; @@ -105,7 +104,7 @@ import net.osmand.plus.measurementtool.LoginBottomSheetFragment; import net.osmand.plus.measurementtool.MeasurementEditingContext; import net.osmand.plus.measurementtool.MeasurementToolFragment; import net.osmand.plus.measurementtool.SnapTrackWarningFragment; -import net.osmand.plus.monitoring.TripRecordingBottomSheet; +import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet; import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.resources.ResourceManager; import net.osmand.plus.routepreparationmenu.ChooseRouteFragment; @@ -2242,8 +2241,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven return getFragment(MeasurementToolFragment.TAG); } - public TripRecordingBottomSheet getTripRecordingBottomSheet() { - return getFragment(TripRecordingBottomSheet.TAG); + public TripRecordingStartingBottomSheet getTripRecordingBottomSheet() { + return getFragment(TripRecordingStartingBottomSheet.TAG); } public ChooseRouteFragment getChooseRouteFragment() { diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index c0fec48168..ff78335e74 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -63,7 +63,7 @@ import net.osmand.plus.measurementtool.MeasurementToolFragment; import net.osmand.plus.measurementtool.StartPlanRouteBottomSheet; import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.monitoring.TripRecordingActiveBottomSheet; -import net.osmand.plus.monitoring.TripRecordingBottomSheet; +import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet; import net.osmand.plus.osmedit.dialogs.DismissRouteBottomSheetFragment; import net.osmand.plus.profiles.ProfileDataObject; import net.osmand.plus.profiles.ProfileDataUtils; @@ -856,7 +856,7 @@ public class MapActivityActions implements DialogProvider { if (monitoringPlugin.hasDataToSave() || monitoringPlugin.wasTrackMonitored()) { TripRecordingActiveBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), monitoringPlugin.getCurrentTrack()); } else { - TripRecordingBottomSheet.showInstance(mapActivity.getSupportFragmentManager()); + TripRecordingStartingBottomSheet.showInstance(mapActivity.getSupportFragmentManager()); } return true; } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 2799ac8ded..4fa978a8d6 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -331,7 +331,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { if (hasDataToSave() || wasTrackMonitored()) { TripRecordingActiveBottomSheet.showInstance(fragmentManager, getCurrentTrack()); } else { - TripRecordingBottomSheet.showInstance(fragmentManager); + TripRecordingStartingBottomSheet.showInstance(fragmentManager); } /*final boolean wasTrackMonitored = settings.SAVE_GLOBAL_TRACK_TO_GPX.get(); @@ -523,7 +523,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { runnable.run(); } else if (map instanceof FragmentActivity) { FragmentActivity activity = (FragmentActivity) map; - TripRecordingBottomSheet.showInstance(activity.getSupportFragmentManager()); + TripRecordingStartingBottomSheet.showInstance(activity.getSupportFragmentManager()); } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java index 00a9c0e8c0..27295899da 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java @@ -4,17 +4,16 @@ import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.res.ColorStateList; -import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.os.Handler; -import android.util.TypedValue; import android.text.format.DateUtils; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; +import android.widget.CompoundButton; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.TextView; @@ -26,7 +25,7 @@ import androidx.annotation.Nullable; import androidx.annotation.StringRes; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.AppCompatImageView; -import androidx.appcompat.widget.SwitchCompat; +import androidx.cardview.widget.CardView; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.content.ContextCompat; import androidx.core.graphics.drawable.DrawableCompat; @@ -49,7 +48,6 @@ import net.osmand.plus.activities.SavingTrackHelper.SaveGpxResult; import net.osmand.plus.base.MenuBottomSheetDialogFragment; import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.helpers.FontCache; import net.osmand.plus.myplaces.SaveCurrentTrackTask; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.track.GpxBlockStatisticsBuilder; @@ -66,7 +64,7 @@ import java.util.Arrays; import java.util.List; import static net.osmand.AndroidUtils.getSecondaryTextColorId; -import static net.osmand.plus.UiUtilities.CompoundButtonType.PROFILE_DEPENDENT; +import static net.osmand.plus.UiUtilities.CompoundButtonType.GLOBAL; public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragment { @@ -84,6 +82,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen private View statusContainer; private LinearLayout buttonAppearance; + private AppCompatImageView trackAppearanceIcon; private View buttonSave; private GpxBlockStatisticsBuilder blockStatisticsBuilder; @@ -141,7 +140,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen createItem(buttonClear, ItemType.CLEAR_DATA, hasDataToSave()); createItem(buttonOnline, ItemType.STOP_ONLINE, hasDataToSave()); - createItem(buttonSegment, ItemType.START_SEGMENT, wasTrackMonitored()); + createItem(buttonSegment, ItemType.START_NEW_SEGMENT, wasTrackMonitored()); createItem(buttonPause, wasTrackMonitored() ? ItemType.PAUSE : ItemType.RESUME, true); createItem(buttonStop, ItemType.STOP, true); @@ -163,37 +162,24 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen blockStatisticsBuilder.initStatBlocks(null, ContextCompat.getColor(app, getActiveTextColorId(nightMode)), nightMode); LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map); - showTrackContainer.setMinimumHeight(app.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_list_item_height)); - final LinearLayout buttonShow = showTrackContainer.findViewById(R.id.basic_item_body); + final CardView buttonShow = showTrackContainer.findViewById(R.id.compound_container); TextView showTrackTitle = buttonShow.findViewById(R.id.title); Integer showTitle = ItemType.SHOW_TRACK.getTitleId(); if (showTitle != null) { showTrackTitle.setText(showTitle); } - AndroidUtils.setPadding(buttonShow, AndroidUtils.dpToPx(app, 12f), 0, buttonShow.getPaddingRight(), 0); - showTrackTitle.setTextColor(ContextCompat.getColor(app, getActiveIconColorId(nightMode))); - showTrackTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.default_desc_text_size)); - Typeface typeface = FontCache.getFont(app, app.getResources().getString(R.string.font_roboto_medium)); - showTrackTitle.setTypeface(typeface); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - float letterSpacing = AndroidUtils.getFloatValueFromRes(app, R.dimen.text_button_letter_spacing); - showTrackTitle.setLetterSpacing(letterSpacing); - } - final SwitchCompat showTrackOnMapButton = buttonShow.findViewById(R.id.switch_button); - showTrackOnMapButton.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null); - UiUtilities.setupCompoundButton(showTrackOnMapButton, nightMode, PROFILE_DEPENDENT); + final CompoundButton showTrackCompound = buttonShow.findViewById(R.id.compound_button); + showTrackCompound.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null); + UiUtilities.setupCompoundButton(showTrackCompound, nightMode, GLOBAL); buttonAppearance = showTrackContainer.findViewById(R.id.additional_button); - View divider = buttonAppearance.getChildAt(0); - AndroidUiHelper.setVisibility(View.GONE, divider); - int marginS = app.getResources().getDimensionPixelSize(R.dimen.context_menu_padding_margin_small); - UiUtilities.setMargins(buttonAppearance, marginS, 0, 0, 0); - updateTrackIcon(buttonAppearance); + trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon); + updateTrackIcon(app, trackAppearanceIcon); buttonAppearance.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (showTrackOnMapButton.isChecked()) { + if (showTrackCompound.isChecked()) { MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { hide(); @@ -203,19 +189,19 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen } } }); - createItem(buttonAppearance, ItemType.APPEARANCE, showTrackOnMapButton.isChecked()); - setShowOnMapBackground(buttonShow, app, showTrackOnMapButton.isChecked(), nightMode); + createItem(buttonAppearance, ItemType.APPEARANCE, showTrackCompound.isChecked()); + setShowOnMapBackground(buttonShow, showTrackCompound.isChecked(), nightMode); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { buttonShow.setBackgroundTintList(null); } buttonShow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - boolean checked = !showTrackOnMapButton.isChecked(); - showTrackOnMapButton.setChecked(checked); + boolean checked = !showTrackCompound.isChecked(); + showTrackCompound.setChecked(checked); app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false); createItem(buttonAppearance, ItemType.APPEARANCE, checked); - setShowOnMapBackground(buttonShow, app, checked, nightMode); + setShowOnMapBackground(buttonShow, checked, nightMode); } }); @@ -277,7 +263,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen settings.SAVE_GLOBAL_TRACK_TO_GPX.set(wasTrackMonitored); updateStatus(); createItem(buttonPause, wasTrackMonitored ? ItemType.PAUSE : ItemType.RESUME, true); - createItem(buttonSegment, ItemType.START_SEGMENT, wasTrackMonitored); + createItem(buttonSegment, ItemType.START_NEW_SEGMENT, wasTrackMonitored); } }); @@ -310,15 +296,17 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen } } - private void updateTrackIcon(View buttonAppearance) { - String width = settings.CURRENT_TRACK_WIDTH.get(); - boolean showArrows = settings.CURRENT_TRACK_SHOW_ARROWS.get(); - int color = settings.CURRENT_TRACK_COLOR.get(); - Drawable appearanceDrawable = TrackAppearanceFragment.getTrackIcon(app, width, showArrows, color); - AppCompatImageView appearanceIcon = buttonAppearance.findViewById(R.id.icon_after_divider); - int marginTrackIconH = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small); - UiUtilities.setMargins(appearanceIcon, marginTrackIconH, 0, marginTrackIconH, 0); - appearanceIcon.setImageDrawable(appearanceDrawable); + public static void updateTrackIcon(OsmandApplication app, AppCompatImageView appearanceIcon) { + if (appearanceIcon != null) { + OsmandSettings settings = app.getSettings(); + String width = settings.CURRENT_TRACK_WIDTH.get(); + boolean showArrows = settings.CURRENT_TRACK_SHOW_ARROWS.get(); + int color = settings.CURRENT_TRACK_COLOR.get(); + Drawable appearanceDrawable = TrackAppearanceFragment.getTrackIcon(app, width, showArrows, color); + int marginTrackIconH = app.getResources().getDimensionPixelSize(R.dimen.content_padding_small); + UiUtilities.setMargins(appearanceIcon, marginTrackIconH, 0, marginTrackIconH, 0); + appearanceIcon.setImageDrawable(appearanceDrawable); + } } private void createItem(View view, ItemType type, boolean enabled) { @@ -370,7 +358,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen setTextColor(context, desc, false, nightMode, type); } - setItemBackground(context, nightMode, button != null ? button : (LinearLayout) view, enabled); + setItemBackground(context, nightMode, button != null ? button : view, enabled); } private String getTimeTrackSaved() { @@ -505,7 +493,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen show(); for (String key : keys) { if (key.equals(UPDATE_TRACK_ICON)) { - updateTrackIcon(buttonAppearance); + updateTrackIcon(app, trackAppearanceIcon); } } } @@ -524,7 +512,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen RECORDING(R.string.recording_default_name, R.drawable.ic_action_track_recordable), ON_PAUSE(R.string.on_pause, R.drawable.ic_pause), CLEAR_DATA(R.string.clear_recorded_data, R.drawable.ic_action_delete_dark), - START_SEGMENT(R.string.gpx_start_new_segment, R.drawable.ic_action_new_segment), + START_NEW_SEGMENT(R.string.gpx_start_new_segment, R.drawable.ic_action_new_segment), SAVE(R.string.shared_string_save, R.drawable.ic_action_save_to_file), PAUSE(R.string.shared_string_pause, R.drawable.ic_pause), RESUME(R.string.shared_string_resume, R.drawable.ic_play_dark), @@ -532,7 +520,9 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen STOP_AND_DISCARD(R.string.track_recording_stop_without_saving, R.drawable.ic_action_rec_stop), STOP_AND_SAVE(R.string.track_recording_save_and_stop, R.drawable.ic_action_save_to_file), STOP_ONLINE(R.string.live_monitoring_stop, R.drawable.ic_world_globe_dark), - CANCEL(R.string.shared_string_cancel, R.drawable.ic_action_close); + CANCEL(R.string.shared_string_cancel, R.drawable.ic_action_close), + START_RECORDING(R.string.shared_string_control_start, R.drawable.ic_action_direction_movement), + SETTINGS(R.string.shared_string_settings, R.drawable.ic_action_settings); @StringRes private final Integer titleId; @@ -560,24 +550,28 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen } } - public static void setItemBackground(Context context, boolean nightMode, LinearLayout view, boolean enabled) { + public static void setItemBackground(Context context, boolean nightMode, View view, boolean enabled) { Drawable background = AppCompatResources.getDrawable(context, R.drawable.btn_background_inactive_light); if (background != null && enabled) { + int normalColorId = view instanceof CardView + ? getActiveTransparentColorId(nightMode) : getInactiveButtonColorId(nightMode); ColorStateList iconColorStateList = AndroidUtils.createPressedColorStateList( - context, getInactiveButtonColorId(nightMode), getActiveButtonColorId(nightMode) + context, normalColorId, getActiveTextColorId(nightMode) ); DrawableCompat.setTintList(background, iconColorStateList); + if (view instanceof CardView) { + ((CardView) view).setCardBackgroundColor(iconColorStateList); + return; + } } else { UiUtilities.tintDrawable(background, ContextCompat.getColor(context, getInactiveButtonColorId(nightMode))); } view.setBackgroundDrawable(background); } - public static void setShowOnMapBackground(LinearLayout view, Context context, boolean checked, boolean nightMode) { - Drawable background = AppCompatResources.getDrawable(context, - nightMode ? checked ? R.drawable.btn_background_inactive_dark : R.drawable.btn_background_stroked_inactive_dark - : checked ? R.drawable.btn_background_inactive_light : R.drawable.btn_background_stroked_inactive_light); - view.setBackgroundDrawable(background); + public static void setShowOnMapBackground(View view, boolean checked, boolean nightMode) { + int background = checked ? getActiveTransparentBackgroundId(nightMode) : getInactiveStrokedBackgroundId(nightMode); + view.setBackgroundResource(background); } public static void setTextColor(Context context, TextView tv, boolean enabled, boolean nightMode, ItemType type) { @@ -638,11 +632,26 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen return nightMode ? R.color.icon_color_osmand_dark : R.color.icon_color_osmand_light; } + @DrawableRes + public static int getActiveTransparentColorId(boolean nightMode) { + return nightMode ? R.color.switch_button_active_dark : R.color.switch_button_active_light; + } + @ColorRes public static int getPressedColorId(boolean nightMode) { return nightMode ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light; } + @DrawableRes + public static int getActiveTransparentBackgroundId(boolean nightMode) { + return nightMode ? R.drawable.btn_background_active_transparent_dark : R.drawable.btn_background_active_transparent_light; + } + + @DrawableRes + public static int getInactiveStrokedBackgroundId(boolean nightMode) { + return nightMode ? R.drawable.btn_background_stroked_inactive_dark : R.drawable.btn_background_stroked_inactive_light; + } + @Override protected int getDismissButtonHeight() { return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java deleted file mode 100644 index bbaf9295f7..0000000000 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java +++ /dev/null @@ -1,306 +0,0 @@ -package net.osmand.plus.monitoring; - -import android.app.Activity; -import android.app.Dialog; -import android.content.Context; -import android.graphics.Typeface; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.text.SpannableString; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.CompoundButton; -import android.widget.CompoundButton.OnCheckedChangeListener; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.SwitchCompat; -import androidx.core.content.ContextCompat; -import androidx.fragment.app.FragmentManager; - -import com.google.android.material.slider.RangeSlider; - -import net.osmand.AndroidUtils; -import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; -import net.osmand.plus.NavigationService; -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.activities.SavingTrackHelper; -import net.osmand.plus.base.MenuBottomSheetDialogFragment; -import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription; -import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.helpers.FontCache; -import net.osmand.plus.settings.backend.OsmandSettings; -import net.osmand.plus.track.TrackAppearanceFragment; - -import static net.osmand.plus.UiUtilities.CompoundButtonType.PROFILE_DEPENDENT; -import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; -import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS; - -public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment { - - public static final String TAG = TripRecordingBottomSheet.class.getSimpleName(); - - private OsmandApplication app; - private OsmandSettings settings; - - private ImageView upDownBtn; - private SwitchCompat confirmEveryRun; - private TextView intervalValueView; - private LinearLayout container; - private View divider; - private boolean infoExpanded; - - @Override - public void createMenuItems(Bundle savedInstanceState) { - app = requiredMyApplication(); - settings = app.getSettings(); - Context context = requireContext(); - - LayoutInflater inflater = UiUtilities.getInflater(context, nightMode); - View itemView = inflater.inflate(R.layout.trip_recording_fragment, null, false); - items.add(new BottomSheetItemWithDescription.Builder() - .setCustomView(itemView) - .create()); - - final int paddingSmall = getResources().getDimensionPixelSize(R.dimen.content_padding_small); - - LinearLayout showTrackOnMapView = itemView.findViewById(R.id.show_track_on_map); - TextView showTrackOnMapTitle = showTrackOnMapView.findViewById(R.id.title); - showTrackOnMapTitle.setText(R.string.show_track_on_map); - - ImageView trackAppearanceIcon = showTrackOnMapView.findViewById(R.id.icon_after_divider); - - int color = settings.CURRENT_TRACK_COLOR.get(); - String width = settings.CURRENT_TRACK_WIDTH.get(); - boolean showArrows = settings.CURRENT_TRACK_SHOW_ARROWS.get(); - Drawable drawable = TrackAppearanceFragment.getTrackIcon(app, width, showArrows, color); - - trackAppearanceIcon.setImageDrawable(drawable); - trackAppearanceIcon.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - MapActivity mapActivity = getMapActivity(); - if (mapActivity != null) { - hide(); - SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); - TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, TripRecordingBottomSheet.this); - } - } - }); - - divider = itemView.findViewById(R.id.second_divider); - LinearLayout expandHideIntervalContainer = itemView.findViewById(R.id.interval_view_container); - upDownBtn = itemView.findViewById(R.id.up_down_button); - expandHideIntervalContainer.setOnClickListener(new View.OnClickListener() { - - @Override - public void onClick(View v) { - toggleInfoView(); - } - }); - - final int secondsLength = SECONDS.length; - final int minutesLength = MINUTES.length; - - intervalValueView = itemView.findViewById(R.id.interval_value); - updateIntervalLegend(); - - container = itemView.findViewById(R.id.always_ask_and_range_slider_container); - RangeSlider intervalSlider = itemView.findViewById(R.id.interval_slider); - intervalSlider.setValueTo(secondsLength + minutesLength - 1); - int currentModeColor = app.getSettings().getApplicationMode().getProfileColor(nightMode); - UiUtilities.setupSlider(intervalSlider, nightMode, currentModeColor, true); - container.setVisibility(View.GONE); - intervalSlider.addOnChangeListener(new RangeSlider.OnChangeListener() { - - @Override - public void onValueChange(@NonNull RangeSlider slider, float value, boolean fromUser) { - int progress = (int) value; - if (progress == 0) { - settings.SAVE_GLOBAL_TRACK_INTERVAL.set(0); - } else if (progress < secondsLength) { - settings.SAVE_GLOBAL_TRACK_INTERVAL.set(SECONDS[progress] * 1000); - } else { - settings.SAVE_GLOBAL_TRACK_INTERVAL.set(MINUTES[progress - secondsLength] * 60 * 1000); - } - updateIntervalLegend(); - } - }); - - for (int i = 0; i < secondsLength + minutesLength; i++) { - if (i < secondsLength) { - if (settings.SAVE_GLOBAL_TRACK_INTERVAL.get() <= SECONDS[i] * 1000) { - intervalSlider.setValues((float) i); - break; - } - } else { - if (settings.SAVE_GLOBAL_TRACK_INTERVAL.get() <= MINUTES[i - secondsLength] * 1000 * 60) { - intervalSlider.setValues((float) i); - break; - } - } - } - boolean checked = !settings.SAVE_GLOBAL_TRACK_REMEMBER.get(); - confirmEveryRun = itemView.findViewById(R.id.confirm_every_run); - confirmEveryRun.setChecked(checked); - setBackgroundAndPadding(checked, paddingSmall); - confirmEveryRun.setOnCheckedChangeListener(new OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - setBackgroundAndPadding(isChecked, paddingSmall); - settings.SAVE_GLOBAL_TRACK_REMEMBER.set(!isChecked); - } - }); - - final SwitchCompat showTrackOnMapButton = showTrackOnMapView.findViewById(R.id.switch_button); - showTrackOnMapButton.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null); - View basicItem = itemView.findViewById(R.id.basic_item_body); - basicItem.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - boolean checked = !showTrackOnMapButton.isChecked(); - showTrackOnMapButton.setChecked(checked); - app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false); - } - }); - UiUtilities.setupCompoundButton(showTrackOnMapButton, nightMode, PROFILE_DEPENDENT); - - updateUpDownBtn(); - } - - private void updateIntervalLegend() { - String text = getString(R.string.save_track_interval_globally); - String textValue; - int interval = settings.SAVE_GLOBAL_TRACK_INTERVAL.get(); - if (interval == 0) { - textValue = getString(R.string.int_continuosly); - } else { - int seconds = interval / 1000; - if (seconds <= SECONDS[SECONDS.length - 1]) { - textValue = seconds + " " + getString(R.string.int_seconds); - } else { - textValue = (seconds / 60) + " " + getString(R.string.int_min); - } - } - String textAll = getString(R.string.ltr_or_rtl_combine_via_colon, text, textValue); - Typeface typeface = FontCache.getRobotoMedium(app); - SpannableString spannableString = UiUtilities.createCustomFontSpannable(typeface, textAll, textValue); - intervalValueView.setText(spannableString); - } - - public void show() { - Dialog dialog = getDialog(); - if (dialog != null) { - dialog.show(); - } - } - - public void hide() { - Dialog dialog = getDialog(); - if (dialog != null) { - dialog.hide(); - } - } - - private void setBackgroundAndPadding(boolean isChecked, int paddingSmall) { - if (nightMode) { - confirmEveryRun.setBackgroundResource( - isChecked ? R.drawable.layout_bg_dark_solid : R.drawable.layout_bg_dark); - } else { - confirmEveryRun.setBackgroundResource( - isChecked ? R.drawable.layout_bg_solid : R.drawable.layout_bg); - } - confirmEveryRun.setPadding(paddingSmall, 0, paddingSmall, 0); - } - - private void updateUpDownBtn() { - int iconId = infoExpanded ? R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up; - upDownBtn.setImageDrawable(getContentIcon(iconId)); - } - - private void toggleInfoView() { - infoExpanded = !infoExpanded; - ViewGroup.MarginLayoutParams marginParams = (ViewGroup.MarginLayoutParams) divider.getLayoutParams(); - final int dp8 = AndroidUtils.dpToPx(app, 8f); - final int dp16 = AndroidUtils.dpToPx(app, 16f); - if (infoExpanded) { - AndroidUtils.setMargins(marginParams, 0, dp16, 0, dp8); - } else { - AndroidUtils.setMargins(marginParams, 0, 0, 0, dp8); - } - AndroidUiHelper.updateVisibility(container, infoExpanded); - updateUpDownBtn(); - } - - @Override - protected boolean useVerticalButtons() { - return true; - } - - @Override - protected int getRightButtonHeight() { - return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height); - } - - @Override - protected int getDismissButtonHeight() { - return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height); - } - - @Override - protected int getRightBottomButtonTextId() { - return R.string.start_recording; - } - - @Override - protected int getDismissButtonTextId() { - return R.string.shared_string_cancel; - } - - @Override - protected DialogButtonType getRightBottomButtonType() { - return DialogButtonType.PRIMARY; - } - - @Override - public int getSecondDividerHeight() { - return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_icon_margin); - } - - @Override - protected void onRightBottomButtonClick() { - SavingTrackHelper helper = app.getSavingTrackHelper(); - helper.startNewSegment(); - settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true); - app.startNavigationService(NavigationService.USED_BY_GPX); - MapActivity mapActivity = getMapActivity(); - if (mapActivity != null) { - TripRecordingActiveBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), helper.getCurrentTrack()); - } - dismiss(); - } - - @Nullable - public MapActivity getMapActivity() { - Activity activity = getActivity(); - if (activity instanceof MapActivity) { - return (MapActivity) activity; - } - return null; - } - - public static void showInstance(@NonNull FragmentManager fragmentManager) { - if (!fragmentManager.isStateSaved()) { - TripRecordingBottomSheet fragment = new TripRecordingBottomSheet(); - fragment.show(fragmentManager, TAG); - } - } -} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java new file mode 100644 index 0000000000..7f19ea13fb --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java @@ -0,0 +1,314 @@ +package net.osmand.plus.monitoring; + +import android.app.Activity; +import android.app.Dialog; +import android.content.Context; +import android.graphics.Typeface; +import android.os.Build; +import android.os.Bundle; +import android.text.SpannableString; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.CompoundButton; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.widget.AppCompatImageView; +import androidx.appcompat.widget.SwitchCompat; +import androidx.cardview.widget.CardView; +import androidx.fragment.app.FragmentManager; + +import com.google.android.material.slider.RangeSlider; + +import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; +import net.osmand.plus.NavigationService; +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.activities.SavingTrackHelper; +import net.osmand.plus.base.MenuBottomSheetDialogFragment; +import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; +import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.helpers.FontCache; +import net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.ItemType; +import net.osmand.plus.settings.backend.OsmandSettings; +import net.osmand.plus.settings.fragments.BaseSettingsFragment; +import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType; +import net.osmand.plus.track.TrackAppearanceFragment; + +import static net.osmand.plus.UiUtilities.CompoundButtonType.GLOBAL; +import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; +import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.UPDATE_TRACK_ICON; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.createItem; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.setShowOnMapBackground; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.updateTrackIcon; + +public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragment { + + public static final String TAG = TripRecordingStartingBottomSheet.class.getSimpleName(); + public static final String UPDATE_LOGGING_INTERVAL = "update_logging_interval"; + + private OsmandApplication app; + private OsmandSettings settings; + + private AppCompatImageView upDownBtn; + private AppCompatImageView trackAppearanceIcon; + private CardView confirmContainer; + private SwitchCompat confirmCompound; + private TextView intervalValueView; + private LinearLayout intervalContainer; + private RangeSlider intervalSlider; + + private boolean infoExpanded; + + public static void showInstance(@NonNull FragmentManager fragmentManager) { + if (!fragmentManager.isStateSaved()) { + TripRecordingStartingBottomSheet fragment = new TripRecordingStartingBottomSheet(); + fragment.show(fragmentManager, TAG); + } + } + + @Override + public void createMenuItems(Bundle savedInstanceState) { + app = requiredMyApplication(); + settings = app.getSettings(); + Context context = requireContext(); + + LayoutInflater inflater = UiUtilities.getInflater(context, nightMode); + View itemView = inflater.inflate(R.layout.trip_recording_starting_fragment, null, false); + items.add(new BaseBottomSheetItem.Builder() + .setCustomView(itemView) + .create()); + + LinearLayout expandHideIntervalContainer = itemView.findViewById(R.id.interval_view_container); + upDownBtn = itemView.findViewById(R.id.up_down_button); + expandHideIntervalContainer.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + updateIntervalContainer(); + } + }); + + intervalValueView = itemView.findViewById(R.id.interval_value); + intervalContainer = itemView.findViewById(R.id.always_ask_and_range_slider_container); + intervalSlider = itemView.findViewById(R.id.interval_slider); + updateIntervalValue(); + + confirmContainer = itemView.findViewById(R.id.confirm_container); + confirmCompound = confirmContainer.findViewById(R.id.confirm_compound_button); + updateGlobalRemember(); + confirmContainer.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + boolean checked = !confirmCompound.isChecked(); + confirmCompound.setChecked(checked); + settings.SAVE_GLOBAL_TRACK_REMEMBER.set(checked); + setShowOnMapBackground(confirmContainer, checked, nightMode); + } + }); + + LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map); + + final CardView buttonShow = itemView.findViewById(R.id.compound_container); + TextView showTrackTitle = buttonShow.findViewById(R.id.title); + showTrackTitle.setText(R.string.show_track_on_map); + final CompoundButton showTrackCompound = buttonShow.findViewById(R.id.compound_button); + showTrackCompound.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null); + UiUtilities.setupCompoundButton(showTrackCompound, nightMode, GLOBAL); + + LinearLayout buttonAppearance = showTrackContainer.findViewById(R.id.additional_button); + trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon); + updateTrackIcon(app, trackAppearanceIcon); + buttonAppearance.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + hide(); + SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); + TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, TripRecordingStartingBottomSheet.this); + } + } + }); + setShowOnMapBackground(buttonShow, showTrackCompound.isChecked(), nightMode); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + buttonShow.setBackgroundTintList(null); + } + buttonShow.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + boolean checked = !showTrackCompound.isChecked(); + showTrackCompound.setChecked(checked); + app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false); + setShowOnMapBackground(buttonShow, checked, nightMode); + } + }); + + updateUpDownBtn(); + + CardView cardLeft = itemView.findViewById(R.id.button_left); + createItem(app, nightMode, cardLeft, ItemType.CANCEL, true, null); + cardLeft.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dismiss(); + } + }); + + CardView cardCenter = itemView.findViewById(R.id.button_center); + createItem(app, nightMode, cardCenter, ItemType.START_RECORDING, true, null); + cardCenter.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + startRecording(); + } + }); + + CardView cardRight = itemView.findViewById(R.id.button_right); + createItem(app, nightMode, cardRight, ItemType.SETTINGS, true, null); + cardRight.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + hide(); + BaseSettingsFragment.showInstance(mapActivity, SettingsScreenType.MONITORING_SETTINGS, TripRecordingStartingBottomSheet.this); + } + } + }); + } + + private void updateIntervalLegend() { + String text = getString(R.string.save_track_interval_globally); + String textValue; + int interval = settings.SAVE_GLOBAL_TRACK_INTERVAL.get(); + if (interval == 0) { + textValue = getString(R.string.int_continuosly); + } else { + int seconds = interval / 1000; + if (seconds <= SECONDS[SECONDS.length - 1]) { + textValue = seconds + " " + getString(R.string.int_seconds); + } else { + textValue = (seconds / 60) + " " + getString(R.string.int_min); + } + } + String textAll = getString(R.string.ltr_or_rtl_combine_via_colon, text, textValue); + Typeface typeface = FontCache.getRobotoMedium(app); + SpannableString spannableString = UiUtilities.createCustomFontSpannable(typeface, textAll, textValue); + intervalValueView.setText(spannableString); + } + + private void updateIntervalValue() { + if (intervalSlider != null && intervalContainer != null) { + updateIntervalLegend(); + final int secondsLength = SECONDS.length; + final int minutesLength = MINUTES.length; + intervalSlider.setValueTo(secondsLength + minutesLength - 1); + int currentModeColor = app.getSettings().getApplicationMode().getProfileColor(nightMode); + UiUtilities.setupSlider(intervalSlider, nightMode, currentModeColor, true); + intervalContainer.setVisibility(View.GONE); + intervalSlider.addOnChangeListener(new RangeSlider.OnChangeListener() { + + @Override + public void onValueChange(@NonNull RangeSlider slider, float value, boolean fromUser) { + int progress = (int) value; + if (progress == 0) { + settings.SAVE_GLOBAL_TRACK_INTERVAL.set(0); + } else if (progress < secondsLength) { + settings.SAVE_GLOBAL_TRACK_INTERVAL.set(SECONDS[progress] * 1000); + } else { + settings.SAVE_GLOBAL_TRACK_INTERVAL.set(MINUTES[progress - secondsLength] * 60 * 1000); + } + updateIntervalLegend(); + } + }); + + for (int i = 0; i < secondsLength + minutesLength; i++) { + if (i < secondsLength) { + if (settings.SAVE_GLOBAL_TRACK_INTERVAL.get() <= SECONDS[i] * 1000) { + intervalSlider.setValues((float) i); + break; + } + } else { + if (settings.SAVE_GLOBAL_TRACK_INTERVAL.get() <= MINUTES[i - secondsLength] * 1000 * 60) { + intervalSlider.setValues((float) i); + break; + } + } + } + } + } + + private void updateIntervalContainer() { + infoExpanded = !infoExpanded; + AndroidUiHelper.updateVisibility(intervalContainer, infoExpanded); + updateUpDownBtn(); + } + + private void updateGlobalRemember() { + if (confirmContainer != null && confirmCompound != null) { + confirmCompound.setChecked(settings.SAVE_GLOBAL_TRACK_REMEMBER.get()); + setShowOnMapBackground(confirmContainer, confirmCompound.isChecked(), nightMode); + } + } + + private void updateUpDownBtn() { + int iconId = infoExpanded ? R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up; + upDownBtn.setImageDrawable(getContentIcon(iconId)); + } + + private void startRecording() { + SavingTrackHelper helper = app.getSavingTrackHelper(); + helper.startNewSegment(); + settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true); + app.startNavigationService(NavigationService.USED_BY_GPX); + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + TripRecordingActiveBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), helper.getCurrentTrack()); + } + dismiss(); + } + + public void show(String... keys) { + Dialog dialog = getDialog(); + if (dialog != null) { + dialog.show(); + for (String key : keys) { + if (key.equals(UPDATE_TRACK_ICON)) { + updateTrackIcon(app, trackAppearanceIcon); + } + if (key.equals(UPDATE_LOGGING_INTERVAL)) { + updateGlobalRemember(); + updateIntervalValue(); + AndroidUiHelper.updateVisibility(intervalContainer, infoExpanded); + } + } + } + } + + public void hide() { + Dialog dialog = getDialog(); + if (dialog != null) { + dialog.hide(); + } + } + + @Nullable + public MapActivity getMapActivity() { + Activity activity = getActivity(); + if (activity instanceof MapActivity) { + return (MapActivity) activity; + } + return null; + } + + @Override + protected boolean hideButtonsContainer() { + return true; + } + +} diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java index e6d39cade8..d71387c0ce 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java @@ -61,6 +61,7 @@ import net.osmand.plus.activities.OsmandInAppPurchaseActivity; import net.osmand.plus.audionotes.MultimediaNotesFragment; import net.osmand.plus.development.DevelopmentSettingsFragment; import net.osmand.plus.monitoring.MonitoringSettingsFragment; +import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet; import net.osmand.plus.openplacereviews.OprSettingsFragment; import net.osmand.plus.osmedit.OsmEditingFragment; import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment; @@ -85,6 +86,7 @@ import java.io.Serializable; import java.util.Set; import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID; +import static net.osmand.plus.monitoring.TripRecordingStartingBottomSheet.UPDATE_LOGGING_INTERVAL; public abstract class BaseSettingsFragment extends PreferenceFragmentCompat implements OnPreferenceChangeListener, OnPreferenceClickListener, AppModeChangedListener, OnConfirmPreferenceChange { @@ -291,6 +293,15 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl } } + @Override + public void onDestroyView() { + super.onDestroyView(); + Fragment target = getTargetFragment(); + if (target instanceof TripRecordingStartingBottomSheet) { + ((TripRecordingStartingBottomSheet) target).show(UPDATE_LOGGING_INTERVAL); + } + } + @Override public void onDetach() { super.onDetach(); @@ -884,21 +895,37 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl } public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType) { - return showInstance(activity, screenType, null); + return showInstance(activity, screenType, (ApplicationMode) null); + } + + public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, Fragment target) { + return showInstance(activity, screenType, null, target); } public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, @Nullable ApplicationMode appMode) { return showInstance(activity, screenType, appMode, new Bundle()); } + public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, @Nullable ApplicationMode appMode, Fragment target) { + return showInstance(activity, screenType, appMode, new Bundle(), target); + } + public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, @Nullable ApplicationMode appMode, @NonNull Bundle args) { + return showInstance(activity, screenType, appMode, args, null); + } + + public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, + @Nullable ApplicationMode appMode, @NonNull Bundle args, @Nullable Fragment target) { try { Fragment fragment = Fragment.instantiate(activity, screenType.fragmentName); if (appMode != null) { args.putString(APP_MODE_KEY, appMode.getStringKey()); } fragment.setArguments(args); + if (target != null) { + fragment.setTargetFragment(target, 0); + } activity.getSupportFragmentManager().beginTransaction() .replace(R.id.fragmentContainer, fragment, screenType.fragmentName) .addToBackStack(DRAWER_SETTINGS_ID + ".new") diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java index f33571bdd6..807becbb1c 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java @@ -37,7 +37,7 @@ import net.osmand.plus.dialogs.GpxAppearanceAdapter.AppearanceListItem; import net.osmand.plus.dialogs.GpxAppearanceAdapter.GpxAppearanceAdapterType; import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.monitoring.TripRecordingActiveBottomSheet; -import net.osmand.plus.monitoring.TripRecordingBottomSheet; +import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet; import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener; import net.osmand.plus.settings.backend.CommonPreference; @@ -398,8 +398,8 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement @Override public void onContextMenuDismiss(@NonNull ContextMenuFragment fragment) { Fragment target = getTargetFragment(); - if (target instanceof TripRecordingBottomSheet) { - ((TripRecordingBottomSheet) target).show(); + if (target instanceof TripRecordingStartingBottomSheet) { + ((TripRecordingStartingBottomSheet) target).show(UPDATE_TRACK_ICON); } else if (target instanceof TripRecordingActiveBottomSheet) { ((TripRecordingActiveBottomSheet) target).show(UPDATE_TRACK_ICON); } From 05972cdfec20ffb99729aa4645c482eaf4b61dcd Mon Sep 17 00:00:00 2001 From: MaartenDeen Date: Wed, 17 Mar 2021 21:16:20 +0000 Subject: [PATCH 140/250] Translated using Weblate (Dutch) Currently translated at 97.2% (3583 of 3685 strings) --- OsmAnd/res/values-nl/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index 04322381ac..ddd016f831 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -3634,7 +3634,7 @@ Route tussen punten Vervolgens, zet uw track vast op de dichtstbijzijnde toegestane weg met een van uw navigatieprofielen om deze optie te gebruiken. %1$s gegevens alleen beschikbaar op wegen, u moet een route berekenen met behulp van \"Route tussen punten\" om deze gegevens te krijgen. - Selecteer hoe de punten verbonden worden, via een rechte lijn, of een route berekenen tussen de punten zoals hieronder aangegeven. + Kies hoe de punten verbonden worden: via een rechte lijn, of een route berekenen tussen de punten zoals hieronder aangegeven. Alleen het volgende segment wordt opnieuw berekend met het geselecteerde profiel. Volgende segment Alle volgende segmenten @@ -3701,7 +3701,7 @@ Wacht totdat route herberekend is. \nNa herberekening is de grafiek zichtbaar. %1$s — %2$s - Kies een trackbestand om te volgen of importeer het, vanaf uw apparaat. + Kies een trackbestand om te volgen of importeer het vanaf uw apparaat. Onderbreking Aangepast Voer een OAuth-login uit om osm edit functies te gebruiken From 09205278acae0dee8b06fd1fda0e6176b2e9260a Mon Sep 17 00:00:00 2001 From: Gilbert Lowel Date: Wed, 17 Mar 2021 08:47:11 +0000 Subject: [PATCH 141/250] Translated using Weblate (Dutch) Currently translated at 97.2% (3583 of 3685 strings) --- OsmAnd/res/values-nl/strings.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index ddd016f831..b2566a077e 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -3137,8 +3137,8 @@ Help ons begrijpen welke OsmAnd functies het populairst zijn. Toets \"Toestaan\" als u akkoord gaat met onze %1$s Shuttlebus - Toon kompas wijzer - Verberg kompas wijzer + Toon kompasliniaal + Verberg kompasliniaal Modus: %s Gebruikers modus, afgeleid van: %s Baseer uw aangepaste profiel op één van de standaard profielen, dit bepaalt de algemene opzet zoals standaard zichtbaarheid van widgets en eenheden van snelheid en afstand. Dit zijn de standaard profielen samen met voorbeelden van aangepaste profielen die uitgebreid kunnen worden: @@ -3972,7 +3972,7 @@ Weet u zeker dat u de opname wilt stoppen\? \n(Alle niet opgeslagen gegevens gaan verloren.). Selecteer segmenten - %1$s meer dan één segment bevat, moet u het nodigde deel van de navigatie selecteren. + %1$s bevat meer dan één segment , je moet het noodzakelijke deel van de navigatie selecteren. Segment %1$d Hillshade / Helling / Contourlijnen OpenPlaceReviews is een gemeenschaps gestuurd project over openbare plaatsen zoals restaurants, hotels, musea, way-points. Het verzamelt alle openbare informatie over hen, zoals foto\'s, recensies, links naar andere systemen die OpenStreetMap, Wikipedia linken. @@ -3996,7 +3996,7 @@ Off-road Bromfiets Auto\'s - Gebruik wegbeperkingen die nu actief zijn op de kaart + Gebruik de wegen beperkingen die nu actief zijn op de kaart Geoptimaliseerde kortere route (energiebesparing) Selecteer een tussenpunt om een kortere, snellere of veiligere route te krijgen Het huidige locatiepictogram wordt vastgeklikt aan de huidige navigatieroute @@ -4005,10 +4005,10 @@ Alle regio\'s Wis %1$d bestanden\? Stop zonder opslaan - Bewaar en stop met opnemen + Bewaar en stop de opname Trackopname gestopt Pauze - Opnieuw opstarten van applicatie vereist om bepaalde instellingen toe te passen. + Herstarten van de applicatie is vereist om bepaalde instellingen toe te passen. Routebepaling kan sterke hellingen vermijden. Een schuifschakelaar om de coördinaten-widget op de kaart weer te geven of te verbergen. Afstand bij het tikken From 778b5b024c4eb7b0e3f1811298457a9322cd8607 Mon Sep 17 00:00:00 2001 From: josep constanti Date: Wed, 17 Mar 2021 18:53:48 +0000 Subject: [PATCH 142/250] Translated using Weblate (Catalan) Currently translated at 94.3% (3477 of 3685 strings) --- OsmAnd/res/values-ca/strings.xml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml index a48a93b61f..8e83c6b040 100644 --- a/OsmAnd/res/values-ca/strings.xml +++ b/OsmAnd/res/values-ca/strings.xml @@ -2158,7 +2158,6 @@ Mostra isòbates i fondàries puntuals. Isòbates Utilitza les cotes d\'elevació - Alçat de la ruta Descens Ascens @@ -3815,4 +3814,15 @@ Permet rierols i torrents Permet les vies navegables no permanents Permet les vies navegables no permanents + Compres + Seleccioneu una categoria o afegiu-ne una de nova + L\'enregistrament continuarà. + Copia el nom del PDI + Mostra/amaga + Interval + Amaga reserves naturals, àrees protegides i delimitacions de parcs nacionals + Fronteres naturals + La traça no conté dades d\'altitud. + La traça no conté dades de velocitat. + Seleccioneu un altre tipus de coloració. \ No newline at end of file From 0b33264c3e8b1e17484c3324065d4f025a310348 Mon Sep 17 00:00:00 2001 From: Evgenii Martynenko Date: Wed, 17 Mar 2021 16:13:02 +0000 Subject: [PATCH 143/250] Translated using Weblate (Russian) Currently translated at 99.8% (3678 of 3685 strings) --- OsmAnd/res/values-ru/strings.xml | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 03ce82f6fa..5398b886f7 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -3437,7 +3437,7 @@ Восстановить все настройки профиля\? Сохранение нового профиля Не удалось создать резервную копию профиля. - Очистить записанные данные\? + Вы уверены, что хотите очистить записанные данные\? Побочный эффект: в треке будут отсутствовать все участки, где не соблюдён критерий минимальной скорости (например где вы толкаете велосипед вверх по крутому склону). Также не будет информации о периодах покоя, например во время отдыха. Это влияет на любой анализ или последующую обработку, например при попытке определить общую продолжительность поездки, время в движении или среднюю скорость. Побочный эффект: в результате фильтрации по точности, точки могут быть полностью пропущены, например, под мостами, под деревьями, между высокими зданиями или при определённых погодных условиях. Примечание: при включении GPS непосредственно перед записью точность определения первой точки может быть снижена, поэтому мы рассматриваем добавление секундной задержки перед записью точки (либо записи лучшей из трёх последовательных точек и т. д.), но пока это не реализовано. @@ -3724,7 +3724,7 @@ Далее необходимо выбрать профиль навигации для определения порогового расстояния и привязки маршрута к ближайшей разрешённой дороге. Выберите, как соединять точки: прямой линией или строить маршрут по заданному профилю. При обратном направлении - Все изменения будут утеряны. + Вы уверены, что хотите отменить все изменения в запланированном маршруте\? Уличная фотосъёмка Сохранить как новый файл трека Добавить в файл трека @@ -4004,9 +4004,9 @@ Обновлено: %s Последний раз проверено: %s Частота обновления - Обновления карт будут проверяться каждую неделю. В следующий раз%1$s в %2$s. - Обновления карт будут проверяться каждый день. Следующий раз%1$s в %2$s. - Обновления карт будут проверяться каждый час. Следующий раз%1$s в %2$s. + Обновления карт будут проверяться каждую неделю. В следующий раз %1$s в %2$s. + Обновления карт будут проверяться каждый день. Следующий раз %1$s в %2$s. + Обновления карт будут проверяться каждый час. Следующий раз %1$s в %2$s. Удалить обновления Вы уверены, что хотите удалить все live обновления для %s\? Покупки @@ -4015,4 +4015,25 @@ Трек не содержит данных о высоте. Трек не содержит данных о скорости. Выберите другой тип окраски. + Значок текущего местоположения будет привязан к маршруту навигации + Запись будет продолжена. + Выберите сегменты + %1$s содержит более одного сегмента, необходимо выбрать нужную часть для навигации. + Сегмент %1$d + Использовать дорожные ограничения, которые сейчас активны на карте + Оптимизированный более короткий маршрут (экономия топлива/энергии) + Не менять ориентацию карты, если скорость меньше порогового значения + Перезапустить + Все регионы + Остановить без сохранения + Сохранить и остановить запись + Запись трека остановлена + Вы уверены, что хотите остановить запись\? +\nВсе несохраненные данные будут потеряны. + На паузе + Позволяет избегать больших подъемов при навигации. + Переключатель для отображения или скрытия виджета координат. + Выберите категорию или добавьте новую + Копировать имя POI + Интервал \ No newline at end of file From d0755df7ee6c8af2aa4cb0710fef209dd6eb0cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Babos=20G=C3=A1bor?= Date: Wed, 17 Mar 2021 11:11:02 +0000 Subject: [PATCH 144/250] Translated using Weblate (Hungarian) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-hu/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index 0367e8b812..2f81cd1464 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -4036,4 +4036,7 @@ A nyomvonal nem tartalmaz magassági adatokat. A nyomvonal nem tartalmaz sebességadatokat. Kérjük, válasszon másik színezést. + Az alkalmazás hetente ellenőrzi a térképfrissítéseket. Következő ellenőrzés: %1$s (ennyi idő múlva: %2$s). + Az alkalmazás naponta ellenőrzi a térképfrissítéseket. Következő ellenőrzés: %1$s (ennyi idő múlva: %2$s). + Az alkalmazás óránként ellenőrzi a térképfrissítéseket. Következő ellenőrzés: %1$s (ennyi idő múlva: %2$s). \ No newline at end of file From 05b32b1fd68c2379adcde4fbdc322f358a559025 Mon Sep 17 00:00:00 2001 From: Ihor Hordiichuk Date: Wed, 17 Mar 2021 13:34:04 +0000 Subject: [PATCH 145/250] Translated using Weblate (Ukrainian) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-uk/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index 3d057b7e4e..054c932cc6 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -4028,9 +4028,9 @@ Оновлено: %s Востаннє перевірено: %s Частота оновлень - Наявність оновлень мап перевірятиметься щотижня. Наступного разу%1$s в %2$s. - Наявність оновлень мап перевірятиметься щогодини. Наступного разу%1$s в %2$s. - Наявність оновлень мап перевірятиметься щодня. Наступного разу%1$s в %2$s. + Наявність оновлень мап перевірятиметься щотижня. Наступного разу %1$s в %2$s. + Наявність оновлень мап перевірятиметься щогодини. Наступного разу %1$s в %2$s. + Наявність оновлень мап перевірятиметься щодня. Наступного разу %1$s в %2$s. Видалити оновлення Ви впевнені, що хочете видалити всі %s поточні оновлення\? Покупки From 63443597b6eb862516c68586dc345139c4a69559 Mon Sep 17 00:00:00 2001 From: Branko Kokanovic Date: Wed, 17 Mar 2021 21:16:01 +0000 Subject: [PATCH 146/250] Translated using Weblate (Serbian) Currently translated at 96.7% (3565 of 3685 strings) --- OsmAnd/res/values-sr/strings.xml | 42 +++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-sr/strings.xml b/OsmAnd/res/values-sr/strings.xml index 16020da81d..ae46e9ca06 100644 --- a/OsmAnd/res/values-sr/strings.xml +++ b/OsmAnd/res/values-sr/strings.xml @@ -1522,7 +1522,6 @@ Поморске дубинске тачке северне полулопте Поморске изобате Боја - Самоподели снимке после размака Почни нови одсечак после размака од 6 минута, нову путању после размака од 2 сата, или нови фајл после дужег размака ако је дан измењен. Прикажи путеве планинских бицикли @@ -3903,4 +3902,45 @@ \n • Прилагођене боје за омиљене и путне тачаке стаза \n \n + Вода + Зима + Моторне санке + Јахање + Тркање + Планинска бицикла + Бицикла + Планинарење + Трчање + Пешачење + Мотор + Аутомобил + Не ротирај карту ако је брзина испод доње границе + Рестарт + Све регије + Обриши %1$d фајлова\? + Заустави без снимања + Сачувај и заустави снимање + Снимање путање заустављено + Да ли сте сигурни да желите да зауставите снимање\? +\nСве несачувани подаци ће бити изгубљени. + Потребан је рестарт апликације да се нека подешавања примене. + Паузирано + Ажурирано: %s + Последње време провере: %s + Учесталост ажурирања + Провера ажурирања карте ће бити сваких недељу дана. Следеће време %1$s за %2$s. + Провера ажурирања карте ће бити сваког дана. Следеће време %1$s за %2$s. + Провера ажурирања карте ће бити на сваких сат времена. Следеће време %1$s за %2$s. + Обриши ажурирања + Да ли сте сигурни да желите да обришете %s ажурирања уживо\? + Куповине + Одаберите категорију или додајте нову + Снимање ће бити настављено. + Копирај име тачке од интереса + Прикажи/сакриј + Интервал + Сакриј резервате природе, заштићена подручја и границе националних паркова + Природне границе + Путања не садржи податке о надморској висини. + Путања не садржи податке о брзини. \ No newline at end of file From 24e8c0c59cedfd1da879c4ce31c7ae9f3cc37076 Mon Sep 17 00:00:00 2001 From: Yaron Shahrabani Date: Wed, 17 Mar 2021 08:52:02 +0000 Subject: [PATCH 147/250] Translated using Weblate (Hebrew) Currently translated at 99.9% (3683 of 3685 strings) --- OsmAnd/res/values-iw/strings.xml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-iw/strings.xml b/OsmAnd/res/values-iw/strings.xml index 0a62aad514..c5949f404d 100644 --- a/OsmAnd/res/values-iw/strings.xml +++ b/OsmAnd/res/values-iw/strings.xml @@ -4010,9 +4010,9 @@ עדכון: %s מועד הבדיקה האחרונה: %s תדירות עדכון - בכל שבוע יתבצע חיפוש לעדכוני מפה. הפעם הבאה%1$s ב־%2$s. - בכל יום יתבצע חיפוש לעדכוני מפה. הפעם הבאה%1$s ב־%2$s. - בכל שעה יתבצע חיפוש לעדכוני מפה. הפעם הבאה%1$s ב־%2$s. + בכל שבוע יתבצע חיפוש לעדכוני מפה. הפעם הבאה %1$s ב־%2$s. + בכל יום יתבצע חיפוש לעדכוני מפה. הפעם הבאה %1$s ב־%2$s. + בכל שעה יתבצע חיפוש לעדכוני מפה. הפעם הבאה %1$s ב־%2$s. מחיקת עדכונים רכישות נא לבחור קטגוריה או להוסיף אחת חדשה @@ -4031,4 +4031,20 @@ הקלטת המסלול נעצרה לעצור את ההקלטה\? \nכל הנתונים שלא יישמרו יאבדו. + נא לבחור מקטעים + %1$s מכיל יותר ממקטע אחד, עליך לבחור את החלקים הנחוצים לניווט. + מקטע %1$d + להשתמש במגבלות הגביש שפעילות כעת על המפה + מסלול מקוצר מרחק (לחסכון באנרגיה) + נא לבחור מטרת נסיעה כדי לקבל מסלול מהיר או בטוח יותר + סמל המיקום הנוכחי יוצמד למסלול הניווט הנוכחי + לא לסובב את המפה אם המהירות קטנה מסף מסוים + בהשהיה + צריך להפעיל את היישומון מחדש כדי שכמה מהשינויים יחולו. + הרכבת המסלול יכולה להימנע מעליות תלולות. + מפסק להצגה או הסתרה של וידג׳ט נקודות הציון במפה. + מרחק בנגיעה + קיים עדכון ל־OpenStreetMap: + להסתיר גבולות של שמורות טבע, אזורים מוגנים ופארקים ציבוריים + גבולות טבעיים \ No newline at end of file From 524694c6d86ed7dd58998419f43d70cd6ba1087a Mon Sep 17 00:00:00 2001 From: iman Date: Wed, 17 Mar 2021 18:36:49 +0000 Subject: [PATCH 148/250] Translated using Weblate (Persian) Currently translated at 98.4% (3628 of 3685 strings) --- OsmAnd/res/values-fa/strings.xml | 70 +++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 5 deletions(-) diff --git a/OsmAnd/res/values-fa/strings.xml b/OsmAnd/res/values-fa/strings.xml index 356d8f0308..872f82859f 100644 --- a/OsmAnd/res/values-fa/strings.xml +++ b/OsmAnd/res/values-fa/strings.xml @@ -3841,7 +3841,7 @@ برای استفاده از قابلیت‌های ویرایشی، از طریق OAuth ثبت ورود کنید ثبت ورود از طریق OAuth پاک‌سازی توکن OAuth اوپن‌استریت‌مپ - خروج ثبت شد + خارج شدید فایل قبلاً در OsmAnd درون‌برد شده است استفاده از الگوریتم مسیریابی دومرحله‌ای A*‎ نمودار @@ -3901,7 +3901,7 @@ برچسب‌ها را بنویسید و با کاما جدا کنید. بستن یادداشت OSM نظردادن به یادداشت OSM - می‌توانید با روش ایمن OAuth وارد شوید یا از نام‌کاربری و گذرواژه‌تان استفاده کنید. + می‌توانید با روش ایمن OAuth وارد شوید یا از نام کاربری و گذرواژه‌تان استفاده کنید. قایق‌موتوری آپلود عکس ناموفق بود، لطفاً بعداً دوباره امتحان کنید انتخاب تصویر @@ -3928,9 +3928,9 @@ آخرین زمان بررسی: %s آخرین روزآمدسازهٔ اوپن‌استریت‌مپ: روزآمدشده: %s - برای روزآمدسازی نقشه هر هفته بررسی می‌شود. زمان بعدی %1$s در %2$s. - برای روزآمدسازی نقشه هر روز بررسی می‌شود. زمان بعدی %1$s در %2$s. - برای روزآمدسازی نقشه هر ساعت بررسی می‌شود. زمان بعدی %1$s در %2$s. + روزآمدی نقشه هر هفته بررسی می‌شود. زمان بعدی %1$s در %2$s. + روزآمدی نقشه هر روز بررسی می‌شود. زمان بعدی %1$s در %2$s. + روزآمدی نقشه هر ساعت بررسی می‌شود. زمان بعدی %1$s در %2$s. حذف روزآمدسازه‌ها آیا از حذف هر %s روزآمدسازهٔ زنده مطمئن هستید؟ تکرار روزآمدسازی @@ -3945,4 +3945,64 @@ نماد موقعیتِ کنونی به مسیر ناوبریِ جاری می‌چسبد مسیریاب از سربالایی‌های شدید دوری می‌کند. خریدها + شروع ضبط + نمایش رد روی نقشه + صندلی چرخ‌دار + پیاده‌گردی + پیاده‌روی + دوچرخه‌سواری برقی + دوچرخه‌سواری کوهستان + دوچرخه‌سواری جاده + دوچرخه‌سواری منظم + وسیلهٔ نقلیهٔ سنگین + کامیونت + کامیون + دوچرخهٔ مسابقه‌ای + خطای کارساز: %1$s + این نام وجود دارد + این موتور مسیریابی آنلاین حذف شود؟ + ویرایش توضیحات + حذف راه‌نشان‌ها + کپی در نشانه‌های نقشه + کپی در علاقه‌مندی‌ها + در حال آپلود + آپلود کامل شد + در حال آپلود %1$d از %2$d + انتخاب پاره‌ها + ‏%1$s بیش از یک پاره دارد و باید بخش مورد نیاز برای ناوبری را انتخاب کنید. + پارهٔ %1$d + %1$d از %2$d آپلود شد + ویرایش‌ها را برای آپلود انتخاب کنید + سایه‌روشن / شیب / منحنی‌های میزان + ‏OpenPlaceReviews پروژه‌ای جامعه‌محور با موضوع مکان‌های عمومی مانند رستوران‌ها، هتل‌ها، موزه‌ها و نقاط بین‌راهی است که همهٔ اطلاعات عمومی دربارهٔ آن‌ها را جمع‌آوری می‌کند؛ اطلاعاتی مانند نگاره، دیدگاه و پیوند به سایر سامانه‌ها همچون اوپن‌استریت‌مپ و ویکی‌پدیا. +\n +\nتمام دادهٔ OpenPlaceReview باز و در دسترس همگان است: http://openplacereviews.org/data. +\n +\nاینجا بیشتر بخوانید: http://openplacereviews.org + OpenPlaceReviews + استفاده از test.openplacereviews.org + ورود به OpenPlaceReviews + آب + زمستان + برف‌رو + سوارکاری + مسابقه + دوچرخهٔ کوهستان + دوچرخه‌سواری + پیاده‌گردی + دویدن + پیاده‌روی + آفرود + موتورسیکلت + خودرو + محدودیت‌های جاده که اکنون روی نقشه فعال هستند را لحاظ کن + هدف رانندگی را انتخاب نمایید تا مسیری کوتاه‌تر، سریع‌تر یا ایمن‌تر دریافت کنید + اگر سرعت پایین‌تر از حدی است نمای نقشه را نچرخان + همهٔ مناطق + %1$d فایل را حذف می‌کنید؟ + توقف بدون ذخیره‌سازی + ذخیره‌سازی و توقف ضبط + ضبط رد متوقف شد + آیا برای توقف ضبط مطمئن هستید؟ +\nهرچه که ذخیره نشده، از دست خواهد رفت. \ No newline at end of file From 90184a64f78d73af3f331fc299c7f3bb24b8c339 Mon Sep 17 00:00:00 2001 From: Liu Tao Date: Wed, 17 Mar 2021 20:39:00 +0000 Subject: [PATCH 149/250] Translated using Weblate (Chinese (Simplified)) Currently translated at 80.0% (2948 of 3685 strings) --- OsmAnd/res/values-zh-rCN/strings.xml | 117 +++++++++++++++++++++++---- 1 file changed, 103 insertions(+), 14 deletions(-) diff --git a/OsmAnd/res/values-zh-rCN/strings.xml b/OsmAnd/res/values-zh-rCN/strings.xml index 50d24bae53..802e9dd458 100644 --- a/OsmAnd/res/values-zh-rCN/strings.xml +++ b/OsmAnd/res/values-zh-rCN/strings.xml @@ -176,7 +176,7 @@ 一般 你的OSM用户名 向 openstreetmap.org 提交所需。 - 您的OSM密码 + 密码 睡眠模式功能 OsmAnd 在屏幕关闭的情况下在后台运行。 市郊 @@ -1930,7 +1930,7 @@ 设置交通警告(限速、强制停车、减速带、隧道)、测速摄像头警告和车道信息。 没有检测到朝向的时候使用罗盘。 根据你的速度(地图与当前的位置同步)自动缩放地图。 - 在导航过程中对齐道路的位置。 + 当前位置的图标将被锁定在当前导航路线上 OsmAnd(OSM自动导航方向) \n \n OsmAnd是一款开源软件导航应用,可以访问各种全球OSM数据。所有的地图数据(矢量图或磁贴图)都可以存储在手机存储卡上,供离线使用。还提供离线和在线路线功能,包括逐个转弯的语音引导。 @@ -2265,7 +2265,7 @@ 你需要互联网连接来安装这个插件。 获取 路线智能重新规划 - 只有在长途旅行路线的初始部分重新规划。 + 只重新计算路线的初始部分,对长途旅行很有用。 你喜欢 OsmAnd 吗? 我们很在乎您的意见,并且听到您的反映对我们来说是很重要的。 评价此应用程序 @@ -2924,14 +2924,14 @@ 音量键用于缩放 请提供该点的名称 轮椅 - 您需要设置工作日以继续 + 设置工作日以继续 两点间路线 规划路线 图片注记 视频注记 你的OSM注记在 %1$s。 显示关闭的注记 - 关闭的OSM注记 + 已关闭的 OSM 注记 添加在线资源 驮道 砾石 @@ -3133,7 +3133,7 @@ 方向 轮椅向前 添加到轨迹 - 显示开始于结束图标 + 显示开始和完成图标 选择宽度 屏幕超时 耐力赛摩托车 @@ -3169,19 +3169,19 @@ 重启需要删除全部的测速相机数据。 该设备没有测速相机。 直排轮滑鞋 - 路线上的当前目的地点将被删除。如果它是目的地,导航将会停止。 + 删除路线上的下一个目的地。如果该目的地是最终目的地,导航将停止。 下载维基百科地图 - 从维基百科获取有关兴趣点的信息。这是你的口袋离线指南-只需启用维基百科插件便可以享受有关你周围物品的文章。 + 从维基百科上获取关于兴趣点的信息,这是一个袖珍的离线指南,提供关于地点和目的地的文章。 添加的点在地图上不可见,因为选定的组是隐藏的,您可以在\"%s\"中找到它。 选择显示轨迹上带有距离或时间标记的间隔。 选择所需的拆分选项:“按时间”或“按距离”。 - 新的配置文件将在下一段路线计算时生效。 + 仅使用选定的配置文件重新计算下一个部分。 整个轨迹 最后更改 导入轨迹 打开一个存在的轨迹 创建新的路线 - 打开一个轨迹文件。 + 选择要打开的轨迹文件。 完成 覆盖轨迹 保存为新的轨迹 @@ -3372,13 +3372,13 @@ 拆分后 OsmAnd 配置文件 用户配置文件 - - 增加了导出和导入所有数据的选项,包括设置、资源、我的地方。 + • 添加了用于导出和导入所有数据的选项,包括设置,资源,我的位置 \n -\n - 规划路线:带有路线的轨道段的图形,并增加了创建和编辑多个轨道段的功能。 +\n• 规划路线:具有路线的路段的图形,并添加了创建和编辑多个路段的功能 \n -\n - 为OpenStreetMap增加了OAuth认证方法,改进了OSM对话框的用户界面。 +\n• 为 OpenStreetMap 添加了 OAuth 身份验证方法,改进了 OSM 对话框的 UI \n -\n - 支持自定义颜色的收藏夹和跟踪航点。 +\n• 支持收藏夹和航路点的自定义颜色 \n \n 反转所有点 @@ -3447,4 +3447,93 @@ 只有路线线会被保存,航点会被删除。 文件名 三个月 + 选择一个支持的 %1$s 扩展文件。 + 检查并共享应用程序的详细日志 + 导入的配置文件包含附加数据。单击 \"导入\",只导入配置文件数据,或选择其他数据。 + 包括补充数据 + 中间到达时间 + 附近的路线 + 已更新:%s + 保存为新的轨迹文件 + 导入或录制轨迹文件 + 行程录制 + 选择要跟随的轨迹文件 + 选择另一轨迹 + 最近的点 + 依附于道路 + 简化轨迹 + 系统默认值 + 以前的所有部分 + • 更新计划路线功能:允许每个航段使用不同的导航类型和包含轨道 +\n +\n• 轨道的新外观菜单:选择颜色、厚度、显示方向箭头、开始和完成图标 +\n +\n•提高自行车节点的能见度。 +\n +\n•轨道现在可上用,有上下文菜单与基本信息。 +\n +\n• 改进的搜索算法 +\n +\n• 改进了导航中的跟踪选项 +\n +\n• 配置文件设置导入/导出的固定问题 +\n +\n + 购买确认后,将向您的 AppGallery 帐户收费。 +\n +\n除非在更新日期之前取消订阅,否则订阅将自动延长。仅在续订日期,您的帐户才需要支付续订期(月/三个月/年)。 +\n +\n您可以在 AppGallery 设置中管理和取消订阅。 + 开发 + 符号 + 旅行 + 添加至少两个点 + 登录 OpenStreetMap + 登录 OpenStreetMap.org + 用 OpenStreetMap 登录 + 在 %1$s 中查看所有尚未上传的编辑或 OSM 错误。已经上传的修改将不会再显示。 + 使用登录名和密码 + 帐户 + 登录 + 管理订阅 + 点击按钮,在 Google Play 上设置付款方式以修复订阅。 + 标记历史 + 偏好徒步路线 + 允许溪流和水沟 + 允许间歇性水路 + 允许间歇性水路 + 分析分割区间 + 汽车 + 在地图上使用现在有效的道路限制 + 优化的更短路线(节能) + 选择驾驶目的,以获得更短、更快或更安全的路线 + 如果速度低于阈值,不要旋转地图视图 + 重新启动 + 所有区域 + 删除 %1$d 文件? + 停止而不保存 + 保存并停止录制 + 你确定要停止录制吗? +\n所有未保存的数据都将丢失。 + 暂停 + 应用某些设置时需要重新启动应用程序。 + 路线可以避开强势上坡。 + 显示或隐藏地图上的坐标小部件。 + 点击距离 + 最新的 OpenStreetMap 更新可用: + 上次检查: %s + 更新频率 + 地图更新将每周检查一次。下次 %1$s 在 %2$s 。 + 地图更新将每天检查。下次 %1$s 在 %2$s 。 + 地图更新将每小时检查一次。下次 %1$s 在 %2$s 。 + 购买 + 选择类别或添加新类别 + 录制将继续。 + 复制兴趣点名称 + 显示/隐藏 + 间隔 + 隐藏自然保护区、保护区和国家公园的边界 + 轨迹不包含高度数据。 + 轨迹不包含速度数据。 + 请选择另一种颜色。 \ No newline at end of file From bc6f84299aa5e2acc4e055b67ead934aca08d135 Mon Sep 17 00:00:00 2001 From: Boyuan Yang <073plan@gmail.com> Date: Wed, 17 Mar 2021 14:03:38 +0000 Subject: [PATCH 150/250] Translated using Weblate (Chinese (Simplified)) Currently translated at 80.0% (2948 of 3685 strings) --- OsmAnd/res/values-zh-rCN/strings.xml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/OsmAnd/res/values-zh-rCN/strings.xml b/OsmAnd/res/values-zh-rCN/strings.xml index 802e9dd458..092e435048 100644 --- a/OsmAnd/res/values-zh-rCN/strings.xml +++ b/OsmAnd/res/values-zh-rCN/strings.xml @@ -2191,7 +2191,7 @@ 有前一版的 OsmAnd 存在,所有的脱机数据将被新版引用。但我的收藏内的标点须以旧版程序导出后再用新版程序导入。 生成 {0} 成功安裝({1})。 正在下载编译… - 你想要安装 OsmAnd - {0} 之中的 {1} {2} MB 吗? + 安装 OsmAnd - {0} 之中的 {1} {2} MB 吗? 获取 OsmAnd 的生成列表失败 正在加载 OsmAnd 编译… 选择要安装的 OsmAnd 版本 @@ -3362,10 +3362,10 @@ 添加到 OpenPlaceReviews 改用 dev.openstreetmap.org 而不是 openstreetmap.org 来测试上传 OSM 注记 / 兴趣点 / GPX。 使用 dev.openstreetmap.org - OsmAnd显示来自多个来源的照片。 -\nOpenPlaceReviews--POI照片。 -\nMapillary - 街道级图像。 -\n网络/维基媒体--根据OpenStreetMap数据的POI照片。 + OsmAnd显示来自多个来源的照片: +\nOpenPlaceReviews - POI照片; +\nMapillary - 街道级图像; +\n网络/维基媒体 - 根据OpenStreetMap数据的POI照片。 %1$s * %2$s 轻型飞机 拆分前 @@ -3536,4 +3536,6 @@ 轨迹不包含高度数据。 轨迹不包含速度数据。 请选择另一种颜色。 + 删除更新 + 您确认想要删除所有 %s 实时更新吗? \ No newline at end of file From 3bc955b5fb25c8ba6a6974920b8d030978a09fde Mon Sep 17 00:00:00 2001 From: MaartenDeen Date: Wed, 17 Mar 2021 21:17:19 +0000 Subject: [PATCH 151/250] Translated using Weblate (Dutch) Currently translated at 97.2% (3585 of 3685 strings) --- OsmAnd/res/values-nl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index b2566a077e..8f7df2d01b 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -3972,7 +3972,7 @@ Weet u zeker dat u de opname wilt stoppen\? \n(Alle niet opgeslagen gegevens gaan verloren.). Selecteer segmenten - %1$s bevat meer dan één segment , je moet het noodzakelijke deel van de navigatie selecteren. + %1$s bevat meer dan één segment, je moet het noodzakelijke deel selecteren om te navigeren. Segment %1$d Hillshade / Helling / Contourlijnen OpenPlaceReviews is een gemeenschaps gestuurd project over openbare plaatsen zoals restaurants, hotels, musea, way-points. Het verzamelt alle openbare informatie over hen, zoals foto\'s, recensies, links naar andere systemen die OpenStreetMap, Wikipedia linken. From f804c9eb035f0653e287fe4b799a43cbec7bab28 Mon Sep 17 00:00:00 2001 From: Evgenii Martynenko Date: Wed, 17 Mar 2021 15:11:36 +0000 Subject: [PATCH 152/250] Translated using Weblate (Russian) Currently translated at 99.7% (3885 of 3894 strings) --- OsmAnd/res/values-ru/phrases.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml index fe3993e225..cd790de9b7 100644 --- a/OsmAnd/res/values-ru/phrases.xml +++ b/OsmAnd/res/values-ru/phrases.xml @@ -1464,7 +1464,7 @@ Доска Статуя Камень - Стелла + Стела Бюст Синяя табличка Дзидзо From 56b18eb70d8a37922f91e616ed4ec30fb406f780 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 17 Mar 2021 21:32:30 +0000 Subject: [PATCH 153/250] Translated using Weblate (German) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-de/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index 2ba741af13..b257089f68 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -4043,9 +4043,9 @@ Aktuelles OpenStreetMap Update verfügbar: Zuletzt geprüft: %s Aktualisierungsintervall - Die Kartenaktualisierung wird wöchentlich überprüft. Das nächste Mal%1$s in %2$s. - Die Kartenaktualisierung wird täglich überprüft. Das nächste Mal%1$s in %2$s. - Die Kartenaktualisierung wird stündlich überprüft. Das nächste Mal%1$s in %2$s. + Die Kartenaktualisierung wird wöchentlich überprüft. Das nächste Mal %1$s in %2$s. + Die Kartenaktualisierung wird täglich überprüft. Das nächste Mal %1$s in %2$s. + Die Kartenaktualisierung wird stündlich überprüft. Das nächste Mal %1$s in %2$s. Sind Sie sicher, dass Sie alle %s Live-Updates löschen möchten\? Kategorie auswählen oder neue hinzufügen Grenzen von Naturschutzgebieten, Schutzgebieten und Nationalparks ausblenden From d199c5f14f205d2dc92b41e1b3074d17825264ce Mon Sep 17 00:00:00 2001 From: Branko Kokanovic Date: Wed, 17 Mar 2021 21:45:22 +0000 Subject: [PATCH 154/250] Translated using Weblate (Serbian) Currently translated at 97.7% (3601 of 3685 strings) --- OsmAnd/res/values-sr/strings.xml | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/OsmAnd/res/values-sr/strings.xml b/OsmAnd/res/values-sr/strings.xml index ae46e9ca06..e23eae86cc 100644 --- a/OsmAnd/res/values-sr/strings.xml +++ b/OsmAnd/res/values-sr/strings.xml @@ -3943,4 +3943,40 @@ Природне границе Путања не садржи податке о надморској висини. Путања не садржи податке о брзини. + Користи test.openplacereviews.org + Користи ограничења на путу тренутно активна на карти + Оптимизовани краћи пут (уштеда енергије) + Одаберите разлог путовања да добијете краћи, бржи или сигурнији пут + Иконица тренутне локације ће бити прилепљена за тренутно навођени пут + Рутирање може да заобиђе велике узбрдице. + Одаберите други тип бојења. + Време објаве + Започни снимање + Прикажи путању на карти + Инвалидска колица + Планинарење + Пешачење + Екетрични бициклизам + Планински бициклизам + Друмски бициклизам + Стаднардни бициклизам + Теретни камион + Камионет + Камион + Скутер + Тркачки бицикл + MTB + Серверска грешка: %1$s + Име већ постоји + Прочитај у целости + Измени опис + Копирај у омиљене + Отпремам + Отпремање завршено + Отпрема се %1$d од %2$d + Одаберите сегменте + %1$s садржи више од једног сегмента, морате одабрати тражени део за навођење. + Сегмент %1$d + Отпремљено %1$d од %2$d + Одаберите измене за отпремање \ No newline at end of file From 29e635bb5928c453f5fa048cfa13a3e00c862e56 Mon Sep 17 00:00:00 2001 From: MaartenDeen Date: Wed, 17 Mar 2021 21:37:30 +0000 Subject: [PATCH 155/250] Translated using Weblate (Dutch) Currently translated at 98.3% (3626 of 3685 strings) --- OsmAnd/res/values-nl/strings.xml | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/OsmAnd/res/values-nl/strings.xml b/OsmAnd/res/values-nl/strings.xml index 8f7df2d01b..93ec4454c6 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -3430,7 +3430,7 @@ Maximale lengte Richting %1$s verwijderd - Een herstart is noodzakelijk om de gegevens van snelheidscamera’s volledig te verwijderen. + Herstart de app om de gegevens van snelheidscamera’s te verwijderen. Verwijderen en Herstarten Dit apparaat bevat geen informatie over snelheidscamera’s. Inline skates @@ -3539,8 +3539,8 @@ %1$s / %2$s POI-types zoeken Knop om OV-informatie al dan niet te tonen op de kaart. - Favoriet toevoegen / bewerken - POI toevoegen / bewerken + Favoriet toevoegen of bewerken + POI toevoegen of bewerken Parkeerlocaties Standaardvolgorde van de ekementen herstellen Terugkeren naar wijzigen @@ -3561,7 +3561,7 @@ Scherm aanzetten bij elke routeaanwijzing. Routeaanwijzingen Uitgeschakeld. De instelling ‘Timeout na wakker worden’ moet ingesteld zijn op ‘Scherm aanlaten’. - Door op de aan/uit knop te drukken gaat het scherm aan met OsmAnd op de voorgrond van het vergrendelde scherm. + Door op de aan/uit knop te drukken gaat het scherm aan met OsmAnd op de voorgrond van het vergrendelingsscherm. Aan/uit-knop Nabijheidssensor Selecteer de schermtimeout na wakker worden. (Kies “%1$s” om geen timeout te gebruiken.) @@ -3607,12 +3607,12 @@ Kies hoe gedownloade rasterkaartsegmenten worden opgeslagen. Geen overeenkomende profielen gevonden. Time-out van het scherm - Regel het zoomniveau, van de kaart, met de volumeknop op het apparaat. + Regel het zoomniveau van de kaart met de volumeknop op het apparaat. Gebruik volumeknoppen om in en uit te zoomen - Verkrijg informatie over POIs uit Wikipedia. Het is je offline reisgidsje - schakel de Wikipedia-plug-in in en geniet van artikelen over de bezienswaardigheden in je omgeving. + Verkrijg informatie over POIs uit Wikipedia, een offline reisgids met artikelen over de bezienswaardigheden in je omgeving. Geef de voertuiglengte op, er zijn mogelijk routebeperkingen voor lange voertuigen. - Het volgende routepunt wordt verwijderd. Als dit de eindbestemming was, stopt de navigatie. - Het volgende routepunt verwijderen + Verwijdert het volgende routepunt. Als dit de eindbestemming was stopt de navigatie. + Het dichstbijzijnde routepunt verwijderen Kies een naam voor het punt Wikipedia-kaarten downloaden Motorscooter @@ -3626,14 +3626,14 @@ Pauzeer track opname Hervat track opnemen Beelden op straatniveau - Selecteer dikte + Selecteer breedte Toon start en aankomst pictogrammen - Richtingaanwijzers - Het toegevoegde punt zal niet zichtbaar zijn op de kaart, aangezien de geselecteerde groep verborgen is, je kan het vinden in \"%s\". + Richtingspijlen + Het toegevoegde punt zal niet zichtbaar zijn op de kaart omdat de geselecteerde groep verborgen is, je kan het vinden in \"%s\". Standaard Route tussen punten Vervolgens, zet uw track vast op de dichtstbijzijnde toegestane weg met een van uw navigatieprofielen om deze optie te gebruiken. - %1$s gegevens alleen beschikbaar op wegen, u moet een route berekenen met behulp van \"Route tussen punten\" om deze gegevens te krijgen. + %1$s gegevens alleen beschikbaar op wegen, u moet een route berekenen met behulp van \"Route tussen punten\" om grafieken te zien. Kies hoe de punten verbonden worden: via een rechte lijn, of een route berekenen tussen de punten zoals hieronder aangegeven. Alleen het volgende segment wordt opnieuw berekend met het geselecteerde profiel. Volgende segment @@ -3646,11 +3646,11 @@ Bewaar als nieuwe track Nieuwe offline pistekaarten \n -\n • Volledige aanpassing van favorieten en GPX-waypoints - aangepaste kleuren, pictogrammen, vormen +\n • Volledige aanpassingsmogelijkheid van favorieten en GPX-waypoints - aangepaste kleuren, pictogrammen, vormen \n -\n • Pas de volgorde van items aan in \"Contextmenu\", \"Configureer kaart\" en \"........\" +\n • Mogelijkheid om de volgorde van items aan in \"Contextmenu\", \"Configureer kaart\" en \"Tekenaar\" te veranderen \n -\n •Wikipedia als een afzonderlijke laag in Kaart configureren, selecteer alleen de benodigde talen +\n • Wikipedia als een afzonderlijke laag in Kaart configureren, selecteer alleen de benodigde talen \n \n • Creëer uw eigen POI-filter / kaarten met totale flexibiliteit \n @@ -3658,9 +3658,9 @@ \n \n • Volledige GPX-routes van navigatieondersteunende rijstroken en volledige afslaginstructies \n -\n •Verbeterde UI-formaten op tablets +\n • Verbeterde UI-formaten op tablets \n -\n •Herstel bugs met RTL +\n • Herstel bugs met RTL \n \n Voeg toe aan een track @@ -3671,7 +3671,7 @@ Route omkeren Selecteer een track waaraan je een nieuw segment wil toevoegen. Selecteer een trackbestand om te openen. - Weet u zeker dat u alle wijzigingen in de geplande route wilt annuleren door deze te sluiten\? + Weet u zeker dat u alle wijzigingen in de geplande route wilt annuleren\? Alles wegknippen voor dit punt Alles wegknippen na dit punt Wijzig het routetype voor @@ -3749,7 +3749,7 @@ \n Wat is er nieuw Voor sneeuwscooter, rijden met speciale wegen en tracks. - Stel aantal werkdagen in om door te gaan + Stel werkdagen in om door te gaan Selecteer het interval waarmee markeringen met afstand of tijd op de track worden weergegeven. Selecteer de gewenste splitsingsoptie: op tijd of op afstand. Vaste @@ -3925,7 +3925,7 @@ Laat regelmatig droogvallende waterwegen toe Geef een parameter Laat leeg indien niet - Analyseren met intervallen + Analyseer intervallen Uploaden naar OpenStreetMap GPX-track bewerken GPX-track hernoemen From a8e1d60af1077e0ebbe8ef89957914d465538f93 Mon Sep 17 00:00:00 2001 From: Skalii Date: Thu, 18 Mar 2021 02:41:01 +0200 Subject: [PATCH 156/250] fix bottom buttons width; some fixes; --- ...h_switch_divider_and_additional_button.xml | 16 ++-- .../preference_button_with_icon_triple.xml | 8 +- .../TripRecordingActiveBottomSheet.java | 95 ++++++++++--------- .../TripRecordingStartingBottomSheet.java | 50 +++------- 4 files changed, 73 insertions(+), 96 deletions(-) diff --git a/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml b/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml index a10a9eef42..e7b84c5305 100644 --- a/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml +++ b/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml @@ -66,25 +66,23 @@ + app:cardElevation="0dp" + tools:cardBackgroundColor="?attr/switch_button_active"> - + android:background="?android:attr/selectableItemBackground"> - + diff --git a/OsmAnd/res/layout/preference_button_with_icon_triple.xml b/OsmAnd/res/layout/preference_button_with_icon_triple.xml index 22d68ff090..c8905bbd61 100644 --- a/OsmAnd/res/layout/preference_button_with_icon_triple.xml +++ b/OsmAnd/res/layout/preference_button_with_icon_triple.xml @@ -1,7 +1,5 @@ @@ -28,7 +26,7 @@ android:layout_height="match_parent" android:layout_marginStart="@dimen/content_padding_half" android:layout_marginLeft="@dimen/content_padding_half" - android:layout_weight="0.5" + android:layout_weight="0.8" android:minWidth="@dimen/button_triple_center_width" android:minHeight="@dimen/setting_list_item_large_height" /> @@ -39,7 +37,7 @@ android:layout_height="match_parent" android:layout_marginStart="@dimen/content_padding_half" android:layout_marginLeft="@dimen/content_padding_half" - android:layout_weight="0.25" + android:layout_weight="0.1" android:minWidth="@dimen/context_menu_top_right_button_min_width" android:minHeight="@dimen/setting_list_item_large_height" /> diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java index 27295899da..7aaa832dd1 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java @@ -6,7 +6,6 @@ import android.content.Context; import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; import android.os.AsyncTask; -import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.text.format.DateUtils; @@ -29,6 +28,7 @@ import androidx.cardview.widget.CardView; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.content.ContextCompat; import androidx.core.graphics.drawable.DrawableCompat; +import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.recyclerview.widget.RecyclerView; @@ -81,7 +81,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen private SelectedGpxFile selectedGpxFile; private View statusContainer; - private LinearLayout buttonAppearance; + private LinearLayout showTrackContainer; private AppCompatImageView trackAppearanceIcon; private View buttonSave; private GpxBlockStatisticsBuilder blockStatisticsBuilder; @@ -161,49 +161,15 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen blockStatisticsBuilder.setBlocksClickable(false); blockStatisticsBuilder.initStatBlocks(null, ContextCompat.getColor(app, getActiveTextColorId(nightMode)), nightMode); - LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map); - - final CardView buttonShow = showTrackContainer.findViewById(R.id.compound_container); - TextView showTrackTitle = buttonShow.findViewById(R.id.title); - Integer showTitle = ItemType.SHOW_TRACK.getTitleId(); - if (showTitle != null) { - showTrackTitle.setText(showTitle); - } - final CompoundButton showTrackCompound = buttonShow.findViewById(R.id.compound_button); - showTrackCompound.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null); - UiUtilities.setupCompoundButton(showTrackCompound, nightMode, GLOBAL); - - buttonAppearance = showTrackContainer.findViewById(R.id.additional_button); + showTrackContainer = itemView.findViewById(R.id.show_track_on_map); trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon); - updateTrackIcon(app, trackAppearanceIcon); - buttonAppearance.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (showTrackCompound.isChecked()) { - MapActivity mapActivity = getMapActivity(); - if (mapActivity != null) { + createShowTrackItem(app, getMapActivity(), nightMode, showTrackContainer, trackAppearanceIcon, + ItemType.SHOW_TRACK.getTitleId(), TripRecordingActiveBottomSheet.this, new Runnable() { + @Override + public void run() { hide(); - SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); - TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, TripRecordingActiveBottomSheet.this); } - } - } - }); - createItem(buttonAppearance, ItemType.APPEARANCE, showTrackCompound.isChecked()); - setShowOnMapBackground(buttonShow, showTrackCompound.isChecked(), nightMode); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - buttonShow.setBackgroundTintList(null); - } - buttonShow.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - boolean checked = !showTrackCompound.isChecked(); - showTrackCompound.setChecked(checked); - app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false); - createItem(buttonAppearance, ItemType.APPEARANCE, checked); - setShowOnMapBackground(buttonShow, checked, nightMode); - } - }); + }); buttonClear.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() { @Override @@ -309,6 +275,49 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen } } + public static void createShowTrackItem(final OsmandApplication app, final MapActivity mapActivity, + final boolean nightMode, LinearLayout showTrackContainer, + AppCompatImageView trackAppearanceIcon, Integer showTrackId, + final Fragment target, final Runnable hideOnClickButtonAppearance) { + final CardView buttonShowTrack = showTrackContainer.findViewById(R.id.compound_container); + final CardView buttonAppearance = showTrackContainer.findViewById(R.id.additional_button_container); + + TextView showTrackTextView = buttonShowTrack.findViewById(R.id.title); + if (showTrackId != null) { + showTrackTextView.setText(showTrackId); + } + final CompoundButton showTrackCompound = buttonShowTrack.findViewById(R.id.compound_button); + showTrackCompound.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null); + UiUtilities.setupCompoundButton(showTrackCompound, nightMode, GLOBAL); + + setShowOnMapBackground(buttonShowTrack, showTrackCompound.isChecked(), nightMode); + buttonShowTrack.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + boolean checked = !showTrackCompound.isChecked(); + showTrackCompound.setChecked(checked); + app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false); + setShowOnMapBackground(buttonShowTrack, checked, nightMode); + createItem(app, nightMode, buttonAppearance, ItemType.APPEARANCE, checked, null); + } + }); + + updateTrackIcon(app, trackAppearanceIcon); + createItem(app, nightMode, buttonAppearance, ItemType.APPEARANCE, showTrackCompound.isChecked(), null); + buttonAppearance.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (showTrackCompound.isChecked()) { + if (mapActivity != null) { + hideOnClickButtonAppearance.run(); + SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); + TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, target); + } + } + } + }); + } + private void createItem(View view, ItemType type, boolean enabled) { createItem(app, nightMode, view, type, enabled, null); } @@ -558,11 +567,11 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen ColorStateList iconColorStateList = AndroidUtils.createPressedColorStateList( context, normalColorId, getActiveTextColorId(nightMode) ); - DrawableCompat.setTintList(background, iconColorStateList); if (view instanceof CardView) { ((CardView) view).setCardBackgroundColor(iconColorStateList); return; } + DrawableCompat.setTintList(background, iconColorStateList); } else { UiUtilities.tintDrawable(background, ContextCompat.getColor(context, getInactiveButtonColorId(nightMode))); } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java index 7f19ea13fb..c03a568137 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java @@ -4,12 +4,10 @@ import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.graphics.Typeface; -import android.os.Build; import android.os.Bundle; import android.text.SpannableString; import android.view.LayoutInflater; import android.view.View; -import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.TextView; @@ -22,7 +20,6 @@ import androidx.fragment.app.FragmentManager; import com.google.android.material.slider.RangeSlider; -import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.NavigationService; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; @@ -37,13 +34,13 @@ import net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.ItemType; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.fragments.BaseSettingsFragment; import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType; -import net.osmand.plus.track.TrackAppearanceFragment; import static net.osmand.plus.UiUtilities.CompoundButtonType.GLOBAL; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.UPDATE_TRACK_ICON; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.createItem; +import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.createShowTrackItem; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.setShowOnMapBackground; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.updateTrackIcon; @@ -60,6 +57,7 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm private CardView confirmContainer; private SwitchCompat confirmCompound; private TextView intervalValueView; + private LinearLayout showTrackContainer; private LinearLayout intervalContainer; private RangeSlider intervalSlider; @@ -100,6 +98,7 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm confirmContainer = itemView.findViewById(R.id.confirm_container); confirmCompound = confirmContainer.findViewById(R.id.confirm_compound_button); + UiUtilities.setupCompoundButton(confirmCompound, nightMode, GLOBAL); updateGlobalRemember(); confirmContainer.setOnClickListener(new View.OnClickListener() { @Override @@ -111,42 +110,15 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm } }); - LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map); - - final CardView buttonShow = itemView.findViewById(R.id.compound_container); - TextView showTrackTitle = buttonShow.findViewById(R.id.title); - showTrackTitle.setText(R.string.show_track_on_map); - final CompoundButton showTrackCompound = buttonShow.findViewById(R.id.compound_button); - showTrackCompound.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null); - UiUtilities.setupCompoundButton(showTrackCompound, nightMode, GLOBAL); - - LinearLayout buttonAppearance = showTrackContainer.findViewById(R.id.additional_button); + showTrackContainer = itemView.findViewById(R.id.show_track_on_map); trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon); - updateTrackIcon(app, trackAppearanceIcon); - buttonAppearance.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - MapActivity mapActivity = getMapActivity(); - if (mapActivity != null) { - hide(); - SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); - TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, TripRecordingStartingBottomSheet.this); - } - } - }); - setShowOnMapBackground(buttonShow, showTrackCompound.isChecked(), nightMode); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - buttonShow.setBackgroundTintList(null); - } - buttonShow.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - boolean checked = !showTrackCompound.isChecked(); - showTrackCompound.setChecked(checked); - app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false); - setShowOnMapBackground(buttonShow, checked, nightMode); - } - }); + createShowTrackItem(app, getMapActivity(), nightMode, showTrackContainer, trackAppearanceIcon, + R.string.show_track_on_map, TripRecordingStartingBottomSheet.this, new Runnable() { + @Override + public void run() { + hide(); + } + }); updateUpDownBtn(); From 2910df88e1a03bb4d96c3f364e38a9669eeebf7e Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 18 Mar 2021 10:43:56 +0200 Subject: [PATCH 157/250] Add src-amazon --- OsmAnd/AndroidManifest-amazon.xml | 27 ++++++++ OsmAnd/build.gradle | 6 +- .../plus/inapp/InAppPurchaseHelperImpl.java | 69 +++++++++++++++++++ .../osmand/plus/inapp/InAppPurchasesImpl.java | 41 +++++++++++ 4 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 OsmAnd/AndroidManifest-amazon.xml create mode 100644 OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java create mode 100644 OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java diff --git a/OsmAnd/AndroidManifest-amazon.xml b/OsmAnd/AndroidManifest-amazon.xml new file mode 100644 index 0000000000..93e028dd17 --- /dev/null +++ b/OsmAnd/AndroidManifest-amazon.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index ad12988def..a565c924f7 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -84,11 +84,11 @@ android { manifest.srcFile "AndroidManifest-nightlyFree.xml" } amazonFree { - java.srcDirs = ["src-nogms", "src-google"] - manifest.srcFile "AndroidManifest-gplayFree.xml" + java.srcDirs = ["src-nogms", "src-amazon"] + manifest.srcFile "AndroidManifest-amazon.xml" } amazonFull { - java.srcDirs = ["src-nogms", "src-google"] + java.srcDirs = ["src-nogms", "src-amazon"] } huawei { java.srcDirs = ["src-nogms", "src-huawei"] diff --git a/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java new file mode 100644 index 0000000000..f59569ecc2 --- /dev/null +++ b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java @@ -0,0 +1,69 @@ +package net.osmand.plus.inapp; + +import android.app.Activity; +import android.content.Context; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import net.osmand.plus.OsmandApplication; + +import java.lang.ref.WeakReference; + +public class InAppPurchaseHelperImpl extends InAppPurchaseHelper { + + public InAppPurchaseHelperImpl(OsmandApplication ctx) { + super(ctx); + purchases = new InAppPurchasesImpl(ctx); + } + + @Override + public void isInAppPurchaseSupported(@NonNull Activity activity, @Nullable InAppPurchaseInitCallback callback) { + + } + + @Override + protected void execImpl(@NonNull InAppPurchaseTaskType taskType, @NonNull InAppCommand command) { + + } + + @Override + public void purchaseFullVersion(@NonNull Activity activity) throws UnsupportedOperationException { + + } + + @Override + public void purchaseDepthContours(@NonNull Activity activity) throws UnsupportedOperationException { + + } + + @Override + public void purchaseContourLines(@NonNull Activity activity) throws UnsupportedOperationException { + + } + + @Override + public void manageSubscription(@NonNull Context ctx, @Nullable String sku) { + + } + + @Override + protected InAppCommand getPurchaseLiveUpdatesCommand(WeakReference activity, String sku, String userInfo) throws UnsupportedOperationException { + return null; + } + + @Override + protected InAppCommand getRequestInventoryCommand() throws UnsupportedOperationException { + return null; + } + + @Override + protected boolean isBillingManagerExists() { + return false; + } + + @Override + protected void destroyBillingManager() { + + } +} \ No newline at end of file diff --git a/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java new file mode 100644 index 0000000000..c67c90308f --- /dev/null +++ b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java @@ -0,0 +1,41 @@ +package net.osmand.plus.inapp; + +import net.osmand.plus.OsmandApplication; + +public class InAppPurchasesImpl extends InAppPurchases { + + private static final InAppSubscription[] LIVE_UPDATES_FREE = new InAppSubscription[] {}; + + public InAppPurchasesImpl(OsmandApplication ctx) { + super(ctx); + inAppPurchases = new InAppPurchase[] {}; + liveUpdates = new LiveUpdatesInAppPurchasesFree(); + } + + @Override + public boolean isFullVersion(String sku) { + return false; + } + + @Override + public boolean isDepthContours(String sku) { + return false; + } + + @Override + public boolean isContourLines(String sku) { + return false; + } + + @Override + public boolean isLiveUpdates(String sku) { + return false; + } + + private static class LiveUpdatesInAppPurchasesFree extends InAppSubscriptionList { + + public LiveUpdatesInAppPurchasesFree() { + super(LIVE_UPDATES_FREE); + } + } +} \ No newline at end of file From 67039222c5ad7cf465e785ace9b484f1acd44103 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 18 Mar 2021 11:14:57 +0200 Subject: [PATCH 158/250] Remove unnecessary changes --- OsmAnd/AndroidManifest-amazon.xml | 27 ------------------- OsmAnd/build.gradle | 2 +- .../osmand/plus/inapp/InAppPurchasesImpl.java | 10 +++---- 3 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 OsmAnd/AndroidManifest-amazon.xml diff --git a/OsmAnd/AndroidManifest-amazon.xml b/OsmAnd/AndroidManifest-amazon.xml deleted file mode 100644 index 93e028dd17..0000000000 --- a/OsmAnd/AndroidManifest-amazon.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index a565c924f7..46192a3144 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -85,7 +85,7 @@ android { } amazonFree { java.srcDirs = ["src-nogms", "src-amazon"] - manifest.srcFile "AndroidManifest-amazon.xml" + manifest.srcFile "AndroidManifest-gplayFree.xml" } amazonFull { java.srcDirs = ["src-nogms", "src-amazon"] diff --git a/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java index c67c90308f..00bbea9693 100644 --- a/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java +++ b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java @@ -4,12 +4,10 @@ import net.osmand.plus.OsmandApplication; public class InAppPurchasesImpl extends InAppPurchases { - private static final InAppSubscription[] LIVE_UPDATES_FREE = new InAppSubscription[] {}; - public InAppPurchasesImpl(OsmandApplication ctx) { super(ctx); inAppPurchases = new InAppPurchase[] {}; - liveUpdates = new LiveUpdatesInAppPurchasesFree(); + liveUpdates = new EmptyLiveUpdatesList(); } @Override @@ -32,10 +30,10 @@ public class InAppPurchasesImpl extends InAppPurchases { return false; } - private static class LiveUpdatesInAppPurchasesFree extends InAppSubscriptionList { + private static class EmptyLiveUpdatesList extends InAppSubscriptionList { - public LiveUpdatesInAppPurchasesFree() { - super(LIVE_UPDATES_FREE); + public EmptyLiveUpdatesList() { + super(new InAppSubscription[] {}); } } } \ No newline at end of file From 80f8254f11286109ea4debd1edaaed500aebcecd Mon Sep 17 00:00:00 2001 From: Xavi Ivars Date: Thu, 18 Mar 2021 08:06:01 +0000 Subject: [PATCH 159/250] Translated using Weblate (Catalan) Currently translated at 94.5% (3485 of 3685 strings) --- OsmAnd/res/values-ca/strings.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OsmAnd/res/values-ca/strings.xml b/OsmAnd/res/values-ca/strings.xml index 8e83c6b040..68ee670baa 100644 --- a/OsmAnd/res/values-ca/strings.xml +++ b/OsmAnd/res/values-ca/strings.xml @@ -174,7 +174,7 @@ Paràmetres generals Configureu els paràmetres generals i de visualització de l\'aplicació. El vostre nom d\'usuari d\'OSM - La vostra contrasenya a OSM + Contrasenya No hi ha prou espai lliure per baixar %1$s MB (lliure: %2$s). Voleu baixar {0} fitxer(s)\? \nS\'ocuparà {1} MB (de {2} MB). @@ -1532,7 +1532,7 @@ Límit d\'alçada Indiqueu l\'alçada del vehicle que les rutes han d\'admetre. Recàlcul intel·ligent de la ruta - Actualitza només la part inicial de la ruta. Pot ser usat per a viatges llargs. + Actualitza només la part inicial de la ruta. Útil per a viatges llargs. Surt Desactivat Acoloreix segons el tipus de xarxa @@ -3323,9 +3323,9 @@ Recàlcul de la ruta Anunci Nom d\'usuari i contrasenya - Aquest paràmetre de connectors és global i afecta tots els perfils + Aquests paràmetres de connectors són global i afecten tots els perfils Edició OSM - Consulteu les vostres edicions o errors OSM encara no pujats a %1$s. Els punts enviats ja no es veuran més. + Consulteu totes les vostres edicions o errors OSM que encara no s\'han pujat a %1$s. Els canvis ja enviats no es veuran més. La icona es mostra mentre navegueu o us mogueu. La icona es mostra en repòs. Valida i comparteix enregistraments detallats de l\'aplicació @@ -3752,7 +3752,7 @@ Proporcioneu la llargada del vostre vehicle, pot haver-hi rutes restringides als vehicles llargs. No s\'ha generat correctament l\'arxiu GPX. Indiqueu-ho a l\'equip de suport per continuar investigant. Enregistra automàticament la traça durant la navegació - Cal afegir almenys dos punts + Afegiu almenys dos punts Canvieu per utilitzar dev.openstreetmap.org en lloc d\'openstreetmap.org en provar la pujada de nota OSM / PDI / GPX. Tanca la nota d\'OSM Comentari de la nota d\'OSM From 72ee17b4f58c93a71a2a5e4e61b536a39e726e7e Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 18 Mar 2021 09:03:05 +0000 Subject: [PATCH 160/250] Translated using Weblate (German) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-de/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index b257089f68..0f36ffa3b1 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -675,8 +675,8 @@ Daten hochladen … Hochladen … Kein Treffer - Suchen … - Adresse suchen … + Suche… + Suche Adresse… Online-Suche mit OSM Nominatim Online-Suche: Hausnummer, Straße, Ort Offline-Suche From 2e685f71829c804857f3d6803c18ee128f44bfe6 Mon Sep 17 00:00:00 2001 From: PaulStets Date: Thu, 18 Mar 2021 11:40:41 +0200 Subject: [PATCH 161/250] Sync gpx reverse with ios --- .../routepreparationmenu/RoutingOptionsHelper.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java index 5f405c90b6..068d9ac4b7 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java @@ -245,10 +245,16 @@ public class RoutingOptionsHelper { TargetPoint pointToStart = tg.getPointToStart(); TargetPoint pointToNavigate = tg.getPointToNavigate(); if (rp.getFile().hasRoute()) { - tg.clearStartPoint(false); - Location finishLoc = ps.get(ps.size() - 1); - tg.navigateToPoint(new LatLon(finishLoc.getLatitude(), finishLoc.getLongitude()), - false, -1, pointToNavigate != null ? pointToNavigate.getOriginalPointDescription() : null); + TargetPoint endPoint = selected ? pointToStart : null; + Location lastLoc = ps.get(ps.size() - 1); + Location firstLoc = ps.get(0); + LatLon firstLatLon = new LatLon(firstLoc.getLatitude(), firstLoc.getLongitude()); + LatLon endLocation = endPoint != null ? endPoint.point : new LatLon(lastLoc.getLatitude(), lastLoc.getLongitude()); + LatLon startLoc = selected ? firstLatLon : (pointToNavigate != null ? pointToNavigate.point : firstLatLon); + tg.navigateToPoint(endLocation, false, -1); + if (pointToStart != null) { + tg.setStartPoint(startLoc, false, null); + } tg.updateRouteAndRefresh(true); } else { Location first = ps.get(0); From d84f8bed00cfda70cc132ccb3291fa933480e5c6 Mon Sep 17 00:00:00 2001 From: PaulStets Date: Thu, 18 Mar 2021 11:45:10 +0200 Subject: [PATCH 162/250] Formatting fixes --- .../plus/routepreparationmenu/RoutingOptionsHelper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java index 068d9ac4b7..30307d6e66 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java @@ -250,10 +250,10 @@ public class RoutingOptionsHelper { Location firstLoc = ps.get(0); LatLon firstLatLon = new LatLon(firstLoc.getLatitude(), firstLoc.getLongitude()); LatLon endLocation = endPoint != null ? endPoint.point : new LatLon(lastLoc.getLatitude(), lastLoc.getLongitude()); - LatLon startLoc = selected ? firstLatLon : (pointToNavigate != null ? pointToNavigate.point : firstLatLon); - tg.navigateToPoint(endLocation, false, -1); + LatLon startLocation = selected ? firstLatLon : (pointToNavigate != null ? pointToNavigate.point : firstLatLon); + tg.navigateToPoint(endLocation, false, -1); if (pointToStart != null) { - tg.setStartPoint(startLoc, false, null); + tg.setStartPoint(startLocation, false, null); } tg.updateRouteAndRefresh(true); } else { From bc1f18fcb44877695cf8cac1eb5f9ef43ad3989d Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 18 Mar 2021 14:06:25 +0100 Subject: [PATCH 163/250] Update quad rect for flippable rects as well --- .../main/java/net/osmand/data/QuadRect.java | 20 ++++++++++--------- .../main/java/net/osmand/data/QuadTree.java | 18 ++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java b/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java index a0b8259b2b..1b5e97bebe 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java @@ -6,6 +6,7 @@ public class QuadRect { public double top; public double bottom; + // left & right / top & bottom could be flipped (so it's useful for latlon bbox) public QuadRect(double left, double top, double right, double bottom) { this.left = left; this.right = right; @@ -21,16 +22,18 @@ public class QuadRect { } public double width() { - return right - left; + return Math.abs(right - left); } public double height() { - return bottom - top; + return Math.abs(bottom - top); } public boolean contains(double left, double top, double right, double bottom) { - return this.left < this.right && this.top < this.bottom && this.left <= left && this.top <= top && this.right >= right - && this.bottom >= bottom; + return Math.min(this.left, this.right) <= Math.min(left, right) + && Math.max(this.left, this.right) >= Math.max(left, right) + && Math.min(this.top, this.bottom) <= Math.min(top, bottom) + && Math.max(this.top, this.bottom) <= Math.max(top, bottom); } public boolean contains(QuadRect box) { @@ -38,11 +41,10 @@ public class QuadRect { } public static boolean intersects(QuadRect a, QuadRect b) { - return a.left < b.right && b.left < a.right && a.top < b.bottom && b.top < a.bottom; - } - - public static boolean trivialOverlap(QuadRect a, QuadRect b) { - return !((a.right < b.left) || (a.left > b.right) || (a.top < b.bottom) || (a.bottom > b.top)); + return Math.min(a.left, a.right) < Math.max(b.left, b.right) + && Math.max(a.left, a.right) > Math.min(b.left, b.right) + && Math.min(a.bottom, a.top) < Math.max(b.bottom, b.top) + && Math.max(a.bottom, a.top) > Math.min(b.bottom, b.top); } public double centerX() { diff --git a/OsmAnd-java/src/main/java/net/osmand/data/QuadTree.java b/OsmAnd-java/src/main/java/net/osmand/data/QuadTree.java index 2b8f0db066..9ed98d06a9 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/QuadTree.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/QuadTree.java @@ -103,18 +103,16 @@ public class QuadTree { void splitBox(QuadRect node_extent, QuadRect[] n) { // coord2d c=node_extent.center(); - double width = node_extent.width(); - double height = node_extent.height(); - double lox = node_extent.left; - double loy = node_extent.top; - double hix = node_extent.right; - double hiy = node_extent.bottom; + double lx = node_extent.left; + double ly = node_extent.top; + double hx = node_extent.right; + double hy = node_extent.bottom; - n[0] = new QuadRect(lox, loy, lox + width * ratio, loy + height * ratio); - n[1] = new QuadRect(hix - width * ratio, loy, hix, loy + height * ratio); - n[2] = new QuadRect(lox, hiy - height * ratio, lox + width * ratio, hiy); - n[3] = new QuadRect(hix - width * ratio, hiy - height * ratio, hix, hiy); + n[0] = new QuadRect(lx, ly, lx + (hx - lx) * ratio, ly + (hy - ly) * ratio); + n[1] = new QuadRect(lx + (hx - lx) * (1 - ratio), ly, hx, ly + (hy - ly) * ratio); + n[2] = new QuadRect(lx, ly + (hy - ly) * (1 - ratio), lx + (hx - lx) * ratio, hy); + n[3] = new QuadRect(lx + (hx - lx) * (1 - ratio), ly + (hy - ly) * (1 - ratio), hx, hy); } } From 4a357e64595963ba3d65032a1d99b4163e69b102 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 18 Mar 2021 14:26:48 +0100 Subject: [PATCH 164/250] Fix bug with quad rect --- OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java b/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java index 1b5e97bebe..de2772aad2 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java @@ -33,7 +33,7 @@ public class QuadRect { return Math.min(this.left, this.right) <= Math.min(left, right) && Math.max(this.left, this.right) >= Math.max(left, right) && Math.min(this.top, this.bottom) <= Math.min(top, bottom) - && Math.max(this.top, this.bottom) <= Math.max(top, bottom); + && Math.max(this.top, this.bottom) >= Math.max(top, bottom); } public boolean contains(QuadRect box) { From 025ee8e9936686b61b0983f734cf098e608b66c5 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 18 Mar 2021 14:30:34 +0100 Subject: [PATCH 165/250] Fix bug with quad rect --- .../src/main/java/net/osmand/data/QuadRect.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java b/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java index de2772aad2..5e71781d4d 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/QuadRect.java @@ -41,11 +41,15 @@ public class QuadRect { } public static boolean intersects(QuadRect a, QuadRect b) { - return Math.min(a.left, a.right) < Math.max(b.left, b.right) - && Math.max(a.left, a.right) > Math.min(b.left, b.right) - && Math.min(a.bottom, a.top) < Math.max(b.bottom, b.top) - && Math.max(a.bottom, a.top) > Math.min(b.bottom, b.top); + return Math.min(a.left, a.right) <= Math.max(b.left, b.right) + && Math.max(a.left, a.right) >= Math.min(b.left, b.right) + && Math.min(a.bottom, a.top) <= Math.max(b.bottom, b.top) + && Math.max(a.bottom, a.top) >= Math.min(b.bottom, b.top); } + + public static boolean trivialOverlap(QuadRect a, QuadRect b) { + return intersects(a, b); + } public double centerX() { return (left + right) / 2; From d8eaaa0b221d95ec184430ab9d3b0df21e69525b Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 18 Mar 2021 17:03:29 +0200 Subject: [PATCH 166/250] Add At symbol --- OsmAnd/res/drawable/ic_action_at_mail.xml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 OsmAnd/res/drawable/ic_action_at_mail.xml diff --git a/OsmAnd/res/drawable/ic_action_at_mail.xml b/OsmAnd/res/drawable/ic_action_at_mail.xml new file mode 100644 index 0000000000..6da427c1ef --- /dev/null +++ b/OsmAnd/res/drawable/ic_action_at_mail.xml @@ -0,0 +1,9 @@ + + + From 75316bd12c59281d5c9af49fc99c254dc6d9d906 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Wed, 17 Mar 2021 18:45:18 +0300 Subject: [PATCH 167/250] Fix huawei build (cherry picked from commit 078e037ac2c7b7b27858c8eeafefcdc65a708a21) --- OsmAnd/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index c862101bc8..3b512b1090 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -91,7 +91,7 @@ android { java.srcDirs = ["src-nogms", "src-google"] } huawei { - java.srcDirs = ["src-nogms", "src-google"] + java.srcDirs = ["src-nogms", "src-huawei"] manifest.srcFile "AndroidManifest-huawei.xml" } From 4c4196aa2bfa8383710141635f2c22082c224795 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Wed, 17 Mar 2021 18:59:52 +0300 Subject: [PATCH 168/250] Fix huawei build (cherry picked from commit 1bdc56d52a450132b3d172284d8c66d2ba908ad9) --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e59a694b17..48bcc21248 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ buildscript { classpath 'com.google.gms:google-services:3.0.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - if (gradle.startParameter.taskNames.toString().contains("huawei")) { + if (gradle.startParameter.taskNames.toString().toLowerCase().contains("huawei")) { classpath 'com.huawei.agconnect:agcp:1.4.1.300' } } From b58d06f290c40f92c908ac84ba83dd0f7e395240 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 17 Mar 2021 18:52:17 +0200 Subject: [PATCH 169/250] Fix compilation (cherry picked from commit c4cf068f1b4ea83fe1802bdcd226850468e7893f) --- .../plus/inapp/InAppPurchaseHelperImpl.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java b/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java index 0f3536e5d0..9f05c1a70c 100644 --- a/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java +++ b/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java @@ -31,7 +31,6 @@ import net.osmand.plus.inapp.InAppPurchases.InAppSubscription; import net.osmand.plus.inapp.InAppPurchases.InAppSubscriptionIntroductoryInfo; import net.osmand.plus.inapp.InAppPurchasesImpl.InAppPurchaseLiveUpdatesOldSubscription; import net.osmand.plus.settings.backend.OsmandSettings; -import net.osmand.plus.settings.backend.OsmandPreference; import net.osmand.util.Algorithms; import java.lang.ref.WeakReference; @@ -268,7 +267,7 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper { InAppSubscription s = (InAppSubscription) inAppPurchase; try { s.setIntroductoryInfo(new InAppSubscriptionIntroductoryInfo(s, introductoryPrice, - introductoryPriceAmountMicros, introductoryPricePeriod, String.valueOf(introductoryPriceCycles))); + introductoryPriceAmountMicros, introductoryPricePeriod, introductoryPriceCycles)); } catch (ParseException e) { LOG.error(e); } @@ -542,20 +541,12 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper { } } } - OsmandPreference subscriptionCancelledTime = ctx.getSettings().LIVE_UPDATES_PURCHASE_CANCELLED_TIME; 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.set(false); - if (!isDepthContoursPurchased(ctx)) { - ctx.getSettings().getCustomRenderBooleanProperty("depthContours").set(false); - } + ctx.getSettings().LIVE_UPDATES_PURCHASED.set(false); + if (!isDepthContoursPurchased(ctx)) { + ctx.getSettings().getCustomRenderBooleanProperty("depthContours").set(false); } } else if (subscribedToLiveUpdates) { - subscriptionCancelledTime.set(0L); ctx.getSettings().LIVE_UPDATES_PURCHASED.set(true); } From 067422823e8bf9eb4cc0684c6946230f910ddd15 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 18 Mar 2021 10:43:56 +0200 Subject: [PATCH 170/250] Add src-amazon (cherry picked from commit 2910df88e1a03bb4d96c3f364e38a9669eeebf7e) --- OsmAnd/AndroidManifest-amazon.xml | 27 ++++++++ OsmAnd/build.gradle | 6 +- .../plus/inapp/InAppPurchaseHelperImpl.java | 69 +++++++++++++++++++ .../osmand/plus/inapp/InAppPurchasesImpl.java | 41 +++++++++++ 4 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 OsmAnd/AndroidManifest-amazon.xml create mode 100644 OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java create mode 100644 OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java diff --git a/OsmAnd/AndroidManifest-amazon.xml b/OsmAnd/AndroidManifest-amazon.xml new file mode 100644 index 0000000000..93e028dd17 --- /dev/null +++ b/OsmAnd/AndroidManifest-amazon.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index 3b512b1090..f757952560 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -84,11 +84,11 @@ android { manifest.srcFile "AndroidManifest-nightlyFree.xml" } amazonFree { - java.srcDirs = ["src-nogms", "src-google"] - manifest.srcFile "AndroidManifest-gplayFree.xml" + java.srcDirs = ["src-nogms", "src-amazon"] + manifest.srcFile "AndroidManifest-amazon.xml" } amazonFull { - java.srcDirs = ["src-nogms", "src-google"] + java.srcDirs = ["src-nogms", "src-amazon"] } huawei { java.srcDirs = ["src-nogms", "src-huawei"] diff --git a/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java new file mode 100644 index 0000000000..f59569ecc2 --- /dev/null +++ b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java @@ -0,0 +1,69 @@ +package net.osmand.plus.inapp; + +import android.app.Activity; +import android.content.Context; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import net.osmand.plus.OsmandApplication; + +import java.lang.ref.WeakReference; + +public class InAppPurchaseHelperImpl extends InAppPurchaseHelper { + + public InAppPurchaseHelperImpl(OsmandApplication ctx) { + super(ctx); + purchases = new InAppPurchasesImpl(ctx); + } + + @Override + public void isInAppPurchaseSupported(@NonNull Activity activity, @Nullable InAppPurchaseInitCallback callback) { + + } + + @Override + protected void execImpl(@NonNull InAppPurchaseTaskType taskType, @NonNull InAppCommand command) { + + } + + @Override + public void purchaseFullVersion(@NonNull Activity activity) throws UnsupportedOperationException { + + } + + @Override + public void purchaseDepthContours(@NonNull Activity activity) throws UnsupportedOperationException { + + } + + @Override + public void purchaseContourLines(@NonNull Activity activity) throws UnsupportedOperationException { + + } + + @Override + public void manageSubscription(@NonNull Context ctx, @Nullable String sku) { + + } + + @Override + protected InAppCommand getPurchaseLiveUpdatesCommand(WeakReference activity, String sku, String userInfo) throws UnsupportedOperationException { + return null; + } + + @Override + protected InAppCommand getRequestInventoryCommand() throws UnsupportedOperationException { + return null; + } + + @Override + protected boolean isBillingManagerExists() { + return false; + } + + @Override + protected void destroyBillingManager() { + + } +} \ No newline at end of file diff --git a/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java new file mode 100644 index 0000000000..c67c90308f --- /dev/null +++ b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java @@ -0,0 +1,41 @@ +package net.osmand.plus.inapp; + +import net.osmand.plus.OsmandApplication; + +public class InAppPurchasesImpl extends InAppPurchases { + + private static final InAppSubscription[] LIVE_UPDATES_FREE = new InAppSubscription[] {}; + + public InAppPurchasesImpl(OsmandApplication ctx) { + super(ctx); + inAppPurchases = new InAppPurchase[] {}; + liveUpdates = new LiveUpdatesInAppPurchasesFree(); + } + + @Override + public boolean isFullVersion(String sku) { + return false; + } + + @Override + public boolean isDepthContours(String sku) { + return false; + } + + @Override + public boolean isContourLines(String sku) { + return false; + } + + @Override + public boolean isLiveUpdates(String sku) { + return false; + } + + private static class LiveUpdatesInAppPurchasesFree extends InAppSubscriptionList { + + public LiveUpdatesInAppPurchasesFree() { + super(LIVE_UPDATES_FREE); + } + } +} \ No newline at end of file From 8db153db32975dcacdca8c4f83427132a5dd5cd7 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 18 Mar 2021 11:14:57 +0200 Subject: [PATCH 171/250] Remove unnecessary changes (cherry picked from commit 67039222c5ad7cf465e785ace9b484f1acd44103) --- OsmAnd/AndroidManifest-amazon.xml | 27 ------------------- OsmAnd/build.gradle | 2 +- .../osmand/plus/inapp/InAppPurchasesImpl.java | 10 +++---- 3 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 OsmAnd/AndroidManifest-amazon.xml diff --git a/OsmAnd/AndroidManifest-amazon.xml b/OsmAnd/AndroidManifest-amazon.xml deleted file mode 100644 index 93e028dd17..0000000000 --- a/OsmAnd/AndroidManifest-amazon.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index f757952560..f6139bab8a 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -85,7 +85,7 @@ android { } amazonFree { java.srcDirs = ["src-nogms", "src-amazon"] - manifest.srcFile "AndroidManifest-amazon.xml" + manifest.srcFile "AndroidManifest-gplayFree.xml" } amazonFull { java.srcDirs = ["src-nogms", "src-amazon"] diff --git a/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java index c67c90308f..00bbea9693 100644 --- a/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java +++ b/OsmAnd/src-amazon/net/osmand/plus/inapp/InAppPurchasesImpl.java @@ -4,12 +4,10 @@ import net.osmand.plus.OsmandApplication; public class InAppPurchasesImpl extends InAppPurchases { - private static final InAppSubscription[] LIVE_UPDATES_FREE = new InAppSubscription[] {}; - public InAppPurchasesImpl(OsmandApplication ctx) { super(ctx); inAppPurchases = new InAppPurchase[] {}; - liveUpdates = new LiveUpdatesInAppPurchasesFree(); + liveUpdates = new EmptyLiveUpdatesList(); } @Override @@ -32,10 +30,10 @@ public class InAppPurchasesImpl extends InAppPurchases { return false; } - private static class LiveUpdatesInAppPurchasesFree extends InAppSubscriptionList { + private static class EmptyLiveUpdatesList extends InAppSubscriptionList { - public LiveUpdatesInAppPurchasesFree() { - super(LIVE_UPDATES_FREE); + public EmptyLiveUpdatesList() { + super(new InAppSubscription[] {}); } } } \ No newline at end of file From dce13081c162110b5841e919bf601edfefea35f3 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 18 Mar 2021 19:14:21 +0200 Subject: [PATCH 172/250] Fix compilation --- .../net/osmand/plus/inapp/InAppPurchaseHelperImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java b/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java index 9f05c1a70c..885e018ab2 100644 --- a/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java +++ b/OsmAnd/src-huawei/net/osmand/plus/inapp/InAppPurchaseHelperImpl.java @@ -267,7 +267,7 @@ public class InAppPurchaseHelperImpl extends InAppPurchaseHelper { InAppSubscription s = (InAppSubscription) inAppPurchase; try { s.setIntroductoryInfo(new InAppSubscriptionIntroductoryInfo(s, introductoryPrice, - introductoryPriceAmountMicros, introductoryPricePeriod, introductoryPriceCycles)); + introductoryPriceAmountMicros, introductoryPricePeriod, String.valueOf(introductoryPriceCycles))); } catch (ParseException e) { LOG.error(e); } From 44f45f4b6638a80a0aee752ce9fc5cfe7c641187 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Fri, 19 Mar 2021 08:58:01 +0200 Subject: [PATCH 173/250] Open market for free amazon version --- OsmAnd/src/net/osmand/plus/Version.java | 2 +- .../plus/activities/PluginInfoFragment.java | 3 +- .../chooseplan/ChoosePlanDialogFragment.java | 85 ++++++++----------- .../plus/chooseplan/OsmLiveGoneDialog.java | 3 +- .../plus/dashboard/DashPluginsFragment.java | 3 +- .../plus/download/DownloadActivity.java | 9 +- .../plus/download/ui/ItemViewHolder.java | 7 +- .../download/ui/UpdatesIndexFragment.java | 3 +- .../osmand/plus/helpers/DiscountHelper.java | 15 ++-- .../plus/liveupdates/LiveUpdatesFragment.java | 5 +- .../plus/liveupdates/OsmLiveActivity.java | 3 +- .../plus/search/QuickSearchListAdapter.java | 12 +-- .../plus/srtmplugin/ContourLinesMenu.java | 4 +- .../WikipediaArticleWikiLinkFragment.java | 3 +- .../explore/ExploreTabFragment.java | 5 +- 15 files changed, 79 insertions(+), 83 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/Version.java b/OsmAnd/src/net/osmand/plus/Version.java index 1ad99c96e8..1d5d5088d7 100644 --- a/OsmAnd/src/net/osmand/plus/Version.java +++ b/OsmAnd/src/net/osmand/plus/Version.java @@ -23,7 +23,7 @@ public class Version { return getBuildFlavor().contains("huawei"); } - private static boolean isAmazon() { + public static boolean isAmazon() { return getBuildFlavor().contains("amazon"); } diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java b/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java index 7deb85768c..5fdf2eab46 100644 --- a/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java @@ -31,6 +31,7 @@ import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.base.BaseOsmAndFragment; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.dialogs.PluginInstalledBottomSheetDialog.PluginStateListener; import net.osmand.plus.settings.fragments.BaseSettingsFragment; import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType; @@ -168,7 +169,7 @@ public class PluginInfoFragment extends BaseOsmAndFragment implements PluginStat if (plugin instanceof SRTMPlugin) { FragmentManager fragmentManager = getActivity().getSupportFragmentManager(); if (fragmentManager != null) { - ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(fragmentManager); + ChoosePlanDialogFragment.showDialogInstance(app, fragmentManager, ChoosePlanDialogType.HILLSHADE_SRTM_PLUGIN); } } else { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL()))); diff --git a/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java b/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java index 256a845dc7..543d7a9c46 100644 --- a/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java @@ -5,6 +5,8 @@ import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; +import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.text.TextUtils; @@ -27,6 +29,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.AppCompatImageView; import androidx.core.content.ContextCompat; +import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; @@ -34,7 +37,6 @@ import net.osmand.AndroidUtils; import net.osmand.PlatformUtil; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.Version; @@ -48,6 +50,7 @@ import net.osmand.plus.inapp.InAppPurchases.InAppPurchase; import net.osmand.plus.inapp.InAppPurchases.InAppSubscription; import net.osmand.plus.inapp.InAppPurchases.InAppSubscriptionIntroductoryInfo; import net.osmand.plus.liveupdates.SubscriptionFragment; +import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.srtmplugin.SRTMPlugin; import net.osmand.plus.widgets.TextViewEx; import net.osmand.util.Algorithms; @@ -709,57 +712,41 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment } } - public static void showFreeVersionInstance(@NonNull FragmentManager fm) { - try { - ChoosePlanFreeBannerDialogFragment fragment = new ChoosePlanFreeBannerDialogFragment(); - fragment.show(fm, ChoosePlanFreeBannerDialogFragment.TAG); - } catch (RuntimeException e) { - LOG.error("showFreeVersionInstance", e); + public enum ChoosePlanDialogType { + + FREE_VERSION("showFreeVersionInstance", ChoosePlanFreeBannerDialogFragment.TAG, ChoosePlanFreeBannerDialogFragment.class), + WIKIPEDIA("showWikipediaInstance", ChoosePlanWikipediaDialogFragment.TAG, ChoosePlanWikipediaDialogFragment.class), + WIKIVOYAGE("showWikivoyageInstance", ChoosePlanWikivoyageDialogFragment.TAG, ChoosePlanWikivoyageDialogFragment.class), + SEA_DEPTH_MAPS("showSeaDepthMapsInstance", ChoosePlanSeaDepthMapsDialogFragment.TAG, ChoosePlanSeaDepthMapsDialogFragment.class), + HILLSHADE_SRTM_PLUGIN("showHillshadeSrtmPluginInstance", ChoosePlanHillshadeSrtmDialogFragment.TAG, ChoosePlanHillshadeSrtmDialogFragment.class), + OSM_LIVE("showOsmLiveInstance", ChoosePlanOsmLiveBannerDialogFragment.TAG, ChoosePlanOsmLiveBannerDialogFragment.class); + + private final String tag; + private final String errorName; + private final Class fragmentClass; + + ChoosePlanDialogType(String errorName, String tag, Class fragmentClass) { + this.tag = tag; + this.errorName = errorName; + this.fragmentClass = fragmentClass; } } - public static void showWikipediaInstance(@NonNull FragmentManager fm) { - try { - ChoosePlanWikipediaDialogFragment fragment = new ChoosePlanWikipediaDialogFragment(); - fragment.show(fm, ChoosePlanWikipediaDialogFragment.TAG); - } catch (RuntimeException e) { - LOG.error("showWikipediaInstance", e); - } - } - - public static void showWikivoyageInstance(@NonNull FragmentManager fm) { - try { - ChoosePlanWikivoyageDialogFragment fragment = new ChoosePlanWikivoyageDialogFragment(); - fragment.show(fm, ChoosePlanWikivoyageDialogFragment.TAG); - } catch (RuntimeException e) { - LOG.error("showWikivoyageInstance", e); - } - } - - public static void showSeaDepthMapsInstance(@NonNull FragmentManager fm) { - try { - ChoosePlanSeaDepthMapsDialogFragment fragment = new ChoosePlanSeaDepthMapsDialogFragment(); - fragment.show(fm, ChoosePlanSeaDepthMapsDialogFragment.TAG); - } catch (RuntimeException e) { - LOG.error("showSeaDepthMapsInstance", e); - } - } - - public static void showHillshadeSrtmPluginInstance(@NonNull FragmentManager fm) { - try { - ChoosePlanHillshadeSrtmDialogFragment fragment = new ChoosePlanHillshadeSrtmDialogFragment(); - fragment.show(fm, ChoosePlanHillshadeSrtmDialogFragment.TAG); - } catch (RuntimeException e) { - LOG.error("showHillshadeSrtmPluginInstance", e); - } - } - - public static void showOsmLiveInstance(@NonNull FragmentManager fm) { - try { - ChoosePlanOsmLiveBannerDialogFragment fragment = new ChoosePlanOsmLiveBannerDialogFragment(); - fragment.show(fm, ChoosePlanOsmLiveBannerDialogFragment.TAG); - } catch (RuntimeException e) { - LOG.error("showOsmLiveInstance", e); + public static void showDialogInstance(@NonNull OsmandApplication app, @NonNull FragmentManager manager, + @NonNull ChoosePlanDialogType dialogType) { + if (Version.isAmazon() && !Version.isPaidVersion(app)) { + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.getUrlWithUtmRef(app, "net.osmand.plus"))); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + if (AndroidUtils.isIntentSafe(app, intent)) { + app.startActivity(intent); + } + } else { + try { + ChoosePlanDialogFragment fragment = (ChoosePlanDialogFragment) Fragment.instantiate(app, dialogType.fragmentClass.getName()); + fragment.show(manager, dialogType.tag); + } catch (RuntimeException e) { + LOG.error(dialogType.errorName, e); + } } } } diff --git a/OsmAnd/src/net/osmand/plus/chooseplan/OsmLiveGoneDialog.java b/OsmAnd/src/net/osmand/plus/chooseplan/OsmLiveGoneDialog.java index fdbce9a076..a4dba21024 100644 --- a/OsmAnd/src/net/osmand/plus/chooseplan/OsmLiveGoneDialog.java +++ b/OsmAnd/src/net/osmand/plus/chooseplan/OsmLiveGoneDialog.java @@ -28,6 +28,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.BaseOsmAndDialogFragment; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.OsmAndFeature; import net.osmand.plus.inapp.InAppPurchaseHelper; import net.osmand.plus.inapp.InAppPurchases.InAppSubscription; @@ -235,7 +236,7 @@ public abstract class OsmLiveGoneDialog extends BaseOsmAndDialogFragment { dismiss(); FragmentActivity activity = getActivity(); if (activity != null) { - ChoosePlanDialogFragment.showOsmLiveInstance(activity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(app, activity.getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE); } } }); diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java index 15d222a980..58d8302f63 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashPluginsFragment.java @@ -21,6 +21,7 @@ import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; import net.osmand.plus.activities.PluginsFragment; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.dashboard.tools.DashFragmentData; import net.osmand.plus.development.OsmandDevelopmentPlugin; import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin; @@ -55,7 +56,7 @@ public class DashPluginsFragment extends DashBaseFragment { if (plugin instanceof SRTMPlugin) { FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager != null) { - ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(fragmentManager); + ChoosePlanDialogFragment.showDialogInstance(getMyApplication(), fragmentManager, ChoosePlanDialogType.HILLSHADE_SRTM_PLUGIN); } } else { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(plugin.getInstallURL()))); diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java index ebbd7d4e3b..ed45d50e84 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java @@ -22,8 +22,6 @@ import android.widget.ProgressBar; import android.widget.Space; import android.widget.TextView; -import com.ibm.icu.impl.IllegalIcuArgumentException; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.UiThread; @@ -35,6 +33,8 @@ import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.viewpager.widget.ViewPager; +import com.ibm.icu.impl.IllegalIcuArgumentException; + import net.osmand.AndroidUtils; import net.osmand.IndexConstants; import net.osmand.PlatformUtil; @@ -52,7 +52,9 @@ import net.osmand.plus.activities.TabActivity; import net.osmand.plus.base.BasicProgressAsyncTask; import net.osmand.plus.base.BottomSheetDialogFragment; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents; +import net.osmand.plus.download.ReloadIndexesTask.ReloadIndexesListener; import net.osmand.plus.download.ui.ActiveDownloadsDialogFragment; import net.osmand.plus.download.ui.DownloadResourceGroupFragment; import net.osmand.plus.download.ui.LocalIndexesFragment; @@ -63,7 +65,6 @@ import net.osmand.plus.inapp.InAppPurchaseHelper; import net.osmand.plus.inapp.InAppPurchaseHelper.InAppPurchaseTaskType; import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin; import net.osmand.plus.settings.backend.OsmandSettings; -import net.osmand.plus.download.ReloadIndexesTask.ReloadIndexesListener; import net.osmand.plus.srtmplugin.SRTMPlugin; import net.osmand.plus.views.controls.PagerSlidingTabStrip; import net.osmand.util.Algorithms; @@ -407,7 +408,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo collapseBanner(); } else { ctx.getMyApplication().logEvent("click_free_dialog"); - ChoosePlanDialogFragment.showFreeVersionInstance(ctx.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(ctx.getMyApplication(), ctx.getSupportFragmentManager(), ChoosePlanDialogType.FREE_VERSION); } } }; diff --git a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java index 7a8deaf506..a24e2c5b2a 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java @@ -32,6 +32,7 @@ import net.osmand.plus.activities.LocalIndexInfo; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.PluginsFragment; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.download.CityItem; import net.osmand.plus.download.CustomIndexItem; import net.osmand.plus.download.DownloadItem; @@ -353,10 +354,10 @@ public class ItemViewHolder { switch (clickAction) { case ASK_FOR_FULL_VERSION_PURCHASE: context.getMyApplication().logEvent("in_app_purchase_show_from_wiki_context_menu"); - ChoosePlanDialogFragment.showWikipediaInstance(context.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(context.getMyApplication(), context.getSupportFragmentManager(), ChoosePlanDialogType.WIKIPEDIA); break; case ASK_FOR_DEPTH_CONTOURS_PURCHASE: - ChoosePlanDialogFragment.showSeaDepthMapsInstance(context.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(context.getMyApplication(), context.getSupportFragmentManager(), ChoosePlanDialogType.SEA_DEPTH_MAPS); break; case ASK_FOR_SEAMARKS_PLUGIN: showPluginsScreen(); @@ -364,7 +365,7 @@ public class ItemViewHolder { context.getString(R.string.activate_seamarks_plugin), Toast.LENGTH_SHORT).show(); break; case ASK_FOR_SRTM_PLUGIN_PURCHASE: - ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(context.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(context.getMyApplication(), context.getSupportFragmentManager(), ChoosePlanDialogType.HILLSHADE_SRTM_PLUGIN); break; case ASK_FOR_SRTM_PLUGIN_ENABLE: showPluginsScreen(); diff --git a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java index faf39a56f7..f12639a805 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java @@ -24,6 +24,7 @@ import net.osmand.Collator; import net.osmand.OsmAndCollator; import net.osmand.map.OsmandRegions; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.base.OsmAndListFragment; @@ -190,7 +191,7 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download if (listAdapter.isShowOsmLiveBanner() && position == 0) { DownloadActivity activity = getMyActivity(); if (activity != null) { - ChoosePlanDialogFragment.showOsmLiveInstance(activity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(activity.getMyApplication(), activity.getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE); } } else { final IndexItem e = (IndexItem) getListAdapter().getItem(position); diff --git a/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java b/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java index a4bb6ec74f..c91655dafc 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/DiscountHelper.java @@ -28,6 +28,7 @@ import net.osmand.osm.PoiType; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.activities.OsmandInAppPurchaseActivity; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.Version; @@ -322,7 +323,7 @@ public class DiscountHelper { } else { for (InAppPurchase p : purchaseHelper.getLiveUpdates().getAllSubscriptions()) { if (url.contains(p.getSku())) { - ChoosePlanDialogFragment.showOsmLiveInstance(mapActivity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(app, mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE); break; } } @@ -367,17 +368,17 @@ public class DiscountHelper { } else if (url.startsWith(SHOW_CHOOSE_PLAN_PREFIX)) { String planType = url.substring(SHOW_CHOOSE_PLAN_PREFIX.length()).trim(); if (CHOOSE_PLAN_TYPE_FREE.equals(planType)) { - ChoosePlanDialogFragment.showFreeVersionInstance(mapActivity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.FREE_VERSION); } else if (CHOOSE_PLAN_TYPE_LIVE.equals(planType)) { - ChoosePlanDialogFragment.showOsmLiveInstance(mapActivity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE); } else if (CHOOSE_PLAN_TYPE_SEA_DEPTH.equals(planType)) { - ChoosePlanDialogFragment.showSeaDepthMapsInstance(mapActivity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.SEA_DEPTH_MAPS); } else if (CHOOSE_PLAN_TYPE_HILLSHADE.equals(planType)) { - ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(mapActivity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.HILLSHADE_SRTM_PLUGIN); } else if (CHOOSE_PLAN_TYPE_WIKIPEDIA.equals(planType)) { - ChoosePlanDialogFragment.showWikipediaInstance(mapActivity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.WIKIPEDIA); } else if (CHOOSE_PLAN_TYPE_WIKIVOYAGE.equals(planType)) { - ChoosePlanDialogFragment.showWikivoyageInstance(mapActivity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.WIKIVOYAGE); } } else { Intent intent = new Intent(Intent.ACTION_VIEW); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index c503162910..eb8e2abff4 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -35,6 +35,7 @@ import androidx.fragment.app.FragmentManager; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; @@ -213,7 +214,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc subscriptionsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - ChoosePlanDialogFragment.showOsmLiveInstance(getActivity().getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(app, getActivity().getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE); } }); if (isDonationSupported()) { @@ -249,7 +250,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc public void onClick(View v) { FragmentActivity activity = getActivity(); if (activity != null) { - ChoosePlanDialogFragment.showOsmLiveInstance(activity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(app, activity.getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE); } } }); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java b/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java index 6014ebbc88..f6df0d3690 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/OsmLiveActivity.java @@ -22,6 +22,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogListener; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.download.AbstractDownloadActivity; import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents; import net.osmand.plus.inapp.InAppPurchaseHelper; @@ -95,7 +96,7 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa protected void onResume() { super.onResume(); if (!InAppPurchaseHelper.isSubscribedToLiveUpdates(getMyApplication()) && showSettingOnly) { - ChoosePlanDialogFragment.showOsmLiveInstance(getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(getMyApplication(), getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE); } } diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java index 9251e555b0..d8ab361a82 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java @@ -10,12 +10,9 @@ import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.ListView; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.view.ContextThemeWrapper; import androidx.core.content.ContextCompat; import androidx.core.view.ViewCompat; @@ -32,9 +29,9 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.UiUtilities.UpdateLocationViewCache; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; -import net.osmand.plus.search.listitems.QuickSearchBannerListItem; -import net.osmand.plus.search.listitems.QuickSearchFreeBannerListItem; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.mapcontextmenu.MenuController; +import net.osmand.plus.search.listitems.QuickSearchBannerListItem; import net.osmand.plus.search.listitems.QuickSearchHeaderListItem; import net.osmand.plus.search.listitems.QuickSearchListItem; import net.osmand.plus.search.listitems.QuickSearchListItemType; @@ -50,9 +47,9 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.List; +import static net.osmand.plus.search.listitems.QuickSearchBannerListItem.ButtonItem; import static net.osmand.plus.search.listitems.QuickSearchBannerListItem.INVALID_ID; import static net.osmand.search.core.ObjectType.POI_TYPE; -import static net.osmand.plus.search.listitems.QuickSearchBannerListItem.ButtonItem; public class QuickSearchListAdapter extends ArrayAdapter { @@ -265,8 +262,7 @@ public class QuickSearchListAdapter extends ArrayAdapter { btnGet.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - ChoosePlanDialogFragment.showWikipediaInstance( - activity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(app, activity.getSupportFragmentManager(), ChoosePlanDialogType.WIKIPEDIA); } }); } diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java b/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java index 86abdee880..ed3d781745 100644 --- a/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java +++ b/OsmAnd/src/net/osmand/plus/srtmplugin/ContourLinesMenu.java @@ -8,6 +8,7 @@ import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuItem; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.settings.backend.CommonPreference; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.R; @@ -139,7 +140,8 @@ public class ContourLinesMenu { } }); } else if (itemId == R.string.srtm_plugin_name) { - ChoosePlanDialogFragment.showHillshadeSrtmPluginInstance(mapActivity.getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(mapActivity.getMyApplication(), + mapActivity.getSupportFragmentManager(), ChoosePlanDialogType.HILLSHADE_SRTM_PLUGIN); closeDashboard(mapActivity); } else if (contourWidthProp != null && itemId == contourWidthName.hashCode()) { plugin.selectPropertyValue(mapActivity, contourWidthProp, widthPref, new Runnable() { diff --git a/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaArticleWikiLinkFragment.java b/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaArticleWikiLinkFragment.java index 1c34b823ab..df66f651df 100644 --- a/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaArticleWikiLinkFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikipedia/WikipediaArticleWikiLinkFragment.java @@ -16,6 +16,7 @@ import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription; import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleDividerItem; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.wikivoyage.article.WikivoyageArticleWikiLinkFragment; @@ -78,7 +79,7 @@ public class WikipediaArticleWikiLinkFragment extends MenuBottomSheetDialogFragm public void onClick(View v) { FragmentManager fm = getFragmentManager(); if (fm != null) { - ChoosePlanDialogFragment.showWikivoyageInstance(fm); + ChoosePlanDialogFragment.showDialogInstance(getMyApplication(), fm, ChoosePlanDialogType.WIKIVOYAGE); } dismiss(); } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java index 396da70e43..80b3c50da4 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java @@ -22,6 +22,7 @@ import net.osmand.plus.R; import net.osmand.plus.Version; import net.osmand.plus.base.BaseOsmAndFragment; import net.osmand.plus.chooseplan.ChoosePlanDialogFragment; +import net.osmand.plus.chooseplan.ChoosePlanDialogFragment.ChoosePlanDialogType; import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadIndexesThread; import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents; @@ -300,7 +301,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv || item.getType() == DownloadActivityType.TRAVEL_FILE) && !Version.isPaidVersion(app)) { FragmentManager fm = getFragmentManager(); if (fm != null) { - ChoosePlanDialogFragment.showWikipediaInstance(fm); + ChoosePlanDialogFragment.showDialogInstance(app, fm, ChoosePlanDialogType.WIKIPEDIA); } } else { DownloadIndexesThread downloadThread = app.getDownloadThread(); @@ -356,7 +357,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv || item.getType() == DownloadActivityType.TRAVEL_FILE) && !Version.isPaidVersion(app)) { FragmentManager fm = getFragmentManager(); if (fm != null) { - ChoosePlanDialogFragment.showWikipediaInstance(fm); + ChoosePlanDialogFragment.showDialogInstance(app, fm, ChoosePlanDialogType.WIKIPEDIA); } } else { DownloadIndexesThread downloadThread = app.getDownloadThread(); From d906018e3a70d742e069fc2e5f573971606347fb Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Fri, 19 Mar 2021 12:06:49 +0200 Subject: [PATCH 174/250] Fix compilation --- .../src/net/osmand/plus/download/ui/UpdatesIndexFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java index 6cf5b924cc..f6cf6b03cc 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java @@ -370,7 +370,8 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download cardView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - ChoosePlanDialogFragment.showOsmLiveInstance(getMyActivity().getSupportFragmentManager()); + ChoosePlanDialogFragment.showDialogInstance(getMyApplication(), + getMyActivity().getSupportFragmentManager(), ChoosePlanDialogType.OSM_LIVE); } }); } else { From 475ab3fbe791a5d541682577a54b325a70bf789a Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Fri, 19 Mar 2021 12:08:03 +0200 Subject: [PATCH 175/250] Remove check for free version --- .../net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java b/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java index 543d7a9c46..8488daf0f5 100644 --- a/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/chooseplan/ChoosePlanDialogFragment.java @@ -734,7 +734,7 @@ public abstract class ChoosePlanDialogFragment extends BaseOsmAndDialogFragment public static void showDialogInstance(@NonNull OsmandApplication app, @NonNull FragmentManager manager, @NonNull ChoosePlanDialogType dialogType) { - if (Version.isAmazon() && !Version.isPaidVersion(app)) { + if (Version.isAmazon()) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Version.getUrlWithUtmRef(app, "net.osmand.plus"))); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (AndroidUtils.isIntentSafe(app, intent)) { From c7fa20cc69f6ce5aae10208e97fc524628304545 Mon Sep 17 00:00:00 2001 From: Skalii Date: Fri, 19 Mar 2021 14:30:56 +0200 Subject: [PATCH 176/250] remove confirm toggle; fix dialog title; --- .../trip_recording_starting_fragment.xml | 49 +------------------ .../TripRecordingStartingBottomSheet.java | 29 +---------- 2 files changed, 3 insertions(+), 75 deletions(-) diff --git a/OsmAnd/res/layout/trip_recording_starting_fragment.xml b/OsmAnd/res/layout/trip_recording_starting_fragment.xml index 809cc015ac..3c76b1e050 100644 --- a/OsmAnd/res/layout/trip_recording_starting_fragment.xml +++ b/OsmAnd/res/layout/trip_recording_starting_fragment.xml @@ -92,55 +92,10 @@ app:trackHeight="@dimen/slider_track_height" tools:visibility="visible" /> - - - - - - - - - - - - @@ -149,7 +104,7 @@ + android:layout_height="@dimen/context_menu_first_line_top_margin" /> diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java index c03a568137..c8c96d1323 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java @@ -14,7 +14,6 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.AppCompatImageView; -import androidx.appcompat.widget.SwitchCompat; import androidx.cardview.widget.CardView; import androidx.fragment.app.FragmentManager; @@ -35,13 +34,11 @@ import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.fragments.BaseSettingsFragment; import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType; -import static net.osmand.plus.UiUtilities.CompoundButtonType.GLOBAL; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.UPDATE_TRACK_ICON; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.createItem; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.createShowTrackItem; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.setShowOnMapBackground; import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.updateTrackIcon; public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragment { @@ -54,8 +51,6 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm private AppCompatImageView upDownBtn; private AppCompatImageView trackAppearanceIcon; - private CardView confirmContainer; - private SwitchCompat confirmCompound; private TextView intervalValueView; private LinearLayout showTrackContainer; private LinearLayout intervalContainer; @@ -96,24 +91,10 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm intervalSlider = itemView.findViewById(R.id.interval_slider); updateIntervalValue(); - confirmContainer = itemView.findViewById(R.id.confirm_container); - confirmCompound = confirmContainer.findViewById(R.id.confirm_compound_button); - UiUtilities.setupCompoundButton(confirmCompound, nightMode, GLOBAL); - updateGlobalRemember(); - confirmContainer.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - boolean checked = !confirmCompound.isChecked(); - confirmCompound.setChecked(checked); - settings.SAVE_GLOBAL_TRACK_REMEMBER.set(checked); - setShowOnMapBackground(confirmContainer, checked, nightMode); - } - }); - showTrackContainer = itemView.findViewById(R.id.show_track_on_map); trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon); createShowTrackItem(app, getMapActivity(), nightMode, showTrackContainer, trackAppearanceIcon, - R.string.show_track_on_map, TripRecordingStartingBottomSheet.this, new Runnable() { + R.string.shared_string_show_on_map, TripRecordingStartingBottomSheet.this, new Runnable() { @Override public void run() { hide(); @@ -221,13 +202,6 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm updateUpDownBtn(); } - private void updateGlobalRemember() { - if (confirmContainer != null && confirmCompound != null) { - confirmCompound.setChecked(settings.SAVE_GLOBAL_TRACK_REMEMBER.get()); - setShowOnMapBackground(confirmContainer, confirmCompound.isChecked(), nightMode); - } - } - private void updateUpDownBtn() { int iconId = infoExpanded ? R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up; upDownBtn.setImageDrawable(getContentIcon(iconId)); @@ -254,7 +228,6 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm updateTrackIcon(app, trackAppearanceIcon); } if (key.equals(UPDATE_LOGGING_INTERVAL)) { - updateGlobalRemember(); updateIntervalValue(); AndroidUiHelper.updateVisibility(intervalContainer, infoExpanded); } From 94c58edb7c0206b400a6773854cbde24a272670e Mon Sep 17 00:00:00 2001 From: Skalii Date: Fri, 19 Mar 2021 14:57:55 +0200 Subject: [PATCH 177/250] redesign trip recording dialog; add options dialog; --- .../layout/bottom_sheet_button_with_icon.xml | 8 +- .../layout/trip_recording_active_fragment.xml | 172 ------- OsmAnd/res/layout/trip_recording_fragment.xml | 91 ++++ OsmAnd/res/values/strings.xml | 2 + .../osmand/plus/activities/MapActivity.java | 6 +- .../plus/activities/MapActivityActions.java | 8 +- .../liveupdates/LiveUpdatesFragmentNew.java | 6 +- .../monitoring/OsmandMonitoringPlugin.java | 54 ++- ....java => TripRecordingBottomFragment.java} | 442 +++++++----------- ...TripRecordingClearDataBottomFragment.java} | 33 +- ...> TripRecordingDiscardBottomFragment.java} | 81 +--- .../TripRecordingOptionsBottomFragment.java | 350 ++++++++++++++ ... TripRecordingStartingBottomFragment.java} | 28 +- .../BooleanPreferenceBottomSheet.java | 4 +- .../fragments/BaseSettingsFragment.java | 8 +- .../plus/track/TrackAppearanceFragment.java | 14 +- 16 files changed, 728 insertions(+), 579 deletions(-) delete mode 100644 OsmAnd/res/layout/trip_recording_active_fragment.xml create mode 100644 OsmAnd/res/layout/trip_recording_fragment.xml rename OsmAnd/src/net/osmand/plus/monitoring/{TripRecordingActiveBottomSheet.java => TripRecordingBottomFragment.java} (65%) rename OsmAnd/src/net/osmand/plus/monitoring/{ClearRecordedDataBottomSheetFragment.java => TripRecordingClearDataBottomFragment.java} (71%) rename OsmAnd/src/net/osmand/plus/monitoring/{StopTrackRecordingBottomFragment.java => TripRecordingDiscardBottomFragment.java} (50%) create mode 100644 OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java rename OsmAnd/src/net/osmand/plus/monitoring/{TripRecordingStartingBottomSheet.java => TripRecordingStartingBottomFragment.java} (88%) diff --git a/OsmAnd/res/layout/bottom_sheet_button_with_icon.xml b/OsmAnd/res/layout/bottom_sheet_button_with_icon.xml index 7c56093fbc..8dd296f01b 100644 --- a/OsmAnd/res/layout/bottom_sheet_button_with_icon.xml +++ b/OsmAnd/res/layout/bottom_sheet_button_with_icon.xml @@ -3,14 +3,13 @@ xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + tools:background="@drawable/btn_background_inactive_dark"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OsmAnd/res/layout/trip_recording_fragment.xml b/OsmAnd/res/layout/trip_recording_fragment.xml new file mode 100644 index 0000000000..68e449cdf3 --- /dev/null +++ b/OsmAnd/res/layout/trip_recording_fragment.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 93cfd93231..21bb56470e 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,6 +11,8 @@ Thx - Hardy --> + All unsaved data will be lost. + Save and continue Logging interval set time period in which OsmAnd will ask for the current location position data. Please select another type of colorization. The track does not contain speed data. diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 487f4d902f..58e46db8ac 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -104,7 +104,7 @@ import net.osmand.plus.measurementtool.LoginBottomSheetFragment; import net.osmand.plus.measurementtool.MeasurementEditingContext; import net.osmand.plus.measurementtool.MeasurementToolFragment; import net.osmand.plus.measurementtool.SnapTrackWarningFragment; -import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet; +import net.osmand.plus.monitoring.TripRecordingStartingBottomFragment; import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.resources.ResourceManager; import net.osmand.plus.routepreparationmenu.ChooseRouteFragment; @@ -2241,8 +2241,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven return getFragment(MeasurementToolFragment.TAG); } - public TripRecordingStartingBottomSheet getTripRecordingBottomSheet() { - return getFragment(TripRecordingStartingBottomSheet.TAG); + public TripRecordingStartingBottomFragment getTripRecordingBottomSheet() { + return getFragment(TripRecordingStartingBottomFragment.TAG); } public ChooseRouteFragment getChooseRouteFragment() { diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index ff78335e74..c51ed68f32 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -62,8 +62,8 @@ 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.monitoring.TripRecordingActiveBottomSheet; -import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet; +import net.osmand.plus.monitoring.TripRecordingBottomFragment; +import net.osmand.plus.monitoring.TripRecordingStartingBottomFragment; import net.osmand.plus.osmedit.dialogs.DismissRouteBottomSheetFragment; import net.osmand.plus.profiles.ProfileDataObject; import net.osmand.plus.profiles.ProfileDataUtils; @@ -854,9 +854,9 @@ public class MapActivityActions implements DialogProvider { app.logEvent("trip_recording_open"); MapActivity.clearPrevActivityIntent(); if (monitoringPlugin.hasDataToSave() || monitoringPlugin.wasTrackMonitored()) { - TripRecordingActiveBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), monitoringPlugin.getCurrentTrack()); + TripRecordingBottomFragment.showInstance(mapActivity.getSupportFragmentManager(), monitoringPlugin.getCurrentTrack()); } else { - TripRecordingStartingBottomSheet.showInstance(mapActivity.getSupportFragmentManager()); + TripRecordingStartingBottomFragment.showInstance(mapActivity.getSupportFragmentManager()); } return true; } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index 756f6a3551..4eb764da2d 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -85,9 +85,9 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFreq import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.setAlarmForPendingIntent; import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.getTertiaryTextColorId; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getActiveTextColorId; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getOsmandIconColorId; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryIconColorId; +import static net.osmand.plus.monitoring.TripRecordingBottomFragment.getActiveTextColorId; +import static net.osmand.plus.monitoring.TripRecordingBottomFragment.getOsmandIconColorId; +import static net.osmand.plus.monitoring.TripRecordingBottomFragment.getSecondaryIconColorId; public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements OnLiveUpdatesForLocalChange { diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 4fa978a8d6..de95978f7d 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -41,13 +41,16 @@ import net.osmand.plus.dashboard.tools.DashFragmentData; import net.osmand.plus.settings.backend.ApplicationMode; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType; +import net.osmand.plus.track.TrackMenuFragment; import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.layers.MapInfoLayer; import net.osmand.plus.views.mapwidgets.widgets.TextInfoWidget; import net.osmand.util.Algorithms; +import java.io.File; import java.lang.ref.WeakReference; +import java.util.Collections; import java.util.List; import static net.osmand.plus.UiUtilities.CompoundButtonType.PROFILE_DEPENDENT; @@ -329,9 +332,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { public void controlDialog(final Activity activity, final boolean showTrackSelection) { FragmentManager fragmentManager = ((FragmentActivity) activity).getSupportFragmentManager(); if (hasDataToSave() || wasTrackMonitored()) { - TripRecordingActiveBottomSheet.showInstance(fragmentManager, getCurrentTrack()); + TripRecordingBottomFragment.showInstance(fragmentManager, getCurrentTrack()); } else { - TripRecordingStartingBottomSheet.showInstance(fragmentManager); + TripRecordingStartingBottomFragment.showInstance(fragmentManager); } /*final boolean wasTrackMonitored = settings.SAVE_GLOBAL_TRACK_TO_GPX.get(); @@ -436,16 +439,22 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { } public void saveCurrentTrack() { - saveCurrentTrack(null, null); + saveCurrentTrack(null, null, true, false); } public void saveCurrentTrack(@Nullable final Runnable onComplete) { - saveCurrentTrack(onComplete, null); + saveCurrentTrack(onComplete, null, true, false); } public void saveCurrentTrack(@Nullable final Runnable onComplete, @Nullable Activity activity) { - stopRecording(); + saveCurrentTrack(onComplete, activity, true, false); + } + public void saveCurrentTrack(@Nullable final Runnable onComplete, @Nullable Activity activity, + final boolean stopRecording, final boolean openTrack) { + if (stopRecording) { + stopRecording(); + } final WeakReference activityRef = activity != null ? new WeakReference<>(activity) : null; app.getTaskManager().runInBackground(new OsmAndTaskRunnable() { @@ -461,7 +470,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { try { SavingTrackHelper helper = app.getSavingTrackHelper(); SaveGpxResult result = helper.saveDataToGpx(app.getAppCustomization().getTracksDir()); - helper.close(); + if (stopRecording) { + helper.close(); + } return result; } catch (Exception e) { e.printStackTrace(); @@ -474,10 +485,31 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { isSaving = false; app.getNotificationHelper().refreshNotifications(); updateControl(); - if (activityRef != null && !Algorithms.isEmpty(result.getFilenames())) { - final Activity a = activityRef.get(); - if (a instanceof FragmentActivity && !a.isFinishing()) { - SaveGPXBottomSheetFragment.showInstance(((FragmentActivity) a).getSupportFragmentManager(), result.getFilenames()); + + File file = null; + File dir = app.getAppCustomization().getTracksDir(); + File[] children = dir.listFiles(); + if (children != null && !Algorithms.isEmpty(result.getFilenames())) { + SavingTrackHelper helper = app.getSavingTrackHelper(); + for (File child : children) { + if (child.getName().startsWith(result.getFilenames().get(0)) + && child.lastModified() == helper.getLastTimeFileSaved()) { + file = child; + } + } + } + if (file != null && file.exists()) { + if (!openTrack) { + if (activityRef != null) { + final Activity a = activityRef.get(); + if (a instanceof FragmentActivity && !a.isFinishing()) { + List singleName = Collections.singletonList(Algorithms.getFileNameWithoutExtension(file)); + SaveGPXBottomSheetFragment.showInstance(((FragmentActivity) a) + .getSupportFragmentManager(), singleName); + } + } + } else { + TrackMenuFragment.openTrack(mapActivity, file, null); } } @@ -523,7 +555,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { runnable.run(); } else if (map instanceof FragmentActivity) { FragmentActivity activity = (FragmentActivity) map; - TripRecordingStartingBottomSheet.showInstance(activity.getSupportFragmentManager()); + TripRecordingStartingBottomFragment.showInstance(activity.getSupportFragmentManager()); } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java similarity index 65% rename from OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java rename to OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java index 7aaa832dd1..471ec813a6 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java @@ -5,11 +5,8 @@ import android.app.Dialog; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; -import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; -import android.text.format.DateUtils; -import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.widget.CompoundButton; @@ -25,59 +22,55 @@ import androidx.annotation.StringRes; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.AppCompatImageView; import androidx.cardview.widget.CardView; -import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.content.ContextCompat; import androidx.core.graphics.drawable.DrawableCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.recyclerview.widget.RecyclerView; -import com.google.android.material.snackbar.Snackbar; - import net.osmand.AndroidUtils; import net.osmand.GPXUtilities.GPXFile; -import net.osmand.IndexConstants; import net.osmand.PlatformUtil; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.activities.SavingTrackHelper; -import net.osmand.plus.activities.SavingTrackHelper.SaveGpxResult; import net.osmand.plus.base.MenuBottomSheetDialogFragment; import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.myplaces.SaveCurrentTrackTask; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.track.GpxBlockStatisticsBuilder; -import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener; import net.osmand.plus.track.TrackAppearanceFragment; import net.osmand.plus.widgets.TextViewEx; import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; -import java.lang.ref.WeakReference; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import static net.osmand.AndroidUtils.getSecondaryTextColorId; +import static net.osmand.AndroidUtils.setPadding; import static net.osmand.plus.UiUtilities.CompoundButtonType.GLOBAL; -public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragment { +public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { - public static final String TAG = TripRecordingActiveBottomSheet.class.getSimpleName(); - private static final Log log = PlatformUtil.getLog(TripRecordingActiveBottomSheet.class); - private static final String UPDATE_CURRENT_GPX_FILE = "update_current_gpx_file"; + public static final String TAG = TripRecordingBottomFragment.class.getSimpleName(); + private static final Log LOG = PlatformUtil.getLog(TripRecordingBottomFragment.class); + private static final String SAVE_CURRENT_GPX_FILE = "save_current_gpx_file"; public static final String UPDATE_TRACK_ICON = "update_track_icon"; - private static final int GENERAL_UPDATE_GPS_INTERVAL = 1000; - private static final int GENERAL_UPDATE_SAVE_INTERVAL = 1000; + private static final int GPS_UPDATE_INTERVAL = 1000; private OsmandApplication app; private OsmandSettings settings; - private SavingTrackHelper helper; + private OsmandMonitoringPlugin plugin; + + private View statusContainer; + private AppCompatImageView trackAppearanceIcon; + private GpxBlockStatisticsBuilder blockStatisticsBuilder; + private SelectedGpxFile selectedGpxFile; private View statusContainer; @@ -88,7 +81,6 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen private final Handler handler = new Handler(); private Runnable updatingGPS; - private Runnable updatingTimeTrackSaved; private GPXFile getGPXFile() { return selectedGpxFile.getGpxFile(); @@ -98,21 +90,21 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen this.selectedGpxFile = selectedGpxFile; } - public boolean hasDataToSave() { + private boolean hasDataToSave() { return app.getSavingTrackHelper().hasDataToSave(); } - public boolean searchingGPS() { + private boolean searchingGPS() { return app.getLocationProvider().getLastKnownLocation() == null; } - public boolean wasTrackMonitored() { + private boolean wasTrackMonitored() { return settings.SAVE_GLOBAL_TRACK_TO_GPX.get(); } public static void showInstance(@NonNull FragmentManager fragmentManager, SelectedGpxFile selectedGpxFile) { if (!fragmentManager.isStateSaved()) { - TripRecordingActiveBottomSheet fragment = new TripRecordingActiveBottomSheet(); + TripRecordingBottomFragment fragment = new TripRecordingBottomFragment(); fragment.setSelectedGpxFile(selectedGpxFile); fragment.show(fragmentManager, TAG); } @@ -122,37 +114,22 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen public void createMenuItems(Bundle savedInstanceState) { app = requiredMyApplication(); settings = app.getSettings(); - helper = app.getSavingTrackHelper(); + plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class); LayoutInflater inflater = UiUtilities.getInflater(getContext(), nightMode); final FragmentManager fragmentManager = getFragmentManager(); - View itemView = inflater.inflate(R.layout.trip_recording_active_fragment, null, false); + View itemView = inflater.inflate(R.layout.trip_recording_fragment, null, false); items.add(new BaseBottomSheetItem.Builder() .setCustomView(itemView) .create()); - View buttonClear = itemView.findViewById(R.id.button_clear); - final View buttonOnline = itemView.findViewById(R.id.button_online); - final View buttonSegment = itemView.findViewById(R.id.button_segment); - buttonSave = itemView.findViewById(R.id.button_save); - final View buttonPause = itemView.findViewById(R.id.button_pause); - View buttonStop = itemView.findViewById(R.id.button_stop); - - createItem(buttonClear, ItemType.CLEAR_DATA, hasDataToSave()); - createItem(buttonOnline, ItemType.STOP_ONLINE, hasDataToSave()); - createItem(buttonSegment, ItemType.START_NEW_SEGMENT, wasTrackMonitored()); - createItem(buttonPause, wasTrackMonitored() ? ItemType.PAUSE : ItemType.RESUME, true); - createItem(buttonStop, ItemType.STOP, true); - - AndroidUiHelper.updateVisibility(buttonOnline, app.getLiveMonitoringHelper().isLiveMonitoringEnabled()); - statusContainer = itemView.findViewById(R.id.status_container); updateStatus(); RecyclerView statBlocks = itemView.findViewById(R.id.block_statistics); if (savedInstanceState != null) { - if (savedInstanceState.containsKey(UPDATE_CURRENT_GPX_FILE) - && savedInstanceState.getBoolean(UPDATE_CURRENT_GPX_FILE)) { + if (savedInstanceState.containsKey(SAVE_CURRENT_GPX_FILE) + && savedInstanceState.getBoolean(SAVE_CURRENT_GPX_FILE)) { selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); } } @@ -161,63 +138,28 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen blockStatisticsBuilder.setBlocksClickable(false); blockStatisticsBuilder.initStatBlocks(null, ContextCompat.getColor(app, getActiveTextColorId(nightMode)), nightMode); - showTrackContainer = itemView.findViewById(R.id.show_track_on_map); + LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map); trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon); createShowTrackItem(app, getMapActivity(), nightMode, showTrackContainer, trackAppearanceIcon, - ItemType.SHOW_TRACK.getTitleId(), TripRecordingActiveBottomSheet.this, new Runnable() { + ItemType.SHOW_TRACK.getTitleId(), TripRecordingBottomFragment.this, new Runnable() { @Override public void run() { hide(); } }); - buttonClear.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() { + CardView cardLeft = itemView.findViewById(R.id.button_left); + createItem(cardLeft, ItemType.CANCEL); + cardLeft.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (fragmentManager != null && hasDataToSave()) { - ClearRecordedDataBottomSheetFragment.showInstance(fragmentManager, TripRecordingActiveBottomSheet.this); - } + dismiss(); } }); - buttonOnline.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - settings.LIVE_MONITORING.set(false); - AndroidUiHelper.updateVisibility(buttonOnline, false); - } - }); - - buttonSegment.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (wasTrackMonitored()) { - blockStatisticsBuilder.stopUpdatingStatBlocks(); - helper.startNewSegment(); - blockStatisticsBuilder.runUpdatingStatBlocksIfNeeded(); - } - } - }); - - buttonSave.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (hasDataToSave()) { - final GPXFile gpxFile = getGPXFile(); - new SaveCurrentTrackTask(app, gpxFile, createSaveListener(new Runnable() { - @Override - public void run() { - blockStatisticsBuilder.stopUpdatingStatBlocks(); - blockStatisticsBuilder.runUpdatingStatBlocksIfNeeded(); - stopUpdatingTimeTrackSaved(); - runUpdatingTimeTrackSaved(); - } - })).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } - } - }); - - buttonPause.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() { + final CardView cardCenterLeft = itemView.findViewById(R.id.button_center_left); + createItem(cardCenterLeft, wasTrackMonitored() ? ItemType.PAUSE : ItemType.RESUME); + cardCenterLeft.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean wasTrackMonitored = !wasTrackMonitored(); @@ -228,19 +170,94 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen } settings.SAVE_GLOBAL_TRACK_TO_GPX.set(wasTrackMonitored); updateStatus(); - createItem(buttonPause, wasTrackMonitored ? ItemType.PAUSE : ItemType.RESUME, true); - createItem(buttonSegment, ItemType.START_NEW_SEGMENT, wasTrackMonitored); + createItem(cardCenterLeft, wasTrackMonitored ? ItemType.PAUSE : ItemType.RESUME); } }); - buttonStop.findViewById(R.id.button_container).setOnClickListener(new View.OnClickListener() { + CardView cardCenterRight = itemView.findViewById(R.id.button_center_right); + createItem(cardCenterRight, ItemType.FINISH); + cardCenterRight.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (fragmentManager != null) { - StopTrackRecordingBottomFragment.showInstance(getMapActivity(), fragmentManager, TripRecordingActiveBottomSheet.this); + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null && plugin != null && app.getSavingTrackHelper().hasDataToSave()) { + plugin.saveCurrentTrack(null, mapActivity); + app.getNotificationHelper().refreshNotifications(); + dismiss(); } } }); + + CardView cardRight = itemView.findViewById(R.id.button_right); + createItem(cardRight, ItemType.OPTIONS); + cardRight.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (fragmentManager != null) { + TripRecordingOptionsBottomFragment.showInstance(fragmentManager, TripRecordingBottomFragment.this, selectedGpxFile); + } + } + }); + + } + + @Override + public void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + outState.putBoolean(SAVE_CURRENT_GPX_FILE, true); + } + + @Override + public void onResume() { + super.onResume(); + blockStatisticsBuilder.runUpdatingStatBlocksIfNeeded(); + runUpdatingGPS(); + } + + @Override + public void onPause() { + super.onPause(); + blockStatisticsBuilder.stopUpdatingStatBlocks(); + stopUpdatingGPS(); + } + + public void show() { + Dialog dialog = getDialog(); + if (dialog != null) { + dialog.show(); + } + } + + public void show(String... keys) { + show(); + for (String key : keys) { + if (key.equals(UPDATE_TRACK_ICON)) { + updateTrackIcon(app, trackAppearanceIcon); + } + } + } + + public void hide() { + Dialog dialog = getDialog(); + if (dialog != null) { + dialog.hide(); + } + } + + public void stopUpdatingGPS() { + handler.removeCallbacks(updatingGPS); + } + + public void runUpdatingGPS() { + updatingGPS = new Runnable() { + @Override + public void run() { + int interval = app.getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get(); + updateStatus(); + handler.postDelayed(this, Math.max(GPS_UPDATE_INTERVAL, interval)); + } + }; + handler.post(updatingGPS); } private void updateStatus() { @@ -290,14 +307,14 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen showTrackCompound.setChecked(app.getSelectedGpxHelper().getSelectedCurrentRecordingTrack() != null); UiUtilities.setupCompoundButton(showTrackCompound, nightMode, GLOBAL); - setShowOnMapBackground(buttonShowTrack, showTrackCompound.isChecked(), nightMode); + setShowTrackItemBackground(buttonShowTrack, showTrackCompound.isChecked(), nightMode); buttonShowTrack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean checked = !showTrackCompound.isChecked(); showTrackCompound.setChecked(checked); app.getSelectedGpxHelper().selectGpxFile(app.getSavingTrackHelper().getCurrentGpx(), checked, false); - setShowOnMapBackground(buttonShowTrack, checked, nightMode); + setShowTrackItemBackground(buttonShowTrack, checked, nightMode); createItem(app, nightMode, buttonAppearance, ItemType.APPEARANCE, checked, null); } }); @@ -318,30 +335,31 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen }); } - private void createItem(View view, ItemType type, boolean enabled) { - createItem(app, nightMode, view, type, enabled, null); + protected static void setShowTrackItemBackground(View view, boolean checked, boolean nightMode) { + int background = checked ? getActiveTransparentBackgroundId(nightMode) : getInactiveStrokedBackgroundId(nightMode); + view.setBackgroundResource(background); } - private void createItem(View view, ItemType type, boolean enabled, @Nullable String description) { - createItem(app, nightMode, view, type, enabled, description); + private void createItem(View view, ItemType type) { + createItem(app, nightMode, view, type, true, null); } public static View createItem(Context context, boolean nightMode, LayoutInflater inflater, ItemType type) { + return createItem(context, nightMode, inflater, type, true, null); + } + + public static View createItem(Context context, boolean nightMode, LayoutInflater inflater, ItemType type, boolean enabled, String description) { View button = inflater.inflate(R.layout.bottom_sheet_button_with_icon, null); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT); int horizontal = context.getResources().getDimensionPixelSize(R.dimen.content_padding); params.setMargins(horizontal, 0, horizontal, 0); button.setLayoutParams(params); - LinearLayout container = button.findViewById(R.id.button_container); - container.setClickable(false); - container.setFocusable(false); - createItem(context, nightMode, button, type, true, null); + createItem(context, nightMode, button, type, enabled, description); return button; } public static void createItem(Context context, boolean nightMode, View view, ItemType type, boolean enabled, @Nullable String description) { view.setTag(type); - LinearLayout button = view.findViewById(R.id.button_container); AppCompatImageView icon = view.findViewById(R.id.icon); if (icon != null) { @@ -367,151 +385,26 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen setTextColor(context, desc, false, nightMode, type); } - setItemBackground(context, nightMode, button != null ? button : view, enabled); + setItemBackground(context, nightMode, view, enabled); } - private String getTimeTrackSaved() { - long timeTrackSaved = helper.getLastTimeFileSaved(); - if (timeTrackSaved != 0) { - long now = System.currentTimeMillis(); - CharSequence time = DateUtils.getRelativeTimeSpanString(timeTrackSaved, now, DateUtils.MINUTE_IN_MILLIS); - return String.valueOf(time); + public static void setItemBackground(Context context, boolean nightMode, View view, boolean enabled) { + Drawable background = AppCompatResources.getDrawable(context, R.drawable.btn_background_inactive_light); + if (background != null && enabled) { + int normalColorId = view instanceof CardView + ? getActiveTransparentColorId(nightMode) : getInactiveButtonColorId(nightMode); + ColorStateList iconColorStateList = AndroidUtils.createPressedColorStateList( + context, normalColorId, getActiveTextColorId(nightMode) + ); + if (view instanceof CardView) { + ((CardView) view).setCardBackgroundColor(iconColorStateList); + return; + } + DrawableCompat.setTintList(background, iconColorStateList); } else { - return null; - } - } - - @Override - public void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.putBoolean(UPDATE_CURRENT_GPX_FILE, true); - } - - @Override - public void onResume() { - super.onResume(); - blockStatisticsBuilder.runUpdatingStatBlocksIfNeeded(); - runUpdatingGPS(); - runUpdatingTimeTrackSaved(); - } - - @Override - public void onPause() { - super.onPause(); - blockStatisticsBuilder.stopUpdatingStatBlocks(); - stopUpdatingGPS(); - stopUpdatingTimeTrackSaved(); - } - - public void stopUpdatingGPS() { - handler.removeCallbacks(updatingGPS); - } - - public void runUpdatingGPS() { - updatingGPS = new Runnable() { - @Override - public void run() { - int interval = app.getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get(); - updateStatus(); - handler.postDelayed(this, Math.max(GENERAL_UPDATE_GPS_INTERVAL, interval)); - } - }; - handler.post(updatingGPS); - } - - public void stopUpdatingTimeTrackSaved() { - handler.removeCallbacks(updatingTimeTrackSaved); - } - - public void runUpdatingTimeTrackSaved() { - updatingTimeTrackSaved = new Runnable() { - @Override - public void run() { - String time = getTimeTrackSaved(); - createItem(buttonSave, ItemType.SAVE, hasDataToSave(), !Algorithms.isEmpty(time) ? time : null); - handler.postDelayed(this, GENERAL_UPDATE_SAVE_INTERVAL); - } - }; - handler.post(updatingTimeTrackSaved); - } - - private SaveGpxListener createSaveListener(@Nullable final Runnable callback) { - return new SaveGpxListener() { - - @Override - public void gpxSavingStarted() { - } - - @Override - public void gpxSavingFinished(Exception errorMessage) { - final MapActivity mapActivity = getMapActivity(); - final Context context = getContext(); - final SaveGpxResult result = helper.saveDataToGpx(app.getAppCustomization().getTracksDir()); - ArrayList filenames = new ArrayList<>(result.getFilenames()); - String fileName = ""; - if (filenames.size() > 0) { - fileName = filenames.get(filenames.size() - 1) + IndexConstants.GPX_FILE_EXT; - } - String message = fileName + " " + app.getResources().getString(R.string.shared_string_is_saved) + ". " - + app.getResources().getString(R.string.track_recording_will_be_continued); - if (mapActivity != null && context != null) { - final WeakReference mapActivityRef = new WeakReference<>(mapActivity); - final FragmentManager fragmentManager = mapActivityRef.get().getSupportFragmentManager(); - Snackbar snackbar = Snackbar.make(getView(), - message, - Snackbar.LENGTH_LONG) - .setAction(R.string.shared_string_rename, new View.OnClickListener() { - @Override - public void onClick(View view) { - fragmentManager.beginTransaction().remove(TripRecordingActiveBottomSheet.this).commitAllowingStateLoss(); - SaveGPXBottomSheetFragment.showInstance(fragmentManager, result.getFilenames()); - } - }); - View view = snackbar.getView(); - CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) view.getLayoutParams(); - params.gravity = Gravity.TOP; - AndroidUtils.setMargins(params, 0, AndroidUtils.getStatusBarHeight(context), 0, 0); - view.setLayoutParams(params); - UiUtilities.setupSnackbar(snackbar, nightMode); - snackbar.show(); - if (callback != null) { - callback.run(); - } - } - } - }; - } - - @Nullable - public MapActivity getMapActivity() { - Activity activity = getActivity(); - if (activity instanceof MapActivity) { - return (MapActivity) activity; - } - return null; - } - - public void show() { - Dialog dialog = getDialog(); - if (dialog != null) { - dialog.show(); - } - } - - public void show(String... keys) { - show(); - for (String key : keys) { - if (key.equals(UPDATE_TRACK_ICON)) { - updateTrackIcon(app, trackAppearanceIcon); - } - } - } - - public void hide() { - Dialog dialog = getDialog(); - if (dialog != null) { - dialog.hide(); + UiUtilities.tintDrawable(background, ContextCompat.getColor(context, getInactiveButtonColorId(nightMode))); } + view.setBackgroundDrawable(background); } public enum ItemType { @@ -522,7 +415,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen ON_PAUSE(R.string.on_pause, R.drawable.ic_pause), CLEAR_DATA(R.string.clear_recorded_data, R.drawable.ic_action_delete_dark), START_NEW_SEGMENT(R.string.gpx_start_new_segment, R.drawable.ic_action_new_segment), - SAVE(R.string.shared_string_save, R.drawable.ic_action_save_to_file), + SAVE(R.string.trip_recording_save_and_continue, R.drawable.ic_action_save_to_file), PAUSE(R.string.shared_string_pause, R.drawable.ic_pause), RESUME(R.string.shared_string_resume, R.drawable.ic_play_dark), STOP(R.string.shared_string_control_stop, R.drawable.ic_action_rec_stop), @@ -531,7 +424,9 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen STOP_ONLINE(R.string.live_monitoring_stop, R.drawable.ic_world_globe_dark), CANCEL(R.string.shared_string_cancel, R.drawable.ic_action_close), START_RECORDING(R.string.shared_string_control_start, R.drawable.ic_action_direction_movement), - SETTINGS(R.string.shared_string_settings, R.drawable.ic_action_settings); + SETTINGS(R.string.shared_string_settings, R.drawable.ic_action_settings), + FINISH(R.string.shared_string_finish, R.drawable.ic_action_point_destination), + OPTIONS(R.string.shared_string_options, R.drawable.ic_overflow_menu_with_background); @StringRes private final Integer titleId; @@ -559,31 +454,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen } } - public static void setItemBackground(Context context, boolean nightMode, View view, boolean enabled) { - Drawable background = AppCompatResources.getDrawable(context, R.drawable.btn_background_inactive_light); - if (background != null && enabled) { - int normalColorId = view instanceof CardView - ? getActiveTransparentColorId(nightMode) : getInactiveButtonColorId(nightMode); - ColorStateList iconColorStateList = AndroidUtils.createPressedColorStateList( - context, normalColorId, getActiveTextColorId(nightMode) - ); - if (view instanceof CardView) { - ((CardView) view).setCardBackgroundColor(iconColorStateList); - return; - } - DrawableCompat.setTintList(background, iconColorStateList); - } else { - UiUtilities.tintDrawable(background, ContextCompat.getColor(context, getInactiveButtonColorId(nightMode))); - } - view.setBackgroundDrawable(background); - } - - public static void setShowOnMapBackground(View view, boolean checked, boolean nightMode) { - int background = checked ? getActiveTransparentBackgroundId(nightMode) : getInactiveStrokedBackgroundId(nightMode); - view.setBackgroundResource(background); - } - - public static void setTextColor(Context context, TextView tv, boolean enabled, boolean nightMode, ItemType type) { + protected static void setTextColor(Context context, TextView tv, boolean enabled, boolean nightMode, ItemType type) { if (tv != null) { int activeColorId = type.isNegative() ? R.color.color_osm_edit_delete : getActiveTextColorId(nightMode); int normalColorId = enabled ? activeColorId : getSecondaryTextColorId(nightMode); @@ -592,7 +463,7 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen } } - public static void setTintedIcon(Context context, AppCompatImageView iv, boolean enabled, boolean nightMode, ItemType type) { + protected static void setTintedIcon(Context context, AppCompatImageView iv, boolean enabled, boolean nightMode, ItemType type) { Integer iconId = type.getIconId(); if (iv != null && iconId != null) { Drawable icon = AppCompatResources.getDrawable(context, iconId); @@ -607,6 +478,9 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen int stopSize = iv.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_icon_margin_large); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(stopSize, stopSize); iv.setLayoutParams(params); + View container = (View) iv.getParent(); + setPadding(container, container.getPaddingLeft(), container.getTop(), + context.getResources().getDimensionPixelSize(R.dimen.content_padding_half), container.getBottom()); } } } @@ -662,17 +536,17 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen } @Override - protected int getDismissButtonHeight() { - return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height); - } - - @Override - protected int getDismissButtonTextId() { - return R.string.shared_string_close; - } - - @Override - protected boolean useVerticalButtons() { + protected boolean hideButtonsContainer() { return true; } + + @Nullable + public MapActivity getMapActivity() { + Activity activity = getActivity(); + if (activity instanceof MapActivity) { + return (MapActivity) activity; + } + return null; + } + } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/ClearRecordedDataBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomFragment.java similarity index 71% rename from OsmAnd/src/net/osmand/plus/monitoring/ClearRecordedDataBottomSheetFragment.java rename to OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomFragment.java index 9a5e40ab95..e51911c867 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/ClearRecordedDataBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomFragment.java @@ -11,21 +11,24 @@ 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.monitoring.TripRecordingActiveBottomSheet.ItemType; +import net.osmand.plus.monitoring.TripRecordingBottomFragment.ItemType; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; -public class ClearRecordedDataBottomSheetFragment extends MenuBottomSheetDialogFragment { +import static net.osmand.AndroidUtils.getPrimaryTextColorId; +import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.*; - public static final String TAG = ClearRecordedDataBottomSheetFragment.class.getSimpleName(); +public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogFragment { + + public static final String TAG = TripRecordingClearDataBottomFragment.class.getSimpleName(); private OsmandApplication app; public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target) { if (!fragmentManager.isStateSaved()) { - ClearRecordedDataBottomSheetFragment fragment = new ClearRecordedDataBottomSheetFragment(); + TripRecordingClearDataBottomFragment fragment = new TripRecordingClearDataBottomFragment(); fragment.setTargetFragment(target, 0); fragment.show(fragmentManager, TAG); } @@ -37,14 +40,14 @@ public class ClearRecordedDataBottomSheetFragment extends MenuBottomSheetDialogF LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); int verticalBig = getResources().getDimensionPixelSize(R.dimen.dialog_content_margin); int verticalNormal = getResources().getDimensionPixelSize(R.dimen.content_padding); - + String description = getString(R.string.clear_recorded_data_warning) + .concat(getString(R.string.lost_data_warning)); final View buttonClear = createItem(inflater, ItemType.CLEAR_DATA); final View buttonCancel = createItem(inflater, ItemType.CANCEL); items.add(new BottomSheetItemWithDescription.Builder() - .setDescription(app.getString(R.string.clear_recorded_data_warning)) - .setDescriptionColorId(!nightMode ? R.color.text_color_primary_light : R.color.text_color_primary_dark) - .setDescriptionMaxLines(2) + .setDescription(description) + .setDescriptionColorId(getPrimaryTextColorId(nightMode)) .setTitle(app.getString(R.string.clear_recorded_data)) .setLayoutId(R.layout.bottom_sheet_item_title_with_description) .create()); @@ -58,6 +61,7 @@ public class ClearRecordedDataBottomSheetFragment extends MenuBottomSheetDialogF public void onClick(View v) { app.getSavingTrackHelper().clearRecordedData(true); dismiss(); + dismissTargetDialog(TripRecordingClearDataBottomFragment.this, TripRecordingOptionsBottomFragment.class); } }) .create()); @@ -78,15 +82,15 @@ public class ClearRecordedDataBottomSheetFragment extends MenuBottomSheetDialogF } private View createItem(LayoutInflater inflater, ItemType type) { - return TripRecordingActiveBottomSheet.createItem(app, nightMode, inflater, type); + return TripRecordingBottomFragment.createItem(app, nightMode, inflater, type); } @Override public void onResume() { super.onResume(); Fragment target = getTargetFragment(); - if (target instanceof TripRecordingActiveBottomSheet) { - ((TripRecordingActiveBottomSheet) target).hide(); + if (target instanceof TripRecordingOptionsBottomFragment) { + ((TripRecordingOptionsBottomFragment) target).hide(); } } @@ -94,8 +98,8 @@ public class ClearRecordedDataBottomSheetFragment extends MenuBottomSheetDialogF public void onPause() { super.onPause(); Fragment target = getTargetFragment(); - if (target instanceof TripRecordingActiveBottomSheet) { - ((TripRecordingActiveBottomSheet) target).show(); + if (target instanceof TripRecordingOptionsBottomFragment) { + ((TripRecordingOptionsBottomFragment) target).show(); } } @@ -103,4 +107,5 @@ public class ClearRecordedDataBottomSheetFragment extends MenuBottomSheetDialogF protected boolean hideButtonsContainer() { return true; } -} \ No newline at end of file + +} diff --git a/OsmAnd/src/net/osmand/plus/monitoring/StopTrackRecordingBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomFragment.java similarity index 50% rename from OsmAnd/src/net/osmand/plus/monitoring/StopTrackRecordingBottomFragment.java rename to OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomFragment.java index f648c5bbdf..971d7399e1 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/StopTrackRecordingBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomFragment.java @@ -8,36 +8,29 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; 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.BaseBottomSheetItem; import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription; import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem; -import net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.ItemType; -import net.osmand.plus.settings.backend.OsmandSettings; +import net.osmand.plus.monitoring.TripRecordingBottomFragment.ItemType; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; -public class StopTrackRecordingBottomFragment extends MenuBottomSheetDialogFragment { +import static net.osmand.AndroidUtils.getPrimaryTextColorId; +import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.ACTION_STOP_AND_DISCARD; +import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.dismissTargetDialog; - public static final String TAG = StopTrackRecordingBottomFragment.class.getSimpleName(); +public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFragment { + + public static final String TAG = TripRecordingDiscardBottomFragment.class.getSimpleName(); private OsmandApplication app; - private MapActivity mapActivity; - private OsmandSettings settings; - private OsmandMonitoringPlugin plugin; - private ItemType tag = ItemType.CANCEL; - public void setMapActivity(MapActivity mapActivity) { - this.mapActivity = mapActivity; - } - - public static void showInstance(MapActivity mapActivity, @NonNull FragmentManager fragmentManager, @NonNull Fragment target) { + public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target) { if (!fragmentManager.isStateSaved()) { - StopTrackRecordingBottomFragment fragment = new StopTrackRecordingBottomFragment(); - fragment.setMapActivity(mapActivity); + TripRecordingDiscardBottomFragment fragment = new TripRecordingDiscardBottomFragment(); fragment.setTargetFragment(target, 0); fragment.show(fragmentManager, TAG); } @@ -46,67 +39,48 @@ public class StopTrackRecordingBottomFragment extends MenuBottomSheetDialogFragm @Override public void createMenuItems(Bundle savedInstanceState) { app = requiredMyApplication(); - settings = app.getSettings(); - plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class); + final OsmandMonitoringPlugin plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class); LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); int verticalBig = getResources().getDimensionPixelSize(R.dimen.dialog_content_margin); int verticalNormal = getResources().getDimensionPixelSize(R.dimen.content_padding); - -// final View buttonDiscard = createItem(inflater, ItemType.STOP_AND_DISCARD); - final View buttonSave = createItem(inflater, ItemType.STOP_AND_SAVE); + String description = getString(R.string.track_recording_description) + .concat(getString(R.string.lost_data_warning)); + final View buttonDiscard = createItem(inflater, ItemType.STOP_AND_DISCARD); final View buttonCancel = createItem(inflater, ItemType.CANCEL); items.add(new BottomSheetItemWithDescription.Builder() - .setDescription(app.getString(R.string.track_recording_description)) - .setDescriptionColorId(!nightMode ? R.color.text_color_primary_light : R.color.text_color_primary_dark) - .setDescriptionMaxLines(4) + .setDescription(description) + .setDescriptionColorId(getPrimaryTextColorId(nightMode)) .setTitle(app.getString(R.string.track_recording_title)) .setLayoutId(R.layout.bottom_sheet_item_title_with_description) .create()); items.add(new DividerSpaceItem(app, verticalBig)); - /*items.add(new BaseBottomSheetItem.Builder() + items.add(new BaseBottomSheetItem.Builder() .setCustomView(buttonDiscard) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - tag = (ItemType) buttonDiscard.getTag(); - if (plugin != null && settings.SAVE_GLOBAL_TRACK_TO_GPX.get()) { + if (plugin != null && app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()) { plugin.stopRecording(); app.getNotificationHelper().refreshNotifications(); } app.getSavingTrackHelper().clearRecordedData(true); dismiss(); + dismissTargetDialog(TripRecordingDiscardBottomFragment.this, + TripRecordingOptionsBottomFragment.class, ACTION_STOP_AND_DISCARD, true); } }) .create()); - items.add(new DividerSpaceItem(app, verticalBig));*/ - - items.add(new BaseBottomSheetItem.Builder() - .setCustomView(buttonSave) - .setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - tag = (ItemType) buttonSave.getTag(); - if (plugin != null && app.getSavingTrackHelper().hasDataToSave()) { - plugin.saveCurrentTrack(null, mapActivity); - app.getNotificationHelper().refreshNotifications(); - dismiss(); - } - } - }) - .create()); - - items.add(new DividerSpaceItem(app, verticalNormal)); + items.add(new DividerSpaceItem(app, verticalBig)); items.add(new BaseBottomSheetItem.Builder() .setCustomView(buttonCancel) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - tag = (ItemType) buttonCancel.getTag(); dismiss(); } }) @@ -116,15 +90,15 @@ public class StopTrackRecordingBottomFragment extends MenuBottomSheetDialogFragm } private View createItem(LayoutInflater inflater, ItemType type) { - return TripRecordingActiveBottomSheet.createItem(app, nightMode, inflater, type); + return TripRecordingBottomFragment.createItem(app, nightMode, inflater, type); } @Override public void onResume() { super.onResume(); Fragment target = getTargetFragment(); - if (target instanceof TripRecordingActiveBottomSheet) { - ((TripRecordingActiveBottomSheet) target).hide(); + if (target instanceof TripRecordingOptionsBottomFragment) { + ((TripRecordingOptionsBottomFragment) target).hide(); } } @@ -132,13 +106,8 @@ public class StopTrackRecordingBottomFragment extends MenuBottomSheetDialogFragm public void onPause() { super.onPause(); Fragment target = getTargetFragment(); - if (target instanceof TripRecordingActiveBottomSheet) { - TripRecordingActiveBottomSheet tripRec = (TripRecordingActiveBottomSheet) target; - if (tag == ItemType.CANCEL) { - tripRec.show(); - } else { - tripRec.dismiss(); - } + if (target instanceof TripRecordingOptionsBottomFragment) { + ((TripRecordingOptionsBottomFragment) target).show(); } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java new file mode 100644 index 0000000000..aa755a4276 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java @@ -0,0 +1,350 @@ +package net.osmand.plus.monitoring; + +import android.app.Activity; +import android.app.Dialog; +import android.os.AsyncTask; +import android.os.Bundle; +import android.os.Handler; +import android.text.format.DateUtils; +import android.view.LayoutInflater; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; + +import net.osmand.GPXUtilities.GPXFile; +import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.R; +import net.osmand.plus.UiUtilities; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.SavingTrackHelper; +import net.osmand.plus.base.MenuBottomSheetDialogFragment; +import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; +import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem; +import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem; +import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.monitoring.TripRecordingBottomFragment.ItemType; +import net.osmand.plus.myplaces.SaveCurrentTrackTask; +import net.osmand.plus.settings.backend.OsmandSettings; +import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener; +import net.osmand.util.Algorithms; + +import static net.osmand.AndroidUtils.getPrimaryTextColorId; + +public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFragment { + + public static final String TAG = TripRecordingOptionsBottomFragment.class.getSimpleName(); + public static final String ACTION_STOP_AND_DISCARD = "action_stop_and_discard"; + private static final String SAVE_CURRENT_GPX_FILE = "save_current_gpx_file"; + private static final int SAVE_UPDATE_INTERVAL = 1000; + + private OsmandApplication app; + private OsmandSettings settings; + private SavingTrackHelper helper; + + private View buttonClear; + private View buttonSave; + + private SelectedGpxFile selectedGpxFile; + private final Handler handler = new Handler(); + private Runnable updatingTimeTrackSaved; + private int indexButtonOnline = -1; + private int indexButtonOnlineDivider = -1; + + private GPXFile getGPXFile() { + return selectedGpxFile.getGpxFile(); + } + + public void setSelectedGpxFile(SelectedGpxFile selectedGpxFile) { + this.selectedGpxFile = selectedGpxFile; + } + + public boolean hasDataToSave() { + return app.getSavingTrackHelper().hasDataToSave(); + } + + public boolean wasTrackMonitored() { + return settings.SAVE_GLOBAL_TRACK_TO_GPX.get(); + } + + public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target, SelectedGpxFile selectedGpxFile) { + if (!fragmentManager.isStateSaved()) { + TripRecordingOptionsBottomFragment fragment = new TripRecordingOptionsBottomFragment(); + fragment.setTargetFragment(target, 0); + fragment.setSelectedGpxFile(selectedGpxFile); + fragment.show(fragmentManager, TAG); + } + } + + @Override + public void createMenuItems(Bundle savedInstanceState) { + app = requiredMyApplication(); + settings = app.getSettings(); + helper = app.getSavingTrackHelper(); + LayoutInflater inflater = UiUtilities.getInflater(app, nightMode); + final FragmentManager fragmentManager = getFragmentManager(); + int dp16 = getResources().getDimensionPixelSize(R.dimen.content_padding); + int dp36 = getResources().getDimensionPixelSize(R.dimen.context_menu_controller_height); + + if (savedInstanceState != null) { + if (savedInstanceState.containsKey(SAVE_CURRENT_GPX_FILE) + && savedInstanceState.getBoolean(SAVE_CURRENT_GPX_FILE)) { + selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); + } + } + + buttonClear = createItem(inflater, ItemType.CLEAR_DATA, hasDataToSave()); + final View buttonDiscard = createItem(inflater, ItemType.STOP_AND_DISCARD); + final View buttonOnline = createItem(inflater, ItemType.STOP_ONLINE, hasDataToSave()); + buttonSave = createItem(inflater, ItemType.SAVE, hasDataToSave()); + final View buttonSegment = createItem(inflater, ItemType.START_NEW_SEGMENT, wasTrackMonitored()); + + items.add(new SimpleBottomSheetItem.Builder() + .setTitle(getString(R.string.shared_string_options)) + .setTitleColorId(getPrimaryTextColorId(nightMode)) + .setLayoutId(R.layout.bottom_sheet_item_title) + .create()); + + items.add(new DividerSpaceItem(app, getResources().getDimensionPixelSize(R.dimen.content_padding_small))); + + items.add(new BaseBottomSheetItem.Builder() + .setCustomView(buttonClear) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (fragmentManager != null && hasDataToSave()) { + TripRecordingClearDataBottomFragment.showInstance(fragmentManager, TripRecordingOptionsBottomFragment.this); + } + } + }) + .create()); + + items.add(new DividerSpaceItem(app, dp16)); + + items.add(new BaseBottomSheetItem.Builder() + .setCustomView(buttonDiscard) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (fragmentManager != null) { + TripRecordingDiscardBottomFragment.showInstance(fragmentManager, TripRecordingOptionsBottomFragment.this); + } + } + }) + .create()); + + items.add(new DividerSpaceItem(app, dp36)); + + if (app.getLiveMonitoringHelper().isLiveMonitoringEnabled()) { + items.add(new BaseBottomSheetItem.Builder() + .setCustomView(buttonOnline) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + settings.LIVE_MONITORING.set(false); + if (indexButtonOnline != -1) { + AndroidUiHelper.updateVisibility(items.get(indexButtonOnline).getView(), false); + } + if (indexButtonOnlineDivider != -1) { + AndroidUiHelper.updateVisibility(items.get(indexButtonOnlineDivider).getView(), false); + } + } + }) + .create()); + indexButtonOnline = items.size() - 1; + + items.add(new DividerSpaceItem(app, dp36)); + indexButtonOnlineDivider = items.size() - 1; + } + + items.add(new BaseBottomSheetItem.Builder() + .setCustomView(buttonSave) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (hasDataToSave()) { + final GPXFile gpxFile = getGPXFile(); + new SaveCurrentTrackTask(app, gpxFile, createSaveListener()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } + } + }) + .create()); + + items.add(new DividerSpaceItem(app, dp16)); + + items.add(new BaseBottomSheetItem.Builder() + .setCustomView(buttonSegment) + .setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (wasTrackMonitored()) { + helper.startNewSegment(); + } + } + }) + .create()); + + items.add(new DividerSpaceItem(app, getResources().getDimensionPixelSize(R.dimen.content_padding_small))); + + } + + @Override + public void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + outState.putBoolean(SAVE_CURRENT_GPX_FILE, true); + } + + @Override + public void onResume() { + super.onResume(); + runUpdatingTimeTrackSaved(); + Fragment target = getTargetFragment(); + if (target instanceof TripRecordingBottomFragment) { + ((TripRecordingBottomFragment) target).hide(); + } + } + + @Override + public void onPause() { + super.onPause(); + stopUpdatingTimeTrackSaved(); + Fragment target = getTargetFragment(); + if (target instanceof TripRecordingBottomFragment) { + if (isDiscard()) { + ((TripRecordingBottomFragment) target).dismiss(); + } else { + ((TripRecordingBottomFragment) target).show(); + } + } + } + + public void show() { + Dialog dialog = getDialog(); + if (dialog != null) { + dialog.show(); + } + } + + public void hide() { + Dialog dialog = getDialog(); + if (dialog != null) { + dialog.hide(); + } + } + + private boolean isDiscard() { + Bundle args = getArguments(); + if (args != null) { + return args.getBoolean(ACTION_STOP_AND_DISCARD); + } + return false; + } + + protected static void dismissTargetDialog(Fragment current, Class targetClass) { + dismissTargetDialog(current, targetClass, null, null); + } + + protected static void dismissTargetDialog(Fragment current, Class targetClass, String booleanKey, Boolean value) { + if (targetClass.isInstance(current.getTargetFragment())) { + Fragment target = current.getTargetFragment(); + if (booleanKey != null && value != null) { + Bundle args = new Bundle(); + args.putBoolean(booleanKey, value); + target.setArguments(args); + } + if (target instanceof DialogFragment) { + ((DialogFragment) target).dismiss(); + } + } + } + + public void stopUpdatingTimeTrackSaved() { + handler.removeCallbacks(updatingTimeTrackSaved); + } + + public void runUpdatingTimeTrackSaved() { + updatingTimeTrackSaved = new Runnable() { + @Override + public void run() { + String time = getTimeTrackSaved(); + TripRecordingBottomFragment.createItem(app, nightMode, buttonSave, ItemType.SAVE, hasDataToSave(), !Algorithms.isEmpty(time) ? time : null); + TripRecordingBottomFragment.createItem(app, nightMode, buttonClear, ItemType.CLEAR_DATA, hasDataToSave(), null); + handler.postDelayed(this, SAVE_UPDATE_INTERVAL); + } + }; + handler.post(updatingTimeTrackSaved); + } + + private String getTimeTrackSaved() { + long timeTrackSaved = helper.getLastTimeFileSaved(); + if (timeTrackSaved != 0) { + long now = System.currentTimeMillis(); + CharSequence time = DateUtils.getRelativeTimeSpanString(timeTrackSaved, now, DateUtils.MINUTE_IN_MILLIS); + return String.valueOf(time); + } else { + return null; + } + } + + private View createItem(LayoutInflater inflater, ItemType type, boolean enabled) { + return TripRecordingBottomFragment.createItem(app, nightMode, inflater, type, enabled, null); + } + + private View createItem(LayoutInflater inflater, ItemType type) { + return TripRecordingBottomFragment.createItem(app, nightMode, inflater, type); + } + + private SaveGpxListener createSaveListener() { + return new SaveGpxListener() { + + @Override + public void gpxSavingStarted() { + } + + @Override + public void gpxSavingFinished(Exception errorMessage) { + MapActivity mapActivity = getMapActivity(); + OsmandMonitoringPlugin plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class); + if (mapActivity != null && plugin != null) { + stopUpdatingTimeTrackSaved(); + settings.SAVE_GLOBAL_TRACK_TO_GPX.set(false); + plugin.saveCurrentTrack(null, mapActivity, false, true); + dismiss(); + dismissTargetDialog(TripRecordingOptionsBottomFragment.this, TripRecordingBottomFragment.class); + settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true); + runUpdatingTimeTrackSaved(); + } + } + }; + } + + @Nullable + public MapActivity getMapActivity() { + Activity activity = getActivity(); + if (activity instanceof MapActivity) { + return (MapActivity) activity; + } + return null; + } + + @Override + protected int getDismissButtonHeight() { + return getResources().getDimensionPixelSize(R.dimen.bottom_sheet_cancel_button_height); + } + + @Override + protected int getDismissButtonTextId() { + return R.string.shared_string_back; + } + + @Override + protected boolean useVerticalButtons() { + return true; + } + +} diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java similarity index 88% rename from OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java rename to OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java index c8c96d1323..8d379237e2 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java @@ -29,21 +29,21 @@ import net.osmand.plus.base.MenuBottomSheetDialogFragment; import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; -import net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.ItemType; +import net.osmand.plus.monitoring.TripRecordingBottomFragment.ItemType; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.fragments.BaseSettingsFragment; import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.UPDATE_TRACK_ICON; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.createItem; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.createShowTrackItem; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.updateTrackIcon; +import static net.osmand.plus.monitoring.TripRecordingBottomFragment.UPDATE_TRACK_ICON; +import static net.osmand.plus.monitoring.TripRecordingBottomFragment.createItem; +import static net.osmand.plus.monitoring.TripRecordingBottomFragment.createShowTrackItem; +import static net.osmand.plus.monitoring.TripRecordingBottomFragment.updateTrackIcon; -public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragment { +public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFragment { - public static final String TAG = TripRecordingStartingBottomSheet.class.getSimpleName(); + public static final String TAG = TripRecordingStartingBottomFragment.class.getSimpleName(); public static final String UPDATE_LOGGING_INTERVAL = "update_logging_interval"; private OsmandApplication app; @@ -52,7 +52,6 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm private AppCompatImageView upDownBtn; private AppCompatImageView trackAppearanceIcon; private TextView intervalValueView; - private LinearLayout showTrackContainer; private LinearLayout intervalContainer; private RangeSlider intervalSlider; @@ -60,7 +59,7 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm public static void showInstance(@NonNull FragmentManager fragmentManager) { if (!fragmentManager.isStateSaved()) { - TripRecordingStartingBottomSheet fragment = new TripRecordingStartingBottomSheet(); + TripRecordingStartingBottomFragment fragment = new TripRecordingStartingBottomFragment(); fragment.show(fragmentManager, TAG); } } @@ -91,10 +90,10 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm intervalSlider = itemView.findViewById(R.id.interval_slider); updateIntervalValue(); - showTrackContainer = itemView.findViewById(R.id.show_track_on_map); + LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map); trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon); createShowTrackItem(app, getMapActivity(), nightMode, showTrackContainer, trackAppearanceIcon, - R.string.shared_string_show_on_map, TripRecordingStartingBottomSheet.this, new Runnable() { + R.string.shared_string_show_on_map, TripRecordingStartingBottomFragment.this, new Runnable() { @Override public void run() { hide(); @@ -104,6 +103,7 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm updateUpDownBtn(); CardView cardLeft = itemView.findViewById(R.id.button_left); + createItem(app, nightMode, cardLeft, ItemType.CANCEL, true, null); cardLeft.setOnClickListener(new View.OnClickListener() { @Override @@ -113,6 +113,7 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm }); CardView cardCenter = itemView.findViewById(R.id.button_center); + createItem(app, nightMode, cardCenter, ItemType.START_RECORDING, true, null); cardCenter.setOnClickListener(new View.OnClickListener() { @Override @@ -122,6 +123,7 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm }); CardView cardRight = itemView.findViewById(R.id.button_right); + createItem(app, nightMode, cardRight, ItemType.SETTINGS, true, null); cardRight.setOnClickListener(new View.OnClickListener() { @Override @@ -129,7 +131,7 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { hide(); - BaseSettingsFragment.showInstance(mapActivity, SettingsScreenType.MONITORING_SETTINGS, TripRecordingStartingBottomSheet.this); + BaseSettingsFragment.showInstance(mapActivity, SettingsScreenType.MONITORING_SETTINGS, TripRecordingStartingBottomFragment.this); } } }); @@ -214,7 +216,7 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm app.startNavigationService(NavigationService.USED_BY_GPX); MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { - TripRecordingActiveBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), helper.getCurrentTrack()); + TripRecordingBottomFragment.showInstance(mapActivity.getSupportFragmentManager(), helper.getCurrentTrack()); } dismiss(); } diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java index 08a4e34b6b..e46e438f67 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java @@ -6,7 +6,6 @@ import android.graphics.drawable.LayerDrawable; import android.os.Build; import android.os.Bundle; import android.view.View; -import android.widget.CompoundButton; import android.widget.LinearLayout; import androidx.annotation.NonNull; @@ -34,9 +33,8 @@ import net.osmand.plus.settings.preferences.SwitchPreferenceEx; import org.apache.commons.logging.Log; -import static net.osmand.plus.UiUtilities.CompoundButtonType.TOOLBAR; import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.getActivePrimaryColorId; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.getSecondaryIconColorId; +import static net.osmand.plus.monitoring.TripRecordingBottomFragment.getSecondaryIconColorId; public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet { diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java index d71387c0ce..2faf24db46 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java @@ -61,7 +61,7 @@ import net.osmand.plus.activities.OsmandInAppPurchaseActivity; import net.osmand.plus.audionotes.MultimediaNotesFragment; import net.osmand.plus.development.DevelopmentSettingsFragment; import net.osmand.plus.monitoring.MonitoringSettingsFragment; -import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet; +import net.osmand.plus.monitoring.TripRecordingStartingBottomFragment; import net.osmand.plus.openplacereviews.OprSettingsFragment; import net.osmand.plus.osmedit.OsmEditingFragment; import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment; @@ -86,7 +86,7 @@ import java.io.Serializable; import java.util.Set; import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID; -import static net.osmand.plus.monitoring.TripRecordingStartingBottomSheet.UPDATE_LOGGING_INTERVAL; +import static net.osmand.plus.monitoring.TripRecordingStartingBottomFragment.UPDATE_LOGGING_INTERVAL; public abstract class BaseSettingsFragment extends PreferenceFragmentCompat implements OnPreferenceChangeListener, OnPreferenceClickListener, AppModeChangedListener, OnConfirmPreferenceChange { @@ -297,8 +297,8 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl public void onDestroyView() { super.onDestroyView(); Fragment target = getTargetFragment(); - if (target instanceof TripRecordingStartingBottomSheet) { - ((TripRecordingStartingBottomSheet) target).show(UPDATE_LOGGING_INTERVAL); + if (target instanceof TripRecordingStartingBottomFragment) { + ((TripRecordingStartingBottomFragment) target).show(UPDATE_LOGGING_INTERVAL); } } diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java index 807becbb1c..958f45193a 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java @@ -36,8 +36,8 @@ import net.osmand.plus.dialogs.GpxAppearanceAdapter; import net.osmand.plus.dialogs.GpxAppearanceAdapter.AppearanceListItem; import net.osmand.plus.dialogs.GpxAppearanceAdapter.GpxAppearanceAdapterType; import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.monitoring.TripRecordingActiveBottomSheet; -import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet; +import net.osmand.plus.monitoring.TripRecordingBottomFragment; +import net.osmand.plus.monitoring.TripRecordingStartingBottomFragment; import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener; import net.osmand.plus.settings.backend.CommonPreference; @@ -64,7 +64,7 @@ import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR; import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_BOLD; import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_MEDIUM; import static net.osmand.plus.dialogs.GpxAppearanceAdapter.getAppearanceItems; -import static net.osmand.plus.monitoring.TripRecordingActiveBottomSheet.UPDATE_TRACK_ICON; +import static net.osmand.plus.monitoring.TripRecordingBottomFragment.UPDATE_TRACK_ICON; public class TrackAppearanceFragment extends ContextMenuScrollFragment implements CardListener, ColorPickerListener { @@ -398,10 +398,10 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement @Override public void onContextMenuDismiss(@NonNull ContextMenuFragment fragment) { Fragment target = getTargetFragment(); - if (target instanceof TripRecordingStartingBottomSheet) { - ((TripRecordingStartingBottomSheet) target).show(UPDATE_TRACK_ICON); - } else if (target instanceof TripRecordingActiveBottomSheet) { - ((TripRecordingActiveBottomSheet) target).show(UPDATE_TRACK_ICON); + if (target instanceof TripRecordingStartingBottomFragment) { + ((TripRecordingStartingBottomFragment) target).show(UPDATE_TRACK_ICON); + } else if (target instanceof TripRecordingBottomFragment) { + ((TripRecordingBottomFragment) target).show(UPDATE_TRACK_ICON); } } From 3bcf8d4e3ba4d68ab77fdf2577a0cf90fa98e32f Mon Sep 17 00:00:00 2001 From: Skalii Date: Fri, 19 Mar 2021 15:00:37 +0200 Subject: [PATCH 178/250] small fixes; --- .../plus/monitoring/TripRecordingBottomFragment.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java index 471ec813a6..36ecc4edfb 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java @@ -72,13 +72,6 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { private GpxBlockStatisticsBuilder blockStatisticsBuilder; private SelectedGpxFile selectedGpxFile; - - private View statusContainer; - private LinearLayout showTrackContainer; - private AppCompatImageView trackAppearanceIcon; - private View buttonSave; - private GpxBlockStatisticsBuilder blockStatisticsBuilder; - private final Handler handler = new Handler(); private Runnable updatingGPS; From 35064dba0158091eac04d69c278722b73a09cf0a Mon Sep 17 00:00:00 2001 From: Skalii Date: Fri, 19 Mar 2021 17:48:57 +0200 Subject: [PATCH 179/250] some fixes; --- ...tom_sheet_with_switch_divider_and_additional_button.xml | 4 ++-- OsmAnd/res/layout/preference_button_with_icon_triple.xml | 7 ++----- OsmAnd/res/values/sizes.xml | 1 - .../plus/monitoring/TripRecordingActiveBottomSheet.java | 5 +++-- .../plus/settings/fragments/BaseSettingsFragment.java | 4 +--- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml b/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml index e7b84c5305..1eb3dd1bd4 100644 --- a/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml +++ b/OsmAnd/res/layout/bottom_sheet_with_switch_divider_and_additional_button.xml @@ -20,9 +20,9 @@ android:layout_marginRight="@dimen/content_padding_half" android:layout_weight="1" android:gravity="center_vertical" - app:cardBackgroundColor="?attr/switch_button_active" app:cardCornerRadius="4dp" - app:cardElevation="0dp"> + app:cardElevation="0dp" + tools:cardBackgroundColor="?attr/switch_button_active"> diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index 79fa32d1c3..dae06fed05 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -418,5 +418,4 @@ 3sp 80dp - 160dp \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java index 7aaa832dd1..dc965143d3 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java @@ -579,8 +579,9 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen } public static void setShowOnMapBackground(View view, boolean checked, boolean nightMode) { - int background = checked ? getActiveTransparentBackgroundId(nightMode) : getInactiveStrokedBackgroundId(nightMode); - view.setBackgroundResource(background); + Drawable background = AppCompatResources.getDrawable(view.getContext(), + checked ? getActiveTransparentBackgroundId(nightMode) : getInactiveStrokedBackgroundId(nightMode)); + view.setBackgroundDrawable(background); } public static void setTextColor(Context context, TextView tv, boolean enabled, boolean nightMode, ItemType type) { diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java index d71387c0ce..a426321eb9 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java @@ -923,9 +923,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl args.putString(APP_MODE_KEY, appMode.getStringKey()); } fragment.setArguments(args); - if (target != null) { - fragment.setTargetFragment(target, 0); - } + fragment.setTargetFragment(target, 0); activity.getSupportFragmentManager().beginTransaction() .replace(R.id.fragmentContainer, fragment, screenType.fragmentName) .addToBackStack(DRAWER_SETTINGS_ID + ".new") From 7a985a4c0051ffab46ab096550cb7a383bdfaa1f Mon Sep 17 00:00:00 2001 From: Shjosan Date: Fri, 19 Mar 2021 10:23:15 +0000 Subject: [PATCH 180/250] Translated using Weblate (Swedish) Currently translated at 67.9% (2504 of 3685 strings) --- OsmAnd/res/values-sv/strings.xml | 245 ++++++++++++++++++++++++++++--- 1 file changed, 221 insertions(+), 24 deletions(-) diff --git a/OsmAnd/res/values-sv/strings.xml b/OsmAnd/res/values-sv/strings.xml index f9305301d2..0dd3173583 100644 --- a/OsmAnd/res/values-sv/strings.xml +++ b/OsmAnd/res/values-sv/strings.xml @@ -159,7 +159,7 @@ till vänster framåt till vänster mot - Höjd + Höjd över havet Kartutseende Att hämta bilen på: em @@ -419,11 +419,11 @@ Nyttjat utrymme är {1} MB. Visningsspråk Nästa Föregående - Ändra enheter för avstånd. - Enheter för avstånd - Eng. mil/fot - Eng. mil/yard - Kilometer/meter + Ändra vad avstånd mäts i. + Enhet för längd + Miles/fot + Miles/yard + Kilomter/meter yd Dela platsen med Plats: %1$s\n%2$s @@ -1326,7 +1326,7 @@ Nyttjat utrymme är {1} MB. Versioner Punkter Inaktiverad - Aktiverad + Aktiverat Redigera grupp En Internetuppkoppling krävs för att installera denna modul. Aktivera @@ -1391,7 +1391,7 @@ Nyttjat utrymme är {1} MB. Starta Stoppa Importera - Exportera + Export Mer… Fler åtgärder Visa inte nästa gång @@ -1403,7 +1403,7 @@ Nyttjat utrymme är {1} MB. Ett oväntat fel uppstod Åtgärd {0} Stäng - Avsluta + Utgång Visa Visa alla Visa på kartan @@ -1605,12 +1605,12 @@ Long %2$s Lägg till favorit Ange enhet för hastighet. Enhet för hastighet - Sjömil - Kilometer i timmen - Engelska mil i timmen - Meter i sekunden + Distansminuter + Kilometer per timme + Miles per timme + Meter per sekund Minuter per kilometer - Minuter per engelsk mil + Minuter per mile Sjömil i timmen (knop) Inspelning av resa Navigering @@ -1618,9 +1618,9 @@ Long %2$s Lägg till ny Välj kategori Antal rader - nmi + di nmi/h - min/m + min/mi min/km m/s Konturlinjer inaktiverade @@ -1676,7 +1676,7 @@ Long %2$s Baskarta över världen (täcker hela världen med låg zoomningsgrad) saknas eller är gammal. Hämta gärna denna karta för en global översikt. Skicka Teckenförklaring - Uppdatera + Uppdatering Återkoppling Läs mer Nyheter @@ -1728,7 +1728,7 @@ Long %2$s Åtgärd ändra Åtgärd ta bort Nära - Dölj + Göm Lägsta kvalitet Högsta kvalitet Videokvalitet @@ -1940,7 +1940,7 @@ Om du tycker om OsmAnd och OSM och vill stödja dem så är detta ett utmärkt s Hoppa över nerladdning av kartor Välj en annan region Obegränsade nedladdningar av kartor, uppdateringar och Wikipedia-plugin. - Mil/metrar + Miles/meter Låt OsmAnd avgöra din plats och föreslå kartor att hämta för den regionen. Platsen hittades inte Ingen Internetanslutning @@ -2055,7 +2055,7 @@ Vänligen tillhandahåll fullständig kod Rutthöjd Sänkning Stigning - Genomsnittshöjd + Genomsnittlig höjd Tid Total sträcka Tidsspann @@ -2064,7 +2064,7 @@ Vänligen tillhandahåll fullständig kod Sluttid Färg Välj mapp för GPX-filer - Medelhastighet + Genomsnittlig hastighet Tid i rörelse Högsta hastighet Serbiska (latin) @@ -2093,7 +2093,6 @@ Vänligen tillhandahåll fullständig kod "Kartöverlägget har ändrats till \"%s\"." Tryck länge och dra knappen för att ändra dess position på skärmen. Använd höjddata - Visa djupkonturer och punkter. Sluttning Höjdområde @@ -2882,7 +2881,7 @@ Vänligen tillhandahåll fullständig kod Konfigurera ruttparametrar Ruttparametrar Appprofil ändrat till \"%s\" - Logcat-buffert + Logcat buffer Tilläggsinställningar Sida vid sida %1$d filer kopierades (%2$s). @@ -3069,5 +3068,203 @@ Vänligen tillhandahåll fullständig kod Undvik resor till Ladda ner Wikipedia kartor Få information om sevärdheter från Wikipedia, en inbunden samling av offline artiklar om ställen och destinationer. - + Visa start och mål-ikoner + Kontrollera och dela detaljerade loggar för appen + Stängd OSM not + Ställ in arbetsdagar för att fortsätta + Rutt mellan punkter + Planera en rutt + Lägg till i ett spår + Välj intervall med vilket markeringar med avstånd eller tid på spåret ska visas. + Välj önskat delningsalternativ: efter tid eller efter avstånd. + Fast + Importera spår + Öppna befintligt spår + Skapa ny rutt + Välj en spårfil att öppna. + Skriv över spår + Spara som nytt spår + Omvänd rutt + Hela spåret beräknas om med den valda profilen. + Endast nästa segment beräknas om med den valda profilen. + Välj hur du ska ansluta punkterna, med en rak linje, eller beräkna en rutt mellan dem enligt nedan. + Hela spåret + Klicka sedan på ditt spår till närmaste tillåtna väg med en av dina navigationsprofiler för att använda detta alternativ. + Tröskelavstånd + Välj en spårfil som du vill lägga till det nya segmentet till. + Vid omvänd riktning + Spara som ny spårfil + Lägg till en spårfil + Spår + Spår + Spår + Logga spår till GPX-fil + Spårrutt + Lägg till spårfil + Lägg till spår waypoint + Lägg till spår waypoint + Spara som spårfil + Välj spårfil att följa + Välj spårfil att följa eller importera spåret från din enhet. + Navigera från min position till spåret + Punkt på spåret för att navigera + Fäst på vägarna + Spårloggning pausar när appen dödas (via senaste appar). (OsmAnd-bakgrundsindikationen försvinner från Android-meddelandefältet.) + Ange loggningsintervallet för den allmänna spårinspelningen (aktiverad via widgeten \'Trip recording\' på kartan). + • Uppdaterad Planera en ruttfunktion: gör det möjligt att använda olika navigeringstyper per segment och inkludera spår +\n +\n • Ny utseendemeny för spår: välj färg, tjocklek, visningspilar, start- och målikoner +\n +\n • Förbättrad synlighet för cykelnoder. +\n +\n • Spår kan nu tappas, har snabbmeny med grundläggande information. +\n +\n • Förbättrade sökalgoritmer +\n +\n • Förbättrade alternativ för följespår i Navigation +\n +\n • Fixade problem med import / export av profilinställningar +\n +\n + Tack för att du köpte \"Konturlinjer\" + Ditt AppGallery-konto debiteras vid köpbekräftelsen. +\n +\nAbonnemanget förlängs automatiskt såvida det inte sägs upp före förnyelsedatumet. Ditt konto debiteras för förnyelseperioden (månad / tre månader / år) endast på förnyelsedatumet. +\n +\nDu kan hantera och avbryta dina prenumerationer i dina AppGallery-inställningar. + Inbyggd kollektivtrafikutveckling + Byt till Java (säker) ruttberäkning för kollektivtrafik + Visa alla dina ändringar som ännu inte har laddats upp eller OSM-buggar i %1$s. Redan uppladdade ändringar visas inte längre. + Du måste logga in för att ladda upp nya eller modifierade ändringar. +\n +\nDu kan logga in med den säkra OAuth-metoden eller använda ditt användarnamn och lösenord. + \"Offentligt\" betyder att spårningen visas offentligt i dina GPS-spår, i offentliga GPS-spårningar och i den offentliga spårningslistan med tidsstämplar i råform. Data som visas via API hänvisar inte till din spårningssida. Tracepoint-tidsstämplar är inte tillgängliga via det offentliga GPS-API:et och spårpunkter är inte kronologiskt ordnade. + Lägg till online-dirigeringsmotorn + Redigera online-dirigeringsmotorn + Subtyp + Fordon + API-nyckel + Sever URL + Ange param + Behåll tom om inte + URL med alla parametrar kommer att se ut så här: + Testa ruttberäkning + Körning + Fot + Cykel + Bil + Kopiera adress + Online-routningsmotor + Online-routningsmotorer + Mappar + Välj mapp + Välj mapp eller lägg till en ny + Tom + Analysera delad intervall + Ladda upp till OpenStreetMap + Redigera spår + Byt namn på spår + Byt mapp + sek + Passerar + Närma sig + Långt förberedan + Förbereda + Av rutten + Anländer till destinationen + Sväng + Tid- och avstånds-intervaller + Meddelandetid för olika röstmeddelanden beror på typ, aktuell navigationshastighet och standardnavigeringshastighet. + Meddelandetid + Starta inspelning + Visa spår på kartan + Rullstol + Vandring + Gång + Elektrisk cykling + Bergscykling + Vägcyckling + Vanlig cyckling + Lastbil + Liten lastbil + Lastbil + Skoter + Racercykel + MTB + Serverfel: %1$s + Namnet finns redan + Ta bort den här online-dirigeringsmodulen\? + Läs allt + Redigera beskrivning + Ta bort waypoints + Kopiera till kartmarkeringar + Kopiera till favoriter + Uppladdning + Uppladdning klar + Laddar upp %1$d av %2$d + Välj segment + %1$s innehåller mer än ett segment, du måste välja önskad del för navigering. + Segment %1$d + OpenPlaceReviews är ett community-drivet projekt om offentliga platser som restauranger, hotell, museer, och waypoints. Det samlar all offentlig information om dem så som foton, recensioner, länkar till andra systemlänkar OpenStreetMap, Wikipedia. +\n +\nAll OpenPlaceReview-data är öppen och tillgänglig för alla: http://openplacereviews.org/data. +\n +\nDu kan läsa mer på: http://openplacereviews.org + Uppladdat %1$d av %2$d + Välj redigeringar för uppladdning + Berg relief/ sluttning / konturlinjer + OpenPlaceReviews + Använd test.openplacereviews.org + Logga in på OpenPlaCereViews + Vatten + Vinter + Snöskoter + Ridning + Racing + Mountainbike + Cyckling + Vandring + Löpning + Gående + Offroad + Motorcyckel + Bil + Använd vägbegränsningar som är aktiva nu på kartan + Optimerad kortare rutt (energibesparing) + Välj körsyfte för att få kortare, snabbare eller säkrare rutt + Ikonen för aktuell plats snappas till den aktuella navigeringsvägen + Rotera inte kartvyn om hastigheten är mindre än en tröskelvärde + Omstart + Alla regioner + Ta bort %1$d filer\? + Stoppa utan att spara + Spara och stoppa inspelningen + Spårinspelningen stoppades + Är du säker på att du vill stoppa inspelningen\? +\nAll osparad data kommer att gå förlorad. + Pausad + Omstart av program krävs för att tillämpa vissa inställningar. + Ruttning kan undvika branta sluttningar. + En toggel för att visa eller dölja koordinatwidgeten på kartan. + Avståndsmätning genom att trycka + Senaste tillgängliga OpenStreetMap-uppdateringen: + Uppdaterad: %s + Senast kontrollerad: %s + Uppdateringsfrekvens + Kartuppdateringar kommer att kontrolleras varje vecka. Nästa gång %1$s i %2$s. + Kartuppdateringar kommer att kontrolleras varje dag. Nästa gång %1$s i %2$s. + Kartuppdateringar kontrolleras varje timme. Nästa gång %1$s i %2$s. + Ta bort uppdateringar + Är du säker på att du vill ta bort alla %s liveuppdateringar\? + Inköp + Välj en kategori eller skapa en ny + Inspelningen kommer fortsätta. + Kopiera POI namn + Visa/Göm + Intervall + Dölj naturreservat, skyddade områden och nationalparkgränser + Naturgränser + Spåret innehåller inte höjddata. + Spåret innehåller inte hastighetsdata. + Välj en annan typ av färgning. \ No newline at end of file From 442e50a26c80603a9eb9bb564e6ee8a2086a2351 Mon Sep 17 00:00:00 2001 From: letypequividelespoubelles Date: Thu, 18 Mar 2021 14:12:30 +0000 Subject: [PATCH 181/250] Translated using Weblate (French) Currently translated at 99.9% (3683 of 3685 strings) --- OsmAnd/res/values-fr/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 6ccab62d05..2542de9309 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -4030,4 +4030,7 @@ Itinéraire court optimisé (plus économe en énergie) Masquer les limites des réserves naturelles, des zones protégées et des parcs nationaux Limites naturelles + %1$s contient plus d\'un segment, vous devez sélectionner le tronçon nécessaire à la navigation. + Sélectionnez le mode de conduite pour avoir l\'itinéraire le plus court, le plus rapide, ou le plus sûr + Appuyer pour afficher ou cacher le widget Coordonnées sur la carte. \ No newline at end of file From dd75f3f4ec967bfba634e52b43685bad73b7d43e Mon Sep 17 00:00:00 2001 From: Evgenii Martynenko Date: Sat, 20 Mar 2021 01:17:02 +0000 Subject: [PATCH 182/250] Translated using Weblate (Russian) Currently translated at 99.8% (3679 of 3685 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 5398b886f7..4c17c33453 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -4036,4 +4036,5 @@ Выберите категорию или добавьте новую Копировать имя POI Интервал + Скрыть природный заповедник, особо охраняемые природные территории и границы национального парка \ No newline at end of file From 7c47ef847cc07b152d8383afe4c875ea5022f202 Mon Sep 17 00:00:00 2001 From: iman Date: Fri, 19 Mar 2021 07:36:49 +0000 Subject: [PATCH 183/250] Translated using Weblate (Persian) Currently translated at 99.9% (3682 of 3685 strings) --- OsmAnd/res/values-fa/strings.xml | 144 ++++++++++++++++++++++--------- 1 file changed, 104 insertions(+), 40 deletions(-) diff --git a/OsmAnd/res/values-fa/strings.xml b/OsmAnd/res/values-fa/strings.xml index 872f82859f..656bb3afc8 100644 --- a/OsmAnd/res/values-fa/strings.xml +++ b/OsmAnd/res/values-fa/strings.xml @@ -56,7 +56,7 @@ فایل ضبط‌شده قابل‌پخش نیست. حذف فایل ضبط‌شده پخش - ضبط + در حال ضبط توقف شروع یادداشت‌های صوتی/تصویری @@ -118,7 +118,7 @@ دقیقه ساعت پارک خودرو حافظهٔ اختصاص‌یافته - حافظهٔ کل سیستم + کل حافظهٔ native مبدأ از نزدیک‌ترین جاده خیلی دور است. خودرو را از پارکینگ بردارید هشدار @@ -489,7 +489,7 @@ مرزهای مناطق را نشان نده (تقسیمات سیاسی سطح ۵–۹). جست‌وجوی حرف‌به‌حرف نام شهر نقشه‌های فقط-جاده - اجرای برنامه در حالت ایمن (به‌جای کد اصلی از اندروید کُندتر استفاده می‌کند). + اجرای برنامه در حالت ایمن (به‌جای کد native از کد Android که کُندتر است استفاده می‌کند). برنامه در حالت ایمن اجرا شده است (از طریق تنظیمات آن را غیرفعال کنید). سرویس پس‌زمینهٔ OsmAnd هنوز در حال اجراست. آن را هم متوقف می‌کنید؟ بستن بستهٔ تغییرات @@ -617,11 +617,11 @@ قفل‌گشایی تنظیم فواصل بیدارباش: سرعت شبیه‌سازی مسیر: - کل حافظهٔ اختصاص‌یافته به برنامه %1$s مگابایت (دالویک %2$s مگابایت، بقیه %3$s مگابایت). -\nحافظهٔ نسبی %4$s مگابایت (حد آندروئید %5$s مگابایت، دالویک %6$s مگابایت). + کل حافظهٔ native اختصاص‌یافته به برنامه %1$s مگابایت (دالویک %2$s مگابایت، بقیه %3$s مگابایت). +\nحافظهٔ proportional ‏%4$s مگابایت (حد اندروید %5$s مگابایت، دالویک %6$s مگابایت). حافظهٔ اختصاص‌یافته %1$s مگابایت (حد اندروید %2$s مگابایت، دالویک %3$s مگابایت). مکان هم‌رسانده - قابل‌ردگیری + قابل‌ردیابی قابل‌شناسایی قالب نقشهٔ پایه برای کارکرد اولیه موردنیاز است و در صف دانلود قرار گرفت. @@ -679,8 +679,8 @@ آیا {0} فایل را دانلود می‌کنید؟ \n {1} مگابایت (از {2} مگابایت) استفاده خواهد شد. پوستهٔ شفاف - کتابخانهٔ بومی بر روی این دستگاه پشتیبانی نمی‌شود. - مقداردهی اولیهٔ کتابخانهٔ بومی… + کتابخانهٔ native بر روی این دستگاه پشتیبانی نمی‌شود. + مقداردهی اولیهٔ کتابخانهٔ native… نمای نقشه خودکار-مرکز مدت‌زمانی که طول می‌کشد تا نقشه با موقعیت کنونی همگام شود. ناوبری فقط با حالت خودکار-مرکز @@ -973,7 +973,7 @@ این افزونه امکانات قابلیت‌دسترسی (accessibility) در دستگاهتان را مستقیماً در OsmAnd به کار می‌گیرد و تسهیلاتی را در اختیارتان می‌گذارد؛ مانند تنظیم‌کردن سرعت گفتار موتور صوتی، تبدیل متن به گفتار (مثل اعلام موقعیت شما)، پیمایش صفحه به‌کمک صفحهٔ جهتی (D-pad) و استفاده از توپک (trackball) برای تنظیم زوم. با ایجاد یا اصلاح نقاط توجه (POI)، ایجاد یادداشت‌های OSM یا نظردادن روی آن‌ها و بارگذاری فایل‌های GPXای که ضبط کرده‌اید در تکمیل نقشهٔ OSM مشارکت کنید. برای این منظور لازم است نام کاربری و گذرواژهٔ خود را در OsmAnd وارد کنید. OpenStreetMap.org یک پروژهٔ نقشه‌کشی جامعه‌محور، جهانی و در مالکیت عمومی است. گفتاری را انتخاب کنید و با پخش پیام‌ها، آن را امتحان کنید: - رندر بومی + رندرگیری native حالت قابلیت دسترسی امکانات موردنیاز برای کاربران مبتلا به نارسایی جسمی را فعال می‌کند. جهت‌ها (۸سویه) @@ -1540,7 +1540,7 @@ آبی شفاف بنفش بنفش شفاف - برای اینکه تغییرات به کار بسته شود، یک بار برنامه را ببندید و باز کنید. + برای به کار بستن تغییرات، لازم است برنامه باز و بسته شود. روشن تیره بنگالی @@ -1631,7 +1631,7 @@ دانلود نامحدود نقشه‌ها، روزآمدسازی‌های نامحدود و افزونهٔ ویکی‌پدیا. مایل/متر صرف‌نظر از دانلود نقشه‌ها - شما نقشهٔ آفلاینی را نصب نکرده‌اید. نقشه‌ای را از لیست انتخاب کنید یا اینکه بعداً از طریق «منو ← %1$s»، آن را دانلود کنید. + نقشهٔ آفلاینی نصب نکرده‌اید. نقشه‌ای را از لیست انتخاب نمایید یا بعداً از طریق «منو ← %1$s»، آن را دانلود کنید. منطقهٔ دیگری را انتخاب کنید جست‌وجوی نقشه‌ها… اجازه دهید برنامه موقعیت شما را پیدا کند تا نقشهٔ آنجا را برای دانلود پیشنهاد بدهد. @@ -1755,7 +1755,7 @@ خطا از اینکه منحنی‌های میزان عمق دریا را خریدید سپاسگزاریم آنالیز روی نقشه - در حال نمایش + نمایان بازیابی خریدها فونت‌های نقشه رانندگی از راست @@ -1813,7 +1813,7 @@ منحنی‌های میزان عمق دریا تراکم منحنی میزان تراکم منحنی میزان - عرض منحنی میزان + ضخامت منحنی میزان ضخامت منحنی میزان استفاده از آزادراه مسیردهی از آزادراه مجاز می‌شود. @@ -3169,7 +3169,7 @@ پوستهٔ برنامه، یکاها، منطقه پیکربندی پروفایل پیام‌های گفتاری فقط در هنگام ناوبری پخش می‌شود. - راهنما و فرمان‌های ناوبری + فرمان‌های ناوبری و اعلام پیام‌ها پیام‌های گفتاری هشدارهای تصویری پروفایل برنامه به «%s» تغییر کرد @@ -3205,7 +3205,7 @@ پارک برفی سورتمه کالسکه‌ای سورتمه - + پیاده‌گردی تور اسکی دان‌هیل نوردیک @@ -3307,7 +3307,7 @@ ‏%1$s پاک‌سازی شود؟ شبکه‌های گره خاموش - پیوند پاره‌ها + اتصال پاره‌ها ثبت جهت هنگام ضبط، جهت (heading) را برای هر یک از نقطه‌های رد ثبت می‌کند. %1$s • %2$s @@ -3382,7 +3382,7 @@ ردهای ضبط‌شدهٔ شما در %1$s یا در پوشهٔ OsmAnd قرار دارند. یادداشت‌های OSMای شما در %1$s قرار دارند. همهٔ ویرایش‌ها یا یادداشت‌های OSMای آپلودنشدهٔ خود را در %1$s ببینید. تغییرات آپلودشده را دیگر نمی‌بینید. - لاگ‌های جزئی برنامه را بررسی و هم‌رسانی کنید + لاگ‌های باجزئیات برنامه را بررسی و هم‌رسانی کنید استفاده از برنامهٔ سیستم صدای شاتر دوربین احراز هویت موفقیت‌آمیز بود @@ -3554,7 +3554,7 @@ %1$s / %2$s هنگام تأیید خرید، بها از حساب گوگل‌پلی شما پرداخت می‌شود. \n -\nاگر اشتراک خود را پیش از پایان زمان اشتراک از تنظیمات گوگل‌پلی لغو کرده باشید، اشتراک شما به‌طور خودکار تمدید نخواهد شد. فقط در موعد تمدید اشتراک، برای دورهٔ (ماهانه/سه‌ماهه/سالانه) از حسابتان برداشت می‌شود. +\nاشتراک شما به‌طور خودکار تمدید خواهد شد مگر اینکه پیش از تاریخ تمدید، اشتراک خود را از تنظیمات گوگل‌پلی لغو کرده باشید. فقط در موعد تمدید اشتراک، برای دورهٔ تمدید (ماهانه / سه‌ماهه / سالانه) از حسابتان برداشت می‌شود. \n \nبرای مدیریت یا لغو اشتراک خود، به تنظیمات گوگل‌پلی بروید. OsmAnd tracker @@ -3629,7 +3629,7 @@ جاهای پارک بازنشانی ترتیب پیشفرض اقلام ‏OsmAnd GPX قالب درستی ندارد. لطفاً برای بررسی بیشتر با گروه پشتیبانی تماس بگیرید. - زمان خاموشی صفحه پس از بیدارباش را انتخاب کنید. («%1$s» یعنی خاموش نشود) + زمان خاموشی صفحه پس از بیدارباش را انتخاب کنید. («%1$s» یعنی زمانی تنظیم نخواهد شد.) اگر «%1$s» روشن باشد، زمان فعالیت به آن وابسته خواهد بود. همیشه کنترل صفحه @@ -3641,14 +3641,14 @@ فشردن دکمهٔ خاموش/روشن دستگاه، صفحه را روشن می‌کند و OsmAnd را روی صفحهٔ قفل نمایش می‌دهد. دکمهٔ خاموش/روشن حسگر مجاورتی - روشن نگه داشتن صفحه + صفحه روشن بماند صفحه را خاموش نگه دار فراتابی مرکاتور یک فایل تصویر برای هر کاشی - هنگام استفاده از منبع به‌عنوان نقشه یا رولایه/زیرلایه، بر نمایش آن اثر می‌گذارند. -\n + هنگامی که به‌عنوان نقشه یا رولایه/زیرلایه استفاده می‌شود، نمایش آن تحت تأثیر قرار می‌گیرد: +\n \n‏%1$s: نقشه به دامنهٔ زوم انتخاب‌شده محدود می‌شود. -\n +\n \n‏%2$s: درجات زوم که در آن کاشی‌های اصلی نمایان خواهند بود. خارج از این مقدارها افزایش یا کاهش مقیاس رخ خواهد داد. فایل SQLiteDB نامی برای منبع نقشهٔ آنلاین بنویسید. @@ -3657,10 +3657,10 @@ زمان انقضا قالب ذخیره‌گاه کمترین و بیشترین درجهٔ زوم را برای نمایش یا بارکردن نقشهٔ آنلاین تنظیم کنید. - کاشی‌های ذخیره‌شده پس از این مدت (به دقیقه) مجدداً دانلود می‌شوند. این خانه را خالی بگذارید تا کاشی‌های این منبع هیچ‌گاه تازه‌سازی نشود. -\n -\nیک روز ۱ ۴۴۰ دقیقه است. -\nیک هفته ۱۰ ۰۸۰ دقیقه است. + کاشی‌های ذخیره‌شده پس از این مدت (به دقیقه) مجدداً دانلود می‌شوند. این خانه را خالی بگذارید تا کاشی‌های این منبع هیچ‌گاه تازه‌سازی نشوند. +\n +\nیک روز ۱ ۴۴۰ دقیقه است. +\nیک هفته ۱۰ ۰۸۰ دقیقه است. \nیک ماه ۴۳ ۸۲۹ دقیقه است. شیوهٔ ذخیره‌سازی کاشی‌های دانلودشده را انتخاب کنید. زمان پیشفرض خاموشی صفحه @@ -3675,7 +3675,7 @@ متر جزئیات اضافه‌تر را روی نقشه آشکار یا پنهان کنید نقشهٔ شب - غیرفعال است. به گزینهٔ «روشن نگه داشتن صفحه» در قسمت «زمان خاموشی پس از بیدارباش» نیاز دارد. + غیرفعال است. به گزینهٔ «صفحه روشن بماند» در قسمت «زمان خاموشی پس از بیدارباش» نیاز دارد. فراتابی شبه مرکاتور اتصال اتصال @@ -3794,7 +3794,7 @@ نام فایل پیشفرض سیستم فقط پارهٔ انتخاب‌شده با استفاده از پروفایل انتخابی بازمحاسبه می‌شود. - آخرین تغییر + آخرین تغییریافته نام: ی - الف نام: الف - ی ردنگاری خودکار در هنگام ناوبری @@ -3828,7 +3828,7 @@ دادهٔ OsmAnd Live دادهٔ OsmAnd Live مسیریابی دومرحله‌ای برای ناوبری خودرویی. - برای مسیریابی حمل‌ونقل عمومی از محاسبات جاوا (امن) استفاده می‌کند + برای مسیریابی حمل‌ونقل عمومی از محاسبات جاوا (ایمن) استفاده می‌کند نقشه‌های محلی ویژه حمل‌ونقل @@ -3838,8 +3838,8 @@ اورژانس سفر تازه‌ها - برای استفاده از قابلیت‌های ویرایشی، از طریق OAuth ثبت ورود کنید - ثبت ورود از طریق OAuth + برای استفاده از قابلیت‌های ویرایشی، از طریق OAuth وارد شوید + ورود از طریق OAuth پاک‌سازی توکن OAuth اوپن‌استریت‌مپ خارج شدید فایل قبلاً در OsmAnd درون‌برد شده است @@ -3852,7 +3852,7 @@ دست‌کم دو نقطه اضافه کنید ورود به اوپن‌استریت‌مپ ورود به OpenStreetMap.org - ثبت ورود از طریق اوپن‌استریت‌مپ + ورود از طریق اوپن‌استریت‌مپ برای آپلود تغییرات جدید باید وارد شوید (login). \n \nبرای ورود می‌توانید از روش امن OAuth یا روش نام کاربری و گذرواژه استفاده کنید. @@ -3877,20 +3877,20 @@ دستگاه شما تنها %1$s فضای خالی دارد. لطفا مقادری فضا خالی کنید و یا تعداد موارد برون‌ریزی را کاهش دهید. فضای کافی موجود نیست گروه‌هایی را که درون‌ریزی خواهند شد را انتخاب کنید. - مواردی را که درون‌ریزی خواهند شد را انتخاب کنید. + مواردی که درون‌برد خواهند شد را انتخاب کنید. افزودن به مپیلاری افزودن به OpenPlaceReviews - برای امتحان کردن بارگذاری یادداشت / نقاط توجه و GPX از dev.openstreetmap.org به جای openstreetmep.org استفاده کنید. - از dev.openstreetmap.org استفاده کنید + برای آپلود آزمایشی یادداشت / نقطهٔ توجه / GPX، به‌جای openstreetmep.org از dev.openstreetmap.org استفاده کنید. + استفاده از dev.openstreetmap.org برنامه OsmAnd عکس‌ها را از چند منبع نشان می‌دهد: \nاز OpenPlaceReview برای عکس‌های نقاط توجه؛ \nاز مپیلاری برای تصویر سطح خیابان؛ \nاز وب و ویکی‌پدیا برای عکس‌های نقاط توجه متناسب با داده‌های اوپن‌استریت‌مپ. هواپیمای سبک - اتصال بخش‌ها + اتصال پاره‌ها تقطیع از اینجا به قبل تقطیع از این جا به بعد - افزودن یک بخش جدید + افزودن یک پارهٔ جدید نمایهٔ OsmAnd نمایهٔ کاربر زمان‌های پیام‌های گفتاری @@ -3911,7 +3911,7 @@ برای درون‌برد لازم است برعکس‌کردن همهٔ نقطه‌ها پروفایلِ هنگام شروع برنامه را انتخاب کنید. - آخرین استفاده + آخرین استفاده‌شده افزودن موتور مسیریابی آنلاین ویرایش موتور مسیریابی آنلاین وسیله نقلیه @@ -3923,7 +3923,7 @@ پا دوچرخه خودرو - برای اینکه برخی تنظیمات به کار بسته شود، لازم است برنامه را ببندید و دوباره باز کنید. + برای به کار بستن برخی تنظیمات، لازم است برنامه باز و بسته شود. پنهان‌کردن مرز ذخیره‌گاه‌های طبیعی، مناطق حفاظت‌شده و پارک‌های ملی آخرین زمان بررسی: %s آخرین روزآمدسازهٔ اوپن‌استریت‌مپ: @@ -4005,4 +4005,68 @@ ضبط رد متوقف شد آیا برای توقف ضبط مطمئن هستید؟ \nهرچه که ذخیره نشده، از دست خواهد رفت. + زیرنوع + پیاده‌سازی Native حمل‌ونقل عمومی + %1$s * %2$s + • گزینه‌ای برای برون‌برد و درون‌برد همهٔ داده‌ها شامل تنظیمات، منابع و مکان‌های من اضافه شد. +\n +\n • طراحی مسیر: برای پاره‌هایی از رد که مسیر دارند نمودار رسم می‌شود. امکان ساخت و ویرایش چندین پارهٔ رد اضافه شد. +\n +\n • شیوهٔ احراز هویت OAuth برای OpenStreetMap اضافه شد، رابط کاربری کادرهای OSM بهبود یافت. +\n +\n • پشتیبانی از رنگ‌های دلخواه برای علاقه‌مندی‌ها (favorites) و راه‌نشان‌های رد (track waypoints) +\n +\n + MTB + ترجیح مسیرهای پیاده‌گردی + ترجیح مسیرهای پیاده‌گردی + رودهای کوچک و نهرهای مصنوعی مجاز باشد + مسیریابی از رودهای کوچک (stream) و نهرهای مصنوعی (drain) مجاز باشد + مسیریابی از آبراه‌های دوره‌ای و غیردائمی را مجاز می‌کند + آبراه‌های غیردائمی مجاز باشد + sec + اسکوتر + تمام‌صفحه + لطفاً رنگ‌بندی دیگری انتخاب کنید. + آلمانی (خودمانی) + مناسب برای اسنوموبیل‌سواری (برف‌روسواری) است. دارای مسیرها و جاده‌های ویژه. + هزینهٔ اشتراک با رسیدن موعد دورهٔ انتخابی از حسابتان پرداخت می‌شود. هر زمان که خواستید در AppGallery آن را لغو کنید. + هنگام تأیید خرید، بها از حساب AppGallery شما پرداخت می‌شود. +\n +\nاشتراک شما به‌طور خودکار ادامه می‌یابد مگر اینکه پیش از تاریخ تمدید، اشتراک خود را لغو کرده باشید. فقط در موعد تمدید اشتراک، برای دورهٔ تمدید (ماهانه / سه‌ماهه / سالانه) از حسابتان برداشت می‌شود. +\n +\nبرای مدیریت یا لغو اشتراک خود، به تنظیمات AppGallery بروید. + اشتراک OsmAnd Live لغو شده است (expired) + اشتراک OsmAnd Live موقتاً متوقف شده است (paused) + اشتراک OsmAnd Live در انتظار است (on hold) + کایاک + Server URL + اگر نیاز ندارد خالی بگذارید + کپی آدرس + موتور مسیریابی آنلاین + موتورهای مسیریابی آنلاین + پوشه‌ها + انتخاب پوشه + پوشه را انتخاب کنید یا یکی جدید اضافه نمایید + تهی + تحلیل بازه‌های تقسیم‌شده + آپلود در OpenStreetMap + ویرایش رد + تغییر نام رد + تغییر پوشه + پیچ + هنگام گذر + نزدیک‌شدن + آمادگی زودتر + آمادگی + خروج از مسیر + رسیدن به مقصد + بازه‌های زمانی و مسافتی + زمان اعلام پیام‌های گفتاری به نوع پیام، سرعت ناوبری جاری و سرعت ناوبری پیش‌فرض بستگی دارد. + زمان اعلام پیام + شروع دوباره + مکث کرده + دکمه‌ای برای آشکار یا پنهان کردن ابزارک مختصات روی نقشه. + بازه + فاصله با لمس دوانگشتی \ No newline at end of file From df7574c4a8ce1cc428dd00b1c5eae470fe27e8ea Mon Sep 17 00:00:00 2001 From: ovl-1 Date: Fri, 19 Mar 2021 13:05:06 +0000 Subject: [PATCH 184/250] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegi?= =?UTF-8?q?an=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 60.1% (2218 of 3685 strings) --- OsmAnd/res/values-nb/strings.xml | 41 ++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml index 75fc2ea21e..8eefe0476c 100644 --- a/OsmAnd/res/values-nb/strings.xml +++ b/OsmAnd/res/values-nb/strings.xml @@ -699,7 +699,7 @@ Generelt loggeintervall t Varighet - Avstand + Distanse Turer Alle Mer… @@ -796,7 +796,7 @@ Laster byer… Ugyldige koordinater Tilbake til kartet - Kommentar er lagt til + Kommentar lagt til Ingen bygninger funnet. Laster gater/bygninger… Favorittnavn endret til \"%1$s\" for å unngå duplisering. @@ -924,7 +924,7 @@ Kopierer OsmAnd-datafiler… Reisemål GPX-filnavn - Distansekalkulator & planleggingsverktøy + Distansekalkulator og planleggingsverktøy Relieffskyggelag Relieffskygger Audio/Video-data @@ -1339,7 +1339,7 @@ Legg til kommentar Navigeringsoppsett. Viser hvor mange gratis nedlastinger som er igjen. - Avstand: + Distanse: Tid: Lyd Tilgjengelige kart @@ -1878,7 +1878,7 @@ Marker som parkeringsplass Rundkjøring: Ta avkjøring %1$d og fortsett Støtt nye funksjoner - Maksimumshastighet + Maksimumsfart Starttid Sluttid Farge @@ -2945,7 +2945,7 @@ Velg typen data du vil dele: Nedlastede kart Besøkte skjermer - Definer hvilken data du ønsker å dele med OsmAnd. + Bestem hvilke data OsmAnd kan dele. Hjelp oss å forstå hvilke land- og regionkart som er mest populære. Hjelp oss å forstå hvilke OsmAnd-funksjoner som er mest populære. Trykk \"Tillat\" hvis du er enig med vår %1$s @@ -3832,7 +3832,7 @@ Ressurser Velg profilen som skal brukes når programmet starter. Sist brukt - Tillat bekker og avløp + Tillat bekker og dreneringsgrøfter Tillat periodiske vannveier Tillat periodiske vannveier Kjøretøy @@ -3854,7 +3854,7 @@ Endre mappe Velg data å eksportere til filen. Din enhet har kun %1$s ledig. Frigjør litt plass eller velg bort noen elementer fra eksporten. - ffffffffff| + Velg grupper som skal importeres. Reverser alle punkter Liten lastebil Lastebil @@ -3874,18 +3874,18 @@ Forberedelse Ankom målet Sving - Tid og avstansintervaller - kunngjøringstid for forskjellige stemmeforespørsler avhenger av forespørselstype, nåværende navigasjonshastighet og forvalgt navigasjonshastighet. + Tid og avstandsintervaller + Kunngjøringstid for forskjellige talemeldinger avhenger av meldingstype, gjeldende navigasjonshastighet og standard-navigasjonshastighet. Turgåing - Fotgjengeri + Gåing sek Kunngjøringstid Start opptak Vis spor på kart Rullestol El-sykkel - Terrengsykkel - Temposykkel + Terrengsykling + Racersykkel Landeveissykling Vanlig sykling Tjenerfeil: %1$s @@ -3895,7 +3895,7 @@ Stor lastebil Slett denne nettbaserte rutingsmotoren\? Les hele - Slett rutepunkt + Slett rutepunkter Luke Logg inn på OpenStreetMap Logg inn @@ -3921,10 +3921,21 @@ Kjøp Velg kategori eller legg til en ny Opptaket vil fortsette. - Kopier POI-navn + Kopier interessepunktnavn Vis/skjul Intervall Sporet inneholder ikke høydedata. Sporet inneholder ikke hastighetsdata. Velg en annen type fargelegging. + Alle regioner + Skjul grenser for naturreservat, beskyttede områder og nasjonalparker + Naturgrenser + Relieffskygge / Bakkehelling / Koter + Ridning + Turgåing + Løping + Gåing + Optimalisert kortere rute (energisparende) + Aktuelle posisjonsikon vil bli festet til gjeldende navigeringsrute + Ruting kan unngå kraftige oppoverbakker. \ No newline at end of file From 44762177550261eedbdf5b67be6a4d8128c5bd8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1ns?= Date: Thu, 18 Mar 2021 11:10:57 +0000 Subject: [PATCH 185/250] Translated using Weblate (Galician) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-gl/strings.xml | 33 ++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/OsmAnd/res/values-gl/strings.xml b/OsmAnd/res/values-gl/strings.xml index 2f3d46f62b..f129d431fb 100644 --- a/OsmAnd/res/values-gl/strings.xml +++ b/OsmAnd/res/values-gl/strings.xml @@ -2567,7 +2567,7 @@ Lon %2$s Escoller variación da altitude Amosar curvas e puntos do afundimento. Curvas do afundimento náuticos - División automática das gravacións en intres + Dividir gravacións após unha pausa Comezar novo segmento despois dun intre de 6 min, nova pista despois dun intre de 2 h, ou novo ficheiro despois dun intre máis longo se mudaches a data. Detido Mínimo desprazamento para o rexistro @@ -3695,9 +3695,9 @@ Lon %2$s Fornece a lonxitude do teu vehículo. Algunhas restricións de ruta poden ser aplicadas a vehículos longos. Eliminar punto de destino máis preto Fornece un nome para o punto - O punto de destino actual na ruta será eliminado. Se fora o destino, a navegación sería interrompida. + Elimina o seguinte destino da ruta. Se é o destino final, a navegación será detida. Baixar mapas da Wikipedia - Obter información sobre os puntos de interese da Wikipedia. É o teu guía de peto sen conexión - só activar o complemento da Wikipedia e desfrutar dos artigos sobre os elementos ó teu redor. + Obtén información sobre os puntos de interese da Wikipedia, unha guía de peto sen conexión que inclúe artigos sobre obxectos e destinos. Enduro Scooter Cadeira de rodas @@ -3808,11 +3808,11 @@ Lon %2$s Iconas de inicio e fin Grazas por mercar \'Curvas de nivel\' A subscrición é cobrada por período escollido. Cancélaa na AppGallery en calquera intre. - O pagamento será cargado na túa conta da AppGallery no mesmo intre da confirmación da compra. + O pagamento será cobrado á túa conta do AppGallery ao confirmar a compra. \n -\nA subscrición é renovada de xeito automático a menos que sexa cancelada antes da data de renovación. A túa conta será cargada polo período de renovación (mes/trimestre/ano) só na data de renovación. +\nA subscrición é renovada de xeito automático a menos que se cancele antes da data de renovación. A conta será cobrada polo período de renovación (mes/trimestre/ano) só na data de renovación. \n -\nPodes xestionar e cancelar as túas subscricións indo ós axustes da AppGallery. +\nPodes administrar e desbotar as subscricións nos axustes do AppGallery. Evitar sendas peonís, camiños e beirarrúas Evitar sendas peonís Desenvolvemento @@ -4033,4 +4033,25 @@ Lon %2$s A pista non contén datos de altitude. A pista non contén datos de velocidade. Escolle outro tipo de cor. + As actualizacións de mapas serán comprobadas cada hora. A seguinte vez %1$s en %2$s. + Escoller segmentos + %1$s contén máis dun segmento, precisas selecionar a parte necesaria para a navegación. + Segmento %1$d + Auga + Inverno + Motoneve + Equitación + Carreira + Bicicleta de montaña + Bicicleta + Sendeirismo + Correndo + A pé + Todo terreo + Motocicleta + Automóbil + Empregar as restricións de estrada que están activas agora no mapa + Ruta optimizada máis curta (baixo consumo) + Escolle o propósito da condución para obter unha ruta máis curta, máis rápida ou máis segura + Agochar reservas naturais, áreas protexidas e de parques nacionais \ No newline at end of file From 37f13f4ee0ca4ba1a3b8f2da6c303267f98fb411 Mon Sep 17 00:00:00 2001 From: scai Date: Fri, 19 Mar 2021 20:30:37 +0000 Subject: [PATCH 186/250] Translated using Weblate (German) Currently translated at 100.0% (3894 of 3894 strings) --- OsmAnd/res/values-de/phrases.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-de/phrases.xml b/OsmAnd/res/values-de/phrases.xml index c143b4967b..11ee006fc4 100644 --- a/OsmAnd/res/values-de/phrases.xml +++ b/OsmAnd/res/values-de/phrases.xml @@ -1232,7 +1232,7 @@ Material: Metall Material: Stahl Material: Stein - Martial: Plastik + Material: Plastik Material: Sandstein Material: Granit Material: Metall, Holz @@ -1479,7 +1479,7 @@ Material: Stahlbeton Material: Beton Material: Mauerwerk - Martial: Ziegel + Material: Ziegel Material: Verbundstoff Material: Kalkstein Material: Marmor From a484fcca36a3874ed37ecbbc8facd471552ea1f9 Mon Sep 17 00:00:00 2001 From: Ajeje Brazorf Date: Thu, 18 Mar 2021 16:28:26 +0000 Subject: [PATCH 187/250] Translated using Weblate (Sardinian) Currently translated at 99.6% (3882 of 3894 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 72e5d794e5..ce6674505d 100644 --- a/OsmAnd/res/values-sc/phrases.xml +++ b/OsmAnd/res/values-sc/phrases.xml @@ -3891,4 +3891,7 @@ Cun àrbores: eja Nùmene de sa pista Brincu cun sos iscì + Riferimentu locale + Geodesista + Tzentru pro cunferèntzias \ No newline at end of file From d9cc0e33c901706d4fbd2fa100f85aced2a0cec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1ns?= Date: Thu, 18 Mar 2021 11:00:43 +0000 Subject: [PATCH 188/250] Translated using Weblate (Galician) Currently translated at 100.0% (3894 of 3894 strings) --- OsmAnd/res/values-gl/phrases.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/OsmAnd/res/values-gl/phrases.xml b/OsmAnd/res/values-gl/phrases.xml index 83d2d73eef..7b065fed21 100644 --- a/OsmAnd/res/values-gl/phrases.xml +++ b/OsmAnd/res/values-gl/phrases.xml @@ -3881,4 +3881,17 @@ Ponte para morcegos Paso de fauna Área de natación + Referencia local + Xeodésico + Centro de conferencias + Posición de parada de biblioteca móbil + Rexistro do cumio: no + Rexistro do cumio: si + Estado da pista: pechada + Estado da pista: aberta + Patrullado: non + Patrullado: si + Arborado: si + Nome da pista + Salto de esquí \ No newline at end of file From 806e25949756114a0959cf1233e2c9ed492eec09 Mon Sep 17 00:00:00 2001 From: iman Date: Thu, 18 Mar 2021 18:21:38 +0000 Subject: [PATCH 189/250] Translated using Weblate (Persian) Currently translated at 36.6% (1427 of 3894 strings) --- OsmAnd/res/values-fa/phrases.xml | 47 ++++++++++++++++---------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/OsmAnd/res/values-fa/phrases.xml b/OsmAnd/res/values-fa/phrases.xml index 19e015f910..f02c2aa1db 100644 --- a/OsmAnd/res/values-fa/phrases.xml +++ b/OsmAnd/res/values-fa/phrases.xml @@ -8,10 +8,10 @@ فروشگاه نوشیدنی فروشگاه گوشت بقالی - فروشگاه محصولات دامی + فروشگاه محصولات مزرعه میوه و سبزی‌فروشی فروشگاه غذاهای دریایی - شیرینی و آجیل فروشی + شیرینی و آب‌نبات فروشی بستنی فروشی فروشگاه بزرگ فروشگاه چای @@ -19,18 +19,18 @@ دستگاه فروش خودکار کتابفروشی فروشگاه دوچرخه - فروشگاه کارتون + فروشگاه انیمه عتیقه فروشی فروشگاه هنر کالای کودک - فروشگاه کیف + کیف فروشی لوازم حمام مبلمان اتاق خواب بوتیک - فروشگاه فرش + فرش فروشی فروشگاه محصولات بهداشتی و آرایشی فروشگاه پوشاک - \فروشگاه پوشاک کودکان + فروشگاه پوشاک کودک کفش فروشی فروشگاه کامپیوتر فروشگاه چاپ و تکثیر @@ -63,7 +63,7 @@ فروشگاه لوزم موسیقی روزنامه فروشی عینک سازی - مواد غذایی ارگانیک + محصولات ارگانیک بازار روز رنگ فروشی فروشگاه حیوانات خانگی @@ -72,8 +72,8 @@ کشتی لوازم ورزشی فروشگاه نوشت افزار - فروشگاه کارد و چنگال - فروشگاه بلیط + فروشگاه ظروف غذاخوری + بلیت فروشی دخانیات اسباب بازی فروشی @@ -121,7 +121,7 @@ معاینه فنی خودرو کارواش جایگاه سوخت; جایگاه سوخت‌گیری; پمپ بنزین; پمپ گاز - ایستگاه شارژ + ایستگاه شارژ; ایستگاه شارژ خودروی برقی سطح شیب دار خودرو هوای فشرده پارکینگ @@ -196,7 +196,7 @@ اسکله نظارت رصد خانه - رصدخانه نجوم + نجومی ساخت و ساز کارگاه معدن @@ -317,7 +317,7 @@ اسکیت روی یخ زمین یخ زمین بسکتبال اسکاتلندی - پیست موتور سواری + ورزش موتورسواری چندورزشی ورزش جهت یابی تنیس پدالی @@ -428,11 +428,11 @@ باشگاه گردشگری کلوپ خیریه کتابخانه - مرکز هنر + مرکز هنری سینما کازینو مرکز اجتماع - مرکز سوسیال + مرکز اجتماعی تئاتر سیرک رقص @@ -446,7 +446,7 @@ لنگرگاه تفریحی گلف کوچک زمین بازی - استخر + استخر شنا پارک آبی پارک کافه @@ -509,7 +509,7 @@ قبرکن صنایع کامپیوتر سالن زیبایی - کاشت ناخن + کاشت ناخن; مانیکور آرایشگر سالن ماساژ سالن تاتو @@ -519,7 +519,7 @@ جمعه بازار خودرو جمعه بازار قایق بارانداز - سرویس بهداشتی + سرویس بهداشتی; دستشویی; مستراح سونا سردخانه مردگان @@ -667,7 +667,7 @@ تنظیمات ساعت کمپ گردشگری کمپ بدون امکانات - مراقبت از پیست + آماده‌سازی پیست نشستن بیرون دخانیات تحویل @@ -766,7 +766,7 @@ دفتر گردشگری دیدنی‌ها - محل اسکان + محل اسکان; اقامت دسترسی اینترنت اوقات فراغت باشگاه @@ -1070,13 +1070,13 @@ سوپ نقطهٔ گردشگری دسترسی اینترنت: ندارد - دسترسی اینترنت - رایگان + دسترسی اینترنت: رایگان خیر خیر خیر - خیر + صدا: خیر خیر - "معدن تاریخی سنگ " + معدن تاریخی سنگ گیاه‌خواری فقط گیاه‌خواری گیاه‌خواری @@ -1188,7 +1188,7 @@ دسترسی اینترنت: عمومی دسترسی اینترنت: با خدمات دسترسی اینترنت: دارد - دسترسی اینترنت - پولی + دسترسی اینترنت: پولی در اتاق جداگانه در یک اتاق جدا اسکوتر @@ -1448,4 +1448,5 @@ بله منطقهٔ حفاظت‌شده بدمینتون + خدمات خودرو; مکانیکی \ No newline at end of file From e84b9ddc6da1c05d6d16b58f8f34e4e22dce2ad1 Mon Sep 17 00:00:00 2001 From: ovl-1 Date: Fri, 19 Mar 2021 19:54:45 +0000 Subject: [PATCH 190/250] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegi?= =?UTF-8?q?an=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 41.4% (1616 of 3894 strings) --- OsmAnd/res/values-nb/phrases.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/OsmAnd/res/values-nb/phrases.xml b/OsmAnd/res/values-nb/phrases.xml index dd15e88444..2d3d19f765 100644 --- a/OsmAnd/res/values-nb/phrases.xml +++ b/OsmAnd/res/values-nb/phrases.xml @@ -1622,4 +1622,29 @@ Video Status Type + Sivilisasjon: gresk-egyptisk (332 f.Kr. – 30 f.Kr.) + Sivilisasjon: Det gamle Egypt (inntil 332 f.Kr.) + Sivilisasjon: Det kinesiske keiserriket (221 f.Kr. – 1911 e.Kr.) + Historisk stein + Historisk periode: neolittisk tid + Historisk periode: mesolittisk tid + Historisk periode: paleolittisk tid (2,6 millioner – 10000 år før nåtid) + Historisk periode: Det ptolemeiske Egypt (305 f.Kr. – 30 f.Kr.) + Historisk periode: Det hellenistiske Hellas + Historisk periode: Den romerske republikk (508 f.Kr. – 27 f.Kr.) + Sivilisasjon: Den romerske antikken (753 f.Kr. – 284 e.Kr.) + Historisk periode: jernalder + Historisk periode: Det arkaiske Hellas + Historisk periode: Det klassiske Hellas (5. – 4. århundre f.Kr.) + Historisk periode: bronsealder + Historisk periode: steinalder / bronsealder (ubestemt) + Sivilisasjon: minoisk + Sivilisasjon: vestromersk (285 – 476) + Sivilisasjon: keltisk + Sivilisasjon: bysantinsk (285 – 1453) + Sivilisasjon: romersk + Sivilisasjon: Den greske antikken + Sivilisasjon: forhistorisk tid + Historisk herregård + Historisk objekt \ No newline at end of file From c42f2240f9f96ffa30fbe1e7ac6aa218589459d5 Mon Sep 17 00:00:00 2001 From: Shjosan Date: Fri, 19 Mar 2021 22:50:21 +0000 Subject: [PATCH 191/250] Translated using Weblate (Swedish) Currently translated at 83.5% (3253 of 3894 strings) --- OsmAnd/res/values-sv/phrases.xml | 106 ++++++++++++++++++++++++++++--- 1 file changed, 97 insertions(+), 9 deletions(-) diff --git a/OsmAnd/res/values-sv/phrases.xml b/OsmAnd/res/values-sv/phrases.xml index 93aabdcb68..e3ed4a4936 100644 --- a/OsmAnd/res/values-sv/phrases.xml +++ b/OsmAnd/res/values-sv/phrases.xml @@ -316,7 +316,7 @@ El Flygbränsle Bensinstation för båtar - Laddstation + Laddstation; Laddningsstation för elfordon; Laddningsstation för el; Elektrisk laddningspunkt; Laddningspunkt; Elektronisk laddstation; Utrustning för elförsörjning av elfordon Fordonsramp Tryckluft Parkering @@ -627,7 +627,7 @@ Hästkapplöpning Skridskoåkning Islager - Korfbal + Korfball Motorsport Multisport Orientering @@ -780,8 +780,8 @@ Tillgång till Internet: service Tillgång till Internet: ja Tillgång till Internet: nej - Tillgång till Internet - avgift - Tillgång till Internet - ingen avgift + Tillgång till internet: avgift + Tillgång till internet: ingen avgift Kloster Religiöst område Vägkors @@ -1342,7 +1342,7 @@ Ingen pump Ja Mineral - Vattenegenskap: lera + Lera Svavel Vattenpunkt Vägstolpe @@ -1382,7 +1382,7 @@ Ja Utan taktil beläggning Ja - Nej + Ljud: nej Endast när gång är tillåtet Räddningsstation Serviceområde @@ -1669,13 +1669,13 @@ Reparation av elektriska fordon Mc-reparation Ja - Ingen självbetjäning + Nej Ja Inte automatisk Full service Ja Borstlös: nej - Biltvätt: ingen + Nej Offentligt bad Hane Förbjudet för män @@ -2055,7 +2055,7 @@ 100LL bränsle Autogas Jet A-1 bränsle - AdBlue bränsle + Dieselavgasvätska Bränsle: trä Bränsle: träkol Bränsle: kol @@ -3165,4 +3165,92 @@ Konstgräs Hard court Metallgitter + Plats: ovan + Plats: ovan jord + Plats: under vattnet + Plats: underjordisk + Social trygghet + Vinterrum: nej + Vinterrum: ja + Standard + Enduro + Off-road + Chopper + Sport motorcykel + Skoter + Motorcykelkläder: nej + Motorcykelkläder + Däck: nej + Däck + Delar: nej + Delar + Reparation + Reparation: nej + Uthyrning: nej + Uthyrning + Försäljning: ja, begagnad + Försäljning: begagnad + Försäljning: nej + Försäljning + Samarbetsyta + Souvlaki + Piadina + Salta pannkakor + Soba + Buschenschank + Heuriger + Gastropub + Gyudon + Ramen + Typ: läsruta + Jul: hemsida + Jul: plats + Jul: öppettider + Jul: Obs + Xmas: period för evenemanget + Brandoperatör + Hög provision + Permanent representation + Huvudfördelningsram + Effekt (el): nej + ATM: ja + Strålbehandling + Beteckning + Energikälla: biomassa + Reddit + Historisk tank + Små elektriska apparater + Medborgartjänster + Invandrarvisum + Visum som inte är invandrare + Förbindelse + Konsulat + Ambasad + Avgångstavlan + Påfyllning av dricksvatten + Pil + Vibrationer + Tryck + Video + SMS + Status + Typ + Utomhus + Typ + Kontantuttag + Tillgänglighet för funktionshindrade + Tillgång för lätta lastbilar + HGV-åtkomst + Mofa-åtkomst + Mopedåtkomst + Motorcykelåtkomst + Släpvangsåtkomst + Husbilsåtkomst + Husvangsåtkomst + Bussåtkomst + Snöskoteråtkomst + Ja + Klättring + Svårighetskategori + Parkera och åk \ No newline at end of file From 733c115d2bdad2b9d026263a8cd766ed792d111b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristjan=20R=C3=A4ts?= Date: Sat, 20 Mar 2021 04:38:54 +0000 Subject: [PATCH 192/250] Translated using Weblate (Estonian) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-et/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-et/strings.xml b/OsmAnd/res/values-et/strings.xml index f212d41299..f78e97a163 100644 --- a/OsmAnd/res/values-et/strings.xml +++ b/OsmAnd/res/values-et/strings.xml @@ -3925,9 +3925,9 @@ Sai üleslaaditud Laadin üles Maastikul - Kaardi värskendusi kontrollitakse kord nädalas. Järgmine kord %1$s %2$s. - Kaardi värskendusi kontrollitakse kord päevas. Järgmine kord %1$s %2$s. - Kaardi värskendusi kontrollitakse kord tunnis. Järgmine kord %1$s %2$s. + Kaardi värskendusi kontrollitakse kord nädalas. Järgmine kord: %1$s %2$s. + Kaardi värskendusi kontrollitakse kord päevas. Järgmine kord: %1$s %2$s. + Kaardi värskendusi kontrollitakse kord tunnis. Järgmine kord: %1$s %2$s. Häälteavituste ajad Eelista matkaradu Eelista matkaradu From 90f3102b1f00f11b9c41833f1599c0b50840bbdd Mon Sep 17 00:00:00 2001 From: Rex_sa Date: Fri, 19 Mar 2021 21:15:34 +0000 Subject: [PATCH 193/250] Translated using Weblate (Arabic) Currently translated at 93.2% (3632 of 3894 strings) --- OsmAnd/res/values-ar/phrases.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-ar/phrases.xml b/OsmAnd/res/values-ar/phrases.xml index 0c42643a7a..372df7b654 100644 --- a/OsmAnd/res/values-ar/phrases.xml +++ b/OsmAnd/res/values-ar/phrases.xml @@ -3702,4 +3702,5 @@ القفز على الجليد الجيوديسيا (شكل الأرض ومساحتها) المرجع المحلي + الزحلقه \ No newline at end of file From c1b3be76fca2ab60fb40433d340fd75686ff4c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sveinn=20=C3=AD=20Felli?= Date: Thu, 18 Mar 2021 09:32:06 +0000 Subject: [PATCH 194/250] Translated using Weblate (Icelandic) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-is/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-is/strings.xml b/OsmAnd/res/values-is/strings.xml index 6a5f04adec..432b5a9946 100644 --- a/OsmAnd/res/values-is/strings.xml +++ b/OsmAnd/res/values-is/strings.xml @@ -4035,9 +4035,9 @@ Uppfært: %s Síðast athugað: %s Uppfærslutíðni - Uppfærslur korta verða athugaðar í hverri viku. Næsta skipti%1$s eftir %2$s. - Uppfærslur korta verða athugaðar á hverjum degi. Næsta skipti%1$s eftir %2$s. - Uppfærslur korta verða athugaðar á klukkustundar fresti. Næsta skipti%1$s eftir %2$s. + Uppfærslur korta verða athugaðar í hverri viku. Næsta skipti %1$s eftir %2$s. + Uppfærslur korta verða athugaðar á hverjum degi. Næsta skipti %1$s eftir %2$s. + Uppfærslur korta verða athugaðar á klukkustundar fresti. Næsta skipti %1$s eftir %2$s. Eyða uppfærslum Ertu viss um að þú viljir eyða öllum %s raunuppfærslum\? Innkaup From 3bfae7e3fe33d9612302a97262747119f97a1d39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sveinn=20=C3=AD=20Felli?= Date: Thu, 18 Mar 2021 09:38:35 +0000 Subject: [PATCH 195/250] Translated using Weblate (Icelandic) Currently translated at 100.0% (3894 of 3894 strings) --- OsmAnd/res/values-is/phrases.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-is/phrases.xml b/OsmAnd/res/values-is/phrases.xml index 87e5c434ea..a67dc7b9f3 100644 --- a/OsmAnd/res/values-is/phrases.xml +++ b/OsmAnd/res/values-is/phrases.xml @@ -3893,4 +3893,5 @@ Skíðastökk Staðvær tilvísun Ráðstefnumiðstöð + Landmælingar \ No newline at end of file From bf075cc7c675c6d5adda1fccfb3f230eb195d15c Mon Sep 17 00:00:00 2001 From: Liu Tao Date: Sat, 20 Mar 2021 07:30:06 +0000 Subject: [PATCH 196/250] Translated using Weblate (Chinese (Simplified)) Currently translated at 80.7% (2974 of 3685 strings) --- OsmAnd/res/values-zh-rCN/strings.xml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-zh-rCN/strings.xml b/OsmAnd/res/values-zh-rCN/strings.xml index 092e435048..3e325159f3 100644 --- a/OsmAnd/res/values-zh-rCN/strings.xml +++ b/OsmAnd/res/values-zh-rCN/strings.xml @@ -2903,7 +2903,7 @@ 搜索兴趣点类型 半径尺 订阅 - OsmAnd Live - 创建/编辑兴趣点 + 创建或编辑兴趣点 编辑在线资源 正轴等角圆柱投影 储存格式 @@ -3538,4 +3538,28 @@ 请选择另一种颜色。 删除更新 您确认想要删除所有 %s 实时更新吗? + 导入的项目将添加前缀 + 全部替换 + 我的位置和路线之间的最小角度 + 自定义配置文件 + 导入完成 + 已添加项目 + 无法备份配置文件。 + 恢复所有的配置文件设置? + 是否确定要清除录制的数据? + 抽屉 + 上下文菜单操作 + 该点以下的元素用分隔线隔开。 + 这些项目从菜单中被隐藏,但所代表的选项或插件将继续工作。 + 隐藏设置会将其重置为原始状态。 + 只有四个按钮。 + 主要动作 + 滑雪旅游 + 自定义 OsmAnd 插件 + 无法从 \'%1$s\' 中读取。 + 无法写到 \'%1$s\'。 + 无法从 \'%1$s\' 导入。 + 选择轨迹文件 + 需要其他地图才能在地图上查看维基百科兴趣点。 + 操作按钮在选定的配置文件之间切换。 \ No newline at end of file From bcae0a2de52dc5c7f0e60817f26be908bf732118 Mon Sep 17 00:00:00 2001 From: iman Date: Thu, 18 Mar 2021 10:08:22 +0000 Subject: [PATCH 197/250] Translated using Weblate (Persian) Currently translated at 30.2% (82 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/fa/ --- OsmAnd-telegram/res/values-fa/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-telegram/res/values-fa/strings.xml b/OsmAnd-telegram/res/values-fa/strings.xml index 577fea7240..963c3068e6 100644 --- a/OsmAnd-telegram/res/values-fa/strings.xml +++ b/OsmAnd-telegram/res/values-fa/strings.xml @@ -81,5 +81,5 @@ ارسال گزارش برون‌برد بافر لاگ‌کت - لاگ‌های جزئی برنامه را بررسی و هم‌رسانی کنید + لاگ‌های باجزئیات برنامه را بررسی و هم‌رسانی کنید \ No newline at end of file From 92d610751c32daa076420d54c3b9218e2e885688 Mon Sep 17 00:00:00 2001 From: Evgenii Martynenko Date: Sat, 20 Mar 2021 01:12:29 +0000 Subject: [PATCH 198/250] Translated using Weblate (Russian) Currently translated at 99.7% (3885 of 3894 strings) --- OsmAnd/res/values-ru/phrases.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml index cd790de9b7..7b2f28b784 100644 --- a/OsmAnd/res/values-ru/phrases.xml +++ b/OsmAnd/res/values-ru/phrases.xml @@ -467,7 +467,7 @@ Информация Часы Турагентство;Туристическое агентство - Место с хорошим видом;Обзорная площадка + Обзорная площадка;Место с хорошим видом Место для лагеря Ночлег Место для пикника @@ -2785,7 +2785,7 @@ Отсутствуют Исключительно Дорожное зеркало - Вид + Дипломатическое учреждение Консульство Генеральное консульство Почётное консульство From a40ed4a7dd3f83a7f32aa7017dd8f3ce1091962c Mon Sep 17 00:00:00 2001 From: Shjosan Date: Fri, 19 Mar 2021 10:24:19 +0000 Subject: [PATCH 199/250] Translated using Weblate (Swedish) Currently translated at 100.0% (271 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/sv/ --- OsmAnd-telegram/res/values-sv/strings.xml | 270 ++++++++++++++++++++++ 1 file changed, 270 insertions(+) diff --git a/OsmAnd-telegram/res/values-sv/strings.xml b/OsmAnd-telegram/res/values-sv/strings.xml index d5705b8e2d..cbf274305e 100644 --- a/OsmAnd-telegram/res/values-sv/strings.xml +++ b/OsmAnd-telegram/res/values-sv/strings.xml @@ -1,4 +1,274 @@ Senaste uppdatering från Telegram: %1$s + Tidslinje + Direkt nu + Min plats + OsmAnd Tracker låter dig dela din plats och se andras i OsmAnd.

Appen använder Telegram API, så du behöver ett Telegram-konto.
+ sek + min + t + Miles/meter + Distansminuter + Kilomter/meter + Miles/yard + Miles/fot + Distansminuter per timme (knop) + Minuter per mile + Minuter per kilometer + Meter per sekund + Miles per timme + Kilometer per timme + mph + km/h + m/s + di/h + min/km + min/mi + di + m + km + mi + ft + yd + Välkommen + Ange ditt Telegram-telefonnummer i internationellt format + Tillstånd + Aktivera chattar + Visa användare på kartan + Installera OsmAnd + Du måste installera den gratis eller betalda versionen av OsmAnd först + OsmAnd logotyp + OsmAnd Tracker tjänst + Delar plats + Dela plats + Avstånd + OsmAnd Tracker körs i bakgrunden med skärmen av. + Bakgrundsläge + Välj en av platsleverantörerna för att dela din plats. + Aktivera \"Plats\" i systeminställningarna + App saknar behörighet för plats data. + Inställningar + Avbryt + Fortsätt + Du är inte inloggad + Starta \"Platsdelning\"\? + Stänger + Loggar ut + Startar + Logga ut + Logga in + Telegram-lösenord + Ange lösenord + Telegram har skickat en kod till dig för OmsAnd för inloggning till ditt konto. + Autentiseringskod + Ange kod + Lösenord + Telefonnummer i internationellt format + Telefonnummer + OsmAnd Online GPS Tracker + Visa på karta + Platsdelning + Sök: Grupp och kontakt + Välj de kontakter och grupper du vill dela din plats med. + Ange tid + Ställ in tiden att dina valda kontakter och grupper ska se din plats i realtid. + Synlig tid för alla + Bakåt + Dela + Installera + %1$d t + %1$d m + %1$d t %2$d m + Ställ in synlig tid för alla + Ange autentiseringskod + Skriv in telefonnummer + Jag har inget Telegramkonto + Du behöver ett registrerat Telegramkonto och ett telefonnummer + Av + Alla + Efter det kan du använda denna app. + Installera Telegram och registrera ett konto. + Du behöver ett Telegramkonto för att använda platsdelning. + Registrering i Telegram + Bot + Direkt + Öppna OsmAnd + Stäng av platsdelning + Delning är påslagen (stäng av) + Går ut + Delningstid + Plats + Skicka min plats + Ställ in minsta intervall för platsdelning. + Ingen rörelse + Senaste tid en kontakt rört sig. + Platshistorik + Göm kontakter som inte har rört sig inom given tid. + Anslutning till OsmAnd + Välj den OsmAnd-version som OsmAnd Tracker använder för att visa positioner. + i %1$s + Konto + Anlutet konto + Hur man stänger av OsmAnd Tracker från Telegram + Hur man stänger av OsmAnd Tracker från Telegram + För att återkalla platsdelningsåtkomst. Öppna Telegram, gå till Inställningar → Sekretess och säkerhet → Sessioner och avsluta OsmAnd Tracker-sessionen. + Stäng + Anslut till internet för att logga ut ordentligt från Telegram. + Grupp + Senaste svar + sedan + Utgång + Stäng av allt + Inaktivera all delning + Stäng av platsdelning i alla valda chatter (%1$d). + Välj OsmAnd version att använda + Välj OsmAnd version där kontakter kommer att visas på kartan. + Sortera efter + Sortera + Efter grupp + Efter namn + Avstånd + Namn + Logga ut från OsmAnd Tracker\? + Är du säker på att du vill logga ut från OsmAnd Tracker så att du inte kan dela plats eller se andras plats\? + Kontakter och grupper delar plats med dig. + Dela plats som + Lägg till enhet + Spara + Inaktivera + Ingen internet-anslutning + Ingen GPS-anslutning + Status + Aktiverat + Delar: %1$s + Delar status + Senaste tillgängliga plats + Skicka plats igen + Hittades inte än + Inte skickat än + Senare + Gå till inställningar + Delar i bakgrunden + Stäng av batterioptimering för OsmAnd Tracker så att den inte plötsligt stängs av i bakgrunden. + Bakgrundsarbete + Ändra batterioptimeringsinställningarna för att stabilisera platsdelning. + Ansluter till internet + Positionering … + Startar + Skickar plats + Väntar på svar från Telegram + Inte möjligt att skicka till Telegram-chattar: + Skickades och uppdaterades + Senast uppdaterad plats: + Om du vill ansluta flera enheter till ett telegramkonto måste du använda olika enheter för att dela din plats. + Du kan skapa och visa enhets-ID i Telegram-klienten genom att använda %1$s chatt-bot. %2$s + Göm + Enhetsnamn + Enhetsnamn kan inte vara tomt + Enhetsnamn för långt + Namnge din nya enhet med max 200 symboler. + Kunde inte lägga till ny enhet + Lägg till + %1$s tillagt. + Välj ett namn som du inte redan har använt + Senaste uppdatering från Telegram + Karta och text + Text + Karta + Välj hur meddelanden med din plats ska se ut. + Skicka plats som + Start datum + Slutdatum + Visa i OsmAnd + Genomsnittlig hastighet + Genomsnittlig höjd + Rörelse tid + Övervakning är inaktiverad + Övervakning är aktiverad + Skickat + GPS-punkter + Samlade + Datum + %1$d punkter + skicka (%1$d i buffer) + Uppdatering + var snäll uppdatera OsmAnd för att visa data på kartan + Visa antal samlade och skickade GPS-punkter. + Visa GPS-punkter + Utseende + Fick GPX-punkter: %1$s + Hur det fungerar + OsmAnd integritetspolicy + Telegram integritetspolicy + Acceptera + Genom att klicka på \"Fortsätt\" godkänner du villkoren i Telegram- och OsmAnds integritetspolicy. + OsmAnd tracker är en av klienterna som använder Telegram öppen plattform. Dina kontakter kan använda vilken Telegram-klient som helst. + Telegram (meddelandeappen) används för att ansluta och kommunicera med människor. + Telegram + OsmAnd Tracker + Aktivera övervakning för att spara alla platser i historiken. + Platsinspelning aktiverad + Deaktivera övervakning + Tidslinje är nu tillgängligt utan extra kostnad. + OK + Sök + Skriv kontakt eller gruppnamn + Sök i alla dina grupper och kontakter. + Sök kontakter + Riktning + Höjd över havet + Precision + Riktning + Integritet + Proxy + Proxy-inställningar + Frånkopplad + Ansluten + Proxy-typ + Aktivera + Anslutning + Server + Port + Referenser + Användarnamn + Lösenord + Nyckel + GPX-inställningar + Filter: ingen loggning under valda hastigheten + Minsta loggningshastighet + Filter: ingen loggning utan att nogranheten är nodd + Minsta loggningsnoggrannhet + Filter: minsta avstånd för att logga en ny punkt + Minsta loggningsavstånd + Välj + Ingen data + Vi har inget sparad data för den valda dagen + Start - Slut datum + Välj tid att visa + Verkställ + Start + Slut + Sparade meddelanden + Enhet för hastighet + Definera enhet för hastighet. + Enhet för längd + Ändra vad avstånd mäts i. + Enheter & format + Tidszon + Välj tidszon som ska visas i dina platsmeddelanden. + Buffertens utgångstid + Maximal tid att lagra poäng i bufferten + OsmAnd Tracler status + Förslagen + Tillbaka till OsmAnd + %1$s sedan + Senaste svar: %1$s sedan + Senaste uppdatering från Telegram: %1$s sedan + Senast response: %1$s + ERR + Export + Logcat buffer + Kontrollera och dela detaljerade loggar för appen + Skicka rapport
\ No newline at end of file From 2b3fc8e809305d4d227244ce4b1b80fff353ec25 Mon Sep 17 00:00:00 2001 From: Evgenii Martynenko Date: Sat, 20 Mar 2021 13:17:18 +0000 Subject: [PATCH 200/250] Translated using Weblate (Russian) Currently translated at 99.8% (3681 of 3685 strings) --- OsmAnd/res/values-ru/strings.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 4c17c33453..307ddf07bc 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -3902,7 +3902,7 @@ \n \n• Добавлен OAuth метод аутентификации для OpenStreetMap, улучшен интерфейс диалоговых OSM. \n -\n • Поддержка пользовательских цветов для избранного и путевых точек трека. +\n• Поддержка пользовательских цветов для избранных и путевых точек. \n \n
Скопировать адрес @@ -4037,4 +4037,6 @@ Копировать имя POI Интервал Скрыть природный заповедник, особо охраняемые природные территории и границы национального парка + «Отслеживаемый» означает, что трек не будет виден в любых общедоступных списках, но обработанные точки из него будут доступны через public GPS API c временными отметками. Другие пользователи смогут лишь загружать обработанные точки из вашего трека. При этом трек не будет ассоциирован с вами. + «Идентифицируемый» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступным на закладке GPS-треки. Другие пользователи смогут загрузить данные трека и в свойствах трека будет указано имя пользователя, загрузившего трек. Отметки времени точек трека доступны через public GPS API. \ No newline at end of file From 947204be3fe2050c01d6a4973e212988f556f64e Mon Sep 17 00:00:00 2001 From: Filip Czaplicki Date: Sat, 20 Mar 2021 14:46:51 +0100 Subject: [PATCH 201/250] README.md: remove extra p closing tag --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 83dbde7b9a..207a545740 100644 --- a/README.md +++ b/README.md @@ -124,4 +124,3 @@ Tokelau, Tonga, Trinidad and Tobago, Tunisia, Turkey, Turkmenistan, Tuvalu, Ugan Ukraine, United Arab Emirates, United Kingdom (UK), United States of America (USA), Uruguay, Uzbekistan, Vanuatu, Venezuela, Vietnam, Wallis and Futuna, Western Sahara, Yemen, Zambia, Zimbabwe. -

From 590d6392a2a4f14b344d93eb864f376a5102174f Mon Sep 17 00:00:00 2001 From: Evgenii Martynenko Date: Sat, 20 Mar 2021 13:19:32 +0000 Subject: [PATCH 202/250] Translated using Weblate (Russian) Currently translated at 99.9% (3683 of 3685 strings) --- OsmAnd/res/values-ru/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 307ddf07bc..8243817771 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -4039,4 +4039,6 @@ Скрыть природный заповедник, особо охраняемые природные территории и границы национального парка «Отслеживаемый» означает, что трек не будет виден в любых общедоступных списках, но обработанные точки из него будут доступны через public GPS API c временными отметками. Другие пользователи смогут лишь загружать обработанные точки из вашего трека. При этом трек не будет ассоциирован с вами. «Идентифицируемый» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступным на закладке GPS-треки. Другие пользователи смогут загрузить данные трека и в свойствах трека будет указано имя пользователя, загрузившего трек. Отметки времени точек трека доступны через public GPS API. + «Общедоступный» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступным на закладке GPS-треки. Отметки времени точек трека не доступны через public GPS API. Однако, другие пользователи по-прежнему могут загрузить файл трека из общего списка треков и данные трека будут иметь все отметки времени. + «Частный» означает, что трек не будет виден в любых общедоступных списках, но точки из него будут доступны через public GPS API без отметок времени. \ No newline at end of file From 0bf8f357569eb469000d924a44b7cb62c42fd985 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Sat, 20 Mar 2021 18:54:27 +0300 Subject: [PATCH 203/250] Fix crash --- OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java index 95d599fb56..c55fb675fd 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java @@ -927,7 +927,11 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM } } + @Nullable public static Pair findPointsNearSegment(RotatedTileBox tb, List points, int r, int mx, int my) { + if (Algorithms.isEmpty(points)) { + return null; + } WptPt prevPoint = points.get(0); int ppx = (int) tb.getPixXFromLatLon(prevPoint.lat, prevPoint.lon); int ppy = (int) tb.getPixYFromLatLon(prevPoint.lat, prevPoint.lon); From c6d66c81ad8c189c95eecf48d8a0e8c4d84572fd Mon Sep 17 00:00:00 2001 From: max-klaus Date: Sat, 20 Mar 2021 21:16:45 +0300 Subject: [PATCH 204/250] Fix #11205 --- OsmAnd/src/net/osmand/plus/track/TrackPointsCard.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/track/TrackPointsCard.java b/OsmAnd/src/net/osmand/plus/track/TrackPointsCard.java index fe824bafc8..7af804ef84 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackPointsCard.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackPointsCard.java @@ -184,7 +184,13 @@ public class TrackPointsCard extends BaseCard implements OnChildClickListener, O } private List getDisplayGroups() { - return selectedGroup != null ? Collections.singletonList(selectedGroup) : getOriginalGroups(); + if (selectedGroup != null) { + List res = new ArrayList<>(); + res.add(selectedGroup); + return res; + } else { + return getOriginalGroups(); + } } @Override From a8d0d60381fe57fe6b69b096c6953038b4a5501b Mon Sep 17 00:00:00 2001 From: solokot Date: Sat, 20 Mar 2021 14:28:24 +0000 Subject: [PATCH 205/250] Translated using Weblate (Russian) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-ru/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 8243817771..17f9218ad8 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -4041,4 +4041,6 @@ «Идентифицируемый» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступным на закладке GPS-треки. Другие пользователи смогут загрузить данные трека и в свойствах трека будет указано имя пользователя, загрузившего трек. Отметки времени точек трека доступны через public GPS API. «Общедоступный» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступным на закладке GPS-треки. Отметки времени точек трека не доступны через public GPS API. Однако, другие пользователи по-прежнему могут загрузить файл трека из общего списка треков и данные трека будут иметь все отметки времени. «Частный» означает, что трек не будет виден в любых общедоступных списках, но точки из него будут доступны через public GPS API без отметок времени. + Выберите цель, чтобы проложить к ней короткий, быстрый или безопасный маршрут + Удалить %1$d файлов\? \ No newline at end of file From 8168fcde22c10bbd8236ccd4751a438b113e34ac Mon Sep 17 00:00:00 2001 From: iman Date: Sat, 20 Mar 2021 15:49:44 +0000 Subject: [PATCH 206/250] Translated using Weblate (Persian) Currently translated at 99.9% (3682 of 3685 strings) --- OsmAnd/res/values-fa/strings.xml | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/OsmAnd/res/values-fa/strings.xml b/OsmAnd/res/values-fa/strings.xml index 656bb3afc8..ff02ab8a68 100644 --- a/OsmAnd/res/values-fa/strings.xml +++ b/OsmAnd/res/values-fa/strings.xml @@ -1275,7 +1275,7 @@ همه راه‌نشان‌ها هشدارهای ترافیکی - نقاط علاقه‌مندی نزدیک + علاقه‌مندی‌های نزدیک نقاط توجه نزدیک آیا نقشه‌های ناموجود را دانلود می‌کنید %1$s ‏(%2$d مگابایت)؟ بیشتر… @@ -2400,16 +2400,16 @@ برنامهٔ OsmAnd (مخفف OSM Automated Navigation Directions به‌معنی راهنمای خودکار ناوبری بر پایهٔ OSM) یک نرم‌افزار نقشه و ناوبری است که به گسترهٔ وسیعی از دادهٔ OSM دسترسی دارد. این دادهٔ رایگان و جهانی با بالاترین کیفیت ارائه می‌شود. \n \nناوبری دیداری و شنیداری، مشاهدهٔ نقاط توجه (POIها یا Points of interest)، ایجاد و مدیریت ردهای GPX، استفاده از تصویرسازی منحنی‌های میزان و اطلاعات ارتفاع (با استفاده از افزونه)، انتخاب حالت‌های پیاده، دوچرخه، خودرو، امکان ویرایش مکان‌ها و... چیزهایی هستند که تجربهٔ مؤثر و لذت‌بخشی در کار با نقشه را برایتان به ارمغان می‌آورند. - ناوبری با GPS -\n • امکان انتخاب بین حالت آنلاین و آفلاین؛ در حالت آفلاین هزینهٔ دیگری بابت اینترنت نمی‌پردازید و در حالت آنلاین عملکرد سریع‌تری را تجربه می‌کنید -\n • راهنمای گام‌به‌گام گفتاری که در پیمودن مسیر راهنمایی‌تان می‌کند (با پیام‌های گفتاری انسانی و ماشینی) -\n • اگر از مسیر منحرف شوید، مسیر جدیدی برایتان پیدا می‌کند -\n • راهنمای خطوط عبوری، نام خیابان‌ها و زمان تخمینی رسیدن را دریافت می‌کنید که در طول مسیر راهنمای شماست -\n • برای داشتن سفری ایمن‌تر، حالات شب/روز به‌صورت خودکار انتخاب می‌شود -\n • اعلام محدودیت‌های سرعت را فعال کنید تا در صورت تجاوز از سرعت مجاز به شما هشدار دهد -\n • زوم نقشه متناسب با سرعتتان تنظیم می‌شود -\n • با استفاده از نشانی، نوع مکان (مثلاً پارکینگ، رستوران، هتل، پمپ گاز، موزه) یا مختصات جغرافیایی به جست‌وجو بپردازید -\n • نقاط بین‌راهی مسیرتان را مشخص کنید + ناوبری با GPS +\n • امکان انتخاب بین حالت آنلاین و آفلاین؛ در حالت آفلاین هزینهٔ دیگری بابت اینترنت نمی‌پردازید و در حالت آنلاین عملکرد سریع‌تری را تجربه می‌کنید +\n • راهنمای گام‌به‌گام گفتاری که در پیمودن مسیر راهنمایی‌تان می‌کند (با پیام‌های گفتاری انسانی و ماشینی) +\n • اگر از مسیر منحرف شوید، مسیر جدیدی برایتان پیدا می‌کند +\n • راهنمای خطوط عبوری، نام خیابان‌ها و زمان تخمینی رسیدن را دریافت می‌کنید که در طول مسیر راهنمای شماست +\n • برای داشتن سفری ایمن‌تر، حالات شب/روز به‌صورت خودکار انتخاب می‌شود +\n • اعلام محدودیت‌های سرعت را فعال کنید تا در صورت تجاوز از سرعت مجاز به شما هشدار دهد +\n • زوم نقشه متناسب با سرعتتان تنظیم می‌شود +\n • با استفاده از نشانی، نوع مکان (مثلاً پارکینگ، رستوران، هتل، پمپ گاز، موزه) یا مختصات جغرافیایی به جست‌وجو بپردازید +\n • پشتیبانی از نقاط میانی در برنامه‌ریزی سفر \n • رد خودتان را ثبت کنید یا یک رد GPX را دانلود و آن را دنبال کنید \n مسافت اصلاح‌شده @@ -2492,12 +2492,12 @@ \n • جنوبگان: * \nبا این نرم‌افزار نقشهٔ بیشتر مناطق جهان را خواهید یافت! \nاز یک مسیریاب معتبر و قابل‌اعتماد استفاده کنید. هر کجا که هستید؛ در فرانسه، آلمان، انگلستان، مکزیک، آمریکا، هلند، ایران، روسیه، برزیل یا هر جای دیگر، فرقی نمی‌کند. - ناوبری -\n • امکان انتخاب بین حالت آنلاین (سریع) و آفلاین (بدون هزینهٔ اضافی بابت اینترنت) -\n • راهنمای گام‌به‌گام گفتاری (پیام‌های گفتاری انسانی و ماشینی) -\n • راهنمای خطوط عبوری، نام خیابان‌ها و زمان تخمینی رسیدن -\n • پشتیبانی از نقاط بین‌راهی مسیر -\n • اگر از مسیر منحرف شوید، مسیر جدیدی برایتان پیدا می‌کند + ناوبری +\n • امکان انتخاب بین حالت آنلاین (سریع) و آفلاین (بدون هزینهٔ اضافی بابت اینترنت) +\n • راهنمای گام‌به‌گام گفتاری (پیام‌های گفتاری انسانی و ماشینی) +\n • راهنمای خطوط عبوری، نام خیابان‌ها و زمان تخمینی رسیدن +\n • پشتیبانی از نقاط میانی در برنامه‌ریزی سفر +\n • اگر از مسیر منحرف شوید، مسیر جدیدی برایتان پیدا می‌کند \n • جست‌وجو با استفاده از نشانی، نوع مکان (مثلاً پارکینگ، رستوران، هتل، پمپ گاز، موزه) یا مختصات جغرافیایی پوشش و کیفیت تقریبی نقشه: \nاروپای غربی: **** @@ -3770,7 +3770,7 @@ مشخص کنید نقطه‌ها با خط مستقیم به هم وصل شوند یا مسیر بینشان مطابق تنظیمات زیر محاسبه شود. تمام رد پارهٔ بعدی - در ادامه برای استفاده از این گزینه، با یکی از پروفایل‌های ناوبری‌تان رد خود را به نزدیک‌ترین جادهٔ مجاز بچسبانید. + در ادامه، رد خود را به نزدیک‌ترین جادهٔ مجاز متناسب با یکی از پروفایل‌های ناوبری‌تان بچسبانید، تا از این گزینه استفاده کنید. پروفایل ناوبری یک فایل رد انتخاب کنید تا پارهٔ جدید را به آن بیفزایید. تصاویر سطح خیابان @@ -3820,7 +3820,7 @@ موتور پرشی اسکوتر موتوری ویلچر رو به جلو - فاصله آستانه + فاصلهٔ آستانه نمادهای ابتدا و انتها راه‌های پیاده از راه‌های پیاده پرهیز می‌کند @@ -3997,7 +3997,7 @@ خودرو محدودیت‌های جاده که اکنون روی نقشه فعال هستند را لحاظ کن هدف رانندگی را انتخاب نمایید تا مسیری کوتاه‌تر، سریع‌تر یا ایمن‌تر دریافت کنید - اگر سرعت پایین‌تر از حدی است نمای نقشه را نچرخان + اگر سرعت پایین‌تر از مقدار زیر بود، نمای نقشه را نچرخان همهٔ مناطق %1$d فایل را حذف می‌کنید؟ توقف بدون ذخیره‌سازی From 2f874ae448fffa87f948a035cabdcea2cd602e65 Mon Sep 17 00:00:00 2001 From: Ajeje Brazorf Date: Sat, 20 Mar 2021 17:14:24 +0000 Subject: [PATCH 207/250] Translated using Weblate (Sardinian) Currently translated at 99.4% (3665 of 3685 strings) --- OsmAnd/res/values-sc/strings.xml | 46 +++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-sc/strings.xml b/OsmAnd/res/values-sc/strings.xml index d00dbd0aab..f2fdc6c6d8 100644 --- a/OsmAnd/res/values-sc/strings.xml +++ b/OsmAnd/res/values-sc/strings.xml @@ -1370,7 +1370,7 @@ Impossìbile iscarrigare. Pro praghere còmpida sa connessione tua pro sighire. Totu sos iscarrigamentos Agiornamentos - Iscarrigadas + Installadas Zona In diretzione Nord In diretzione Est @@ -2163,7 +2163,6 @@ Curvas de profondidade nàuticas Ammustra sas lìnias de profondidade. Imprea sos datos de s\'artària - Istile de ghia Artària de su caminu Falada @@ -3163,7 +3162,7 @@ Paràmetros de su veìculu Sos annùntzios vocales benint riproduidos petzi durante sa navigatzione. Istrutziones e annùntzios de navigatzione - Annùntzios vocales + Indicatziones vocales Avisos in s\'ischermu Cunfigura sos paràmetros de s\'àndala Paràmetros de s\'àndala @@ -4002,4 +4001,45 @@ Foras de camineras Moto Màchina + Ischerta sos segmentos + %1$s cuntenet prus de unu segmentu. Depes ischertare sa parte chi serbit pro sa navigatzione. + Segmentu %1$d + Imprea sas restritziones de sos caminos chi sunt ativas como in sa mapa + Àndala prus curtza otimizada (rispàrmiu energèticu) + Ischerta sa modalidade pro sa ghia pro otènnere un\'àndala prus curtza, prus lestra o prus segura + S\'icona de sa positzione atuale s\'at a ligare a s\'àndala de navigatzione atuale + Non rodes sa vista de sa mapa si sa lestresa est in suta de unu lìmite + Torra a incumintzare + Totu sas regiones + Iscantzellare %1$d documentos\? + Acabba chene sarvare + Sarva e acabba sa registratzione + Registratzione de sa rasta firmada + Ses seguru de chèrrere acabbare cun sa registratzione\? +\nTotu sos datos non sarvados s\'ant a pèrdere. + In pàusa + Pro aplicare unas cantas impostatziones diat pòdere èssere netzessàriu torrare a allùghere s\'aplicatzione. + Su càrculu de s\'àndala diat pòdere evitare artziadas mannas. + Unu butone pro ammustrare o cuare su widget de sas coordinadas in sa mapa. + Ùrtimu agiornamentu de OpenStreetMap a disponimentu: + Agiornadu: %s + Ùrtima verìfica: %s + Frecuèntzia de sos agiornamentos + Sos agiornamentos de sa mapa ant a èssere verificados cada chida. Sa borta chi benit: %1$s in %2$s. + Sos agiornamentos de sa mapa ant a èssere verificados cada die. Sa borta chi benit: %1$s in %2$s. + Sos agiornamentos de sa mapa ant a èssere verificados cada ora. Sa borta chi benit: %1$s in %2$s. + Iscantzella sos agiornamentos + Ses seguru de chèrrere iscantzellare totu sos %s agiornamentos in direta\? + Ischerta una categoria o annanghe·nde una noa + Sa registratzione at a sighire. + Còpia su nùmene de su PDI + Ammustra/cua + Intervallu + Cua sas làcanas de sas riservas naturales, de sas àreas amparadas e de sos parcos natzionales + Làcanas naturales + Sa rasta non cuntenet datos de artària. + Sa rasta non cuntenet datos de lestresa. + Ischerta un\'àtera casta de coloratzione. + Còmporas + Distàntzia pro tocu \ No newline at end of file From 34d0d6e8d4fb85a77eaa0f68739c492477681dbf Mon Sep 17 00:00:00 2001 From: ace shadow Date: Sat, 20 Mar 2021 19:08:36 +0000 Subject: [PATCH 208/250] Translated using Weblate (Slovak) Currently translated at 96.0% (3740 of 3894 strings) --- OsmAnd/res/values-sk/phrases.xml | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/OsmAnd/res/values-sk/phrases.xml b/OsmAnd/res/values-sk/phrases.xml index da5fec65f7..8cb67c413d 100644 --- a/OsmAnd/res/values-sk/phrases.xml +++ b/OsmAnd/res/values-sk/phrases.xml @@ -3704,4 +3704,40 @@ Hlbinná psychológia Chiropraxia Pôrodníctvo (postnatálne) + Radarová veža + Malé odpočívadlo + Prístrešky + Na streche + Bod GPX + Vrcholová kniha: nie + Vrcholová kniha: áno + Stav zjazdovky: zatvorená + Stav zjazdovky: otvorená + Strážené: nie + Strážené: áno + Názov zjazdovky + Lyžiarsky skok + Netopierí tunel + Netopierí most + Ekodukt + Plavecká zóna + Miesto na pranie šiat + Prekladisko odpadu + Sídlo lesnej správy + Jazero + Rieka + Studňa + Poháňané čerpadlo + Vodná nádrž + Kohútik + Vodáreň + Potrubná studňa + Očkovanie: COVID19 + Očkovanie + Stanica záchranárov + Siréna + Číslo nástupišťa + Geodet + Konferenčné centrum + Horský žľab \ No newline at end of file From fa254ad6904fd09353293a8110487f28a92d6df2 Mon Sep 17 00:00:00 2001 From: Franco Date: Sat, 20 Mar 2021 19:17:21 +0000 Subject: [PATCH 209/250] Translated using Weblate (Spanish (Argentina)) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-es-rAR/strings.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml index 4646f1e575..08ecee8769 100644 --- a/OsmAnd/res/values-es-rAR/strings.xml +++ b/OsmAnd/res/values-es-rAR/strings.xml @@ -4032,9 +4032,9 @@ Actualizado: %s Última comprobación: %s Frecuencia de actualización - Las actualizaciones del mapa serán comprobadas cada semana. La próxima vez %1$s en %2$s. - Las actualizaciones del mapa serán comprobadas cada día. La próxima vez %1$s en %2$s. - Las actualizaciones del mapa serán comprobadas cada hora. La próxima vez %1$s en %2$s. + Las actualizaciones del mapa serán comprobadas cada semana. Próxima vez el %1$s a las %2$s hs. + Las actualizaciones del mapa serán comprobadas cada día. Próxima vez el %1$s a las %2$s hs. + Las actualizaciones del mapa serán comprobadas cada hora. Próxima vez el %1$s a las %2$s hs. Borrar actualizaciones ¿Borrar todas las actualizaciones en vivo de «%s»\? Compras @@ -4045,4 +4045,6 @@ La traza no contiene datos de altitud. La traza no contiene datos de velocidad. Elige otro tipo de color. + Fronteras naturales + Oculta fronteras de reservas naturales, áreas protegidas y parques nacionales \ No newline at end of file From 3d36bccaf65d86a3dd10668c8332eff734347dfd Mon Sep 17 00:00:00 2001 From: Eduardo Addad de Oliveira Date: Sat, 20 Mar 2021 20:18:26 +0000 Subject: [PATCH 210/250] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-pt-rBR/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-pt-rBR/strings.xml b/OsmAnd/res/values-pt-rBR/strings.xml index 543748fcb5..5cb9de5bb1 100644 --- a/OsmAnd/res/values-pt-rBR/strings.xml +++ b/OsmAnd/res/values-pt-rBR/strings.xml @@ -4038,4 +4038,6 @@ A trilha não contém dados de altitude. A trilha não contém dados de velocidade. Selecione outro tipo de colorização. + Limites naturais + Segmento %1$d \ No newline at end of file From c6731760dd70539311250c9b449db79fc62a2711 Mon Sep 17 00:00:00 2001 From: Eduardo Addad de Oliveira Date: Sat, 20 Mar 2021 20:17:53 +0000 Subject: [PATCH 211/250] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (3894 of 3894 strings) --- OsmAnd/res/values-pt-rBR/phrases.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-pt-rBR/phrases.xml b/OsmAnd/res/values-pt-rBR/phrases.xml index 37cd897bcd..560f405680 100644 --- a/OsmAnd/res/values-pt-rBR/phrases.xml +++ b/OsmAnd/res/values-pt-rBR/phrases.xml @@ -3892,4 +3892,6 @@ Nome da pista Salto de esqui Centro de conferências + Geodesia + Geodesia \ No newline at end of file From f7b74ce0a2e8e209abd219c13e907a686a4a4dee Mon Sep 17 00:00:00 2001 From: Franco Date: Sat, 20 Mar 2021 19:25:55 +0000 Subject: [PATCH 212/250] Translated using Weblate (Spanish (American)) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-es-rUS/strings.xml | 65 +++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 12 deletions(-) diff --git a/OsmAnd/res/values-es-rUS/strings.xml b/OsmAnd/res/values-es-rUS/strings.xml index 8bc855c80d..1669ea5037 100644 --- a/OsmAnd/res/values-es-rUS/strings.xml +++ b/OsmAnd/res/values-es-rUS/strings.xml @@ -380,10 +380,10 @@ No se ha encontrado un desvío Actualización disponible para %1$s mapa(s) Encender pantalla - Accede a tantos tipos de mapas en línea (llamados teselas o ráster) que desees, desde teselas predefinidas de OSM (como Mapnik) a imágenes satelitales y capas de propósito especial como mapas del tiempo, mapas del clima, mapas geológicos, capas de sombreado, etc. -\n -\nCualquiera de estos mapas puede usarse como el mapa predefinido que se mostrará, o como una superposición o subyacencia de otro mapa base (como los mapas estándar de OsmAnd en línea). Ciertos elementos de los mapas vectoriales de OsmAnd pueden ocultarse a través del menú «Configurar mapa» para hacer cualquier subyacencia mas visible. -\n + Accede a tantos tipos de mapas en línea (llamados teselas o ráster) que desees, desde teselas predefinidas de OSM (como Mapnik) a imágenes satelitales y capas de propósito especial como mapas meteorológicos, mapas del clima, mapas geológicos, capas de sombreado, etc. +\n +\nCualquiera de estos mapas puede usarse como el mapa predefinido que se mostrará, o como una superposición o subyacencia de otro mapa base (como los mapas estándar de OsmAnd en línea). Ciertos elementos de los mapas vectoriales de OsmAnd pueden ocultarse a través del menú «Configurar mapa» para hacer cualquier subyacencia mas visible. +\n \nDescarga las teselas de los mapas directamente en línea, o prepáralo para su uso sin conexión (copiar manualmente en la carpeta de datos OsmAnd) como una base de datos SQLite que puede ser producida por una variedad de herramientas de preparación de mapas de terceros. Activa la funcionalidad para registrar y guardar tus trazas manualmente pulsando el widget de grabación GPX en el mapa, o automáticamente registrando todas tus rutas navegadas en un archivo GPX. \n @@ -418,7 +418,7 @@ Registra dónde se ha estacionado el automóvil, incluyendo cuánto tiempo queda. \n Tanto la ubicación como el tiempo del estacionamiento se muestran en el menú principal y en un widget sobre el mapa. Se puede añadir una alarma de recordatorio al calendario de Android. Crea caminos pulsando el mapa, usando o modificando archivos GPX existentes, para planificar un viaje y medir la distancia entre puntos. El resultado puede guardarse como un archivo GPX y usarse luego para la orientación. - Activa las funciones de accesibilidad del dispositivo, directamente en OsmAnd. Facilita por ejemplo, el ajuste de la velocidad de la voz para voces de texto a voz, la configuración de navegación D-pad, usando la rueda de desplazamiento para el control del zoom, o la retroalimentación de texto a voz, por ejemplo, para anunciar la ubicación automáticamente. + Activa las funciones de accesibilidad del dispositivo, directamente en OsmAnd. Facilita por ejemplo, el ajuste de la velocidad de la voz para voces de texto a voz, la configuración de navegación del pad direccional, usando la rueda de desplazamiento para el control del zoom, o la retroalimentación de texto a voz, por ejemplo, para anunciar la ubicación automáticamente. Haz contribuciones en OSM, como el crear o modificar objetos PDI, abrir o comentar notas de OSM y contribuir con archivos de trazas GPX grabados en OsmAnd, proporcionando tu nombre de usuario y contraseña. OpenStreetMap.org es un proyecto de mapeo de dominio público, global, libre e impulsado por la comunidad. Ajusta las funciones de desarrollo y depuración, como la simulación de navegación, el rendimiento del renderizado o las indicaciones por voz. Destinado para desarrolladores, no es necesario para el normal uso de la aplicación. Descargar el mapa especial sin conexión para mostrar las instalaciones de esquí. @@ -1057,7 +1057,7 @@ Suburbio Aldea Villa - Pueblo + Ciudad pequeña Ciudad Parar simulación Iniciar simulación @@ -1662,7 +1662,7 @@ Navegación Ejecutar en modo reposo Información del favorito - Añadir a Favoritos + Añadir favorito Caminos Define la unidad de velocidad. Unidad de velocidad @@ -2667,7 +2667,7 @@ Wikiviajes Artículos de Wikiviajes en todo el mundo La página sólo está disponible en línea. ¿Abrirla en el navegador web? - Caché de imágenes + Almacén de imágenes Borrar historial de búsquedas Mostrar imágenes No @@ -3301,7 +3301,7 @@ Elegir el color Los perfiles predefinidos de OsmAnd no se pueden borrar, sino desactivar (en la pantalla anterior) u ordenarse en la parte inferior. Editar perfiles - El «Tipo de navegación» rige la forma en que se calculan las rutas. + El «Tipo de navegación» determina cómo se calculan las rutas. Aspecto del perfil Icono, color y nombre Editar la lista de perfiles @@ -3530,7 +3530,7 @@ Buscar por tipos de PDI Regla radial Acción rápida - Compras de OsmAnd + Compras en OsmAnd El pago será cargado a la cuenta de Google Play al confirmar la compra. \n \nLa suscripción se renueva automáticamente a menos que se cancele antes de la fecha de renovación. Se le cobrará a su cuenta el período de renovación (mes/trimestre/año) sólo en la fecha de renovación. @@ -3561,7 +3561,7 @@ Kirguís Kazajo Javanés - Gujarati + Gujaratí Chuvash Checheno Bávaro @@ -3905,7 +3905,7 @@ Añadir nuevo segmento %1$s * %2$s Alemán (casual) - Avión ligero + Aeronave ligera Usado por última vez Preferir rutas de senderismo Prefiere rutas de senderismo @@ -4006,4 +4006,45 @@ Senderismo Bicicleta Automóvil + Elegir segmentos + «%1$s» contiene más de un segmento, debe marcar la parte necesaria para la navegación. + Segmento %1$d + Usar las restricciones viales que están activas ahora en el mapa + Ruta optimizada más corta (bajo consumo) + Elige el propósito de la conducción para obtener la ruta más corta, más rápida o más segura + El icono de la ubicación actual se ajustará a la ruta de navegación actual + No girar la vista del mapa si la velocidad es inferior a un umbral + Reiniciar + Todas las regiones + ¿Borrar %1$d archivos\? + Parar sin guardar + Guardar y parar la grabación + Grabación de la traza detenida + ¿Dejar de grabar\? +\nTodos los datos no guardados se perderán. + En pausa + Es necesario reiniciar la aplicación para aplicar algunos ajustes. + La ruta podría evitar las fuertes subidas. + Alternar para mostrar u ocultar el widget de coordenadas en el mapa. + Distancia al pulsar + Última actualización de OpenStreetMap disponible: + Actualizado: %s + Última comprobación: %s + Frecuencia de actualización + Las actualizaciones del mapa serán comprobadas cada semana. Próxima vez el %1$s a las %2$s hs. + Las actualizaciones del mapa serán comprobadas cada día. Próxima vez el %1$s a las %2$s hs. + Las actualizaciones del mapa serán comprobadas cada hora. Próxima vez el %1$s a las %2$s hs. + Borrar actualizaciones + ¿Borrar todas las actualizaciones en vivo de «%s»\? + Compras + Marca una categoría o añade una nueva + La grabación continuará. + Copiar nombre del PDI + Mostrar/Ocultar + Intervalo + Oculta fronteras de reservas naturales, áreas protegidas y parques nacionales + Fronteras naturales + La traza no contiene datos de altitud. + La traza no contiene datos de velocidad. + Elige otro tipo de color. \ No newline at end of file From c129ef5ce71bcacf5f8f149affd9652d05475a06 Mon Sep 17 00:00:00 2001 From: Liu Tao Date: Sat, 20 Mar 2021 16:47:42 +0000 Subject: [PATCH 213/250] Translated using Weblate (Chinese (Simplified)) Currently translated at 85.2% (3142 of 3685 strings) --- OsmAnd/res/values-zh-rCN/strings.xml | 251 +++++++++++++++++---------- 1 file changed, 159 insertions(+), 92 deletions(-) diff --git a/OsmAnd/res/values-zh-rCN/strings.xml b/OsmAnd/res/values-zh-rCN/strings.xml index 3e325159f3..8c7ed3af42 100644 --- a/OsmAnd/res/values-zh-rCN/strings.xml +++ b/OsmAnd/res/values-zh-rCN/strings.xml @@ -149,8 +149,8 @@ 离线编辑 始终使用离线编辑。 正在上传… - 上传修改OSM - 删除修改 + 上传编辑到 OSM + 删除编辑 所有上传 免费版 北美 @@ -166,8 +166,8 @@ 大洋洲 全球和专题地图 全球维基百科的POI - 语音包(录制,功能有限) - 语音包(TTS合成,优先选用) + 语音提示(录音,功能有限) + 语音提示(TTS,首选) 维基百科(离线) 用户自定义 用户配置文件 @@ -186,7 +186,7 @@ 城市 升级OsmAnd+ 重命名 - 上传GPX文件OSM社区。它们将被用于改善地图。 + 将 GPX 文件上传到 OSM 社区,改进地图。 发送到OSM 朋友 @@ -195,11 +195,11 @@ 类别 谢谢,不用了 渲染调试信息 - 反向GPX方向 + 反转轨迹方向 在没有连接到互联网的情况下,无法进行操作。 下一页 上一页 - 更改长度单位。 + 改变测量的距离。 长度单位 英里/英尺 英里/码 @@ -251,7 +251,7 @@ 导入 发送报告 任何 - 由于Yandex的交通信息。 + 感谢 Yandex 提供交通信息。 Yandex的流量 路线 收藏 @@ -269,7 +269,7 @@ 后来 下载区域 - 正在搜索信号… + 等待信号…… 竖屏 横屏 屏幕方向 @@ -292,9 +292,9 @@ 无法保存 GPX 文件。 你已到达。 无效的座标 - 回到OsmAnd地图 + 返回地图 关闭 - 将GPX轨迹保存到SD卡… + 保存 GPX 文件…… 成品 使用互联网计算路线。 使用在线导航 @@ -351,18 +351,18 @@ 版本: 关于 版本信息,许可证,项目成员 - 过期(分钟):%1$s + 到期时间(分钟): %1$s 可下载:%1$s 最大显示级别:%1$s 最小显示级别:%1$s 地图瓦片数据:%1$s 地图瓦片数据源 %1$s 已成功保存 - 椭圆墨卡托 + 椭圆墨卡托投影 最大显示级别 - 过期(分钟) + 到期时间(分钟) 最小显示级别 URL - 选择已有来源… + 选择现有的…… 定义/编辑… FPS 调试信息 选择驾驶区域:美国、欧洲、英国、亚洲等。 @@ -370,14 +370,14 @@ 日本 美国 加拿大 - 欧洲、亚洲、拉丁美洲及相似地区 - 英国、印度、澳大利亚及其他 + 欧洲、亚洲、拉丁美洲和类似地区 + 英国、印度和类似地区 播报… 设置街道名称、交通警告(强制停车、减速带)、测速仪警告、限速等公告。 播报限速 播报测速电子眼 播报交通信息 - 请在设置中指定OSM用户名和密码 + 请在“设置”中指定 OSM 用户和密码 设为终点 设为起点 地图: @@ -387,7 +387,7 @@ 起点: 终点 %1$s 设为终点 - 先选择城市或街道 + 首先设置城市或街道 在相邻城市搜索街道 OSM 修改文件已成功生成 %1$s 无法备份 OSM 更改。 @@ -402,7 +402,7 @@ 开始编辑 完成编辑 清除所有点 - 打开已有 GPX + 打开现有的 GPX 文件 请等待当前任务完成 完整版本 停止导航 @@ -438,7 +438,7 @@ 使用系统应用拍照。 设置音频和视频设置。 音频/视频设置 - 录制时发生错误 + 录制失败 摄像头不可用 音频/视频正在记录,要停止请点击AV窗体。 打开外部播放器 @@ -510,7 +510,7 @@ 使用在线地图(在储存卡上下载并缓存瓦片)。 在线地图 配置在线或缓存瓦片地图来源。 - 显示特殊可用性功能的设置。 + 矢量地图很可能显示更快速。但在某些设备上不能正常工作。 测试语音提示 这个位置没有离线矢量地图。您可以从设置(数据管理)中下载,或者切换到在线地图。 @@ -530,7 +530,7 @@ 异步 OSM 编辑: OSM兴趣点/注记已在设备上保存 显示当前轨迹 - 此 OsmAnd 免费版本最多支持下载 %1$s 套数据,并且不支持离线维基百科文章。 + 你可以下载或更新 %1$s 地图。 显示 POI 描述。 已存在上次导出的收藏夹文件。是否要替换它? 指定导航选项。 @@ -552,30 +552,32 @@ 删除 %1$s? 停止模拟导航 开始模拟导航 - 文件无法重命名。 - 同名文件已存在。 - 找到了几个相关的 POI 类别。 - 用于搜索POI的本地数据不存在。 + 无法重命名文件。 + 已经有一个同名的文件存在。 + 找到了几个相关的兴趣点类别。 + 下载离线数据以搜索兴趣点。 按名称搜索 兴趣点数据文件 \'%1$s\' 是多余的,可以删除。 用于维护 POI 改动的本地文件不存在,且无法创建。 - 服务器包含与您当前应用版本不兼容的地图文件。要下载并使用这些文件,请将应用程序升级至新版本。 + 下载新版本的应用程序,以便能够使用新的地图文件。 搜索位置… 我的位置(已找到) 地址… 收藏夹… 未定义 上次地图显示位置 - 路线已成功保存为 \'%1$s\'。 + 路线保存为“%1$s”。 文件名: 同名文件已存在。 保存 %2$d 个项目中的 %1$d 个已成功上传。 显示更多地图细节 - 收藏点已成功删除。 + 收藏点已删除。 您将要删除 %1$d 个收藏点和 %2$d 个收藏组。是否确认? 基础世界地图(小比例尺下覆盖整个世界)丢失。请考虑下载 World_basemap_x.obf 以确保应用运行环境完整。 - \n\n长按进入选项 + " +\n +\n长按选项" 本地版本 管理地图文件。 下载 @@ -583,8 +585,8 @@ 地址数据 交通设施数据 地图数据 - 语音数据(TTS) - 语音数据(录制) + 语音提示(TTS) + 语音提示(录音) 兴趣点数据 TTS语音 新搜索 @@ -592,18 +594,18 @@ 地图字体大小 显示渲染性能。 解包新数据… - 已选择在线导航服务,但网络连接不可用。 + 在线导航不能离线工作。 不支持的语言 数据丢失 使用当前终点 提醒语音音频 - 媒体/音乐音频 + 媒体/导航音频 应用程序无法下载地图图层 %1$s,请尝试重新安装。 调整叠加层透明度。 叠加层透明度 调整基本地图透明度。 基础地图透明度 - 背景层地图… + 背景层地图…… 背景层地图 选择背景层地图 叠加层地图… @@ -635,7 +637,7 @@ 存储目录 GPS 状态应用未安装。是否转到应用市场中搜索? 语音指引不可用。请到“设置”→“常规设置”→“语音指引”中选择想要的语音数据包并下载。 - 未选择引导语音 + 选择一个语音提示包 调整夜间和白天模式之间的切换。 是否下载 {0} 个文件({1} MB)? 已选择 {0} 个项目 @@ -646,11 +648,11 @@ 下载地图 此地图无法下载 无法绘制所选区域。 - 使用位置 … - 渲染器已成功加载 + 使用位置…… + 已加载渲染器 无法加载渲染器。 矢量渲染器 - 选择渲染器外观 + 选择渲染外观 显示POI网址 显示POI电话 搜索交通设施 @@ -659,17 +661,18 @@ 离线矢量地图 修改 POI 删除 POI - 保持地图正北朝上 + 不旋转(正北永远朝上) 地图对齐方式: 地图朝向 路线详情 - 收藏夹已成功导入 + 收藏已导入 选择是否有拍照声。 - 拍照时播放声音 + 播放相机快门声 语音数据版本不支持 指定的语音数据已损坏 - 选择的语音数据不可用 - SD卡无法访问。\n您将无法查看地图和进行搜索。 + 所选语音提示包不可用 + 无法访问存储卡。 +\n你将无法看到地图或查找内容。 SD卡处于只读状态。\n您将只能查看已有地图,无法从互联网下载。 正在解压缩文件… 在上一次地图中心附近搜索 @@ -679,14 +682,14 @@ 添加新规则 在地图上显示公共交通站点。 显示公共交通站点 - 导航应用 OsmAnd + OsmAnd 导航应用 POI 数据已成功更新 ({0} 已载入) 无法更新本地兴趣点列表。 无法从服务器加载数据。 此区域没有可用的离线 POI 数据 小比例尺下更新 POI 功能不可用 更新 POI - 是否要通过互联网更新本地数据? + 从互联网更新本地数据? 城市:{0} 街道:{0},{1} 交叉路口:{0} x {1} 在 {2} @@ -705,7 +708,7 @@ 总距离 %1$s,行驶时间 %2$d 时 %3$d 分。 在线或离线导航服务。 导航服务 - SD卡上的数据存储目录无法访问! + 存储卡上的存储文件夹无法访问! 是否下载 {0} - {1}? {0} 的离线数据已经存在({1})。是否要更新它({2})? 地址 @@ -713,7 +716,7 @@ 正在下载可用区域的列表… 区域列表未能从 osmand.net 获取。 收藏点已被编辑 - 请首先选择目的地 + 请先设置目的地 营业时间 正在打开修改集… 正在关闭修改集… @@ -739,23 +742,23 @@ 更新地图 重新载入地图瓦片 目标 - 加入收藏夹 + 添加到“收藏” 在当地名称和英文名称之间选择。 - 在地图中使用英文名称 - 应用程序设置 + 在地图上使用英文名称 + 应用设置 搜索地址 选择建筑物 选择街道 选择城市 选择国家 显示上一次使用的兴趣点叠加层。 - 显示POI + 显示兴趣点叠加 选择在线或缓存地图瓦片的来源。 瓦片地图来源 地图来源 显示位置 使用互联网下载丢失的地图瓦片 - 导航应用程序 + 导航应用 选择POI 搜索更多 从列表中选择区域 @@ -785,13 +788,13 @@ 已删除 添加 修改 - 动作 {0} 已成功完成。 - 执行动作 {0} 时发生意外的错误。 + 动作 {0} 已完成。 + 无法执行动作 {0}。 执行动作 {0} 时发生 I/O 错误。 节点的信息未能加载 所有其他标记都已保留 - 是否删除选中的过滤器? - 过滤器 %1$s 已被删除 + 删除此筛选规则? + 筛选规则“%1$s”已被删除 过滤器 %1$s 已创建 自动对焦 清除中途点 @@ -819,11 +822,11 @@ 顶栏 完整报告 重新计算路线 - OpenStreetMap 登录名和密码 + OSM 用户名和密码 捐赠 接收者数量 编辑数 %1$s,排名 %2$s,总计编辑 %3$s - OSM 编辑排名 + OSM 编辑者排名 订阅 OsmAnd 实时订阅 公开名称 @@ -849,16 +852,16 @@ 工具栏 小工具 添加地图标记 - 您确定要添加所有地点到地图标记? + 将所有点添加为地图标记? 选择地图标记 反向顺序 激活地图标记功能。 - 您要移除所有有效标记? - 您要清除历史地图标记? + 删除所有的活动标记? + 清除地图标记历史记录? 激活标记 地图标记 地图标记 - 显示 MTB 路线 + 显示山地自行车道 显示多边形 电子邮件地址 隐藏地下物体 @@ -948,7 +951,7 @@ 米/秒 分钟每千米 分钟/英里 - 海里/小时 (节) + 海里每小时(节) 分钟每米 分/千米 @@ -1005,7 +1008,7 @@ 爱沙尼亚语 宿务语 避免独立日志 - 位置服务未启用。您确定要开启? + 位置服务已关闭。要开启吗? 下载额外的维基百科数据 (%1$s MB) 吗? 导入到 OsmAnd 阅读完整文章(在线) @@ -1016,10 +1019,10 @@ 已禁用 退出 隐藏门牌号码 - 复制文件失败 + 移动文件失败 外部存储 多用户存储 - 内部应用存储 + 内部存储 手动指定 内部存储 地图存储 @@ -1076,11 +1079,11 @@ 更多… 匿名上传您的 OSM 注记,或者使用您的 OpenStreetMap.org 账号。 附近的维基百科文章 - 搜索城市或地区 + 城市或地区 上传兴趣点 路线计算 - 您暂时没有轨迹 - 您也可以将轨迹添加到文件夹下 + 你还没有任何轨迹文件 + 你也可以将轨迹文件添加到文件夹 继续 暂停 无数据 @@ -1088,7 +1091,7 @@ 筛选器:不记录低于该速度的点。 通知 圣诞兴趣点 - 显示圣诞兴趣点? + 显示圣诞假期兴趣点? 输入城市、地址、兴趣点名称 创建自定义过滤器 自定义搜索 @@ -1184,7 +1187,7 @@ 德国道路地图 高对比度道路 美国道路地图 - 兴趣点… + 兴趣点叠加层…… 地图来源… 改变地图来源 添加地图来源 @@ -1212,7 +1215,7 @@ 速度限制容忍程度 其他地图属性 显示路线 - 搜索地理位置 + 按地理位置搜索 颜色方案 改变颜色 编辑名称 @@ -1332,7 +1335,7 @@ 轻点动作按钮会在地图上显示或隐藏 OSM 注记。 按距离排序 在我的收藏中搜索 - 要在地图上看到起伏的山坡,您需要下载这个地区的地形阴影层地图。 + 下载“山体阴影”叠加层地图以显示垂直阴影。 安装“等高线”插件以显示渐变的垂直区域。 基于缩放级别开始隐藏 下载本地区使用的“等高线”地图。 @@ -1341,7 +1344,7 @@ 从缩放级别开始显示 组名称 动画处理我的位置 - 在导航过程中打开\"我的位置\"的动画地图平移。 + 在导航过程中开启“我的位置”的动画地图平移。 轻点按钮将在屏幕中心位置添加一个目的地。以前设定的目的地成为最后的中转点。 使画面居中的新航线目的地的按钮,取代之前选择的目的地(如果有的话)。 使屏幕居中的按钮,是第一中间目的。 @@ -1351,8 +1354,8 @@ 海洋等深线和航海点。 感谢你购买“航海等深线” 航海等深线 - 南半球航海等深线 - 北半球航海等深线 + 南半球航海深度点 + 北半球航海深度点 航海等深线 航海地图 在地图上分析 @@ -1366,7 +1369,7 @@ 坡度 添加新文件夹 转到这条路线上 - 在这条路线的突出点 + 航点、兴趣点、命名的特征 轨迹 移动的时间 时间跨度 @@ -1412,7 +1415,7 @@ 如果 %1$s 的名称缺失则音译 音译名称 请输入新筛选器的名称,该名称将添加到你的\"类别\"选项卡中。 - 每个月会收取认购费用。您可以在 Google Play 随时取消您的订购。 + 订阅按选定的时间段收费。可随时在 Google Play 上取消。 你的部分捐款将发送给 OSM 捐助者。订阅费用保持不变。 启用认购可每小时、每天、每周的更新以及世界各地所有的地图无限制的下载。 获得 @@ -1466,7 +1469,7 @@ 触觉方向 由振动指示目标点方向。 启用导航时由 OsmAnd 实时服务提供的更新。 - 未设置目的地 + 辅助功能插件:没有设置目的地 磁方位 相对方位 当您离开道路时不重新计算路线 @@ -2174,7 +2177,7 @@ 停用 已停用 安装的 Android TTS(文本到语音)引擎不支持所选语言,将使用其预设的 TTS 语言。在市场上寻找其他 TTS 引擎? - 安装所选语言没有数据。你想要去市场安装吗? + 去应用市场下载选定的语言? 沿着整条轨迹 指定以脱机矢量地图显示 \n @@ -2214,9 +2217,9 @@ 没有我的收藏标点要保存 通过 OsmAnd 分享我的收藏夹 在 SD 卡上找到的区域没有离线数据。从互联网下载区域数据。 - 输入搜索条件来查找 POI + 输入查找兴趣点 地图图层 - POI 搜索 + 搜索兴趣点 使用轨迹球设备来移动地图。 使用轨迹球 设置每个背景位置固定所允许的最高等待时间。 @@ -2420,14 +2423,14 @@ 重新载入 重置 按月将记录的轨迹存放在文件夹中 - 按照月份将记录的轨迹存储在子文件夹中(例如 2017-01)。 + 按照月份将记录的轨迹存储在子文件夹中(例如 2018-01)。 重新加载区片以查看最新的数据。 区片缓存 平均 升序/降序 最大/最小 %2$d 中的 %1$d - 移动时间 + 运动时间 最小/最大 暂停/继续导航 暂停或恢复导航的按钮。 @@ -2478,8 +2481,8 @@ 点击地图上的标记将其移动到活动标记的顶端, 而不打开上下文菜单。 \'一个点击\'激活 做注记! - 使用小部件或上下文菜单, 在地图上的每个点添加音频、视频或照片注释。 - 按日期说明 + 通过使用小部件或上下文菜单将音频、视频或照片注记添加到地图上的任何点。 + 按日期排序的视频或音频注记 按日期 按类型 用航路点寻找轨迹 @@ -2501,7 +2504,7 @@ 显示从你的位置到活动标记位置的方向线。 显示一个或两个箭头指示方向到活动标记。 选择如何显示到活动标记的距离。 - 选择想显示多少的方向指标。 + 指定方向指示器的数量。 小数位数 右方 左方 @@ -2514,7 +2517,7 @@ 明日开始营业时间 兴趣点(POI)标签 显示数字盘 - 在地图上显示/隐藏 OSM 注记。 + 在地图上显示或隐藏 OSM 注记。 GPX - 适合导出到 JOSM 或其它 OSM 编辑器。 OSC - 适合导出到 OSM。 GPX 文件 @@ -2667,7 +2670,7 @@ 夜间模式 切换日间/夜间模式 此地区 - 编辑活动 + 编辑动作 你增加了%1$s 个目标。输入文件名后点击\"保存\"。 请在允许OsmAnd获取定位信息后继续。 平顺度 @@ -2724,7 +2727,7 @@ 逐步 道路类型 退出于 - 在地图中显示或隐藏已选中的GPX轨迹的按钮。 + 在地图上显示或隐藏所选轨迹的按钮。 请先设置目的地 为OsmAnd Live启用公共交通的变更情况。 添加出发地和目的地 @@ -3562,4 +3565,68 @@ 选择轨迹文件 需要其他地图才能在地图上查看维基百科兴趣点。 操作按钮在选定的配置文件之间切换。 + Parrot + WunderLINQ + 外部输入设备 + 按类别排序 + MGRS + 奥克西坦语 + 使用录制的 GPX 轨迹模拟你的位置。 + 编辑 %1$s,总计 %2$s mBTC + 选择导航配置文件 + 继续在地图上显示 + 距离指示 + 最后使用:%1$s + 在地图上显示箭头 + 显示方向线 + 移动到历史 + 你必须至少添加一个标记才能使用此功能。 + 导入为收藏 + 添加始发站 + 从地图标记中删除的航点 + 使用两位数的经度 + 搜索国家、城市或省份 + 删除搜索历史记录 + 页面仅在线提供。在网页浏览器中打开? + 选择一本旅游书籍 + 仅在 Wi-Fi 上 + 仅在 Wi-Fi 上 + 选择合适的项目 + 购买以下其中一项,即可获得离线旅游指南功能: + 解锁所有 OsmAnd 功能 + 等高线和山体阴影地图 + 每小时更新地图 + 每月更新地图 + 欢迎使用公开测试版 + 任何人都可以编辑的自由的全球旅游指南。 + 下载 Wikivoyage 旅行指南,在没有连接到互联网的情况下查看世界各地的文章。 + 旧的默认 \'Mapnik\' 风格。与 \'Mapnik\' 颜色相似。 + 在地图上保留已通过的标记 + 选择要跟随的轨迹文件 + 国道 + 选择要在应用程序中可见的配置文件。 + BRouter(离线) + 船、划船、帆船 + 散步、徒步、跑步 + 山地自行车、轻便摩托车、马 + 汽车、卡车、摩托车 + 选择导航类型 + 基于你的自定义配置文件的默认应用程序配置文件之一,这定义了基本的设置,如部件的默认可见性和速度和距离的单位。这些是默认的应用程序配置文件,以及它们可以扩展到的自定义配置文件的例子: + 选择用以开始的配置文件 + 是否确定要删除“%s”配置文件 + 首先保存配置文件的更改 + 你不能删除 OsmAnd 的基本配置文件 + 已经有该名称的配置文件 + 你必须先指定一个配置文件名称。 + 输入配置文件名称 + 请为新应用配置文件选择导航类型 + 选择导航类型 + 用户模式,派生自: %s + 显示指南针标尺 + 选择你分享的数据 + 如果同意我们的%1$s,请点击“允许” + 帮助我们了解 OsmAnd 功能的受欢迎程度。 + 帮助我们了解国家和地区地图的受欢迎程度。 + 定义允许 OsmAnd 分享哪些数据。 + 选择要分享的数据类型: \ No newline at end of file From f16b46295dd62551a05ef5f959f95e265e8d8664 Mon Sep 17 00:00:00 2001 From: cepprice Date: Sun, 21 Mar 2021 14:44:37 +0500 Subject: [PATCH 214/250] Make track arrows more visible when track line is thin --- .../views/layers/geometry/GpxGeometryWay.java | 20 ++++++-- .../geometry/GpxGeometryWayContext.java | 11 +++++ .../layers/geometry/GpxGeometryWayDrawer.java | 46 ++++++++++++++++++- 3 files changed, 71 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java index 24d49df0b1..0e9b73dc82 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java @@ -2,13 +2,14 @@ package net.osmand.plus.views.layers.geometry; import android.graphics.Bitmap; -import androidx.annotation.NonNull; - +import net.osmand.AndroidUtils; import net.osmand.GPXUtilities.WptPt; import net.osmand.data.RotatedTileBox; import java.util.List; +import androidx.annotation.NonNull; + public class GpxGeometryWay extends GeometryWay> { private List points; @@ -76,7 +77,9 @@ public class GpxGeometryWay extends GeometryWay { - private static final double DIRECTION_ARROW_DISTANCE_MULTIPLIER = 10.0; + private static final float TRACK_WIDTH_THRESHOLD = 8f; + private static final float ARROW_DISTANCE_MULTIPLIER = 1.5f; + private static final float SPECIAL_ARROW_DISTANCE_MULTIPLIER = 10f; private Bitmap arrowBitmap; @@ -114,6 +117,9 @@ public class GpxGeometryWay extends GeometryWay { @@ -22,31 +25,70 @@ public class GpxGeometryWayDrawer extends GeometryWayDrawer style) { super(x, y, angle, style); + createCircleBitmap((GeometryArrowsStyle) style); } @Override void draw(Canvas canvas, GeometryWayContext context) { if (style instanceof GeometryArrowsStyle) { + Context ctx = style.getCtx(); GeometryArrowsStyle arrowsWayStyle = (GeometryArrowsStyle) style; Bitmap bitmap = style.getPointBitmap(); + boolean useSpecialArrow = arrowsWayStyle.useSpecialArrow(); - float newWidth = arrowsWayStyle.getTrackWidth() / 2f; + float newWidth = useSpecialArrow ? AndroidUtils.dpToPx(ctx, 12) : arrowsWayStyle.getTrackWidth() / 2f; float paintH2 = bitmap.getHeight() / 2f; float paintW2 = newWidth / 2f; Matrix matrix = getMatrix(); matrix.reset(); - matrix.postScale(newWidth / bitmap.getWidth(), 1); + float sy = useSpecialArrow ? newWidth / bitmap.getHeight() : 1; + matrix.postScale(newWidth / bitmap.getWidth(), sy); matrix.postRotate((float) angle, paintW2, paintH2); matrix.postTranslate(x - paintW2, y - paintH2); + if (useSpecialArrow) { + drawCircle(canvas, arrowsWayStyle); + } + Paint paint = context.getPaintIconCustom(); Integer pointColor = style.getPointColor(); paint.setColorFilter(new PorterDuffColorFilter(pointColor, PorterDuff.Mode.SRC_IN)); canvas.drawBitmap(bitmap, matrix, paint); } } + + private void drawCircle(Canvas canvas, GeometryArrowsStyle style) { + float offset = circleBitmap.getWidth() / 2f; + float angleOffset = AndroidUtils.dpToPx(style.getCtx(), 1); + double rad = Math.toRadians(angle + 90); + float x = (float) (this.x - offset - angleOffset * Math.cos(rad)); + float y = (float) (this.y - offset - angleOffset * Math.sin(rad)); + canvas.drawBitmap(circleBitmap, x, y, null); + } + + private void createCircleBitmap(GeometryArrowsStyle style) { + Context ctx = style.getCtx(); + int size = AndroidUtils.dpToPx(ctx, 16); + circleBitmap = Bitmap.createBitmap(size, size, style.getPointBitmap().getConfig()); + Paint paint = new Paint(Paint.DITHER_FLAG | Paint.ANTI_ALIAS_FLAG); + paint.setStyle(Paint.Style.FILL); + + Canvas c = new Canvas(circleBitmap); + + paint.setColor(0x33000000); + Path path = new Path(); + path.addCircle(size / 2f, size / 2f, AndroidUtils.dpToPx(ctx, 8), Path.Direction.CW); + c.drawPath(path, paint); + + paint.setColor(style.getTrackColor()); + path.reset(); + path.addCircle(size / 2f, size / 2f, AndroidUtils.dpToPx(ctx, 7), Path.Direction.CW); + c.drawPath(path, paint); + } } } \ No newline at end of file From e06478d4fe94e6b4af55dccd5e7d2ecae58b3806 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Sun, 21 Mar 2021 15:25:45 +0200 Subject: [PATCH 215/250] Revert "Compute obstaclesTime before adding final segment" --- .../src/main/java/net/osmand/router/BinaryRoutePlanner.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java index 4c85058fa3..0769e1390c 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/BinaryRoutePlanner.java @@ -457,10 +457,10 @@ public class BinaryRoutePlanner { directionAllowed = false; continue; } - obstaclesTime += obstacle; - obstaclesTime += heightObstacle; boolean alreadyVisited = checkIfOppositeSegmentWasVisited(ctx, reverseWaySearch, graphSegments, segment, oppositeSegments, segmentPoint, segmentDist, obstaclesTime); + obstaclesTime += obstacle; + obstaclesTime += heightObstacle; if (alreadyVisited) { directionAllowed = false; continue; From 53c817e8112dc49c9905995c982ba904836ac2a2 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Sun, 21 Mar 2021 15:39:13 +0200 Subject: [PATCH 216/250] Review --- .../GpxApproximationFragment.java | 19 ++++++----- .../MeasurementToolFragment.java | 34 ++++++++----------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java index cea8ff65a4..521034a430 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java @@ -158,15 +158,6 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment updateCardsLayout(); } updateCards(); - final LockableScrollView profileContainer = mainView.findViewById(R.id.route_menu_bottom_scroll); - profileContainer.postDelayed(new Runnable() { - @Override - public void run() { - if (snapToRoadAppMode.getOrder() > 4) { - profileContainer.fullScroll(View.FOCUS_DOWN); - } - } - }, 100); updateButtons(mainView); progressBar = mainView.findViewById(R.id.progress_bar); @@ -185,6 +176,16 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment calculateGpxApproximation(true); + final LockableScrollView profileView = mainView.findViewById(R.id.route_menu_bottom_scroll); + final LinearLayout profileContainer = mainView.findViewById(R.id.route_menu_cards_container); + profileView.postDelayed(new Runnable() { + @Override + public void run() { + int selectedProfilePosition = profileContainer.getHeight() / ApplicationMode.values(getMyApplication()).size() * snapToRoadAppMode.getOrder(); + profileView.scrollTo(0, selectedProfilePosition); + } + }, 100); + return mainView; } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 34fde58555..23a86009a0 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -132,8 +132,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route private ImageView mainIcon; private String fileName; private OnBackPressedCallback onBackPressedCallback; - private boolean isShowSnapWarning; - private static final String SHOW_SNAP_WARNING = "show_snap_warning"; + private boolean showSnapWarning; private InfoType currentInfoType; @@ -237,11 +236,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route if (mapActivity == null) { return null; } - if (savedInstanceState != null) { - restoreState(savedInstanceState); - } else if (getArguments() != null) { - restoreState(getArguments()); - } + final MeasurementToolLayer measurementLayer = mapActivity.getMapLayers().getMeasurementToolLayer(); final OsmandApplication app = mapActivity.getMyApplication(); @@ -559,12 +554,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } }); - isShowSnapWarning = getArguments().getBoolean(SHOW_SNAP_WARNING); initMeasurementMode(gpxData, savedInstanceState == null); if (savedInstanceState == null) { if (fileName != null) { addNewGpxData(getGpxFile(fileName)); - } else if (editingCtx.isApproximationNeeded() && isFollowTrackMode()) { + } else if (editingCtx.isApproximationNeeded() && isFollowTrackMode() && showSnapWarning) { enterApproximationMode(mapActivity); } } else { @@ -673,6 +667,15 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route this.fileName = fileName; } + + public boolean isShowSnapWarning() { + return this.showSnapWarning; + } + + public void setShowSnapWarning(boolean showSnapWarning) { + this.showSnapWarning = showSnapWarning; + } + public MeasurementEditingContext getEditingCtx() { return editingCtx; } @@ -1965,13 +1968,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } public static boolean showInstance(FragmentManager fragmentManager, MeasurementEditingContext editingCtx, - boolean followTrackMode, boolean isShowSnapWarning) { + boolean followTrackMode, boolean showSnapWarning) { MeasurementToolFragment fragment = new MeasurementToolFragment(); fragment.setEditingCtx(editingCtx); fragment.setMode(FOLLOW_TRACK_MODE, followTrackMode); - Bundle bundle = new Bundle(); - bundle.putBoolean(SHOW_SNAP_WARNING, isShowSnapWarning); - fragment.setArguments(bundle); + fragment.setShowSnapWarning(showSnapWarning); return showFragment(fragment, fragmentManager); } @@ -2114,9 +2115,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route manager.beginTransaction() .hide(this).commit(); layer.setTapsDisabled(true); - if (isShowSnapWarning) { - SnapTrackWarningFragment.showInstance(mapActivity.getSupportFragmentManager(), this); - } + SnapTrackWarningFragment.showInstance(mapActivity.getSupportFragmentManager(), this); AndroidUiHelper.setVisibility(mapActivity, View.GONE, R.id.map_ruler_container); } } @@ -2142,7 +2141,4 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route void onUpdateInfo(); } - public void restoreState(Bundle bundle) { - isShowSnapWarning = bundle.getBoolean(SHOW_SNAP_WARNING); - } } \ No newline at end of file From fcd2eed6525258e036152f969d2fa062b9c9d14b Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Sun, 21 Mar 2021 17:25:58 +0200 Subject: [PATCH 217/250] Small fixes --- .../measurementtool/MeasurementToolFragment.java | 2 +- .../routepreparationmenu/FollowTrackFragment.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index b59915ecdb..9e88c5689f 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -571,7 +571,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route if (savedInstanceState == null) { if (fileName != null) { addNewGpxData(getGpxFile(fileName)); - } else if (editingCtx.isApproximationNeeded() && isFollowTrackMode() && showSnapWarning) { + } else if (editingCtx.isApproximationNeeded() && isFollowTrackMode() && isShowSnapWarning()) { enterApproximationMode(mapActivity); } } else { diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java index a5209eac18..8228fa6192 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java @@ -57,8 +57,8 @@ import net.osmand.plus.routepreparationmenu.cards.ReverseTrackCard; import net.osmand.plus.routepreparationmenu.cards.SelectTrackCard; import net.osmand.plus.routepreparationmenu.cards.TrackEditCard; import net.osmand.plus.routepreparationmenu.cards.TracksToFollowCard; -import net.osmand.plus.routing.IRouteInformationListener; import net.osmand.plus.routing.GPXRouteParams.GPXRouteParamsBuilder; +import net.osmand.plus.routing.IRouteInformationListener; import net.osmand.plus.routing.RouteService; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.settings.backend.ApplicationMode; @@ -452,12 +452,12 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca } else if (card instanceof TrackEditCard) { openPlanRoute(false); close(); + } else if (card instanceof SelectTrackCard) { + updateSelectionMode(true); + } else if (card instanceof ReverseTrackCard + || card instanceof NavigateTrackOptionsCard) { + updateMenu(); } - } else if (card instanceof SelectTrackCard) { - updateSelectionMode(true); - } else if (card instanceof ReverseTrackCard - || card instanceof NavigateTrackOptionsCard) { - updateMenu(); } } From 170c70e42bc555daf3015c776123234db90086cf Mon Sep 17 00:00:00 2001 From: cepprice Date: Sun, 21 Mar 2021 20:54:58 +0500 Subject: [PATCH 218/250] Refactor to optimize memory consumption and rendering speed --- .../views/layers/geometry/GpxGeometryWay.java | 26 ++++++++++++-- .../geometry/GpxGeometryWayContext.java | 15 ++++++++ .../layers/geometry/GpxGeometryWayDrawer.java | 34 ++++--------------- 3 files changed, 45 insertions(+), 30 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java index 0e9b73dc82..c0fdf55930 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java @@ -77,18 +77,27 @@ public class GpxGeometryWay extends GeometryWay { - private static final float TRACK_WIDTH_THRESHOLD = 8f; + private static final float TRACK_WIDTH_THRESHOLD_DP = 8f; private static final float ARROW_DISTANCE_MULTIPLIER = 1.5f; private static final float SPECIAL_ARROW_DISTANCE_MULTIPLIER = 10f; + private final float TRACK_WIDTH_THRESHOLD_PIX; private Bitmap arrowBitmap; + public static final int OUTER_CIRCLE_COLOR = 0x33000000; protected int pointColor; protected int trackColor; protected float trackWidth; + private float circleAngleOffset; + private float outerCircleRadius; + private float innerCircleRadius; + GeometryArrowsStyle(GpxGeometryWayContext context, int arrowColor, int trackColor, float trackWidth) { this(context, null, arrowColor, trackColor, trackWidth); + circleAngleOffset = AndroidUtils.dpToPx(context.getCtx(), 1); + outerCircleRadius = AndroidUtils.dpToPx(context.getCtx(), 8); + innerCircleRadius = AndroidUtils.dpToPx(context.getCtx(), 7); } GeometryArrowsStyle(GpxGeometryWayContext context, Bitmap arrowBitmap, int arrowColor, int trackColor, float trackWidth) { @@ -97,6 +106,7 @@ public class GpxGeometryWay extends GeometryWay style) { super(x, y, angle, style); - createCircleBitmap((GeometryArrowsStyle) style); } @Override @@ -63,32 +59,14 @@ public class GpxGeometryWayDrawer extends GeometryWayDrawer Date: Sun, 21 Mar 2021 18:06:57 +0200 Subject: [PATCH 219/250] Fix scroll to profile item --- .../measurementtool/GpxApproximationFragment.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java index 521034a430..a8e19d7141 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/GpxApproximationFragment.java @@ -8,6 +8,7 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.ProgressBar; +import android.widget.ScrollView; import androidx.activity.OnBackPressedCallback; import androidx.annotation.NonNull; @@ -21,7 +22,6 @@ import net.osmand.GPXUtilities.WptPt; import net.osmand.LocationsHolder; import net.osmand.PlatformUtil; import net.osmand.ResultMatcher; -import net.osmand.plus.LockableScrollView; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; @@ -176,13 +176,15 @@ public class GpxApproximationFragment extends ContextMenuScrollFragment calculateGpxApproximation(true); - final LockableScrollView profileView = mainView.findViewById(R.id.route_menu_bottom_scroll); - final LinearLayout profileContainer = mainView.findViewById(R.id.route_menu_cards_container); + final ScrollView profileView = (ScrollView) getBottomScrollView(); profileView.postDelayed(new Runnable() { @Override public void run() { - int selectedProfilePosition = profileContainer.getHeight() / ApplicationMode.values(getMyApplication()).size() * snapToRoadAppMode.getOrder(); - profileView.scrollTo(0, selectedProfilePosition); + View view = profileView.findViewWithTag(snapToRoadAppMode.getStringKey()); + if (view != null) { + int headerHeight = getResources().getDimensionPixelSize(R.dimen.measurement_tool_button_height); + profileView.scrollTo(0, view.getTop() + headerHeight); + } } }, 100); From e058dad69257b6e90c6d16050b75b1745072d719 Mon Sep 17 00:00:00 2001 From: cepprice Date: Sun, 21 Mar 2021 21:57:59 +0500 Subject: [PATCH 220/250] Don't bias arrow's position --- .../osmand/plus/views/layers/geometry/GpxGeometryWay.java | 6 ------ .../plus/views/layers/geometry/GpxGeometryWayDrawer.java | 3 --- 2 files changed, 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java index c0fdf55930..5ba26346a3 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GpxGeometryWay.java @@ -89,13 +89,11 @@ public class GpxGeometryWay extends GeometryWay Date: Sun, 21 Mar 2021 20:52:57 +0200 Subject: [PATCH 221/250] Remove unnecessary changes and fix cards update --- .../wikivoyage/explore/ExploreRvAdapter.java | 4 ++-- .../wikivoyage/explore/ExploreTabFragment.java | 17 ++++++++++++++--- .../explore/WikivoyageExploreActivity.java | 8 +++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java index becc599ced..6883aa2abd 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreRvAdapter.java @@ -158,8 +158,8 @@ public class ExploreRvAdapter extends RecyclerView.Adapter, List> res) { ExploreTabFragment fragment = weakFragment.get(); - if (res != null && fragment != null && fragment.isResumed()) { + if (res != null && fragment != null && fragment.isAdded()) { fragment.addIndexItemCards(res.first, res.second); + fragment.removeRedundantCards(); + if (!fragment.isResumed()) { + fragment.invalidateAdapter(); + } } } } diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java index 3bfa4b7a14..55f81ad441 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/WikivoyageExploreActivity.java @@ -373,7 +373,13 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv @Override public void savedArticlesUpdated() { - updateFragments(); + ExploreTabFragment exploreTabFragment = getExploreTabFragment(); + SavedArticlesTabFragment savedArticlesTabFragment = getSavedArticlesTabFragment(); + if (exploreTabFragment != null && savedArticlesTabFragment != null + && exploreTabFragment.isAdded() && savedArticlesTabFragment.isAdded()) { + exploreTabFragment.savedArticlesUpdated(); + savedArticlesTabFragment.savedArticlesUpdated(); + } } public static class LoadWikivoyageData extends AsyncTask { From 913e125968cb1cd9195eb7f3a9b38849ed670eb5 Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 22 Mar 2021 04:40:26 +0200 Subject: [PATCH 222/250] add static graphs --- OsmAnd/res/layout/gpx_item_altitude.xml | 1 + OsmAnd/res/layout/gpx_item_general.xml | 1 + OsmAnd/res/layout/gpx_item_speed.xml | 1 + .../res/layout/gpx_list_item_tab_content.xml | 4 +- OsmAnd/res/layout/trip_recording_fragment.xml | 8 +- .../TripRecordingBottomFragment.java | 142 ++++++++- .../plus/myplaces/GPXItemPagerAdapter.java | 289 +++++++++++------- .../plus/track/GpxBlockStatisticsBuilder.java | 252 +++++++++++---- .../net/osmand/plus/track/OverviewCard.java | 4 +- .../views/controls/PagerSlidingTabStrip.java | 16 +- 10 files changed, 522 insertions(+), 196 deletions(-) diff --git a/OsmAnd/res/layout/gpx_item_altitude.xml b/OsmAnd/res/layout/gpx_item_altitude.xml index 9dd2037878..699e6812ea 100644 --- a/OsmAnd/res/layout/gpx_item_altitude.xml +++ b/OsmAnd/res/layout/gpx_item_altitude.xml @@ -273,6 +273,7 @@
diff --git a/OsmAnd/res/layout/gpx_item_general.xml b/OsmAnd/res/layout/gpx_item_general.xml index 962bbbe9f5..fe90a5c031 100644 --- a/OsmAnd/res/layout/gpx_item_general.xml +++ b/OsmAnd/res/layout/gpx_item_general.xml @@ -291,6 +291,7 @@
diff --git a/OsmAnd/res/layout/gpx_item_speed.xml b/OsmAnd/res/layout/gpx_item_speed.xml index d5bc1d3edb..785c8109ef 100644 --- a/OsmAnd/res/layout/gpx_item_speed.xml +++ b/OsmAnd/res/layout/gpx_item_speed.xml @@ -275,6 +275,7 @@
diff --git a/OsmAnd/res/layout/gpx_list_item_tab_content.xml b/OsmAnd/res/layout/gpx_list_item_tab_content.xml index ac7918d06a..5fa3d3ab29 100644 --- a/OsmAnd/res/layout/gpx_list_item_tab_content.xml +++ b/OsmAnd/res/layout/gpx_list_item_tab_content.xml @@ -4,7 +4,9 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + + android:layout_marginBottom="@dimen/context_menu_padding_margin_small" /> + + 0) { - DateFormat tf = SimpleDateFormat.getTimeInstance(DateFormat.SHORT); - DateFormat df = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM); + }); + if (analysis.timeSpan > 0) { + DateFormat tf = SimpleDateFormat.getTimeInstance(DateFormat.SHORT); + DateFormat df = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM); - Date start = new Date(analysis.startTime); - ((TextView) view.findViewById(R.id.start_time_text)).setText(tf.format(start)); - ((TextView) view.findViewById(R.id.start_date_text)).setText(df.format(start)); - Date end = new Date(analysis.endTime); - ((TextView) view.findViewById(R.id.end_time_text)).setText(tf.format(end)); - ((TextView) view.findViewById(R.id.end_date_text)).setText(df.format(end)); - } else { - view.findViewById(R.id.list_divider).setVisibility(View.GONE); - view.findViewById(R.id.start_end_time).setVisibility(View.GONE); + Date start = new Date(analysis.startTime); + ((TextView) view.findViewById(R.id.start_time_text)).setText(tf.format(start)); + ((TextView) view.findViewById(R.id.start_date_text)).setText(df.format(start)); + Date end = new Date(analysis.endTime); + ((TextView) view.findViewById(R.id.end_time_text)).setText(tf.format(end)); + ((TextView) view.findViewById(R.id.end_date_text)).setText(df.format(end)); + } else { + view.findViewById(R.id.list_divider).setVisibility(View.GONE); + view.findViewById(R.id.start_end_time).setVisibility(View.GONE); + } } } else { chart.setVisibility(View.GONE); @@ -412,17 +463,19 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid view.findViewById(R.id.start_end_time).setVisibility(View.GONE); } updateJoinGapsInfo(view, position); - view.findViewById(R.id.analyze_on_map).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - openAnalyzeOnMap(GPXTabItemType.GPX_TAB_ITEM_GENERAL); + if (!onlyGraphs) { + view.findViewById(R.id.analyze_on_map).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + openAnalyzeOnMap(GPXTabItemType.GPX_TAB_ITEM_GENERAL); + } + }); + TextView overflowMenu = view.findViewById(R.id.overflow_menu); + if (!gpxItem.group.getTrack().generalTrack) { + setupOptionsPopupMenu(overflowMenu, true); + } else { + overflowMenu.setVisibility(View.GONE); } - }); - TextView overflowMenu = view.findViewById(R.id.overflow_menu); - if (!gpxItem.group.getTrack().generalTrack) { - setupOptionsPopupMenu(overflowMenu, true); - } else { - overflowMenu.setVisibility(View.GONE); } } @@ -598,7 +651,7 @@ public class GPXItemPagerAdapter extends PagerAdapter implements CustomTabProvid @Override public void tabStylesUpdated(View tabsContainer, int currentPosition) { ViewGroup.MarginLayoutParams params = (MarginLayoutParams) tabsContainer.getLayoutParams(); - params.height = app.getResources().getDimensionPixelSize(R.dimen.dialog_button_height); + params.height = app.getResources().getDimensionPixelSize(!onlyGraphs ? R.dimen.dialog_button_height : R.dimen.context_menu_buttons_bottom_height); tabsContainer.setLayoutParams(params); UiUtilities.updateCustomRadioButtons(app, tabsContainer, nightMode, getCustomRadioButtonType(currentPosition)); } diff --git a/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java b/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java index 09adb88117..1670562eee 100644 --- a/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java +++ b/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java @@ -14,6 +14,7 @@ import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.AppCompatImageView; +import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -35,30 +36,44 @@ import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.List; +import static net.osmand.plus.liveupdates.LiveUpdatesFragmentNew.getDefaultIconColorId; + public class GpxBlockStatisticsBuilder { - private static final Log log = PlatformUtil.getLog(GpxBlockStatisticsBuilder.class); - private static final int GENERAL_UPDATE_INTERVAL = 1000; + private static final Log LOG = PlatformUtil.getLog(GpxBlockStatisticsBuilder.class); + private static final int BLOCKS_UPDATE_INTERVAL = 1000; + public static final String INIT_BLOCKS_BASE = "init_blocks_base"; + public static final String INIT_BLOCKS_GENERAL = "init_blocks_general"; + public static final String INIT_BLOCKS_ALTITUDE = "init_blocks_altitude"; + public static final String INIT_BLOCKS_SPEED = "init_blocks_speed"; private final OsmandApplication app; + private final boolean nightMode; + private RecyclerView blocksView; private final SelectedGpxFile selectedGpxFile; + private GPXTrackAnalysis analysis; private BlockStatisticsAdapter adapter; private final List items = new ArrayList<>(); private boolean blocksClickable = true; + private String initBlocksKey = INIT_BLOCKS_BASE; private final Handler handler = new Handler(); private Runnable updatingItems; private boolean updateRunning = false; - public GpxBlockStatisticsBuilder(OsmandApplication app, SelectedGpxFile selectedGpxFile) { + public GpxBlockStatisticsBuilder(OsmandApplication app, SelectedGpxFile selectedGpxFile, boolean nightMode) { this.app = app; this.selectedGpxFile = selectedGpxFile; + this.nightMode = nightMode; } public boolean isUpdateRunning() { @@ -73,6 +88,10 @@ public class GpxBlockStatisticsBuilder { this.blocksView = blocksView; } + public void setInitBlocksKey(String initBlocksKey) { + this.initBlocksKey = initBlocksKey; + } + @Nullable public GpxDisplayItem getDisplayItem(GPXFile gpxFile) { return gpxFile.tracks.size() > 0 ? GpxUiHelper.makeGpxDisplayItem(app, gpxFile) : null; @@ -82,9 +101,9 @@ public class GpxBlockStatisticsBuilder { return selectedGpxFile.getGpxFile(); } - public void initStatBlocks(@Nullable SegmentActionsListener actionsListener, @ColorInt int activeColor, boolean nightMode) { + public void initStatBlocks(@Nullable SegmentActionsListener actionsListener, @ColorInt int activeColor) { initItems(); - adapter = new BlockStatisticsAdapter(getDisplayItem(getGPXFile()), actionsListener, activeColor, nightMode); + adapter = new BlockStatisticsAdapter(getDisplayItem(getGPXFile()), actionsListener, activeColor); adapter.setItems(items); blocksView.setLayoutManager(new LinearLayoutManager(app, LinearLayoutManager.HORIZONTAL, false)); blocksView.setAdapter(adapter); @@ -107,7 +126,7 @@ public class GpxBlockStatisticsBuilder { } AndroidUiHelper.updateVisibility(blocksView, !Algorithms.isEmpty(items)); int interval = app.getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get(); - updateRunning = handler.postDelayed(this, Math.max(GENERAL_UPDATE_INTERVAL, interval)); + updateRunning = handler.postDelayed(this, Math.max(BLOCKS_UPDATE_INTERVAL, interval)); } }; updateRunning = handler.post(updatingItems); @@ -117,65 +136,187 @@ public class GpxBlockStatisticsBuilder { public void initItems() { GPXFile gpxFile = getGPXFile(); GpxDisplayItem gpxDisplayItem = getDisplayItem(gpxFile); - GPXTrackAnalysis analysis = null; boolean withoutGaps = true; if (gpxDisplayItem != null) { analysis = gpxDisplayItem.analysis; withoutGaps = !selectedGpxFile.isJoinSegments() && gpxDisplayItem.isGeneralTrack(); } if (analysis != null) { - float totalDistance = withoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance; - float timeSpan = withoutGaps ? analysis.timeSpanWithoutGaps : analysis.timeSpan; - String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app); - String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app); - String avg = OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app); - String max = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app); - items.clear(); - prepareData(analysis, app.getString(R.string.distance), OsmAndFormatter.getFormattedDistance(totalDistance, app), - R.drawable.ic_action_track_16, R.color.icon_color_default_light, GPXDataSetType.ALTITUDE, GPXDataSetType.SPEED, ItemType.ITEM_DISTANCE); - prepareData(analysis, app.getString(R.string.altitude_ascent), asc, - R.drawable.ic_action_arrow_up_16, R.color.gpx_chart_red, GPXDataSetType.SLOPE, null, ItemType.ITEM_ALTITUDE); - prepareData(analysis, app.getString(R.string.altitude_descent), desc, - R.drawable.ic_action_arrow_down_16, R.color.gpx_pale_green, GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE, ItemType.ITEM_ALTITUDE); - prepareData(analysis, app.getString(R.string.average_speed), avg, - R.drawable.ic_action_speed_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null, ItemType.ITEM_SPEED); - prepareData(analysis, app.getString(R.string.max_speed), max, - R.drawable.ic_action_max_speed_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null, ItemType.ITEM_SPEED); - prepareData(analysis, app.getString(R.string.shared_string_time_span), - Algorithms.formatDuration((int) (timeSpan / 1000), app.accessibilityEnabled()), - R.drawable.ic_action_time_span_16, R.color.icon_color_default_light, GPXDataSetType.SPEED, null, ItemType.ITEM_TIME); + switch (initBlocksKey) { + case INIT_BLOCKS_GENERAL: { + float totalDistance = withoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance; + float timeSpan = withoutGaps ? analysis.timeSpanWithoutGaps : analysis.timeSpan; + Date start = new Date(analysis.startTime); + Date end = new Date(analysis.endTime); + prepareDataDistance(totalDistance); + prepareDataTimeSpan(timeSpan); + prepareDataStartTime(start); + prepareDataEndTime(end); + break; + } + case INIT_BLOCKS_ALTITUDE: { + String min = OsmAndFormatter.getFormattedAlt(analysis.minElevation, app); + String max = OsmAndFormatter.getFormattedAlt(analysis.maxElevation, app); + String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app); + String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app); + prepareDataAverageAltitude(); + prepareDataAltitudeRange(min, max); + prepareDataAscent(asc); + prepareDataDescent(desc); + break; + } + case INIT_BLOCKS_SPEED: { + String avg = OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app); + String max = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app); + long timeMoving = withoutGaps ? analysis.timeMovingWithoutGaps : analysis.timeMoving; + float totalDistanceMoving = withoutGaps ? analysis.totalDistanceMovingWithoutGaps : analysis.totalDistanceMoving; + prepareDataAverageSpeed(avg); + prepareDataMaximumSpeed(max); + prepareDataTimeMoving(timeMoving); + prepareDataDistanceCorrected(totalDistanceMoving); + break; + } + default: + case INIT_BLOCKS_BASE: { + float totalDistance = withoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance; + String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app); + String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app); + String avg = OsmAndFormatter.getFormattedSpeed(analysis.avgSpeed, app); + String max = OsmAndFormatter.getFormattedSpeed(analysis.maxSpeed, app); + float timeSpan = withoutGaps ? analysis.timeSpanWithoutGaps : analysis.timeSpan; + prepareDataDistance(totalDistance); + prepareDataAscent(asc); + prepareDataDescent(desc); + prepareDataAverageSpeed(avg); + prepareDataMaximumSpeed(max); + prepareDataTimeSpan(timeSpan); + break; + } + } } } - public void prepareData(GPXTrackAnalysis analysis, String title, String value, - @DrawableRes int imageResId, @ColorRes int imageColorId, + public void prepareDataDistance(float totalDistance) { + prepareData(app.getString(R.string.distance), OsmAndFormatter.getFormattedDistance(totalDistance, app), + R.drawable.ic_action_track_16, GPXDataSetType.ALTITUDE, GPXDataSetType.SPEED, ItemType.ITEM_DISTANCE); + } + + public void prepareDataAverageAltitude() { + prepareData(app.getString(R.string.average_altitude), OsmAndFormatter.getFormattedAlt(analysis.avgElevation, app), + R.drawable.ic_action_altitude_average_16, GPXDataSetType.ALTITUDE, null, ItemType.ITEM_ALTITUDE); + } + + public void prepareDataAltitudeRange(String min, String max) { + String pattern = app.getString(R.string.ltr_or_rtl_combine_via_dash); + prepareData(app.getString(R.string.altitude_range), String.format(pattern, min, max), + R.drawable.ic_action_altitude_range_16, GPXDataSetType.ALTITUDE, null, ItemType.ITEM_ALTITUDE); + } + + public void prepareDataAscent(String asc) { + prepareData(app.getString(R.string.altitude_ascent), asc, + R.drawable.ic_action_arrow_up_16, R.color.gpx_chart_red, + GPXDataSetType.SLOPE, null, ItemType.ITEM_ALTITUDE); + } + + public void prepareDataDescent(String desc) { + prepareData(app.getString(R.string.altitude_descent), desc, + R.drawable.ic_action_arrow_down_16, R.color.gpx_pale_green, + GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE, ItemType.ITEM_ALTITUDE); + } + + public void prepareDataAverageSpeed(String avg) { + prepareData(app.getString(R.string.average_speed), avg, + R.drawable.ic_action_speed_16, GPXDataSetType.SPEED, null, ItemType.ITEM_SPEED); + } + + public void prepareDataMaximumSpeed(String max) { + prepareData(app.getString(R.string.max_speed), max, + R.drawable.ic_action_max_speed_16, GPXDataSetType.SPEED, null, ItemType.ITEM_SPEED); + } + + public void prepareDataTimeMoving(long timeMoving) { + prepareData(app.getString(R.string.shared_string_time_moving), + Algorithms.formatDuration((int) (timeMoving / 1000), app.accessibilityEnabled()), + R.drawable.ic_action_time_span_16, GPXDataSetType.SPEED, null, ItemType.ITEM_TIME_MOVING); + } + + public void prepareDataDistanceCorrected(float totalDistanceMoving) { + prepareData(app.getString(R.string.distance_moving), + OsmAndFormatter.getFormattedDistance(totalDistanceMoving, app), + R.drawable.ic_action_polygom_dark, GPXDataSetType.SPEED, null, ItemType.ITEM_DISTANCE_MOVING); + } + + public void prepareDataTimeSpan(float timeSpan) { + prepareData(app.getString(R.string.shared_string_time_span), + Algorithms.formatDuration((int) (timeSpan / 1000), app.accessibilityEnabled()), + R.drawable.ic_action_time_span_16, GPXDataSetType.SPEED, null, ItemType.ITEM_TIME_SPAN); + } + + public void prepareDataStartTime(Date start) { + DateFormat dtf = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + prepareData(app.getString(R.string.shared_string_start_time), dtf.format(start), + R.drawable.ic_action_time_start_16, GPXDataSetType.SPEED, null, ItemType.ITEM_TIME); + } + + public void prepareDataEndTime(Date end) { + DateFormat dtf = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + prepareData(app.getString(R.string.shared_string_end_time), dtf.format(end), + R.drawable.ic_action_time_end_16, GPXDataSetType.SPEED, null, ItemType.ITEM_TIME); + } + + public void prepareData(String title, String value, @DrawableRes int imageResId, GPXDataSetType firstType, GPXDataSetType secondType, ItemType itemType) { - StatBlock statBlock = new StatBlock(title, value, imageResId, imageColorId, firstType, secondType, itemType); - switch (statBlock.itemType) { - case ITEM_DISTANCE: { - if (analysis.totalDistance != 0f) { - items.add(statBlock); + prepareData(title, value, imageResId, getDefaultIconColorId(nightMode), firstType, secondType, itemType); + } + + public void prepareData(String title, String value, @DrawableRes int imageResId, @ColorRes int imageColorId, + GPXDataSetType firstType, GPXDataSetType secondType, ItemType itemType) { + if (analysis != null) { + StatBlock statBlock = new StatBlock(title, value, imageResId, imageColorId, firstType, secondType, itemType); + switch (statBlock.itemType) { + case ITEM_DISTANCE: { + if (analysis.totalDistance != 0f) { + items.add(statBlock); + } + break; } - break; - } - case ITEM_ALTITUDE: { - if (analysis.hasElevationData) { - items.add(statBlock); + case ITEM_DISTANCE_MOVING: { + if (analysis.totalDistanceMoving != 0f) { + items.add(statBlock); + } + break; } - break; - } - case ITEM_SPEED: { - if (analysis.isSpeedSpecified()) { - items.add(statBlock); + case ITEM_ALTITUDE: { + if (analysis.hasElevationData) { + items.add(statBlock); + } + break; } - break; - } - case ITEM_TIME: { - if (analysis.hasSpeedData) { - items.add(statBlock); + case ITEM_SPEED: { + if (analysis.isSpeedSpecified()) { + items.add(statBlock); + } + break; + } + case ITEM_TIME: { + if (analysis.timeSpan > 0) { + items.add(statBlock); + } + break; + } + case ITEM_TIME_SPAN: { + if (analysis.hasSpeedData) { + items.add(statBlock); + } + break; + } + case ITEM_TIME_MOVING: { + if (analysis.isTimeMoving()) { + items.add(statBlock); + } + break; } - break; } } } @@ -203,9 +344,12 @@ public class GpxBlockStatisticsBuilder { public enum ItemType { ITEM_DISTANCE, + ITEM_DISTANCE_MOVING, ITEM_ALTITUDE, ITEM_SPEED, - ITEM_TIME; + ITEM_TIME, + ITEM_TIME_SPAN, + ITEM_TIME_MOVING; } private class BlockStatisticsAdapter extends RecyclerView.Adapter { @@ -215,17 +359,15 @@ public class GpxBlockStatisticsBuilder { private final SegmentActionsListener actionsListener; @ColorInt private final int activeColor; - private final boolean nightMode; private final int minWidthPx; private final int maxWidthPx; private final int textSize; public BlockStatisticsAdapter(GpxDisplayItem displayItem, SegmentActionsListener actionsListener, - @ColorInt int activeColor, boolean nightMode) { + @ColorInt int activeColor) { this.displayItem = displayItem; this.actionsListener = actionsListener; this.activeColor = activeColor; - this.nightMode = nightMode; minWidthPx = AndroidUtils.dpToPx(app, 60f); maxWidthPx = AndroidUtils.dpToPx(app, 120f); textSize = app.getResources().getDimensionPixelSize(R.dimen.default_desc_text_size); @@ -250,7 +392,7 @@ public class GpxBlockStatisticsBuilder { holder.valueText.setText(item.value); holder.valueText.setTextColor(activeColor); holder.titleText.setText(item.title); - holder.titleText.setTextColor(app.getResources().getColor(R.color.text_color_secondary_light)); + holder.titleText.setTextColor(ContextCompat.getColor(app, R.color.text_color_secondary_light)); float letterSpacing = 0.00f; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { letterSpacing = Math.max(holder.valueText.getLetterSpacing(), holder.titleText.getLetterSpacing()); diff --git a/OsmAnd/src/net/osmand/plus/track/OverviewCard.java b/OsmAnd/src/net/osmand/plus/track/OverviewCard.java index 25fa38e04e..2822297f2e 100644 --- a/OsmAnd/src/net/osmand/plus/track/OverviewCard.java +++ b/OsmAnd/src/net/osmand/plus/track/OverviewCard.java @@ -51,7 +51,7 @@ public class OverviewCard extends BaseCard { super(mapActivity); this.actionsListener = actionsListener; this.selectedGpxFile = selectedGpxFile; - blockStatisticsBuilder = new GpxBlockStatisticsBuilder(app, selectedGpxFile); + blockStatisticsBuilder = new GpxBlockStatisticsBuilder(app, selectedGpxFile, nightMode); } @Override @@ -80,7 +80,7 @@ public class OverviewCard extends BaseCard { initEditButton(iconColorDef, iconColorPres); initDirectionsButton(iconColorDef, iconColorPres); } - blockStatisticsBuilder.initStatBlocks(actionsListener, getActiveColor(), nightMode); + blockStatisticsBuilder.initStatBlocks(actionsListener, getActiveColor()); } private GPXFile getGPXFile() { diff --git a/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java b/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java index f6d5bdd4fd..f79ac0c6b5 100644 --- a/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java +++ b/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java @@ -66,12 +66,17 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { public interface CustomTabProvider { public View getCustomTabView(@NonNull ViewGroup parent, int position); + public void select(View tab); + public void deselect(View tab); + public void tabStylesUpdated(View tabsContainer, int currentPosition); } public interface OnTabReselectedListener { + public void onTabSelected(int position); + public void onTabReselected(int position); } @@ -121,7 +126,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { private int underlineHeight = 0; @ColorInt private int underlineColor; - + private int dividerWidth = 0; private int dividerPadding = 0; @@ -197,7 +202,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { //In case we have the padding they must be equal so we take the biggest padding = Math.max(paddingLeft, paddingRight); - + // get custom attrs a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); @@ -221,7 +226,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { tabTypefaceSelectedStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTextSelectedStyle, Typeface.NORMAL); tabTextAlpha = a.getFloat(R.styleable.PagerSlidingTabStrip_pstsTextAlpha, HALF_TRANSP); tabTextSelectedAlpha = a.getFloat(R.styleable.PagerSlidingTabStrip_pstsTextSelectedAlpha, OPAQUE); - tabTypeface = FontCache.getRobotoMedium(context); + tabTypeface = FontCache.getRobotoMedium(context); a.recycle(); setMarginBottomTabContainer(); @@ -326,6 +331,9 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { View tab = tabsContainer.getChildAt(pager.getCurrentItem()); notSelected(tab); pager.setCurrentItem(position); + if (tabReselectedListener != null) { + tabReselectedListener.onTabSelected(position); + } } else if (tabReselectedListener != null) { tabReselectedListener.onTabReselected(position); } @@ -470,7 +478,7 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { // draw underline rectPaint.setColor(underlineColor); //underlineColor canvas.drawRect(padding, height - underlineHeight, tabsContainer.getWidth() + padding, height, rectPaint); - + // draw divider if (dividerWidth != 0) { dividerPaint.setStrokeWidth(dividerWidth); From 4543e16b1448eedc0dc5967628df9dd609148919 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 22 Mar 2021 12:03:10 +0200 Subject: [PATCH 223/250] Added icon ic_action_dialog for track recording show dialog option --- OsmAnd/res/drawable/ic_action_dialog.xml | 63 ++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 OsmAnd/res/drawable/ic_action_dialog.xml diff --git a/OsmAnd/res/drawable/ic_action_dialog.xml b/OsmAnd/res/drawable/ic_action_dialog.xml new file mode 100644 index 0000000000..0346a117dd --- /dev/null +++ b/OsmAnd/res/drawable/ic_action_dialog.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + From 5f67fbcac69b1ad024e9fae2c2bbd10017e6fca3 Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 22 Mar 2021 13:13:04 +0200 Subject: [PATCH 224/250] add new setting - show start dialog --- OsmAnd/res/values/strings.xml | 6 +++-- OsmAnd/res/xml/monitoring_settings.xml | 9 +++++++- .../plus/activities/MapActivityActions.java | 2 +- .../MonitoringSettingsFragment.java | 7 ++++++ .../monitoring/OsmandMonitoringPlugin.java | 5 +++-- .../TripRecordingStartingBottomFragment.java | 22 ++++++++++++++++++- .../plus/settings/backend/OsmandSettings.java | 1 + 7 files changed, 45 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 21bb56470e..2e8b12d4fa 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,7 +11,9 @@ Thx - Hardy --> - All unsaved data will be lost. + If disabled, recording will start right after tap on the widget or menu item, skipping the confirmation dialog. + Show start dialog + All unsaved data will be lost. Save and continue Logging interval set time period in which OsmAnd will ask for the current location position data. Please select another type of colorization. @@ -1177,7 +1179,7 @@ No search results?\nProvide feedback - If disabled, recording will start right after tap on the widget or menu item, skipping the confirmation dialog. - Show start dialog - All unsaved data will be lost. + If disabled, recording will start right after tap on the widget or menu item, skipping the confirmation dialog. + Show start dialog + All unsaved data will be lost. Save and continue Logging interval set time period in which OsmAnd will ask for the current location position data. Please select another type of colorization. diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 7f96fbf3ec..487f4d902f 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -104,7 +104,7 @@ import net.osmand.plus.measurementtool.LoginBottomSheetFragment; import net.osmand.plus.measurementtool.MeasurementEditingContext; import net.osmand.plus.measurementtool.MeasurementToolFragment; import net.osmand.plus.measurementtool.SnapTrackWarningFragment; -import net.osmand.plus.monitoring.TripRecordingStartingBottomSheetFragment; +import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet; import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.resources.ResourceManager; import net.osmand.plus.routepreparationmenu.ChooseRouteFragment; @@ -2241,8 +2241,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven return getFragment(MeasurementToolFragment.TAG); } - public TripRecordingStartingBottomSheetFragment getTripRecordingBottomSheet() { - return getFragment(TripRecordingStartingBottomSheetFragment.TAG); + public TripRecordingStartingBottomSheet getTripRecordingBottomSheet() { + return getFragment(TripRecordingStartingBottomSheet.TAG); } public ChooseRouteFragment getChooseRouteFragment() { diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index c3f36f89f3..4ef54303ea 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -62,8 +62,8 @@ 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.monitoring.TripRecordingBottomSheetFragment; -import net.osmand.plus.monitoring.TripRecordingStartingBottomSheetFragment; +import net.osmand.plus.monitoring.TripRecordingBottomSheet; +import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet; import net.osmand.plus.osmedit.dialogs.DismissRouteBottomSheetFragment; import net.osmand.plus.profiles.ProfileDataObject; import net.osmand.plus.profiles.ProfileDataUtils; @@ -854,9 +854,9 @@ public class MapActivityActions implements DialogProvider { app.logEvent("trip_recording_open"); MapActivity.clearPrevActivityIntent(); if (monitoringPlugin.hasDataToSave() || monitoringPlugin.wasTrackMonitored()) { - TripRecordingBottomSheetFragment.showInstance(mapActivity.getSupportFragmentManager(), monitoringPlugin.getCurrentTrack()); + TripRecordingBottomSheet.showInstance(mapActivity.getSupportFragmentManager()); } else { - TripRecordingStartingBottomSheetFragment.showInstance(mapActivity.getSupportFragmentManager(), app, monitoringPlugin.getCurrentTrack()); + TripRecordingStartingBottomSheet.showTripRecordingDialog(mapActivity.getSupportFragmentManager(), app); } return true; } diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index b9219a3d75..243362ea98 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -85,9 +85,9 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFreq import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.setAlarmForPendingIntent; import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.getTertiaryTextColorId; -import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.getActiveTextColorId; -import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.getOsmandIconColorId; -import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.getSecondaryIconColorId; +import static net.osmand.plus.monitoring.TripRecordingBottomSheet.getActiveTextColorId; +import static net.osmand.plus.monitoring.TripRecordingBottomSheet.getOsmandIconColorId; +import static net.osmand.plus.monitoring.TripRecordingBottomSheet.getSecondaryIconColorId; public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements OnLiveUpdatesForLocalChange { diff --git a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java index 2d67428141..f4ef01b7f1 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java @@ -300,8 +300,8 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment FragmentActivity activity = getActivity(); if (activity != null && !activity.isChangingConfigurations()) { Fragment target = getTargetFragment(); - if (target instanceof TripRecordingStartingBottomSheetFragment) { - ((TripRecordingStartingBottomSheetFragment) target).show(); + if (target instanceof TripRecordingStartingBottomSheet) { + ((TripRecordingStartingBottomSheet) target).show(); } } super.onDestroy(); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 35dbea97a8..a96fc06d94 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -337,9 +337,9 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { public void controlDialog(final Activity activity, final boolean showTrackSelection) { FragmentManager fragmentManager = ((FragmentActivity) activity).getSupportFragmentManager(); if (hasDataToSave() || wasTrackMonitored()) { - TripRecordingBottomSheetFragment.showInstance(fragmentManager, getCurrentTrack()); + TripRecordingBottomSheet.showInstance(fragmentManager); } else { - TripRecordingStartingBottomSheetFragment.showInstance(fragmentManager, app, getCurrentTrack()); + TripRecordingStartingBottomSheet.showTripRecordingDialog(fragmentManager, app); } /*final boolean wasTrackMonitored = settings.SAVE_GLOBAL_TRACK_TO_GPX.get(); @@ -507,7 +507,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { final Activity a = activityRef.get(); if (a instanceof FragmentActivity && !a.isFinishing()) { List singleName = Collections.singletonList(Algorithms.getFileNameWithoutExtension(file)); - SaveGPXBottomSheetFragment.showInstance(((FragmentActivity) a) + SaveGPXBottomSheet.showInstance(((FragmentActivity) a) .getSupportFragmentManager(), singleName); } } @@ -558,7 +558,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { runnable.run(); } else if (map instanceof FragmentActivity) { FragmentActivity activity = (FragmentActivity) map; - TripRecordingStartingBottomSheetFragment.showInstance(activity.getSupportFragmentManager(), app, getCurrentTrack()); + TripRecordingStartingBottomSheet.showTripRecordingDialog(activity.getSupportFragmentManager(), app); } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/SaveGPXBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/SaveGPXBottomSheet.java similarity index 97% rename from OsmAnd/src/net/osmand/plus/monitoring/SaveGPXBottomSheetFragment.java rename to OsmAnd/src/net/osmand/plus/monitoring/SaveGPXBottomSheet.java index d37d113e6c..14fd6e1352 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/SaveGPXBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/SaveGPXBottomSheet.java @@ -42,10 +42,10 @@ import java.util.List; import static net.osmand.FileUtils.ILLEGAL_FILE_NAME_CHARACTERS; -public class SaveGPXBottomSheetFragment extends MenuBottomSheetDialogFragment { +public class SaveGPXBottomSheet extends MenuBottomSheetDialogFragment { public static final String TAG = "SaveGPXBottomSheetFragment"; public static final String SAVED_TRACKS_KEY = "saved_track_filename"; - private static final Log LOG = PlatformUtil.getLog(SaveGPXBottomSheetFragment.class); + private static final Log LOG = PlatformUtil.getLog(SaveGPXBottomSheet.class); private boolean openTrack = false; private File file; @@ -227,7 +227,7 @@ public class SaveGPXBottomSheetFragment extends MenuBottomSheetDialogFragment { if (fragmentManager.isStateSaved()) { return; } - SaveGPXBottomSheetFragment f = new SaveGPXBottomSheetFragment(); + SaveGPXBottomSheet f = new SaveGPXBottomSheet(); Bundle b = new Bundle(); b.putStringArrayList(SAVED_TRACKS_KEY, new ArrayList<>(filenames)); f.setArguments(b); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java similarity index 97% rename from OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheetFragment.java rename to OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java index 4772e53197..8db1508454 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomSheet.java @@ -73,10 +73,10 @@ import static net.osmand.plus.track.GpxBlockStatisticsBuilder.INIT_BLOCKS_ALTITU import static net.osmand.plus.track.GpxBlockStatisticsBuilder.INIT_BLOCKS_GENERAL; import static net.osmand.plus.track.GpxBlockStatisticsBuilder.INIT_BLOCKS_SPEED; -public class TripRecordingBottomSheetFragment extends MenuBottomSheetDialogFragment implements SegmentActionsListener { +public class TripRecordingBottomSheet extends MenuBottomSheetDialogFragment implements SegmentActionsListener { - public static final String TAG = TripRecordingBottomSheetFragment.class.getSimpleName(); - private static final Log LOG = PlatformUtil.getLog(TripRecordingBottomSheetFragment.class); + public static final String TAG = TripRecordingBottomSheet.class.getSimpleName(); + private static final Log LOG = PlatformUtil.getLog(TripRecordingBottomSheet.class); public static final String UPDATE_TRACK_ICON = "update_track_icon"; private static final int GPS_UPDATE_INTERVAL = 1000; private static final String[] INIT_BLOCKS_KEYS = @@ -104,10 +104,6 @@ public class TripRecordingBottomSheetFragment extends MenuBottomSheetDialogFragm return selectedGpxFile.getGpxFile(); } - public void setSelectedGpxFile(SelectedGpxFile selectedGpxFile) { - this.selectedGpxFile = selectedGpxFile; - } - private boolean hasDataToSave() { return helper.hasDataToSave(); } @@ -120,10 +116,9 @@ public class TripRecordingBottomSheetFragment extends MenuBottomSheetDialogFragm return settings.SAVE_GLOBAL_TRACK_TO_GPX.get(); } - public static void showInstance(@NonNull FragmentManager fragmentManager, SelectedGpxFile selectedGpxFile) { + public static void showInstance(@NonNull FragmentManager fragmentManager) { if (!fragmentManager.isStateSaved()) { - TripRecordingBottomSheetFragment fragment = new TripRecordingBottomSheetFragment(); - fragment.setSelectedGpxFile(selectedGpxFile); + TripRecordingBottomSheet fragment = new TripRecordingBottomSheet(); fragment.show(fragmentManager, TAG); } } @@ -149,7 +144,7 @@ public class TripRecordingBottomSheetFragment extends MenuBottomSheetDialogFragm LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map); trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon); createShowTrackItem(showTrackContainer, trackAppearanceIcon, ItemType.SHOW_TRACK.getTitleId(), - TripRecordingBottomSheetFragment.this, nightMode, new Runnable() { + TripRecordingBottomSheet.this, nightMode, new Runnable() { @Override public void run() { hide(); @@ -213,7 +208,7 @@ public class TripRecordingBottomSheetFragment extends MenuBottomSheetDialogFragm @Override public void onClick(View v) { if (fragmentManager != null) { - TripRecordingOptionsBottomSheetFragment.showInstance(fragmentManager, TripRecordingBottomSheetFragment.this); + TripRecordingOptionsBottomSheet.showInstance(fragmentManager, TripRecordingBottomSheet.this); } } }); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomSheet.java similarity index 78% rename from OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomSheetFragment.java rename to OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomSheet.java index 2e1f171bce..88814e4819 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomSheet.java @@ -11,7 +11,7 @@ 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.monitoring.TripRecordingBottomSheetFragment.ItemType; +import net.osmand.plus.monitoring.TripRecordingBottomSheet.ItemType; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; @@ -19,15 +19,15 @@ import androidx.fragment.app.FragmentManager; import static net.osmand.AndroidUtils.getPrimaryTextColorId; -public class TripRecordingClearDataBottomSheetFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheetFragment.DismissTargetFragment { +public class TripRecordingClearDataBottomSheet extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheet.DismissTargetFragment { - public static final String TAG = TripRecordingClearDataBottomSheetFragment.class.getSimpleName(); + public static final String TAG = TripRecordingClearDataBottomSheet.class.getSimpleName(); private OsmandApplication app; public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target) { if (!fragmentManager.isStateSaved()) { - TripRecordingClearDataBottomSheetFragment fragment = new TripRecordingClearDataBottomSheetFragment(); + TripRecordingClearDataBottomSheet fragment = new TripRecordingClearDataBottomSheet(); fragment.setTargetFragment(target, 0); fragment.show(fragmentManager, TAG); } @@ -81,15 +81,15 @@ public class TripRecordingClearDataBottomSheetFragment extends MenuBottomSheetDi } private View createItem(LayoutInflater inflater, ItemType type) { - return TripRecordingBottomSheetFragment.createItem(app, nightMode, inflater, type); + return TripRecordingBottomSheet.createItem(app, nightMode, inflater, type); } @Override public void onResume() { super.onResume(); Fragment target = getTargetFragment(); - if (target instanceof TripRecordingOptionsBottomSheetFragment) { - ((TripRecordingOptionsBottomSheetFragment) target).hide(); + if (target instanceof TripRecordingOptionsBottomSheet) { + ((TripRecordingOptionsBottomSheet) target).hide(); } } @@ -97,8 +97,8 @@ public class TripRecordingClearDataBottomSheetFragment extends MenuBottomSheetDi public void onPause() { super.onPause(); Fragment target = getTargetFragment(); - if (target instanceof TripRecordingOptionsBottomSheetFragment) { - ((TripRecordingOptionsBottomSheetFragment) target).show(); + if (target instanceof TripRecordingOptionsBottomSheet) { + ((TripRecordingOptionsBottomSheet) target).show(); } } @@ -110,8 +110,8 @@ public class TripRecordingClearDataBottomSheetFragment extends MenuBottomSheetDi @Override public void dismissTarget() { Fragment target = getTargetFragment(); - if (target instanceof TripRecordingOptionsBottomSheetFragment) { - ((TripRecordingOptionsBottomSheetFragment) target).dismiss(); + if (target instanceof TripRecordingOptionsBottomSheet) { + ((TripRecordingOptionsBottomSheet) target).dismiss(); } } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomSheet.java similarity index 80% rename from OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomSheetFragment.java rename to OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomSheet.java index 949257bc73..70414eab5e 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomSheet.java @@ -12,24 +12,24 @@ 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.monitoring.TripRecordingBottomSheetFragment.ItemType; +import net.osmand.plus.monitoring.TripRecordingBottomSheet.ItemType; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import static net.osmand.AndroidUtils.getPrimaryTextColorId; -import static net.osmand.plus.monitoring.TripRecordingOptionsBottomSheetFragment.ACTION_STOP_AND_DISMISS; +import static net.osmand.plus.monitoring.TripRecordingOptionsBottomSheet.ACTION_STOP_AND_DISMISS; -public class TripRecordingDiscardBottomSheetFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheetFragment.DismissTargetFragment { +public class TripRecordingDiscardBottomSheet extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheet.DismissTargetFragment { - public static final String TAG = TripRecordingDiscardBottomSheetFragment.class.getSimpleName(); + public static final String TAG = TripRecordingDiscardBottomSheet.class.getSimpleName(); private OsmandApplication app; public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target) { if (!fragmentManager.isStateSaved()) { - TripRecordingDiscardBottomSheetFragment fragment = new TripRecordingDiscardBottomSheetFragment(); + TripRecordingDiscardBottomSheet fragment = new TripRecordingDiscardBottomSheet(); fragment.setTargetFragment(target, 0); fragment.show(fragmentManager, TAG); } @@ -93,15 +93,15 @@ public class TripRecordingDiscardBottomSheetFragment extends MenuBottomSheetDial } private View createItem(LayoutInflater inflater, ItemType type) { - return TripRecordingBottomSheetFragment.createItem(app, nightMode, inflater, type); + return TripRecordingBottomSheet.createItem(app, nightMode, inflater, type); } @Override public void onResume() { super.onResume(); Fragment target = getTargetFragment(); - if (target instanceof TripRecordingOptionsBottomSheetFragment) { - ((TripRecordingOptionsBottomSheetFragment) target).hide(); + if (target instanceof TripRecordingOptionsBottomSheet) { + ((TripRecordingOptionsBottomSheet) target).hide(); } } @@ -109,16 +109,16 @@ public class TripRecordingDiscardBottomSheetFragment extends MenuBottomSheetDial public void onPause() { super.onPause(); Fragment target = getTargetFragment(); - if (target instanceof TripRecordingOptionsBottomSheetFragment) { - ((TripRecordingOptionsBottomSheetFragment) target).show(); + if (target instanceof TripRecordingOptionsBottomSheet) { + ((TripRecordingOptionsBottomSheet) target).show(); } } @Override public void dismissTarget() { Fragment target = getTargetFragment(); - if (target instanceof TripRecordingOptionsBottomSheetFragment) { - ((TripRecordingOptionsBottomSheetFragment) target).dismiss(); + if (target instanceof TripRecordingOptionsBottomSheet) { + ((TripRecordingOptionsBottomSheet) target).dismiss(); } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomSheet.java similarity index 86% rename from OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomSheetFragment.java rename to OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomSheet.java index c110343ba8..ac42775bd2 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomSheet.java @@ -27,7 +27,7 @@ import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem; import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.ItemType; +import net.osmand.plus.monitoring.TripRecordingBottomSheet.ItemType; import net.osmand.plus.myplaces.SaveCurrentTrackTask; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.track.SaveGpxAsyncTask.SaveGpxListener; @@ -35,9 +35,9 @@ import net.osmand.util.Algorithms; import static net.osmand.AndroidUtils.getPrimaryTextColorId; -public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheetFragment.DismissTargetFragment { +public class TripRecordingOptionsBottomSheet extends MenuBottomSheetDialogFragment implements TripRecordingBottomSheet.DismissTargetFragment { - public static final String TAG = TripRecordingOptionsBottomSheetFragment.class.getSimpleName(); + public static final String TAG = TripRecordingOptionsBottomSheet.class.getSimpleName(); public static final String ACTION_STOP_AND_DISMISS = "action_stop_and_discard"; private static final int SAVE_UPDATE_INTERVAL = 1000; @@ -72,7 +72,7 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target) { if (!fragmentManager.isStateSaved()) { - TripRecordingOptionsBottomSheetFragment fragment = new TripRecordingOptionsBottomSheetFragment(); + TripRecordingOptionsBottomSheet fragment = new TripRecordingOptionsBottomSheet(); fragment.setTargetFragment(target, 0); fragment.show(fragmentManager, TAG); } @@ -109,7 +109,7 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial @Override public void onClick(View v) { if (fragmentManager != null && hasDataToSave()) { - TripRecordingClearDataBottomSheetFragment.showInstance(fragmentManager, TripRecordingOptionsBottomSheetFragment.this); + TripRecordingClearDataBottomSheet.showInstance(fragmentManager, TripRecordingOptionsBottomSheet.this); } } }) @@ -123,7 +123,7 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial @Override public void onClick(View v) { if (fragmentManager != null) { - TripRecordingDiscardBottomSheetFragment.showInstance(fragmentManager, TripRecordingOptionsBottomSheetFragment.this); + TripRecordingDiscardBottomSheet.showInstance(fragmentManager, TripRecordingOptionsBottomSheet.this); } } }) @@ -189,8 +189,8 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial super.onResume(); runUpdatingTimeTrackSaved(); Fragment target = getTargetFragment(); - if (target instanceof TripRecordingBottomSheetFragment) { - ((TripRecordingBottomSheetFragment) target).hide(); + if (target instanceof TripRecordingBottomSheet) { + ((TripRecordingBottomSheet) target).hide(); } } @@ -224,8 +224,8 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial @Override public void run() { String time = getTimeTrackSaved(); - TripRecordingBottomSheetFragment.createItem(app, nightMode, buttonSave, ItemType.SAVE, hasDataToSave(), !Algorithms.isEmpty(time) ? time : null); - TripRecordingBottomSheetFragment.createItem(app, nightMode, buttonClear, ItemType.CLEAR_DATA, hasDataToSave(), null); + TripRecordingBottomSheet.createItem(app, nightMode, buttonSave, ItemType.SAVE, hasDataToSave(), !Algorithms.isEmpty(time) ? time : null); + TripRecordingBottomSheet.createItem(app, nightMode, buttonClear, ItemType.CLEAR_DATA, hasDataToSave(), null); handler.postDelayed(this, SAVE_UPDATE_INTERVAL); } }; @@ -244,11 +244,11 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial } private View createItem(LayoutInflater inflater, ItemType type, boolean enabled) { - return TripRecordingBottomSheetFragment.createItem(app, nightMode, inflater, type, enabled, null); + return TripRecordingBottomSheet.createItem(app, nightMode, inflater, type, enabled, null); } private View createItem(LayoutInflater inflater, ItemType type) { - return TripRecordingBottomSheetFragment.createItem(app, nightMode, inflater, type); + return TripRecordingBottomSheet.createItem(app, nightMode, inflater, type); } private SaveGpxListener createSaveListener() { @@ -286,11 +286,11 @@ public class TripRecordingOptionsBottomSheetFragment extends MenuBottomSheetDial @Override public void dismissTarget() { Fragment target = getTargetFragment(); - if (target instanceof TripRecordingBottomSheetFragment) { + if (target instanceof TripRecordingBottomSheet) { if (isDiscard()) { - ((TripRecordingBottomSheetFragment) target).dismiss(); + ((TripRecordingBottomSheet) target).dismiss(); } else { - ((TripRecordingBottomSheetFragment) target).show(); + ((TripRecordingBottomSheet) target).show(); } } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java similarity index 87% rename from OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheetFragment.java rename to OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java index 8b41dab876..e45f792514 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java @@ -19,31 +19,29 @@ import androidx.fragment.app.FragmentManager; import com.google.android.material.slider.RangeSlider; -import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.NavigationService; 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.activities.SavingTrackHelper; import net.osmand.plus.base.MenuBottomSheetDialogFragment; import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; -import net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.ItemType; +import net.osmand.plus.monitoring.TripRecordingBottomSheet.ItemType; import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.fragments.BaseSettingsFragment; import net.osmand.plus.settings.fragments.BaseSettingsFragment.SettingsScreenType; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS; -import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.createItem; -import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.createShowTrackItem; -import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.updateTrackIcon; +import static net.osmand.plus.monitoring.TripRecordingBottomSheet.createItem; +import static net.osmand.plus.monitoring.TripRecordingBottomSheet.createShowTrackItem; +import static net.osmand.plus.monitoring.TripRecordingBottomSheet.updateTrackIcon; -public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDialogFragment { +public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragment { - public static final String TAG = TripRecordingStartingBottomSheetFragment.class.getSimpleName(); + public static final String TAG = TripRecordingStartingBottomSheet.class.getSimpleName(); public static final String UPDATE_LOGGING_INTERVAL = "update_logging_interval"; private OsmandApplication app; @@ -59,12 +57,12 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia public static void showInstance(@NonNull FragmentManager fragmentManager) { if (!fragmentManager.isStateSaved()) { - TripRecordingStartingBottomSheetFragment fragment = new TripRecordingStartingBottomSheetFragment(); + TripRecordingStartingBottomSheet fragment = new TripRecordingStartingBottomSheet(); fragment.show(fragmentManager, TAG); } } - public static void showInstance(@NonNull FragmentManager fragmentManager, OsmandApplication app, SelectedGpxFile selectedGpxFile) { + public static void showTripRecordingDialog(@NonNull FragmentManager fragmentManager, OsmandApplication app) { if (!fragmentManager.isStateSaved()) { OsmandSettings settings = app.getSettings(); boolean showStartDialog = settings.SHOW_TRIP_REC_START_DIALOG.get(); @@ -72,7 +70,7 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia showInstance(fragmentManager); } else { startRecording(app); - TripRecordingBottomSheetFragment.showInstance(fragmentManager, selectedGpxFile); + TripRecordingBottomSheet.showInstance(fragmentManager); } } } @@ -106,7 +104,7 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia LinearLayout showTrackContainer = itemView.findViewById(R.id.show_track_on_map); trackAppearanceIcon = showTrackContainer.findViewById(R.id.additional_button_icon); createShowTrackItem(showTrackContainer, trackAppearanceIcon, R.string.shared_string_show_on_map, - TripRecordingStartingBottomSheetFragment.this, nightMode, new Runnable() { + TripRecordingStartingBottomSheet.this, nightMode, new Runnable() { @Override public void run() { hide(); @@ -142,7 +140,7 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia if (mapActivity != null) { hide(); BaseSettingsFragment.showInstance(mapActivity, SettingsScreenType.MONITORING_SETTINGS, - null, new Bundle(), TripRecordingStartingBottomSheetFragment.this); + null, new Bundle(), TripRecordingStartingBottomSheet.this); } } }); @@ -221,10 +219,8 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia } private static void startRecording(OsmandApplication app) { - OsmandSettings settings = app.getSettings(); - SavingTrackHelper helper = app.getSavingTrackHelper(); - helper.startNewSegment(); - settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true); + app.getSavingTrackHelper().startNewSegment(); + app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.set(true); app.startNavigationService(NavigationService.USED_BY_GPX); } @@ -232,8 +228,7 @@ public class TripRecordingStartingBottomSheetFragment extends MenuBottomSheetDia startRecording(app); MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { - SavingTrackHelper helper = app.getSavingTrackHelper(); - TripRecordingBottomSheetFragment.showInstance(mapActivity.getSupportFragmentManager(), helper.getCurrentTrack()); + TripRecordingBottomSheet.showInstance(mapActivity.getSupportFragmentManager()); } dismiss(); } diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java index 8a37c9c239..2f4ca39f84 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BooleanPreferenceBottomSheet.java @@ -34,7 +34,7 @@ import net.osmand.plus.settings.preferences.SwitchPreferenceEx; import org.apache.commons.logging.Log; import static net.osmand.plus.liveupdates.LiveUpdatesSettingsDialogFragmentNew.getActivePrimaryColorId; -import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.getSecondaryIconColorId; +import static net.osmand.plus.monitoring.TripRecordingBottomSheet.getSecondaryIconColorId; public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet { diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java index 8b1f5fb09b..7329c58105 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java @@ -36,8 +36,8 @@ import net.osmand.plus.dialogs.GpxAppearanceAdapter; import net.osmand.plus.dialogs.GpxAppearanceAdapter.AppearanceListItem; import net.osmand.plus.dialogs.GpxAppearanceAdapter.GpxAppearanceAdapterType; import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.monitoring.TripRecordingBottomSheetFragment; -import net.osmand.plus.monitoring.TripRecordingStartingBottomSheetFragment; +import net.osmand.plus.monitoring.TripRecordingBottomSheet; +import net.osmand.plus.monitoring.TripRecordingStartingBottomSheet; import net.osmand.plus.routepreparationmenu.cards.BaseCard; import net.osmand.plus.routepreparationmenu.cards.BaseCard.CardListener; import net.osmand.plus.settings.backend.CommonPreference; @@ -64,7 +64,7 @@ import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_COLOR_ATTR; import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_BOLD; import static net.osmand.plus.dialogs.GpxAppearanceAdapter.TRACK_WIDTH_MEDIUM; import static net.osmand.plus.dialogs.GpxAppearanceAdapter.getAppearanceItems; -import static net.osmand.plus.monitoring.TripRecordingBottomSheetFragment.UPDATE_TRACK_ICON; +import static net.osmand.plus.monitoring.TripRecordingBottomSheet.UPDATE_TRACK_ICON; public class TrackAppearanceFragment extends ContextMenuScrollFragment implements CardListener, ColorPickerListener { @@ -398,10 +398,10 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement @Override public void onContextMenuDismiss(@NonNull ContextMenuFragment fragment) { Fragment target = getTargetFragment(); - if (target instanceof TripRecordingStartingBottomSheetFragment) { - ((TripRecordingStartingBottomSheetFragment) target).show(); - } else if (target instanceof TripRecordingBottomSheetFragment) { - ((TripRecordingBottomSheetFragment) target).show(UPDATE_TRACK_ICON); + if (target instanceof TripRecordingStartingBottomSheet) { + ((TripRecordingStartingBottomSheet) target).show(); + } else if (target instanceof TripRecordingBottomSheet) { + ((TripRecordingBottomSheet) target).show(UPDATE_TRACK_ICON); } }