From 35064dba0158091eac04d69c278722b73a09cf0a Mon Sep 17 00:00:00 2001 From: Skalii Date: Fri, 19 Mar 2021 17:48:57 +0200 Subject: [PATCH 01/23] 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 f3c34e1060268e540c496de0be9e08f453c46172 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 22 Mar 2021 14:40:03 +0200 Subject: [PATCH 02/23] Small fixes --- .../plus/activities/PluginInfoFragment.java | 2 +- .../MonitoringSettingsFragment.java | 31 ++++++++++++++----- .../TripRecordingActiveBottomSheet.java | 29 +++++++++-------- .../TripRecordingStartingBottomSheet.java | 8 ++--- .../RouteOptionsBottomSheet.java | 4 +-- .../fragments/BaseSettingsFragment.java | 28 ++--------------- 6 files changed, 47 insertions(+), 55 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java b/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java index 5fdf2eab46..ced666e32b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/PluginInfoFragment.java @@ -139,7 +139,7 @@ public class PluginInfoFragment extends BaseOsmAndFragment implements PluginStat if (settingsScreenType != null) { Bundle args = new Bundle(); args.putBoolean(PLUGIN_INFO, true); - BaseSettingsFragment.showInstance(activity, settingsScreenType, null, args); + BaseSettingsFragment.showInstance(activity, settingsScreenType, null, args, null); } } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java index ae35fd767c..8ade392007 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java @@ -9,25 +9,27 @@ import android.text.SpannableStringBuilder; import android.view.LayoutInflater; import android.view.View; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; import androidx.preference.Preference; -import net.osmand.plus.helpers.AndroidUiHelper; -import net.osmand.plus.settings.backend.ApplicationMode; -import net.osmand.plus.settings.backend.OsmAndAppCustomization; import net.osmand.plus.OsmandPlugin; -import net.osmand.plus.settings.backend.CommonPreference; -import net.osmand.plus.settings.backend.OsmandPreference; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.myplaces.FavoritesActivity; import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet; import net.osmand.plus.profiles.SelectCopyAppModeBottomSheet.CopyAppModePrefsListener; -import net.osmand.plus.settings.fragments.BaseSettingsFragment; +import net.osmand.plus.settings.backend.ApplicationMode; +import net.osmand.plus.settings.backend.CommonPreference; +import net.osmand.plus.settings.backend.OsmAndAppCustomization; +import net.osmand.plus.settings.backend.OsmandPreference; import net.osmand.plus.settings.bottomsheets.ResetProfilePrefsBottomSheet; import net.osmand.plus.settings.bottomsheets.ResetProfilePrefsBottomSheet.ResetAppModePrefsListener; import net.osmand.plus.settings.bottomsheets.SingleSelectPreferenceBottomSheet; +import net.osmand.plus.settings.fragments.BaseSettingsFragment; import net.osmand.plus.settings.preferences.ListPreferenceEx; import net.osmand.plus.settings.preferences.SwitchPreferenceEx; import net.osmand.plus.widgets.style.CustomTypefaceSpan; @@ -36,11 +38,12 @@ import java.util.HashMap; import java.util.LinkedHashMap; import static net.osmand.plus.activities.PluginInfoFragment.PLUGIN_INFO; -import static net.osmand.plus.settings.backend.OsmandSettings.MONTHLY_DIRECTORY; -import static net.osmand.plus.settings.backend.OsmandSettings.REC_DIRECTORY; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS; +import static net.osmand.plus.monitoring.TripRecordingStartingBottomSheet.UPDATE_LOGGING_INTERVAL; import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID; +import static net.osmand.plus.settings.backend.OsmandSettings.MONTHLY_DIRECTORY; +import static net.osmand.plus.settings.backend.OsmandSettings.REC_DIRECTORY; public class MonitoringSettingsFragment extends BaseSettingsFragment implements CopyAppModePrefsListener, ResetAppModePrefsListener { @@ -292,6 +295,18 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment resetToDefault.setIcon(getActiveIcon(R.drawable.ic_action_reset_to_default_dark)); } + @Override + public void onDestroy() { + FragmentActivity activity = getActivity(); + if (activity != null && !activity.isChangingConfigurations()) { + Fragment target = getTargetFragment(); + if (target instanceof TripRecordingStartingBottomSheet) { + ((TripRecordingStartingBottomSheet) target).show(UPDATE_LOGGING_INTERVAL); + } + } + super.onDestroy(); + } + @Override public boolean onPreferenceClick(Preference preference) { String prefId = preference.getKey(); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java index dc965143d3..3863905fce 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingActiveBottomSheet.java @@ -29,6 +29,7 @@ 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.FragmentActivity; import androidx.fragment.app.FragmentManager; import androidx.recyclerview.widget.RecyclerView; @@ -81,7 +82,6 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen private SelectedGpxFile selectedGpxFile; private View statusContainer; - private LinearLayout showTrackContainer; private AppCompatImageView trackAppearanceIcon; private View buttonSave; private GpxBlockStatisticsBuilder blockStatisticsBuilder; @@ -161,10 +161,10 @@ 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() { + createShowTrackItem(showTrackContainer, trackAppearanceIcon, ItemType.SHOW_TRACK.getTitleId(), + TripRecordingActiveBottomSheet.this, nightMode, new Runnable() { @Override public void run() { hide(); @@ -275,10 +275,15 @@ 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) { + public static void createShowTrackItem(LinearLayout showTrackContainer, AppCompatImageView trackAppearanceIcon, + Integer showTrackId, final Fragment target, + final boolean nightMode, final Runnable hideOnClickButtonAppearance) { + FragmentActivity activity = target.getActivity(); + if (!(activity instanceof MapActivity)) { + return; + } + final MapActivity mapActivity = (MapActivity) activity; + final OsmandApplication app = mapActivity.getMyApplication(); final CardView buttonShowTrack = showTrackContainer.findViewById(R.id.compound_container); final CardView buttonAppearance = showTrackContainer.findViewById(R.id.additional_button_container); @@ -308,11 +313,9 @@ public class TripRecordingActiveBottomSheet extends MenuBottomSheetDialogFragmen @Override public void onClick(View v) { if (showTrackCompound.isChecked()) { - if (mapActivity != null) { - hideOnClickButtonAppearance.run(); - SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); - TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, target); - } + hideOnClickButtonAppearance.run(); + SelectedGpxFile selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); + TrackAppearanceFragment.showInstance(mapActivity, selectedGpxFile, target); } } }); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java index c8c96d1323..fcc48efd45 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomSheet.java @@ -93,8 +93,8 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm 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() { + createShowTrackItem(showTrackContainer, trackAppearanceIcon, R.string.shared_string_show_on_map, + TripRecordingStartingBottomSheet.this, nightMode, new Runnable() { @Override public void run() { hide(); @@ -129,7 +129,8 @@ 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, + null, new Bundle(), TripRecordingStartingBottomSheet.this); } } }); @@ -255,5 +256,4 @@ public class TripRecordingStartingBottomSheet extends MenuBottomSheetDialogFragm protected boolean hideButtonsContainer() { return true; } - } diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java index 9e3c633544..4067340431 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java @@ -12,9 +12,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.ColorInt; -import androidx.annotation.ColorRes; import androidx.appcompat.widget.SwitchCompat; -import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; @@ -556,7 +554,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment { Bundle args = new Bundle(); args.putString(DIALOG_MODE_KEY, dialogMode.name()); BaseSettingsFragment.showInstance(mapActivity, - SettingsScreenType.NAVIGATION, applicationMode, args); + SettingsScreenType.NAVIGATION, applicationMode, args, null); } }) .create(); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java index a426321eb9..4c0af32894 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java @@ -61,7 +61,6 @@ 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; @@ -86,7 +85,6 @@ 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 { @@ -293,15 +291,6 @@ 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(); @@ -895,24 +884,11 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl } public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType) { - return showInstance(activity, screenType, (ApplicationMode) null); - } - - public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, Fragment target) { - return showInstance(activity, screenType, null, target); + return showInstance(activity, screenType, null); } 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); + return showInstance(activity, screenType, appMode, new Bundle(), null); } public static boolean showInstance(FragmentActivity activity, SettingsScreenType screenType, From 695a0016b918426cb6a719ecc133f0040d0307f5 Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 22 Mar 2021 16:03:32 +0200 Subject: [PATCH 03/23] lost fixes after merge; --- .../plus/monitoring/MonitoringSettingsFragment.java | 6 +++--- .../routepreparationmenu/RouteOptionsBottomSheet.java | 8 ++++---- .../plus/settings/fragments/BaseSettingsFragment.java | 11 ----------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java index 8ade392007..8ee1de18a3 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java @@ -40,7 +40,7 @@ import java.util.LinkedHashMap; import static net.osmand.plus.activities.PluginInfoFragment.PLUGIN_INFO; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS; -import static net.osmand.plus.monitoring.TripRecordingStartingBottomSheet.UPDATE_LOGGING_INTERVAL; +import static net.osmand.plus.monitoring.TripRecordingStartingBottomFragment.UPDATE_LOGGING_INTERVAL; import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID; import static net.osmand.plus.settings.backend.OsmandSettings.MONTHLY_DIRECTORY; import static net.osmand.plus.settings.backend.OsmandSettings.REC_DIRECTORY; @@ -300,8 +300,8 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment FragmentActivity activity = getActivity(); if (activity != null && !activity.isChangingConfigurations()) { Fragment target = getTargetFragment(); - if (target instanceof TripRecordingStartingBottomSheet) { - ((TripRecordingStartingBottomSheet) target).show(UPDATE_LOGGING_INTERVAL); + if (target instanceof TripRecordingStartingBottomFragment) { + ((TripRecordingStartingBottomFragment) target).show(UPDATE_LOGGING_INTERVAL); } } super.onDestroy(); diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java index 4067340431..52cf2ac54e 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java @@ -105,7 +105,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment { private final Class[] excludeParameters; @SafeVarargs - DialogMode(Class ... excludeParameters) { + DialogMode(Class... excludeParameters) { this.excludeParameters = excludeParameters; } @@ -693,9 +693,9 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment { } public static void showInstance(MapActivity mapActivity, - Fragment targetFragment, - DialogMode dialogMode, - String appModeKey) { + Fragment targetFragment, + DialogMode dialogMode, + String appModeKey) { try { FragmentManager fm = mapActivity.getSupportFragmentManager(); if (!fm.isStateSaved()) { diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java index 6f6ced0203..4c0af32894 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java @@ -61,7 +61,6 @@ 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.TripRecordingStartingBottomFragment; import net.osmand.plus.openplacereviews.OprSettingsFragment; import net.osmand.plus.osmedit.OsmEditingFragment; import net.osmand.plus.profiles.SelectAppModesBottomSheetDialogFragment; @@ -86,7 +85,6 @@ import java.io.Serializable; import java.util.Set; import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID; -import static net.osmand.plus.monitoring.TripRecordingStartingBottomFragment.UPDATE_LOGGING_INTERVAL; public abstract class BaseSettingsFragment extends PreferenceFragmentCompat implements OnPreferenceChangeListener, OnPreferenceClickListener, AppModeChangedListener, OnConfirmPreferenceChange { @@ -293,15 +291,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl } } - @Override - public void onDestroyView() { - super.onDestroyView(); - Fragment target = getTargetFragment(); - if (target instanceof TripRecordingStartingBottomFragment) { - ((TripRecordingStartingBottomFragment) target).show(UPDATE_LOGGING_INTERVAL); - } - } - @Override public void onDetach() { super.onDetach(); From 8e2b5a72f02dd3762531ee5e753f52a288a40d90 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 22 Mar 2021 17:21:26 +0200 Subject: [PATCH 04/23] Fix compilation --- .../osmand/plus/monitoring/MonitoringSettingsFragment.java | 6 +++--- .../osmand/plus/monitoring/TripRecordingBottomFragment.java | 2 +- .../monitoring/TripRecordingStartingBottomFragment.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java index 8ade392007..8ee1de18a3 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java @@ -40,7 +40,7 @@ import java.util.LinkedHashMap; import static net.osmand.plus.activities.PluginInfoFragment.PLUGIN_INFO; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS; -import static net.osmand.plus.monitoring.TripRecordingStartingBottomSheet.UPDATE_LOGGING_INTERVAL; +import static net.osmand.plus.monitoring.TripRecordingStartingBottomFragment.UPDATE_LOGGING_INTERVAL; import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID; import static net.osmand.plus.settings.backend.OsmandSettings.MONTHLY_DIRECTORY; import static net.osmand.plus.settings.backend.OsmandSettings.REC_DIRECTORY; @@ -300,8 +300,8 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment FragmentActivity activity = getActivity(); if (activity != null && !activity.isChangingConfigurations()) { Fragment target = getTargetFragment(); - if (target instanceof TripRecordingStartingBottomSheet) { - ((TripRecordingStartingBottomSheet) target).show(UPDATE_LOGGING_INTERVAL); + if (target instanceof TripRecordingStartingBottomFragment) { + ((TripRecordingStartingBottomFragment) target).show(UPDATE_LOGGING_INTERVAL); } } super.onDestroy(); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java index 45d934249c..a1e6d4fd0c 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java @@ -151,7 +151,7 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i 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(), - TripRecordingActiveBottomSheet.this, nightMode, new Runnable() { + TripRecordingBottomFragment.this, nightMode, new Runnable() { @Override public void run() { hide(); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java index bcf4ce7c7b..0a210b87cd 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java @@ -93,7 +93,7 @@ public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFr 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, - TripRecordingStartingBottomSheet.this, nightMode, new Runnable() { + TripRecordingStartingBottomFragment.this, nightMode, new Runnable() { @Override public void run() { hide(); @@ -132,7 +132,7 @@ public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFr if (mapActivity != null) { hide(); BaseSettingsFragment.showInstance(mapActivity, SettingsScreenType.MONITORING_SETTINGS, - null, new Bundle(), TripRecordingStartingBottomSheet.this); + null, new Bundle(), TripRecordingStartingBottomFragment.this); } } }); From e1da7bbadf3e53fc7093f7ce95616f374405f3e8 Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 22 Mar 2021 19:05:51 +0200 Subject: [PATCH 05/23] some fixes; --- .../MonitoringSettingsFragment.java | 2 +- .../monitoring/OsmandMonitoringPlugin.java | 10 ++- .../TripRecordingBottomFragment.java | 57 ++++++------ .../TripRecordingClearDataBottomFragment.java | 14 ++- .../TripRecordingDiscardBottomFragment.java | 27 ++++-- .../TripRecordingOptionsBottomFragment.java | 87 +++++++------------ .../TripRecordingStartingBottomFragment.java | 14 +-- .../plus/track/TrackAppearanceFragment.java | 2 +- 8 files changed, 98 insertions(+), 115 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java index 8ee1de18a3..b8f5920d8d 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java @@ -301,7 +301,7 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment if (activity != null && !activity.isChangingConfigurations()) { Fragment target = getTargetFragment(); if (target instanceof TripRecordingStartingBottomFragment) { - ((TripRecordingStartingBottomFragment) target).show(UPDATE_LOGGING_INTERVAL); + ((TripRecordingStartingBottomFragment) 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 de95978f7d..680fffd087 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -25,6 +25,7 @@ import com.google.android.material.slider.Slider; import net.osmand.AndroidUtils; import net.osmand.Location; +import net.osmand.PlatformUtil; import net.osmand.ValueHolder; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.NavigationService; @@ -48,6 +49,8 @@ import net.osmand.plus.views.layers.MapInfoLayer; import net.osmand.plus.views.mapwidgets.widgets.TextInfoWidget; import net.osmand.util.Algorithms; +import org.apache.commons.logging.Log; + import java.io.File; import java.lang.ref.WeakReference; import java.util.Collections; @@ -57,6 +60,7 @@ import static net.osmand.plus.UiUtilities.CompoundButtonType.PROFILE_DEPENDENT; public class OsmandMonitoringPlugin extends OsmandPlugin { + private static final Log LOG = PlatformUtil.getLog(OsmandMonitoringPlugin.class); public static final String ID = "osmand.monitoring"; public final static String OSMAND_SAVE_SERVICE_ACTION = "OSMAND_SAVE_SERVICE_ACTION"; public static final int REQUEST_LOCATION_PERMISSION_FOR_GPX_RECORDING = 208; @@ -470,12 +474,10 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { try { SavingTrackHelper helper = app.getSavingTrackHelper(); SaveGpxResult result = helper.saveDataToGpx(app.getAppCustomization().getTracksDir()); - if (stopRecording) { - helper.close(); - } + helper.close(); return result; } catch (Exception e) { - e.printStackTrace(); + LOG.error(e.getMessage(), e); } return null; } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java index efed60b340..eb0d983f0e 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java @@ -38,6 +38,7 @@ 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.helpers.AndroidUiHelper; @@ -60,12 +61,12 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { 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 GPS_UPDATE_INTERVAL = 1000; private OsmandApplication app; private OsmandSettings settings; + private SavingTrackHelper helper; private OsmandMonitoringPlugin plugin; private View statusContainer; @@ -85,7 +86,7 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { } private boolean hasDataToSave() { - return app.getSavingTrackHelper().hasDataToSave(); + return helper.hasDataToSave(); } private boolean searchingGPS() { @@ -108,7 +109,9 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { public void createMenuItems(Bundle savedInstanceState) { app = requiredMyApplication(); settings = app.getSettings(); + helper = app.getSavingTrackHelper(); plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class); + selectedGpxFile = helper.getCurrentTrack(); LayoutInflater inflater = UiUtilities.getInflater(getContext(), nightMode); final FragmentManager fragmentManager = getFragmentManager(); @@ -121,12 +124,6 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { updateStatus(); RecyclerView statBlocks = itemView.findViewById(R.id.block_statistics); - if (savedInstanceState != null) { - if (savedInstanceState.containsKey(SAVE_CURRENT_GPX_FILE) - && savedInstanceState.getBoolean(SAVE_CURRENT_GPX_FILE)) { - selectedGpxFile = app.getSavingTrackHelper().getCurrentTrack(); - } - } blockStatisticsBuilder = new GpxBlockStatisticsBuilder(app, selectedGpxFile); blockStatisticsBuilder.setBlocksView(statBlocks); blockStatisticsBuilder.setBlocksClickable(false); @@ -174,7 +171,7 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { @Override public void onClick(View v) { MapActivity mapActivity = getMapActivity(); - if (mapActivity != null && plugin != null && app.getSavingTrackHelper().hasDataToSave()) { + if (mapActivity != null && plugin != null && hasDataToSave()) { plugin.saveCurrentTrack(null, mapActivity); app.getNotificationHelper().refreshNotifications(); dismiss(); @@ -188,19 +185,13 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { @Override public void onClick(View v) { if (fragmentManager != null) { - TripRecordingOptionsBottomFragment.showInstance(fragmentManager, TripRecordingBottomFragment.this, selectedGpxFile); + TripRecordingOptionsBottomFragment.showInstance(fragmentManager, TripRecordingBottomFragment.this); } } }); } - @Override - public void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.putBoolean(SAVE_CURRENT_GPX_FILE, true); - } - @Override public void onResume() { super.onResume(); @@ -387,18 +378,18 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { } public static void setItemBackground(Context context, boolean nightMode, View view, boolean enabled) { - Drawable background = AppCompatResources.getDrawable(context, R.drawable.btn_background_inactive_light); + if (view instanceof CardView) { + int colorId = enabled ? getActiveTransparentColorId(nightMode) : getInactiveButtonColorId(nightMode); + ((CardView) view).setCardBackgroundColor(AndroidUtils.createPressedColorStateList( + context, colorId, getActiveTextColorId(nightMode) + )); + return; + } + Drawable background = AppCompatResources.getDrawable(context, getInactiveButtonBackgroundId(nightMode)); 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); + DrawableCompat.setTintList(background, AndroidUtils.createPressedColorStateList( + context, getInactiveButtonColorId(nightMode), getActiveTextColorId(nightMode) + )); } else { UiUtilities.tintDrawable(background, ContextCompat.getColor(context, getInactiveButtonColorId(nightMode))); } @@ -483,6 +474,10 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { } } + public interface DismissTargetFragment { + void dismissTarget(); + } + @ColorRes public static int getActiveTextColorId(boolean nightMode) { return nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light; @@ -513,7 +508,7 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { return nightMode ? R.color.icon_color_osmand_dark : R.color.icon_color_osmand_light; } - @DrawableRes + @ColorRes public static int getActiveTransparentColorId(boolean nightMode) { return nightMode ? R.color.switch_button_active_dark : R.color.switch_button_active_light; } @@ -533,6 +528,11 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { return nightMode ? R.drawable.btn_background_stroked_inactive_dark : R.drawable.btn_background_stroked_inactive_light; } + @DrawableRes + public static int getInactiveButtonBackgroundId(boolean nightMode) { + return nightMode ? R.drawable.btn_background_inactive_dark : R.drawable.btn_background_inactive_light; + } + @Override protected boolean hideButtonsContainer() { return true; @@ -546,5 +546,4 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment { } return null; } - } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomFragment.java index e51911c867..c4bd642c1b 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingClearDataBottomFragment.java @@ -18,9 +18,8 @@ import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import static net.osmand.AndroidUtils.getPrimaryTextColorId; -import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.*; -public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogFragment { +public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomFragment.DismissTargetFragment { public static final String TAG = TripRecordingClearDataBottomFragment.class.getSimpleName(); @@ -41,7 +40,7 @@ public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogF 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)); + .concat("\n").concat(getString(R.string.lost_data_warning)); final View buttonClear = createItem(inflater, ItemType.CLEAR_DATA); final View buttonCancel = createItem(inflater, ItemType.CANCEL); @@ -61,7 +60,7 @@ public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogF public void onClick(View v) { app.getSavingTrackHelper().clearRecordedData(true); dismiss(); - dismissTargetDialog(TripRecordingClearDataBottomFragment.this, TripRecordingOptionsBottomFragment.class); + dismissTarget(); } }) .create()); @@ -108,4 +107,11 @@ public class TripRecordingClearDataBottomFragment extends MenuBottomSheetDialogF return true; } + @Override + public void dismissTarget() { + Fragment target = getTargetFragment(); + if (target instanceof TripRecordingOptionsBottomFragment) { + ((TripRecordingOptionsBottomFragment) target).dismiss(); + } + } } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomFragment.java index 971d7399e1..20a2889f3e 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingDiscardBottomFragment.java @@ -19,10 +19,9 @@ import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; 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; +import static net.osmand.plus.monitoring.TripRecordingOptionsBottomFragment.ACTION_STOP_AND_DISMISS; -public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFragment { +public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomFragment.DismissTargetFragment { public static final String TAG = TripRecordingDiscardBottomFragment.class.getSimpleName(); @@ -43,13 +42,11 @@ public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFra 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.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(description) + .setDescription(getString(R.string.track_recording_description)) .setDescriptionColorId(getPrimaryTextColorId(nightMode)) .setTitle(app.getString(R.string.track_recording_title)) .setLayoutId(R.layout.bottom_sheet_item_title_with_description) @@ -68,8 +65,14 @@ public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFra } app.getSavingTrackHelper().clearRecordedData(true); dismiss(); - dismissTargetDialog(TripRecordingDiscardBottomFragment.this, - TripRecordingOptionsBottomFragment.class, ACTION_STOP_AND_DISCARD, true); + + Fragment target = getTargetFragment(); + if (target != null) { + Bundle args = new Bundle(); + args.putBoolean(ACTION_STOP_AND_DISMISS, true); + target.setArguments(args); + } + dismissTarget(); } }) .create()); @@ -111,6 +114,14 @@ public class TripRecordingDiscardBottomFragment extends MenuBottomSheetDialogFra } } + @Override + public void dismissTarget() { + Fragment target = getTargetFragment(); + if (target instanceof TripRecordingOptionsBottomFragment) { + ((TripRecordingOptionsBottomFragment) target).dismiss(); + } + } + @Override protected boolean hideButtonsContainer() { return true; diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java index aa755a4276..ee18485e78 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingOptionsBottomFragment.java @@ -11,7 +11,6 @@ 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; @@ -36,11 +35,10 @@ import net.osmand.util.Algorithms; import static net.osmand.AndroidUtils.getPrimaryTextColorId; -public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFragment { +public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFragment implements TripRecordingBottomFragment.DismissTargetFragment { 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"; + public static final String ACTION_STOP_AND_DISMISS = "action_stop_and_discard"; private static final int SAVE_UPDATE_INTERVAL = 1000; private OsmandApplication app; @@ -72,11 +70,10 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra return settings.SAVE_GLOBAL_TRACK_TO_GPX.get(); } - public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target, SelectedGpxFile selectedGpxFile) { + public static void showInstance(@NonNull FragmentManager fragmentManager, @NonNull Fragment target) { if (!fragmentManager.isStateSaved()) { TripRecordingOptionsBottomFragment fragment = new TripRecordingOptionsBottomFragment(); fragment.setTargetFragment(target, 0); - fragment.setSelectedGpxFile(selectedGpxFile); fragment.show(fragmentManager, TAG); } } @@ -86,18 +83,12 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra app = requiredMyApplication(); settings = app.getSettings(); helper = app.getSavingTrackHelper(); + selectedGpxFile = helper.getCurrentTrack(); 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()); @@ -193,12 +184,6 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra } - @Override - public void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.putBoolean(SAVE_CURRENT_GPX_FILE, true); - } - @Override public void onResume() { super.onResume(); @@ -213,14 +198,7 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra public void onPause() { super.onPause(); stopUpdatingTimeTrackSaved(); - Fragment target = getTargetFragment(); - if (target instanceof TripRecordingBottomFragment) { - if (isDiscard()) { - ((TripRecordingBottomFragment) target).dismiss(); - } else { - ((TripRecordingBottomFragment) target).show(); - } - } + dismissTarget(); } public void show() { @@ -237,32 +215,6 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra } } - 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); } @@ -312,17 +264,37 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra 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); + Bundle args = new Bundle(); + args.putBoolean(ACTION_STOP_AND_DISMISS, true); + setArguments(args); dismiss(); - dismissTargetDialog(TripRecordingOptionsBottomFragment.this, TripRecordingBottomFragment.class); - settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true); - runUpdatingTimeTrackSaved(); + dismissTarget(); } } }; } + private boolean isDiscard() { + Bundle args = getArguments(); + if (args != null) { + return args.getBoolean(ACTION_STOP_AND_DISMISS); + } + return false; + } + + @Override + public void dismissTarget() { + Fragment target = getTargetFragment(); + if (target instanceof TripRecordingBottomFragment) { + if (isDiscard()) { + ((TripRecordingBottomFragment) target).dismiss(); + } else { + ((TripRecordingBottomFragment) target).show(); + } + } + } + @Nullable public MapActivity getMapActivity() { Activity activity = getActivity(); @@ -346,5 +318,4 @@ public class TripRecordingOptionsBottomFragment extends MenuBottomSheetDialogFra protected boolean useVerticalButtons() { return true; } - } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java index ffbadd5557..0626b98c7d 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingStartingBottomFragment.java @@ -219,19 +219,13 @@ public class TripRecordingStartingBottomFragment extends MenuBottomSheetDialogFr dismiss(); } - public void show(String... keys) { + public void show() { 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)) { - updateIntervalValue(); - AndroidUiHelper.updateVisibility(intervalContainer, infoExpanded); - } - } + updateTrackIcon(app, trackAppearanceIcon); + updateIntervalValue(); + AndroidUiHelper.updateVisibility(intervalContainer, infoExpanded); } } diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java index 958f45193a..e8bf36bc27 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java @@ -399,7 +399,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement public void onContextMenuDismiss(@NonNull ContextMenuFragment fragment) { Fragment target = getTargetFragment(); if (target instanceof TripRecordingStartingBottomFragment) { - ((TripRecordingStartingBottomFragment) target).show(UPDATE_TRACK_ICON); + ((TripRecordingStartingBottomFragment) target).show(); } else if (target instanceof TripRecordingBottomFragment) { ((TripRecordingBottomFragment) target).show(UPDATE_TRACK_ICON); } From ee4beb8c458deecead6e932e057c718550237549 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 22 Mar 2021 19:56:27 +0200 Subject: [PATCH 06/23] Fix compilation --- .../net/osmand/plus/monitoring/MonitoringSettingsFragment.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java index 8ee1de18a3..78a4182edf 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java @@ -40,7 +40,6 @@ import java.util.LinkedHashMap; import static net.osmand.plus.activities.PluginInfoFragment.PLUGIN_INFO; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.SECONDS; -import static net.osmand.plus.monitoring.TripRecordingStartingBottomFragment.UPDATE_LOGGING_INTERVAL; import static net.osmand.plus.myplaces.FavoritesActivity.TAB_ID; import static net.osmand.plus.settings.backend.OsmandSettings.MONTHLY_DIRECTORY; import static net.osmand.plus.settings.backend.OsmandSettings.REC_DIRECTORY; @@ -301,7 +300,7 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment if (activity != null && !activity.isChangingConfigurations()) { Fragment target = getTargetFragment(); if (target instanceof TripRecordingStartingBottomFragment) { - ((TripRecordingStartingBottomFragment) target).show(UPDATE_LOGGING_INTERVAL); + ((TripRecordingStartingBottomFragment) target).show(); } } super.onDestroy(); From 7aa5e4e1a62b6339fd507f4eb58a20e16cac6b40 Mon Sep 17 00:00:00 2001 From: letypequividelespoubelles Date: Mon, 22 Mar 2021 16:31:44 +0000 Subject: [PATCH 07/23] Translated using Weblate (French) Currently translated at 100.0% (271 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/fr/ --- OsmAnd-telegram/res/values-fr/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-telegram/res/values-fr/strings.xml b/OsmAnd-telegram/res/values-fr/strings.xml index 4b9d45edfb..1e37b3e68c 100644 --- a/OsmAnd-telegram/res/values-fr/strings.xml +++ b/OsmAnd-telegram/res/values-fr/strings.xml @@ -213,7 +213,7 @@ Par groupe Par distance Se déconnecter d\'OsmAnd Tracker \? - Êtes-vous sûr·e de vouloir vous déconnecter d\'OsmAnd Tracker ; vous ne pourrez pas partager votre position ni vous la position des autres \? + Êtes-vous sûr·e de vouloir vous déconnecter d\'OsmAnd Tracker \? Vous ne pourrez pas partager votre position ni voir la position des autres. Contacts et groupes partageant leur position avec vous. Partager la position comme Ajouter un périphérique From ca83e5793212eb59d1e3ce2cdb0694fa9b046cd4 Mon Sep 17 00:00:00 2001 From: Hinagiku Zeppeki Date: Mon, 22 Mar 2021 11:56:03 +0000 Subject: [PATCH 08/23] Translated using Weblate (Japanese) Currently translated at 95.3% (3515 of 3685 strings) --- OsmAnd/res/values-ja/strings.xml | 115 +++++++++++++++++++++++++++++-- 1 file changed, 108 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/values-ja/strings.xml b/OsmAnd/res/values-ja/strings.xml index ace0b01cd1..206586cfd1 100644 --- a/OsmAnd/res/values-ja/strings.xml +++ b/OsmAnd/res/values-ja/strings.xml @@ -2084,7 +2084,6 @@ POIの更新は利用できません 時間 総走行距離 標高データを使用 - 水域 水域ポリゴン 近隣のWikipedia記事 @@ -2133,14 +2132,14 @@ POIの更新は利用できません 画面中央に写真メモを追加するボタンです。 画面中央にOSMメモを追加するボタンです。 画面中央にPOIを追加できるボタンです。 - ナビゲーション中の案内音声の有効無効を切り替えることが出来ます。 + ナビゲーション中の案内音声の有効/無効を切り替えます。 画面中央に駐車場所を追加するボタンです。 実行時に入力画面を表示 場所 重複を避けるためにクイックアクション名は[%1$s]に変更されました。 クイックアクション名の重複 - マップ画面でのお気に入り地点の表示/非表示の切替が出来ます。 - マップ画面でのPOIの表示/非表示の切替が出来ます。 + マップ画面でのお気に入り地点の表示/非表示を切り替えます。 + マップ画面でのPOIの表示/非表示を切り替えます。 %1$sを表示 %1$sを非表示 カテゴリーを追加 @@ -2546,7 +2545,7 @@ POIの更新は利用できません 種類別 小数点以下の桁数 次の入力項目へ移動 - マップ画面のタップで操作ボタンやウィジェットの表示と交互に切り替えます。 + マップ画面のタップで操作ボタンやウィジェットの表示を切り替えます。 フルスクリーンモード オンライン追跡用のバッファ指定 送信用現在地データをネット接続せずにどのくらいの時間記録するか、バッファを指定します @@ -2829,7 +2828,7 @@ POIの更新は利用できません 編集 %1$s, 合計 %2$s mBTC 起動 グアラニー語 - OsmAndマップ表示の昼/夜モードを切り替えることが出来ます。 + OsmAndマップ表示の昼/夜モードを切り替えます。 昼モード 夜モード 昼/夜モードの切り替え @@ -3715,7 +3714,7 @@ POIの更新は利用できません 低い橋を避けるために船の高さを調整できます。橋が可動式の場合は、開いた状態の高さが参照されます。 低い橋を避けるために船の高さを設定します。注:橋が可動式の場合は、開いた状態の高さが参照されます。 狭い橋を避けるために船の幅を設定します - マップ上のMapillaryレイヤーの表示/非表示を切り替えるトグルボタンです。 + マップ上のMapillaryレイヤーの表示/非表示を切り替えます。 ルート検索時に指定した車両の長さを考慮します。 長さ制限 ベアリング @@ -3849,4 +3848,106 @@ POIの更新は利用できません \nグラフは再計算後に利用できるようになります。 OSM通知/ POI / GPXのアップロードをテストする場合、openstreetmap.orgではなくdev.openstreetmap.orgを使用するよう切り替えます。 dev.openstreetmap.orgを使用 + 次々回案内(中距離) + 次回案内(長距離) + + 通過する + 目標に接近 + 方向転換 + ルートからの逸脱 + 目的地に到着 + タイミングと距離の間隔 + 案内タイミング + 音声による案内タイミングは、音声形式、現在のナビゲーション速度、および標準のナビゲーション速度によって異なります。 + 記録の開始 + マップ上に経路を表示 + 車椅子 + ハイキング + 徒歩 + 電動自転車 + 山岳(MTB)サイクリング + ロードサイクリング + 一般的なサイクリング + 重量物運搬車 + 小型トラック + トラック + スクーター + レーシングバイク + マウンテンバイク + サーバーエラー: %1$s + この名前はすでに存在します + このオンラインルーティングエンジンを削除しますか? + 全文を読む + 説明の編集 + 経由地点を削除 + マップマーカーにコピー + お気に入りにコピー + アップロード中 + アップロードが完了しました + %2$d個中%1$d個をアップロード中 + セグメントの選択 + %1$sには複数のセグメントが含まれているため、ナビゲーションに必要な部分を選択する必要があります。 + %1$dセグメント + %2$d個中%1$d個をアップロードしました + アップロードする編集を選択 + 陰影起伏図 / 勾配 / 等高線 + OpenPlaceReviewsは、レストラン、ホテル、美術館、中途経由地点などの公共の場所に関するコミュニティが運営するプロジェクトです。写真、レビュー、他のシステムへのリンク、OpenStreetMap、Wikipediaへのリンクなど、それらに関するすべての公開情報を収集しています。 +\n +\nOpenPlaceReviewデータは全て公開されており、誰でもアクセス可能です。http://openplacereviews.org/data +\n +\n詳細については下記サイトをご覧ください。http://openplacereviews.org + OpenPlaceReviews + test.openplacereviews.orgを使用 + OpenPlaceReviewsにログイン + + + スノーモービル + 乗馬 + レーシング + マウンテンバイク + 自転車 + ハイキング + ランニング + 徒歩 + 未舗装道路 + オートバイ + 最適化されたなるべく短いルート (省エネ) + + マップ上で現在有効になっている道路の制限を使用します + 運転の目的を選択することで、より短くより速くより安全なルートを取得します + 現在地アイコンが現在のナビゲーションルートに保持されます + 速度がしきい値未満の場合は、マップビューを回転させないでください + 再起動 + すべての地域 + %1$d個のファイルを削除しますか? + 保存せずに終了 + 記録を停止してもよろしいですか? +\n保存しない場合データはすべて失われます。 + 記録を保存して終了 + 記録を停止しました + 一時停止中 + 一部の設定を適用するには、アプリケーションの再起動が必要です。 + ルート検索時になるべく急な上り坂を回避するようにします。 + マップ上で座標ウィジェットの表示/非表示を切り替えます。 + タップで距離 + 利用可能な最新OpenStreetMapの更新: + 更新: %s + 最後にチェック時間: %s + 更新間隔 + マップの更新は毎週チェックされます。次回は%2$sの%1$sです。 + マップの更新は毎日チェックされます。次回は%2$sの%1$sです。 + マップの更新は1時間ごとにチェックされます。次回は%2$sの%1$sです。 + 更新の削除 + %sのライブアップデートをすべて削除してもよろしいですか? + 購入 + カテゴリを選択するか、新しいカテゴリを追加します + 記録を継続します。 + POI名をコピー + 表示/非表示 + 間隔 + 自然保護区、保護地域、国立公園の境界を非表示にします + 自然保護区の境界 + 経路には標高データは含まれていません。 + 経路には速度データは含まれていません。 + 別タイプのカラーを選択してください。 \ No newline at end of file From 7c5b425e5aad06428e9f19437d505177a4f3a2ee Mon Sep 17 00:00:00 2001 From: letypequividelespoubelles Date: Mon, 22 Mar 2021 16:18:00 +0000 Subject: [PATCH 09/23] Translated using Weblate (French) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-fr/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index 2542de9309..18cf09a780 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -4033,4 +4033,6 @@ %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. + L’icône de localisation va se déplacer sur le trajet en cours. + Veuillez sélectionner un autre type de colorisation. \ No newline at end of file From fe5219f296d238e0329b66211f19387dc1289a17 Mon Sep 17 00:00:00 2001 From: Evgenii Martynenko Date: Mon, 22 Mar 2021 10:00:16 +0000 Subject: [PATCH 10/23] Translated using Weblate (Russian) Currently translated at 100.0% (3685 of 3685 strings) --- OsmAnd/res/values-ru/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-ru/strings.xml b/OsmAnd/res/values-ru/strings.xml index 17f9218ad8..1b8e013301 100644 --- a/OsmAnd/res/values-ru/strings.xml +++ b/OsmAnd/res/values-ru/strings.xml @@ -4037,9 +4037,9 @@ Копировать имя POI Интервал Скрыть природный заповедник, особо охраняемые природные территории и границы национального парка - «Отслеживаемый» означает, что трек не будет виден в любых общедоступных списках, но обработанные точки из него будут доступны через public GPS API c временными отметками. Другие пользователи смогут лишь загружать обработанные точки из вашего трека. При этом трек не будет ассоциирован с вами. - «Идентифицируемый» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступным на закладке GPS-треки. Другие пользователи смогут загрузить данные трека и в свойствах трека будет указано имя пользователя, загрузившего трек. Отметки времени точек трека доступны через public GPS API. - «Общедоступный» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступным на закладке GPS-треки. Отметки времени точек трека не доступны через public GPS API. Однако, другие пользователи по-прежнему могут загрузить файл трека из общего списка треков и данные трека будут иметь все отметки времени. + «Отслеживаемый» означает, что трек не будет виден в любых общедоступных списках, но обработанные точки c отметками времени из него будут доступны через public GPS API (при этом трек не будет ассоциирован с вами). Другие пользователи смогут лишь загружать обработанные точки из вашего трека. + «Идентифицируемый» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступном на странице GPS-треки. Другие пользователи смогут загрузить данные трека и в свойствах трека будет указано имя пользователя, загрузившего трек. Отметки времени точек трека доступны через public GPS API будут ссылаться на страницу с вашим оригинальным треком. + «Общедоступный» означает, что трек будет виден всем в разделе треки пользователя, загрузившего трек и в общем списке треков, доступном на странице GPS-треки. Отметки времени точек трека не доступны через public GPS API. Однако, другие пользователи по-прежнему могут загрузить файл трека из общего списка треков и данные трека будут иметь все отметки времени. «Частный» означает, что трек не будет виден в любых общедоступных списках, но точки из него будут доступны через public GPS API без отметок времени. Выберите цель, чтобы проложить к ней короткий, быстрый или безопасный маршрут Удалить %1$d файлов\? From 8195de78f03dee49e034da3db8b3713ce6e5c97a Mon Sep 17 00:00:00 2001 From: Michalis Date: Sun, 21 Mar 2021 18:12:16 +0000 Subject: [PATCH 11/23] Translated using Weblate (Greek) Currently translated at 91.2% (3363 of 3685 strings) --- OsmAnd/res/values-el/strings.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OsmAnd/res/values-el/strings.xml b/OsmAnd/res/values-el/strings.xml index 73b9f244c5..1f5c371c25 100644 --- a/OsmAnd/res/values-el/strings.xml +++ b/OsmAnd/res/values-el/strings.xml @@ -1873,7 +1873,6 @@ Συνολική απόσταση Επιλέξτε διακύμανση ανύψωσης Χρήση υψομετρικών δεδομένων - Εμφάνιση ισοβαθών καμπυλών και σημείων. Ναυτικές ισοβαθείς καμπύλες Αυτόματος διαχωρισμός καταγραφών μετά από κενό @@ -2516,7 +2515,7 @@ Υποβολή ΣΕ Βασικό Προχωρημένο - Αριθμός κτιρίου + Αριθμός κτηρίου Επόμενο Άνοιγμα στις Κλείσιμο στις From bcc6eff8959af9d343fe137076dbdd6101011263 Mon Sep 17 00:00:00 2001 From: ovl-1 Date: Sun, 21 Mar 2021 16:09:51 +0000 Subject: [PATCH 12/23] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegian?= =?UTF-8?q?=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 60.8% (2243 of 3685 strings) --- OsmAnd/res/values-nb/strings.xml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/OsmAnd/res/values-nb/strings.xml b/OsmAnd/res/values-nb/strings.xml index 8eefe0476c..38107b6cc1 100644 --- a/OsmAnd/res/values-nb/strings.xml +++ b/OsmAnd/res/values-nb/strings.xml @@ -167,7 +167,7 @@ Fluorescerende overlegg Bruk fluorescerende farger til å vise spor og ruter. Frakoblet redigering - Bruk alltid frakoblet redigering. + Hvis redigering uten nett er aktivert, lagres endringer lokalt først og lastes opp på forespørsel, ellers vil endringer bli lastet opp umiddelbart. Du kan laste ned eller oppdatere %1$s kart. Gratisversjon Vis interessepunkt-beskrivelse. @@ -401,7 +401,7 @@ Offline-søk Nettbasert søk Maks. nettbasert zoom - Ikke bla gjennom nettbaserte kartfliser for zoomnivåer utover dette. + Ikke bla gjennom nettbaserte kart for zoomnivåer utover dette. Total distanse %1$s, reisetid %2$d t %3$d min. Nettbasert eller frakoblet navigeringstjeneste. Navigeringstjeneste @@ -1492,7 +1492,7 @@ Vent til gjeldende oppgave er ferdig Slett dette elementet\? Slett parkeringsplassmarkør - Slett endring + Slett redigering Gjenåpne Liker du OsmAnd\? Bygningsnummer @@ -1520,7 +1520,7 @@ Kannada Buss Tog - Valgte taledata er ikke tilgjengelig + Valgte talemeldingspakke er ikke tilgjengelig Spesifisert taledata er ødelagt Taledataversjon som ikke støttes Sporer posisjonen din mens skjermen er slått av. @@ -2173,7 +2173,7 @@ Angi ditt OSM-brukernavn og passord for å laste opp GPX-filer. Doner for å se nye funksjoner implementert i programmet. Last opp alle - Last opp endring til OSM + Last opp redigering til OSM Asynkron OSM-redigering: Oppgi det nettbaserte sporingsintervallet. Nettbasert sporingsintervall @@ -2239,7 +2239,7 @@ Legg til parkeringsplass Rediger handling Slett handling - Navneforvalg + Forhåndsinnstilt navn En knapp for å legge til en kartmarkør i skjermsenteret. En knapp for å legge til et GPX-rutepunkt i midten av skjermen. En knapp for å legge til et lydnotat i midten av skjermen. @@ -2829,7 +2829,7 @@ Veitype Overflate Jevnhet - Stigning + Bratthet Legg til bosted Legg til arbeidssted Arbeid @@ -2865,9 +2865,9 @@ Fast dekke Betong Brostein - Naturlig brostein - Steinbelagt - Rullestein + Kuppelstein + Belegningsstein + Rullestein (liten) Stein Metall Tre @@ -2907,8 +2907,8 @@ Milliradianer Vinkel-måleenheter Endre hva asimut måles i. - Ingen rustikk brostein eller brostein - Unngår rustikk brostein og brostein + Ingen kuppelstein eller brostein + Unngår kuppelstein og brostein Ingen trikk Unngår trikk Ingen buss @@ -3145,7 +3145,8 @@ Annet Delt OSM-redigeringer - Rute: Distanse %1$s, rutingstid %2$s \nUtregning: %3$.1f sec, %4$d veier, %5$d flis) + Rute: Distanse %1$s, rutetid %2$s +\nBeregning: %3$.1f sek., %4$d veier, %5$d fliser) Koter og relieffskygge Oppdater alle kart Er du sikker på at du vil oppdatere alle (%1$d) kart\? From a903353acbc0fc03a4b7197762b1751d3a4c0313 Mon Sep 17 00:00:00 2001 From: letypequividelespoubelles Date: Mon, 22 Mar 2021 16:27:41 +0000 Subject: [PATCH 13/23] Translated using Weblate (French) Currently translated at 99.8% (3888 of 3894 strings) --- OsmAnd/res/values-fr/phrases.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OsmAnd/res/values-fr/phrases.xml b/OsmAnd/res/values-fr/phrases.xml index ec8b6a2227..08eb6883a4 100644 --- a/OsmAnd/res/values-fr/phrases.xml +++ b/OsmAnd/res/values-fr/phrases.xml @@ -3886,4 +3886,10 @@ Statut de la piste : ouvert Nom de la piste Saut à ski + Livre d\'or au sommet : non + Livre d\'or au sommet : oui + Surveillé : non + Surveillé : oui + Référence locale + Géodésien \ No newline at end of file From 8444e834843ee0c19f93710ace56400efd96e61c Mon Sep 17 00:00:00 2001 From: iman Date: Mon, 22 Mar 2021 09:05:41 +0000 Subject: [PATCH 14/23] Translated using Weblate (Persian) Currently translated at 36.7% (1430 of 3894 strings) --- OsmAnd/res/values-fa/phrases.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OsmAnd/res/values-fa/phrases.xml b/OsmAnd/res/values-fa/phrases.xml index f02c2aa1db..00c6ee88d6 100644 --- a/OsmAnd/res/values-fa/phrases.xml +++ b/OsmAnd/res/values-fa/phrases.xml @@ -1449,4 +1449,7 @@ منطقهٔ حفاظت‌شده بدمینتون خدمات خودرو; مکانیکی + نوع + فلکهٔ کوچک + میدان \ No newline at end of file From f8bac862d1306d8cd57b39101d5ca7f612ec3aa5 Mon Sep 17 00:00:00 2001 From: ovl-1 Date: Sun, 21 Mar 2021 16:22:44 +0000 Subject: [PATCH 15/23] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegian?= =?UTF-8?q?=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 42.4% (1654 of 3894 strings) --- OsmAnd/res/values-nb/phrases.xml | 40 +++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-nb/phrases.xml b/OsmAnd/res/values-nb/phrases.xml index 2d3d19f765..1e62078b4b 100644 --- a/OsmAnd/res/values-nb/phrases.xml +++ b/OsmAnd/res/values-nb/phrases.xml @@ -1626,7 +1626,7 @@ 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: neolittisk tid (yngre steinalder) 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.) @@ -1647,4 +1647,42 @@ Sivilisasjon: forhistorisk tid Historisk herregård Historisk objekt + Materiale: kalkstein + Materiale: granittstein + Materiale: sandstein + Materiale: stein + Husly + T-bane + Ferge + Buss + Overflate: snø + Overflate: salt + Overflate: is + Overflate: gjørme + Overflate: jord + Overflate: jord + Overflate: gress + Overflate: sand + Overflate: komprimert + Overflate: fin grus + Overflate: grus + Overflate: tre + Overflate: metall + Overflate: stein + Overflate: rullestein (liten) + Overflate: belegningsstein + Overflate: kuppelstein + Overflate: brostein + Overflate: betong + Overflate: asfalt + Overflate: fast dekke + Overflate: uten fast dekke + Gapahuk + Stein + Sandstein + Kalkstein + Stein + Passasje i en mur eller et gjerde + Ly + Grensestein \ No newline at end of file From 2d6ea304b2d9d4fe9a268316194df0c820eae213 Mon Sep 17 00:00:00 2001 From: Shjosan Date: Mon, 22 Mar 2021 08:20:56 +0000 Subject: [PATCH 16/23] Translated using Weblate (Swedish) Currently translated at 85.4% (3329 of 3894 strings) --- OsmAnd/res/values-sv/phrases.xml | 76 ++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/OsmAnd/res/values-sv/phrases.xml b/OsmAnd/res/values-sv/phrases.xml index e3ed4a4936..8546a555f5 100644 --- a/OsmAnd/res/values-sv/phrases.xml +++ b/OsmAnd/res/values-sv/phrases.xml @@ -3253,4 +3253,80 @@ Klättring Svårighetskategori Parkera och åk + Uttag: Tesla Roadster: utgående + Uttag: Tesla Roadster: ström + Uttag: Tesla Roadster + Uttag: Tesla Supercharger + Uttag: Tesla Supercharger: utgående + Uttag: Tesla Supercharger: ström + Uttag: Tesla standard: utgående + Uttag: Tesla standard: ström + Uttag: Tesla standard + Uttag: CHAdeMO: utgående + Uttag: CHAdeMO: ström + Uttag: CHAdeMO + Uttag: Typ 3: utgeånde + Uttag: Typ 3: ström + Uttag: Typ 3 + Uttag: Typ 2: utgeånde + Uttag: Typ 2 kombo: ström + Uttag: Typ 2 kombo + Uttag: Typ 2: utgående + Uttag: Typ 2: ström + Uttag: Typ 2 + Uttag: Typ 1 kombo: ström + Uttag: Typ 1 kombo + Uttag: Typ 1: utgående + Uttag: Typ 1: ström + Uttag: Typ 1 + Uttag: Typ 1 kombo: utgående + Uttag: CEE röd 125A: utgående + Uttag: CEE röd 125A: ström + Uttag: CEE röd 125A + Uttag: CEE röd 64A: utgående + Uttag: CEE röd 64A: ström + Uttag: CEE röd 64A + Uttag: CEE röd 32A: utgående + Uttag: CEE röd 32A: ström + Uttag: CEE röd 32A + Uttag: CEE röd 16A: utgående + Uttag: CEE röd 16A: ström + Uttag: CEE röd 16A + Uttag: CEE blå: utgående + Uttag: CEE blå: ström + Uttag: CEE blå + Multi familj + Familj + Gemenskap + Flaskvatten + Vattentank + Vattentransporter + Borrhål + Pump + Rinnande vatten + Rörledning + Vattenbrunn + Aquatabs + Omvänd osmos + Klor + Ingen + Hållbarhet på vattenplats: kritiskt + Hållbarhet på vattenplats: hållbar + Behöver underhåll + Trasig + Begränsad + Stängd + Öppen + Plats: area + Plats: väg + Plats: hus + Plats: entre + Plats: vägg + Plats: bro + Plats: kiosk + Plats: plattform + Plats: inne + Plats: ute + Plats: tak + Plats: tak \ No newline at end of file From 2651fdfa4aaf85cc4aa5610ed67e433fd421ba3d Mon Sep 17 00:00:00 2001 From: Liu Tao Date: Mon, 22 Mar 2021 17:55:22 +0000 Subject: [PATCH 17/23] Translated using Weblate (Chinese (Simplified)) Currently translated at 19.6% (766 of 3894 strings) --- OsmAnd/res/values-zh-rCN/phrases.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OsmAnd/res/values-zh-rCN/phrases.xml b/OsmAnd/res/values-zh-rCN/phrases.xml index 07cbf034cb..9c7d6634aa 100644 --- a/OsmAnd/res/values-zh-rCN/phrases.xml +++ b/OsmAnd/res/values-zh-rCN/phrases.xml @@ -769,4 +769,6 @@ 充电站 无外卖 仅限外卖 + 配药 + 自动化 \ No newline at end of file From bd1846683d0b15ba093834ebbc46418a188f91c5 Mon Sep 17 00:00:00 2001 From: Gilbert Lowel Date: Sun, 21 Mar 2021 09:15:02 +0000 Subject: [PATCH 18/23] Translated using Weblate (Dutch) Currently translated at 98.4% (3627 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 93ec4454c6..e8767cf4cf 100644 --- a/OsmAnd/res/values-nl/strings.xml +++ b/OsmAnd/res/values-nl/strings.xml @@ -3748,7 +3748,7 @@ \n \n Wat is er nieuw - Voor sneeuwscooter, rijden met speciale wegen en tracks. + Voor sneeuwscooter, rijden op speciale wegen en tracks. 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. From aed05f43e09cb4be4f14dbee58801baa29b66c86 Mon Sep 17 00:00:00 2001 From: Michalis Date: Sun, 21 Mar 2021 17:50:44 +0000 Subject: [PATCH 19/23] Translated using Weblate (Greek) Currently translated at 19.5% (53 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/el/ --- OsmAnd-telegram/res/values-el/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-telegram/res/values-el/strings.xml b/OsmAnd-telegram/res/values-el/strings.xml index ff81d49e6c..819b9d3d48 100644 --- a/OsmAnd-telegram/res/values-el/strings.xml +++ b/OsmAnd-telegram/res/values-el/strings.xml @@ -39,7 +39,7 @@ Κοινοποίηση Προηγούμενο Συνέχεια - Ακύρωση + Άκυρο Επιλογές Ενεργοποιημένο Μονάδες μέτρησης & φορμά From 6193387459d7dc77f45e44eac969deffa92c35d8 Mon Sep 17 00:00:00 2001 From: Ldm Public Date: Mon, 22 Mar 2021 17:59:16 +0000 Subject: [PATCH 20/23] Translated using Weblate (French) Currently translated at 100.0% (271 of 271 strings) Translation: OsmAnd/Telegram Translate-URL: https://hosted.weblate.org/projects/osmand/telegram/fr/ --- OsmAnd-telegram/res/values-fr/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-telegram/res/values-fr/strings.xml b/OsmAnd-telegram/res/values-fr/strings.xml index 1e37b3e68c..bff9d36680 100644 --- a/OsmAnd-telegram/res/values-fr/strings.xml +++ b/OsmAnd-telegram/res/values-fr/strings.xml @@ -213,7 +213,7 @@ Par groupe Par distance Se déconnecter d\'OsmAnd Tracker \? - Êtes-vous sûr·e de vouloir vous déconnecter d\'OsmAnd Tracker \? Vous ne pourrez pas partager votre position ni voir la position des autres. + Êtes-vous certain de vouloir vous déconnecter d\'OsmAnd Tracker \? Vous ne pourrez pas partager votre position ni voir la position des autres. Contacts et groupes partageant leur position avec vous. Partager la position comme Ajouter un périphérique From 35d72bdbaad8bc01a78871cbad501ddabb8d7719 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 22 Mar 2021 19:57:34 +0100 Subject: [PATCH 21/23] Fix #10968 --- .../main/java/net/osmand/router/RouteResultPreparation.java | 4 ++-- .../src/main/java/net/osmand/router/RouteSegmentResult.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java index c6a5f1d393..7a9cfb1ab4 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java @@ -1117,8 +1117,8 @@ public class RouteResultPreparation { if (UNMATCHED_HIGHWAY_TYPE.equals(rr.getObject().getHighway())) { bearingDist = RouteSegmentResult.DIST_BEARING_DETECT_UNMATCHED; } - double mpi = MapUtils.degreesDiff(prev.getBearingEnd(prev.getEndPointIndex(), bearingDist), - rr.getBearingBegin(rr.getStartPointIndex(), bearingDist)); + double mpi = MapUtils.degreesDiff(prev.getBearingEnd(prev.getEndPointIndex(), Math.min(prev.getDistance(), bearingDist)), + rr.getBearingBegin(rr.getStartPointIndex(), Math.min(rr.getDistance(), bearingDist))); if (mpi >= TURN_DEGREE_MIN) { if (mpi < TURN_DEGREE_MIN) { // Slight turn detection here causes many false positives where drivers would expect a "normal" TL. Best use limit-angle=TURN_DEGREE_MIN, this reduces TSL to the turn-lanes cases. diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java index c57fdc8f1c..1699b3daf9 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java @@ -457,7 +457,7 @@ public class RouteSegmentResult implements StringExternalizable } public float getBearingBegin() { - return getBearingBegin(startPointIndex, DIST_BEARING_DETECT); + return getBearingBegin(startPointIndex, distance > 0 && distance < DIST_BEARING_DETECT ? distance : DIST_BEARING_DETECT); } public float getBearingBegin(int point, float dist) { @@ -465,7 +465,7 @@ public class RouteSegmentResult implements StringExternalizable } public float getBearingEnd() { - return getBearingEnd(endPointIndex, DIST_BEARING_DETECT); + return getBearingEnd(endPointIndex, distance > 0 && distance < DIST_BEARING_DETECT ? distance : DIST_BEARING_DETECT); } public float getBearingEnd(int point, float dist) { From 1d66be6f4b5064756e5404d26cd5676d357d5f99 Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 22 Mar 2021 21:38:39 +0200 Subject: [PATCH 22/23] some fixes; --- OsmAnd/res/layout/gpx_item_altitude.xml | 4 +- OsmAnd/res/layout/gpx_item_general.xml | 4 +- OsmAnd/res/layout/gpx_item_speed.xml | 4 +- .../TripRecordingBottomFragment.java | 12 ++- .../plus/myplaces/GPXItemPagerAdapter.java | 78 ++++++------------ .../plus/myplaces/SegmentGPXAdapter.java | 2 +- .../plus/track/GpxBlockStatisticsBuilder.java | 79 ++++++++++--------- .../net/osmand/plus/track/SegmentsCard.java | 2 +- 8 files changed, 82 insertions(+), 103 deletions(-) diff --git a/OsmAnd/res/layout/gpx_item_altitude.xml b/OsmAnd/res/layout/gpx_item_altitude.xml index 699e6812ea..f297e7a18e 100644 --- a/OsmAnd/res/layout/gpx_item_altitude.xml +++ b/OsmAnd/res/layout/gpx_item_altitude.xml @@ -52,7 +52,7 @@ { WrapContentHeightViewPager pager = row.findViewById(R.id.pager); PagerSlidingTabStrip tabLayout = row.findViewById(R.id.sliding_tabs); - pager.setAdapter(new GPXItemPagerAdapter(app, item, displayHelper, nightMode, listener)); + pager.setAdapter(new GPXItemPagerAdapter(app, item, displayHelper, nightMode, listener, false)); if (create) { tabLayout.setViewPager(pager); } else { diff --git a/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java b/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java index 6eb1be4c16..96478490bb 100644 --- a/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java +++ b/OsmAnd/src/net/osmand/plus/track/GpxBlockStatisticsBuilder.java @@ -152,8 +152,8 @@ public class GpxBlockStatisticsBuilder { withoutGaps = !selectedGpxFile.isJoinSegments() && gpxDisplayItem.isGeneralTrack(); } } + items.clear(); if (analysis != null) { - items.clear(); switch (initBlocksKey) { case INIT_BLOCKS_GENERAL: { float totalDistance = withoutGaps ? analysis.totalDistanceWithoutGaps : analysis.totalDistance; @@ -283,51 +283,52 @@ public class GpxBlockStatisticsBuilder { 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; + if (analysis == null) { + return; + } + StatBlock statBlock = new StatBlock(title, value, imageResId, imageColorId, firstType, secondType, itemType); + switch (statBlock.itemType) { + case ITEM_DISTANCE: { + if (analysis.totalDistance != 0f) { + items.add(statBlock); } - case ITEM_DISTANCE_MOVING: { - if (analysis.totalDistanceMoving != 0f) { - items.add(statBlock); - } - break; + break; + } + case ITEM_DISTANCE_MOVING: { + if (analysis.totalDistanceMoving != 0f) { + items.add(statBlock); } - case ITEM_ALTITUDE: { - if (analysis.hasElevationData) { - items.add(statBlock); - } - break; + break; + } + case ITEM_ALTITUDE: { + if (analysis.hasElevationData) { + items.add(statBlock); } - case ITEM_SPEED: { - if (analysis.isSpeedSpecified()) { - items.add(statBlock); - } - break; + break; + } + case ITEM_SPEED: { + if (analysis.isSpeedSpecified()) { + items.add(statBlock); } - case ITEM_TIME: { - if (analysis.timeSpan > 0) { - items.add(statBlock); - } - break; + break; + } + case ITEM_TIME: { + if (analysis.timeSpan > 0) { + items.add(statBlock); } - case ITEM_TIME_SPAN: { - if (analysis.hasSpeedData) { - items.add(statBlock); - } - break; + break; + } + case ITEM_TIME_SPAN: { + if (analysis.hasSpeedData) { + items.add(statBlock); } - case ITEM_TIME_MOVING: { - if (analysis.isTimeMoving()) { - items.add(statBlock); - } - break; + break; + } + case ITEM_TIME_MOVING: { + if (analysis.isTimeMoving()) { + items.add(statBlock); } + break; } } } diff --git a/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java b/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java index ad266fc2ab..a3ed324543 100644 --- a/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java +++ b/OsmAnd/src/net/osmand/plus/track/SegmentsCard.java @@ -47,7 +47,7 @@ public class SegmentsCard extends BaseCard { WrapContentHeightViewPager pager = segmentView.findViewById(R.id.pager); PagerSlidingTabStrip tabLayout = segmentView.findViewById(R.id.sliding_tabs); - pager.setAdapter(new GPXItemPagerAdapter(app, displayItem, displayHelper, nightMode, listener)); + pager.setAdapter(new GPXItemPagerAdapter(app, displayItem, displayHelper, nightMode, listener, false)); tabLayout.setViewPager(pager); container.addView(segmentView); From 6daf7505910031c752706e3c0e6755a774928aa2 Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 22 Mar 2021 21:52:10 +0200 Subject: [PATCH 23/23] small fixes; --- .../plus/monitoring/TripRecordingBottomFragment.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java index 7c2f284668..eae0e5e919 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/TripRecordingBottomFragment.java @@ -225,6 +225,10 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i super.onResume(); blockStatisticsBuilder.runUpdatingStatBlocksIfNeeded(); runUpdatingGPS(); + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(trackChartPoints); + } } @Override @@ -235,7 +239,8 @@ public class TripRecordingBottomFragment extends MenuBottomSheetDialogFragment i MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(null); - }} + } + } public void show() { Dialog dialog = getDialog();