Compare commits

..

19 Commits

Author SHA1 Message Date
Konstantin Pastbin
f71058f0f5 WIP try 184
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
2026-01-03 23:48:43 +07:00
Vraj Shah
b07c22fc91 [android] Adjust map buttons margins in route building
Signed-off-by: Vraj Shah <vrajshah006@gmail.com>
2026-01-03 23:48:41 +07:00
Konstantin Pastbin
f5a9973c73 [search] Enable Lithuanian for search categories/synonyms
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
2026-01-03 23:15:26 +07:00
Konstantin Pastbin
1d6d071c1a [planet] Update map data to 260101-test
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
2026-01-03 23:15:16 +07:00
gekeleda
dc259f2b0e [android] Increase logged info of rejected locations
Signed-off-by: gekeleda <git@davidgekeler.eu>
2026-01-03 23:15:16 +07:00
gekeleda
ca6b0286c8 [android] remove previous location quality check 2026-01-03 23:15:16 +07:00
gekeleda
f3fd814d07 [android] Fix most accurate location provider
Signed-off-by: gekeleda <mail@davidgekeler.eu>
2026-01-03 23:15:16 +07:00
x7z4w
6073cd1ca3 [drape] Adjust double- and long-tap delays
Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
2026-01-03 23:15:16 +07:00
eisa01
d29afb5b95 [carplay] Add myPositionMode button to iOS <26 workaround
See PR #2474

Signed-off-by: eisa01 <eisa01@gmail.com>
2026-01-03 23:15:16 +07:00
eisa01
71cfe12164 [carplay] Use system buttons for better appearance
Signed-off-by: eisa01 <eisa01@gmail.com>
2026-01-03 23:15:16 +07:00
Johannes
59a6c6e630 make sure to use the correct myPositionMode terminology 2026-01-03 23:15:16 +07:00
Johannes
374667366b Add position mode toggle for CarPlay 2026-01-03 23:15:16 +07:00
Yannik Bloscheck
e18e85a49d [ios] Don't let custom map appearance influence CarPlay
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
2026-01-03 23:15:16 +07:00
Yannik Bloscheck
c7db4f9c33 [ios] Always use light map appearance by default
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
2026-01-03 23:15:16 +07:00
Leonardo Bishop
266c38ed78 [ios] Handle distinct FollowAndRotateRoute and FollowAndRotateCompass modes
Signed-off-by: Leonardo Bishop <me@leonardobishop.net>
2026-01-03 23:15:16 +07:00
Leonardo Bishop
f4d6e32605 [android] Handle distinct FollowAndRotateRoute and FollowAndRotateCompass modes
Signed-off-by: Leonardo Bishop <me@leonardobishop.net>
2026-01-03 23:15:16 +07:00
Leonardo Bishop
1b15810260 [drape] Add FollowAndRotateRoute mode
This adds a new mode to rotate the camera towards the route while driving.
This is done by looking ahead X number of seconds along the current route,
up to the next turn, and calculating the angle between the current position
and then.

Squashed commits:

[drape] Add bearing calculation via route lookahead while navigating
[drape] Extract NavigationContext from OnLocationUpdate params
[drape] Increase rotation animation duration during navigation
[drape] Seperate route and compass rotation into two modes
[drape] Reduce route lookahead maximum to 25 seconds
[drape] Fix case where rotation was incorrectly considered invalid
[drape] Make FollowAndRotateRoute mode only available during driving navigation
[drape] Rewrite FollowedPolyline::GetLookaheadPoint
[drape] Cleanup

Signed-off-by: Leonardo Bishop <me@leonardobishop.net>
2026-01-03 23:15:16 +07:00
thesupertechie
614ea4ec9c [core] remove random key file
Signed-off-by: thesupertechie <thesupertechie1@gmail.com>
2026-01-03 23:15:16 +07:00
thesupertechie
f5d3417997 [tts] add tamil TTS translation
Signed-off-by: thesupertechie <thesupertechie1@gmail.com>
2026-01-03 23:15:16 +07:00
108 changed files with 3065 additions and 2693 deletions

View File

@@ -352,7 +352,6 @@ dependencies {
implementation libs.androidx.work.runtime
implementation libs.androidx.lifecycle.process
implementation libs.androidx.documentfile
// 1.13 Material library version doesn't render properly alpha properties on map buttons
implementation libs.android.material
// Fix for app/organicmaps/util/FileUploadWorker.java:14: error: cannot access ListenableFuture
// https://github.com/organicmaps/organicmaps/issues/6106

View File

@@ -446,7 +446,7 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity
default -> throw new AssertionError("Unexpected result code = " + result);
};
mAlertDialog = new MaterialAlertDialogBuilder(this)
mAlertDialog = new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(titleId)
.setMessage(messageId)
.setCancelable(true)

View File

@@ -9,7 +9,8 @@ import static app.organicmaps.leftbutton.LeftButtonsHolder.BUTTON_HELP_CODE;
import static app.organicmaps.leftbutton.LeftButtonsHolder.BUTTON_RECORD_TRACK_CODE;
import static app.organicmaps.leftbutton.LeftButtonsHolder.BUTTON_SETTINGS_CODE;
import static app.organicmaps.sdk.location.LocationState.FOLLOW;
import static app.organicmaps.sdk.location.LocationState.FOLLOW_AND_ROTATE;
import static app.organicmaps.sdk.location.LocationState.FOLLOW_AND_ROTATE_COMPASS;
import static app.organicmaps.sdk.location.LocationState.FOLLOW_AND_ROTATE_ROUTE;
import static app.organicmaps.sdk.location.LocationState.LOCATION_TAG;
import static app.organicmaps.sdk.util.PowerManagment.POWER_MANAGEMENT_TAG;
import static app.organicmaps.sdk.util.Utils.dimen;
@@ -432,7 +433,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
}
dismissLocationErrorDialog();
mLocationErrorDialog = new MaterialAlertDialogBuilder(MwmActivity.this)
mLocationErrorDialog = new MaterialAlertDialogBuilder(MwmActivity.this, R.style.MwmTheme_AlertDialog)
.setMessage(R.string.unknown_current_position)
.setCancelable(true)
.setPositiveButton(R.string.ok, null)
@@ -655,7 +656,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
else
{
dismissAlertDialog();
mAlertDialog = new MaterialAlertDialogBuilder(this)
mAlertDialog = new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.message_invalid_feature_position)
.setPositiveButton(R.string.ok, null)
.setOnDismissListener(dialog -> mAlertDialog = null)
@@ -1155,7 +1156,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
if (type == IsolinesState.EXPIREDDATA)
{
mAlertDialog = new MaterialAlertDialogBuilder(this)
mAlertDialog = new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.downloader_update_maps)
.setMessage(R.string.isolines_activation_error_dialog)
.setPositiveButton(
@@ -1774,7 +1775,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
{
dismissAlertDialog();
mAlertDialog =
new MaterialAlertDialogBuilder(this)
new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.unable_to_calc_alert_title)
.setMessage(R.string.unable_to_calc_alert_subtitle)
.setPositiveButton(R.string.settings,
@@ -1797,7 +1798,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
builder.append(getString(resId)).append("\n\n");
dismissAlertDialog();
mAlertDialog = new MaterialAlertDialogBuilder(this)
mAlertDialog = new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.dialog_routing_disclaimer_title)
.setMessage(builder.toString())
.setCancelable(false)
@@ -1846,7 +1847,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
return true;
final MapObject endPoint = Objects.requireNonNull(controller.getEndPoint());
final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this)
final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.p2p_only_from_current)
.setMessage(R.string.p2p_reroute_from_current)
.setCancelable(false)
@@ -1900,7 +1901,8 @@ public class MwmActivity extends BaseMwmFragmentActivity
locationHelper.restartWithNewMode();
if ((newMode == FOLLOW || newMode == FOLLOW_AND_ROTATE) && !LocationUtils.checkFineLocationPermission(this))
if ((newMode == FOLLOW || newMode == FOLLOW_AND_ROTATE_ROUTE || newMode == FOLLOW_AND_ROTATE_COMPASS)
&& !LocationUtils.checkFineLocationPermission(this))
{
// Try to optimistically request FINE permission for FOLLOW and FOLLOW_AND_ROTATE modes.
Logger.i(LOCATION_TAG, "Requesting ACCESS_FINE_LOCATION permission for " + LocationState.nameOf(newMode));
@@ -2040,7 +2042,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
{
mPreciseLocationDialogShown = true;
final MaterialAlertDialogBuilder builder =
new MaterialAlertDialogBuilder(this)
new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle("" + getString(R.string.limited_accuracy))
.setMessage(R.string.precise_location_is_disabled_long_text)
.setNegativeButton(R.string.close, (dialog, which) -> dialog.dismiss())
@@ -2074,7 +2076,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
return;
}
mLocationErrorDialog = new MaterialAlertDialogBuilder(this)
mLocationErrorDialog = new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.enable_location_services)
.setMessage(R.string.location_is_disabled_long_text)
.setOnDismissListener(dialog -> mLocationErrorDialog = null)
@@ -2167,7 +2169,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
return;
}
final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this)
final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.enable_location_services)
.setMessage(R.string.location_is_disabled_long_text)
.setOnDismissListener(dialog -> mLocationErrorDialog = null)
@@ -2253,7 +2255,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
dismissAlertDialog();
final MaterialAlertDialogBuilder builder =
new MaterialAlertDialogBuilder(this)
new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.current_location_unknown_error_title)
.setCancelable(true)
.setMessage(R.string.power_save_dialog_summary)
@@ -2278,7 +2280,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
{
dismissAlertDialog();
mAlertDialog =
new MaterialAlertDialogBuilder(this)
new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.load_kmz_title)
.setMessage(getString(R.string.unknown_file_type, uri))
.setPositiveButton(R.string.ok, null)
@@ -2295,7 +2297,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
{
dismissAlertDialog();
mAlertDialog =
new MaterialAlertDialogBuilder(this)
new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.load_kmz_title)
.setMessage(getString(R.string.failed_to_open_file, uri, error))
.setPositiveButton(R.string.ok, null)
@@ -2317,7 +2319,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
public void onBookmarksFileImportFailed()
{
dismissAlertDialog();
mAlertDialog = new MaterialAlertDialogBuilder(this)
mAlertDialog = new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.load_kmz_title)
.setMessage(R.string.load_kmz_failed)
.setPositiveButton(R.string.ok, null)
@@ -2578,7 +2580,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
private void reportUnsupported()
{
new MaterialAlertDialogBuilder(this)
new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setMessage(R.string.unsupported_phone)
.setCancelable(false)
.setPositiveButton(R.string.close, (dlg, which) -> this.moveTaskToBack(true))

View File

@@ -120,7 +120,7 @@ public class SplashActivity extends AppCompatActivity
private void showFatalErrorDialog(@StringRes int titleId, @StringRes int messageId, Exception error)
{
mCanceled = true;
new MaterialAlertDialogBuilder(this, R.style.MwmTheme_M3_AlertDialog)
new MaterialAlertDialogBuilder(this, R.style.MwmTheme_AlertDialog)
.setTitle(titleId)
.setMessage(messageId)
.setPositiveButton(

View File

@@ -60,14 +60,14 @@ public enum BookmarksSharingHelper
case BookmarkSharingResult.SUCCESS ->
SharingUtils.shareBookmarkFile(context, launcher, result.getSharingPath(), result.getMimeType());
case BookmarkSharingResult.EMPTY_CATEGORY ->
new MaterialAlertDialogBuilder(context)
new MaterialAlertDialogBuilder(context, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.bookmarks_error_title_share_empty)
.setMessage(R.string.bookmarks_error_message_share_empty)
.setPositiveButton(R.string.ok, null)
.show();
case BookmarkSharingResult.ARCHIVE_ERROR, BookmarkSharingResult.FILE_ERROR ->
{
new MaterialAlertDialogBuilder(context)
new MaterialAlertDialogBuilder(context, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.dialog_routing_system_error)
.setMessage(R.string.bookmarks_error_message_share_general)
.setPositiveButton(R.string.ok, null)

View File

@@ -183,11 +183,16 @@ public final class UiHelpers
drawableRes = R.drawable.ic_follow;
tintColor = Colors.LOCATION_TINT;
}
case LocationState.FOLLOW_AND_ROTATE ->
case LocationState.FOLLOW_AND_ROTATE_COMPASS ->
{
drawableRes = R.drawable.ic_follow_and_rotate;
tintColor = Colors.LOCATION_TINT;
}
case LocationState.FOLLOW_AND_ROTATE_ROUTE ->
{
drawableRes = R.drawable.ic_follow_route;
tintColor = Colors.LOCATION_TINT;
}
default -> throw new IllegalArgumentException("Invalid button mode: " + locationMode);
}

View File

@@ -42,7 +42,7 @@ public final class CustomMapServerDialog
edit.setText(current);
MaterialAlertDialogBuilder builder =
new MaterialAlertDialogBuilder(context)
new MaterialAlertDialogBuilder(context, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.download_resources_custom_url_title)
.setMessage(R.string.download_resources_custom_url_message)
.setView(dialogView)

View File

@@ -113,7 +113,7 @@ public class EditTextDialogFragment extends BaseMwmDialogFragment
negativeButtonText = args.getString(ARG_NEGATIVE_BUTTON);
}
AlertDialog editTextDialog = new MaterialAlertDialogBuilder(requireActivity())
AlertDialog editTextDialog = new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setView(buildView())
.setNegativeButton(negativeButtonText, null)
.setPositiveButton(positiveButtonText, null)

View File

@@ -119,7 +119,7 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
{
if (RoutingController.get().isNavigating())
{
new MaterialAlertDialogBuilder(adapter.mActivity)
new MaterialAlertDialogBuilder(adapter.mActivity, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.downloader_delete_map)
.setMessage(R.string.downloader_delete_map_while_routing_dialog)
.setPositiveButton(R.string.ok, null)
@@ -133,7 +133,7 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
return;
}
new MaterialAlertDialogBuilder(adapter.mActivity)
new MaterialAlertDialogBuilder(adapter.mActivity, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.downloader_delete_map)
.setMessage(R.string.downloader_delete_map_dialog)
.setNegativeButton(R.string.cancel, null)

View File

@@ -49,7 +49,7 @@ public class MapManagerHelper
return;
}
final AlertDialog dlg = new MaterialAlertDialogBuilder(activity)
final AlertDialog dlg = new MaterialAlertDialogBuilder(activity, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.country_status_download_failed)
.setMessage(getErrorCodeStrRes(errorData.errorCode))
.setNegativeButton(R.string.cancel,
@@ -72,7 +72,7 @@ public class MapManagerHelper
private static void notifyNoSpaceInternal(Activity activity)
{
new MaterialAlertDialogBuilder(activity)
new MaterialAlertDialogBuilder(activity, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.downloader_no_space_title)
.setMessage(R.string.downloader_no_space_message)
.setPositiveButton(android.R.string.ok, null)
@@ -123,7 +123,7 @@ public class MapManagerHelper
return false;
}
new MaterialAlertDialogBuilder(activity)
new MaterialAlertDialogBuilder(activity, R.style.MwmTheme_AlertDialog)
.setTitle(R.string.download_over_mobile_header)
.setMessage(R.string.download_over_mobile_message)
.setNegativeButton(R.string.cancel, null)

View File

@@ -493,7 +493,7 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
}
});
return new MaterialAlertDialogBuilder(requireActivity())
return new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(R.string.editor_socket)
.setView(dialogView)
.setPositiveButton(R.string.save,
@@ -997,7 +997,7 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
message = R.string.editor_reset_edits_message;
}
new MaterialAlertDialogBuilder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(message)
.setPositiveButton(title,
(dialog, which) -> {
@@ -1020,7 +1020,7 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
private void placeDisused()
{
new MaterialAlertDialogBuilder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(R.string.editor_mark_business_vacant_title)
.setMessage(R.string.editor_mark_business_vacant_description)
.setPositiveButton(R.string.editor_submit, (dlg, which) -> {

View File

@@ -352,7 +352,7 @@ public class EditorHostFragment
private void processNoFeatures()
{
new MaterialAlertDialogBuilder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(R.string.downloader_no_space_title)
.setPositiveButton(R.string.ok, null)
.show();
@@ -386,7 +386,7 @@ public class EditorHostFragment
private void showNoobDialog()
{
new MaterialAlertDialogBuilder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(R.string.editor_share_to_all_dialog_title)
.setMessage(getString(R.string.editor_share_to_all_dialog_message_1) + " "
+ getString(R.string.editor_share_to_all_dialog_message_2))

View File

@@ -155,7 +155,7 @@ public class FeatureCategoryFragment
// Duplicate of showNoobDialog()
private void showNoteConfirmationDialog(double lat, double lon, String noteText)
{
new MaterialAlertDialogBuilder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(R.string.editor_share_to_all_dialog_title)
.setMessage(getString(R.string.editor_share_to_all_dialog_message_1) + " "
+ getString(R.string.editor_share_to_all_dialog_message_2))

View File

@@ -79,7 +79,7 @@ public class OsmLoginFragment extends BaseMwmToolbarFragment
private void onAuthFail()
{
new MaterialAlertDialogBuilder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(R.string.editor_login_error_dialog)
.setPositiveButton(R.string.ok, null)
.show();

View File

@@ -66,7 +66,7 @@ public class FaqFragment extends BaseMwmFragment
FloatingActionButton feedbackFab = root.findViewById(R.id.feedback_fab);
feedbackFab.setOnClickListener(
v
-> new MaterialAlertDialogBuilder(requireActivity())
-> new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(R.string.feedback)
.setNegativeButton(R.string.cancel, null)
.setItems(new CharSequence[] {getString(R.string.feedback_general), getString(R.string.report_a_bug)},

View File

@@ -107,7 +107,7 @@ public class TrafficButtonController implements TrafficManager.TrafficCallback
if (mDialog != null && mDialog.isShowing())
return;
mDialog = new MaterialAlertDialogBuilder(mActivity)
mDialog = new MaterialAlertDialogBuilder(mActivity, R.style.MwmTheme_AlertDialog)
.setMessage(R.string.common_check_internet_connection_dialog)
.setPositiveButton(R.string.ok, (dialog, which) -> TrafficManager.INSTANCE.setEnabled(false))
.setCancelable(true)

View File

@@ -56,7 +56,7 @@ abstract class BaseRoutingErrorDialogFragment extends BaseMwmDialogFragment
public Dialog onCreateDialog(Bundle savedInstanceState)
{
parseArguments();
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity())
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setCancelable(true)
.setNegativeButton(android.R.string.cancel, null);
beforeDialogCreated(builder);

View File

@@ -494,7 +494,7 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment implements La
pref.setOnPreferenceClickListener(preference -> {
if (MapManager.nativeIsDownloading())
{
new MaterialAlertDialogBuilder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(R.string.downloading_is_active)
.setMessage(R.string.cant_change_this_setting)
.setPositiveButton(R.string.ok, null)

View File

@@ -97,7 +97,7 @@ public class StoragePathFragment extends BaseSettingsFragment
final String oldPath = storages.get(currentIndex).mPath;
final String newPath = storages.get(newIndex).mPath;
new MaterialAlertDialogBuilder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setCancelable(false)
.setTitle(R.string.move_maps)
.setPositiveButton(R.string.ok, (dlg, which) -> moveStorage(newPath, oldPath))
@@ -133,7 +133,7 @@ public class StoragePathFragment extends BaseSettingsFragment
if (!result)
{
new MaterialAlertDialogBuilder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setTitle(R.string.move_maps_error)
.setPositiveButton(
R.string.report_a_bug,

View File

@@ -49,8 +49,8 @@ public class MyPositionButton
int colorAttr = R.attr.iconTint;
@DimenRes
int sizeDimen = R.dimen.map_button_icon_size;
if (mode == LocationState.FOLLOW || mode == LocationState.FOLLOW_AND_ROTATE
|| mode == LocationState.PENDING_POSITION)
if (mode == LocationState.FOLLOW || mode == LocationState.FOLLOW_AND_ROTATE_ROUTE
|| mode == LocationState.FOLLOW_AND_ROTATE_COMPASS || mode == LocationState.PENDING_POSITION)
{
colorAttr = com.google.android.material.R.attr.colorSecondary;
if (mode == LocationState.PENDING_POSITION)
@@ -69,7 +69,8 @@ public class MyPositionButton
case LocationState.NOT_FOLLOW_NO_POSITION -> R.drawable.ic_location_off;
case LocationState.NOT_FOLLOW -> R.drawable.ic_location_crosshair;
case LocationState.FOLLOW -> R.drawable.ic_follow;
case LocationState.FOLLOW_AND_ROTATE -> R.drawable.ic_follow_and_rotate;
case LocationState.FOLLOW_AND_ROTATE_COMPASS -> R.drawable.ic_follow_and_rotate;
case LocationState.FOLLOW_AND_ROTATE_ROUTE -> R.drawable.ic_follow_route;
default -> throw new IllegalArgumentException("Invalid button mode: " + mode);
};
image = ResourcesCompat.getDrawable(resources, drawableRes, context.getTheme());

View File

@@ -47,7 +47,7 @@ public class BookmarkColorDialogFragment extends BaseMwmDialogFragment
mIconResId = getArguments().getInt(ICON_RES);
}
return new MaterialAlertDialogBuilder(requireActivity())
return new MaterialAlertDialogBuilder(requireActivity(), R.style.MwmTheme_AlertDialog)
.setView(buildView())
.setTitle(R.string.choose_color)
.setNegativeButton(R.string.cancel, null)

View File

@@ -464,7 +464,7 @@ public class PlacePageController
mAlertDialog.show();
return;
}
mAlertDialog = new MaterialAlertDialogBuilder(requireContext())
mAlertDialog = new MaterialAlertDialogBuilder(requireContext(), R.style.MwmTheme_AlertDialog)
.setTitle(requireContext().getString(R.string.delete_track_dialog_title, mMapObject.getTitle()))
.setCancelable(true)
.setNegativeButton(R.string.cancel, null)

View File

@@ -4,7 +4,7 @@
android:color="?colorControlHighlight">
<item>
<shape>
<solid android:color="?appBackground" />
<solid android:color="?cardBackground" />
</shape>
</item>
<item android:id="@android:id/mask">

View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:strokeColor="@android:color/white"
android:fillColor="@android:color/white"
android:pathData="M15.15 16.92l-7.04 2.8v0.4l2.63 1.07 0.98 2.67h0.39z"/>
<path
android:strokeColor="@android:color/white"
android:strokeWidth="2"
android:strokeLineJoin="miter"
android:pathData="m 16.25,15.95 c 2.29,-2.29 1.91,-3.87 -4.06,-3.87"/>
<path
android:strokeColor="@android:color/white"
android:strokeWidth="2"
android:strokeLineJoin="miter"
android:pathData="M8.98 7.43c-2.97 2.96-2.72 4.66 3.24 4.66"/>
<path
android:strokeColor="@android:color/white"
android:strokeWidth="2"
android:strokeLineJoin="miter"
android:pathData="M8.89 7.51l8.83-8.79"/>
<path
android:strokeColor="@android:color/white"
android:strokeWidth="2"
android:strokeLineJoin="miter"
android:pathData="M9.2 22.83c-0.64 0.57-2.9 2.5-3.56 3.13"/>
</vector>

View File

@@ -1,18 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/Widget.Material3.CardView.Filled"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/margin_half"
app:cardBackgroundColor="?attr/colorSurfaceContainerHigh"
app:cardCornerRadius="28dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:background="?cardBackground">
<LinearLayout
android:orientation="vertical"
@@ -55,4 +49,3 @@
tools:text="Do not Use Today"/>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@@ -22,9 +22,12 @@
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:baselineAligned="false"
android:orientation="horizontal"
android:orientation="vertical"
tools:ignore="ScrollViewSize">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
@@ -108,5 +111,6 @@
android:text="@string/register_at_openstreetmap" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@@ -17,7 +17,6 @@
android:id="@+id/street_frame"
android:layout_width="500dp"
android:layout_height="wrap_content"
style="@style/Widget.Material3.CardView.Filled"
android:layout_marginEnd="@dimen/margin_quarter"
app:cardCornerRadius="@dimen/margin_half"
android:elevation="@dimen/nav_elevation"

View File

@@ -11,7 +11,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="?menuBackground"
android:backgroundTint="?menuBackground"
android:background="@drawable/onmap_downloader_background"
android:padding="@dimen/margin_base"
android:clipToPadding="false"
android:clipChildren="false"

View File

@@ -1,18 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/Widget.Material3.CardView.Filled"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_double_and_half"
android:background="?cardBackground"
android:minWidth="@dimen/dialog_min_width"
android:minHeight="@dimen/dialog_min_height"
app:cardBackgroundColor="?attr/colorSurfaceContainerHigh"
app:cardCornerRadius="28dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/margin_base_plus">
@@ -82,4 +77,3 @@
app:buttonTint="@null"/>
</RadioGroup>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@@ -1,18 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/Widget.Material3.CardView.Filled"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/margin_half"
app:cardBackgroundColor="?attr/colorSurfaceContainerHigh"
app:cardCornerRadius="28dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:background="?cardBackground">
<LinearLayout
android:orientation="vertical"
@@ -47,4 +41,3 @@
style="@style/MwmWidget.Button.StackedButtonsDialog"
tools:text="Do not Use Today"/>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View File

@@ -13,6 +13,7 @@
android:paddingTop="@dimen/margin_half"
android:paddingBottom="@dimen/margin_half"
android:layout_marginEnd="@dimen/margin_base"
android:background="?cardBackground"
android:textAppearance="@style/MwmTextAppearance.Caption"
tools:text="Downloaded"
tools:background="#80FF0000"/>

View File

@@ -6,7 +6,7 @@
android:id="@+id/rl__bookmark_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?appBackground"
android:background="?cardBackground"
android:padding="@dimen/margin_half">
<LinearLayout
android:id="@+id/ll__bookmark_name"

View File

@@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:background="?appBackground"
android:background="?cardBackground"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.MaterialToolbar
@@ -69,6 +69,7 @@
android:inputType="textMultiLine"/>
</com.google.android.material.textfield.TextInputLayout>
<View
android:background="?cardBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

View File

@@ -11,6 +11,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:background="?appBackground"/>
android:fadeScrollbars="false" />
</LinearLayout>

View File

@@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="@style/MwmWidget.Floating"
android:background="?appBackground"
android:background="?cardBackground"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/toolbar_with_search"/>
@@ -17,12 +17,10 @@
style="@style/MwmWidget.Button.Primary"
tools:text="@string/downloader_update_all_button"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
<include
layout="@layout/recycler_default"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?appBackground"
android:scrollbars="vertical"
android:layout_below="@id/toolbar"
android:layout_above="@id/action"/>

View File

@@ -4,7 +4,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?appBackground">
android:background="?cardBackground">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/MwmWidget.ToolbarStyle"

View File

@@ -5,7 +5,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?windowBackgroundForced"
android:orientation="vertical">
<com.google.android.material.appbar.MaterialToolbar

View File

@@ -10,7 +10,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/frameLayout"
android:background="?windowBackgroundForced">
android:background="?cardBackground">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/phones_recycler"

View File

@@ -61,12 +61,12 @@
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:background="?appBackground">
android:background="?cardBackground">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:clipToPadding="false"
android:background="?appBackground"
android:background="?cardBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>

View File

@@ -4,10 +4,6 @@
style="@style/MwmWidget.FrameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?appBackground"
android:scrollbars="vertical"/>
<include
layout="@layout/recycler_default"/>
</FrameLayout>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -16,9 +16,33 @@
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_half"
style="@style/MwmWidget.M3.Editor.CardView"
app:cardBackgroundColor="?cardBackground">
card_view:cardBackgroundColor="?cardBackground"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="4dp">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et__timetable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@null"
android:gravity="top|start"
android:inputType="textMultiLine"
android:padding="@dimen/margin_base"
android:textAppearance="@style/MwmTextAppearance.Body3"
tools:hint="hint"
tools:text="trololo \ntrololo \ntrololo"/>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_half"
card_view:cardBackgroundColor="?cardBackground"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="4dp">
<LinearLayout
android:id="@+id/examples"
@@ -26,26 +50,6 @@
android:layout_height="match_parent"
android:orientation="vertical"
android:animateLayoutChanges="true">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/margin_half"
android:layout_marginBottom="@dimen/margin_half"
app:hintEnabled="false">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et__timetable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@null"
android:gravity="top|start"
android:inputType="textMultiLine"
android:padding="@dimen/margin_base"
android:textAppearance="@style/MwmTextAppearance.Body3"
tools:hint="hint"
tools:text="trololo \ntrololo \ntrololo"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/tv__examples_title"

View File

@@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?appBackground"
android:background="?cardBackground"
android:padding="@dimen/margin_base">
<LinearLayout

View File

@@ -5,7 +5,7 @@
style="@style/MwmTextAppearance.Headline6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?appBackground"
android:background="?windowBackgroundForced"
android:gravity="start|center_vertical"
android:paddingStart="@dimen/margin_base"
android:paddingTop="@dimen/margin_base_plus"

View File

@@ -6,7 +6,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_gravity="center"
android:orientation="vertical"
android:background="?appBackground"
android:background="?cardBackground"
android:padding="@dimen/margin_base">
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"

View File

@@ -7,7 +7,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorSurfaceContainerHigh"
android:background="?cardBackground"
android:minHeight="@dimen/height_item_oneline"
android:paddingStart="@dimen/margin_base_plus"
android:paddingEnd="@dimen/margin_base_plus">

View File

@@ -7,7 +7,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorSurfaceContainerHigh"
android:background="?cardBackground"
android:minHeight="@dimen/height_item_oneline"
android:paddingStart="@dimen/margin_base_plus"
android:paddingEnd="@dimen/margin_base_plus">

View File

@@ -1,15 +1,11 @@
<com.google.android.material.card.MaterialCardView
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/MwmWidget.M3.Editor.CardView"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_margin="@dimen/margin_eighth"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/margin_half"
android:background="?cardBackground"
android:layout_height="@dimen/height_item_oneline"
android:background="?clickableBackground"
android:layout_marginTop="@dimen/margin_half"
android:paddingStart="@dimen/margin_half_plus"
android:paddingEnd="@dimen/margin_half_plus">
@@ -29,6 +25,7 @@
android:layout_marginStart="@dimen/margin_half"
android:layout_marginEnd="@dimen/margin_half"
android:layout_toStartOf="@id/delete_icon"
android:textColorHint="?android:textColorSecondary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/delete_icon"
app:layout_constraintStart_toEndOf="@+id/phone_icon"
@@ -44,6 +41,7 @@
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/delete_icon"
style="@style/MwmWidget.Editor.MetadataIcon"
android:layout_marginStart="@dimen/margin_half"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
@@ -51,4 +49,3 @@
app:srcCompat="@drawable/ic_delete" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>

View File

@@ -17,7 +17,6 @@
android:id="@+id/street_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.Material3.CardView.Filled"
android:layout_marginStart="@dimen/nav_street_left"
android:layout_marginEnd="@dimen/margin_quarter"
app:cardCornerRadius="@dimen/margin_half"

View File

@@ -4,7 +4,7 @@
android:id="@+id/menu_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?appBackground"
android:background="?cardBackground"
android:clickable="true"
android:visibility="gone"
tools:visibility="visible">

View File

@@ -2,7 +2,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:background="?appBackground"
android:background="?cardBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content">

View File

@@ -29,7 +29,7 @@
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?appBackground"
android:background="?cardBackground"
android:padding="@dimen/margin_base"
android:text="@string/editor_focus_map_on_location"
app:layout_constraintTop_toBottomOf="@+id/toolbar_point_chooser" />

View File

@@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/height_block_base"
android:background="?appBackground"
android:background="?cardBackground"
android:baselineAligned="false">
<LinearLayout
android:id="@+id/btn__search_point"

View File

@@ -146,13 +146,16 @@
android:foreground="@drawable/shadow_top"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
<RelativeLayout
android:id="@+id/driving_options_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackgroundBorderless"
android:gravity="center"
android:minHeight="@dimen/height_block_base">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/driving_options_btn_img"
android:layout_width="@dimen/margin_base_plus"
@@ -171,7 +174,8 @@
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_light"
tools:text="test" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</FrameLayout>
<FrameLayout
style="@style/MwmWidget.FrameLayout.Elevation"

View File

@@ -11,7 +11,7 @@
<item name="android:textColorPrimary">@color/text_light</item>
<item name="android:textColorPrimaryInverse">@color/text_dark</item>
<item name="android:textColorSecondary">@color/text_light_subtitle</item>
<item name="android:windowBackground">?appBackground</item>
<item name="android:windowBackground">?windowBackgroundForced</item>
<item name="android:colorPrimaryDark">@color/bg_primary_dark</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:fontFamily">@string/robotoRegular</item>
@@ -21,7 +21,7 @@
<item name="android:statusBarColor">?colorPrimary</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="alertDialogTheme">@style/MwmTheme.M3.AlertDialog</item>
<item name="alertDialogTheme">@style/MwmTheme.AlertDialog</item>
<item name="windowBackgroundForced">@color/bg_window</item>
<item name="cardBackground">@color/bg_cards</item>
<item name="titleDialogTheme">@color/white_primary</item>

View File

@@ -120,7 +120,7 @@
<dimen name="nav_frame_padding">@dimen/margin_half</dimen>
<dimen name="zoom_buttons_margin">58dp</dimen>
<dimen name="map_buttons_bottom_margin">136dp</dimen>
<dimen name="map_buttons_bottom_margin">184dp</dimen>
<dimen name="map_buttons_bottom_max_width">300dp</dimen>
<dimen name="appbar_elevation">4dp</dimen>

View File

@@ -12,7 +12,7 @@
<item name="android:textColorPrimary">@color/text_dark</item>
<item name="android:textColorPrimaryInverse">@color/text_light</item>
<item name="android:textColorSecondary">@color/text_dark_subtitle</item>
<item name="android:windowBackground">?appBackground</item>
<item name="android:windowBackground">?windowBackgroundForced</item>
<item name="android:colorPrimaryDark">@color/bg_primary_dark</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:fontFamily">@string/robotoRegular</item>
@@ -20,7 +20,7 @@
<item name="android:windowActionBarOverlay">true</item>
<item name="clickableBackground">?selectableItemBackground</item>
<item name="android:statusBarColor">?colorPrimary</item>
<item name="alertDialogTheme">@style/MwmTheme.M3.AlertDialog</item>
<item name="alertDialogTheme">@style/MwmTheme.AlertDialog</item>
<item name="windowBackgroundForced">@color/bg_window</item>
<item name="cardBackground">@color/bg_cards</item>
<item name="titleDialogTheme">@color/black_primary</item>
@@ -185,11 +185,11 @@
</style>
<style name="MwmTheme.CardBg">
<item name="android:windowBackground">?appBackground</item>
<item name="android:windowBackground">@color/bg_cards</item>
</style>
<style name="MwmTheme.WindowBg">
<item name="android:windowBackground">?appBackground</item>
<item name="android:windowBackground">@color/bg_window</item>
</style>
<style name="MwmTheme.AlertDialog" parent="Theme.Material3.DayNight.Dialog.Alert">
@@ -243,7 +243,7 @@
<style name="MwmTheme.FullScreenDialog">
<item name="android:windowIsFloating">false</item>
<item name="android:windowBackground">?appBackground</item>
<item name="android:windowBackground">@android:color/white</item>
</style>
<style name="MwmTheme.MaterialTimePicker" parent="ThemeOverlay.MaterialComponents.TimePicker">
@@ -281,11 +281,4 @@
<style name="PopupMenu" parent="ThemeOverlay.Material3">
<item name="android:popupBackground">?windowBackgroundForced</item>
</style>
<!-- Theme required to apply M3 dialog style on preference screen -->
<style name="MwmTheme.M3.AlertDialog" parent="ThemeOverlay.Material3.MaterialAlertDialog">
<item name="dialogCornerRadius">28dp</item>
<item name="cornerFamily">rounded</item>
<item name="android:colorBackground">?attr/colorSurfaceContainerHigh</item>
<item name="android:layout">@layout/m3_alert_dialog</item>
</style>
</resources>

View File

@@ -27,6 +27,8 @@ import app.organicmaps.sdk.util.NetworkPolicy;
import app.organicmaps.sdk.util.log.Logger;
import org.chromium.base.ObserverList;
import java.util.HashMap;
public class LocationHelper implements BaseLocationProvider.Listener
{
private static final long INTERVAL_MS = 500;
@@ -56,6 +58,12 @@ public class LocationHelper implements BaseLocationProvider.Listener
private Handler mHandler;
private Runnable mLocationTimeoutRunnable = this::notifyLocationUpdateTimeout;
private static final double INTERVAL_PROVIDER_DECISION = 3.0; // seconds
private final HashMap<String, Integer> mProviderLocationCounts = new HashMap<>();
private final HashMap<String, Float> mProviderAccuracyMeans = new HashMap<>();
private double mTimeAtLastProviderChange = Double.NaN;
private String mCurrentProvider = null;
@NonNull
private final GnssStatusCompat.Callback mGnssStatusCallback = new GnssStatusCompat.Callback() {
@Override
@@ -187,7 +195,6 @@ public class LocationHelper implements BaseLocationProvider.Listener
@Override
public void onLocationChanged(@NonNull Location location)
{
Logger.d(TAG, "provider = " + mLocationProvider.getClass().getSimpleName() + " location = " + location);
if (!isActive())
{
@@ -201,21 +208,59 @@ public class LocationHelper implements BaseLocationProvider.Listener
return;
}
if (mSavedLocation != null)
{
if (!LocationUtils.isLocationBetterThanLast(location, mSavedLocation))
{
Logger.d(TAG, "The new " + location + " is worse than the last " + mSavedLocation);
updateProviderDecision(location);
if(mCurrentProvider != null && !mCurrentProvider.equals(location.getProvider())) {
Logger.d(TAG, "REJECTED: provider = " + mLocationProvider.getClass().getSimpleName() + " location = " + location);
return;
}
}
Logger.d(TAG, "provider = " + mLocationProvider.getClass().getSimpleName() + " location = " + location);
mSavedLocation = location;
mMyPosition = null;
notifyLocationUpdated();
}
// Used by GoogleFusedLocationProvider.
private void updateProviderDecision(Location location) {
if(Double.isNaN(mTimeAtLastProviderChange))
mTimeAtLastProviderChange = location.getElapsedRealtimeNanos() * 1.0E-9;
String provider = location.getProvider();
int count = mProviderLocationCounts.getOrDefault(provider, 0);
float average = mProviderAccuracyMeans.getOrDefault(provider, 0.0f);
float accuracy = location.getAccuracy();
float newAverage = (count * average + accuracy) / (count + 1);
mProviderLocationCounts.put(provider, count + 1);
mProviderAccuracyMeans.put(provider, newAverage);
double currentTime = location.getElapsedRealtimeNanos();
double timeDiff = (currentTime - mTimeAtLastProviderChange) * 1.0E-9;
if(timeDiff > INTERVAL_PROVIDER_DECISION) {
mCurrentProvider = getMinAccuracyProvider();
Logger.d(TAG, "Selected: " + mCurrentProvider + ", with acc. " + mProviderAccuracyMeans.get(mCurrentProvider));
mTimeAtLastProviderChange = currentTime;
mProviderLocationCounts.clear();
mProviderAccuracyMeans.clear();
}
}
private String getMinAccuracyProvider() {
String minAccuracyProvider = null;
float minAccuracy = Float.MAX_VALUE;
for(String p : mProviderAccuracyMeans.keySet()) {
float pAccuracy = mProviderAccuracyMeans.get(p);
if(pAccuracy < minAccuracy) {
minAccuracy = pAccuracy;
minAccuracyProvider = p;
}
}
return minAccuracyProvider;
}
// Used by GoogleFusedLocationProvider.
@SuppressWarnings("unused")
@Override
@UiThread

View File

@@ -20,7 +20,8 @@ public final class LocationState
}
@Retention(RetentionPolicy.SOURCE)
@IntDef({PENDING_POSITION, NOT_FOLLOW_NO_POSITION, NOT_FOLLOW, FOLLOW, FOLLOW_AND_ROTATE})
@IntDef({PENDING_POSITION, NOT_FOLLOW_NO_POSITION, NOT_FOLLOW, FOLLOW, FOLLOW_AND_ROTATE_COMPASS,
FOLLOW_AND_ROTATE_ROUTE})
@interface Value
{}
@@ -29,7 +30,8 @@ public final class LocationState
public static final int NOT_FOLLOW_NO_POSITION = 1;
public static final int NOT_FOLLOW = 2;
public static final int FOLLOW = 3;
public static final int FOLLOW_AND_ROTATE = 4;
public static final int FOLLOW_AND_ROTATE_COMPASS = 4;
public static final int FOLLOW_AND_ROTATE_ROUTE = 5;
// These constants should correspond to values defined in platform/location.hpp
// Leave 0-value as no any error.
@@ -69,7 +71,8 @@ public final class LocationState
case NOT_FOLLOW_NO_POSITION -> "NOT_FOLLOW_NO_POSITION";
case NOT_FOLLOW -> "NOT_FOLLOW";
case FOLLOW -> "FOLLOW";
case FOLLOW_AND_ROTATE -> "FOLLOW_AND_ROTATE";
case FOLLOW_AND_ROTATE_COMPASS -> "FOLLOW_AND_ROTATE_COMPASS";
case FOLLOW_AND_ROTATE_ROUTE -> "FOLLOW_AND_ROTATE_ROUTE";
default -> "Unknown: " + mode;
};
}

View File

@@ -81,20 +81,6 @@ public class LocationUtils
return location.getAccuracy() > 0.0f;
}
public static boolean isLocationBetterThanLast(@NonNull Location newLocation, @NonNull Location lastLocation)
{
if (newLocation.getElapsedRealtimeNanos() < lastLocation.getElapsedRealtimeNanos())
return false;
// As described in isAccuracySatisfied, GPS may have zero accuracy "for some reasons".
if (isFromGpsProvider(lastLocation) && lastLocation.getAccuracy() == 0.0f)
return true;
double speed = Math.max(DEFAULT_SPEED_MPS, (newLocation.getSpeed() + lastLocation.getSpeed()) / 2.0);
double lastAccuracy = lastLocation.getAccuracy() + speed * LocationUtils.getTimeDiff(lastLocation, newLocation);
return newLocation.getAccuracy() < lastAccuracy;
}
public static boolean areLocationServicesTurnedOn(@NonNull Context context)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,108 @@
{
"make_a_slight_right_turn":"லேசாக வலதுபுறம் திரும்புங்கள்.",
"make_a_slight_right_turn_street":"NULL",
"make_a_slight_right_turn_street_verb":"NULL",
"make_a_right_turn":"வலதுபுறமாக திரும்புங்கள்.",
"make_a_right_turn_street":"NULL",
"make_a_sharp_right_turn":"கூர்மையாக வலதுபுறம் திரும்புங்கள்.",
"make_a_sharp_right_turn_street":"NULL",
"enter_the_roundabout":"ரவுண்டபௌட்டை நுழையுங்கள்.",
"enter_the_roundabout_street":"NULL",
"enter_the_roundabout_street_verb":"NULL",
"leave_the_roundabout":"ரவுண்டபௌட்டை வெளியேறுங்கள்.",
"leave_the_roundabout_street":"NULL",
"leave_the_roundabout_street_verb":"NULL",
"make_a_slight_left_turn":"லேசாக இடதுபுறம் திரும்புங்கள்.",
"make_a_slight_left_turn_street":"NULL",
"make_a_slight_left_turn_street_verb":"NULL",
"make_a_left_turn":"இடதுபுறமாக திரும்புங்கள்.",
"make_a_left_turn_street":"NULL",
"make_a_sharp_left_turn":"கூர்மையாக இடதுபுறம் திரும்புங்கள்.",
"make_a_sharp_left_turn_street":"NULL",
"make_a_u_turn":"U-வழியில் திரும்புங்கள்.",
"make_a_u_turn_street":"NULL",
"make_a_u_turn_street_verb":"NULL",
"go_straight":"நேரா போங்க.",
"exit":"வெளியேறுங்கள்.",
"onto":"நோக்கி",
"take_exit_number":"வெளியேறும் வழி எடுங்கள்",
"take_exit_number_street_verb":"NULL",
"route_recalculating":"வழி மறுபடி கணிக்கிறது",
"destination":"நீங்கள் வருவீர்கள்.",
"you_have_reached_the_destination":"நீங்கள் வந்துவிட்டீர்கள்..",
"in_50_meters":"ஐம்பது மீட்டரில்",
"in_100_meters":"நூறு மீட்டரில்",
"in_200_meters":"இருநூறு மீட்டரில்",
"in_250_meters":"இருநூற்று ஐம்பது மீட்டரில்",
"in_300_meters":"முன்னூறு மீட்டரில்",
"in_400_meters":"நானூறு மீட்டரில்",
"in_500_meters":"ஐநூறு மீட்டரில்",
"in_600_meters":"அறுநூறு மீட்டரில்",
"in_700_meters":"எழுநூறு மீட்டரில்",
"in_750_meters":"எழுநூறு ஐம்பது மீட்டரில்",
"in_800_meters":"எண்ணூறு மீட்டரில்",
"in_900_meters":"தொள்ளாயிரம் மீட்டரில்",
"in_1_kilometer":"ஒரு கிலோமீட்டரில்",
"in_1_5_kilometers":"ஒன்றரை கிலோமீட்டரில்",
"in_2_kilometers":"இரண்டு கிலோமீட்டரில்",
"in_2_5_kilometers":"இரண்டரை கிலோமீட்டரில்",
"in_3_kilometers":"மூன்று கிலோமீட்டரில்",
"then":"அடுத்தது",
"dist_direction_onto_street":"%1$s %4$s %3$s %5$s %2$s",
"take_the_1_exit":"ஒன்றாம் வெளியேறும் வழி எடுங்கள்.",
"take_the_1_exit_street":"NULL",
"take_the_1_exit_street_verb":"NULL",
"take_the_2_exit":"இரண்டாம் வெளியேறும் வழி எடுங்கள்.",
"take_the_2_exit_street":"NULL",
"take_the_2_exit_street_verb":"NULL",
"take_the_3_exit":"மூன்றாம் வெளியேறும் வழி எடுங்கள்.",
"take_the_3_exit_street":"NULL",
"take_the_3_exit_street_verb":"NULL",
"take_the_4_exit":"நான்காவது வெளியேறும் வழி எடுங்கள்.",
"take_the_4_exit_street":"NULL",
"take_the_4_exit_street_verb":"NULL",
"take_the_5_exit":"ஐந்தாவது வெளியேறும் வழி எடுங்கள்.",
"take_the_5_exit_street":"NULL",
"take_the_5_exit_street_verb":"NULL",
"take_the_6_exit":"ஆறாவது வெளியேறும் வழி எடுங்கள்.",
"take_the_6_exit_street":"NULL",
"take_the_6_exit_street_verb":"NULL",
"take_the_7_exit":"ஏழாவது வெளியேறும் வழி எடுங்கள்.",
"take_the_7_exit_street":"NULL",
"take_the_7_exit_street_verb":"NULL",
"take_the_8_exit":"எட்டாவது வெளியேறும் வழி எடுங்கள்.",
"take_the_8_exit_street":"NULL",
"take_the_8_exit_street_verb":"NULL",
"take_the_9_exit":"ஒன்பதாவது வெளியேறும் வழி எடுங்கள்.",
"take_the_9_exit_street":"NULL",
"take_the_9_exit_street_verb":"NULL",
"take_the_10_exit":"பத்தாவது வெளியேறும் வழி எடுங்கள்.",
"take_the_10_exit_street":"NULL",
"take_the_10_exit_street_verb":"NULL",
"take_the_11_exit":"பதினொன்றாவது வெளியேறும் வழி எடுங்கள்.",
"take_the_11_exit_street":"NULL",
"take_the_11_exit_street_verb":"NULL",
"in_50_feet":"ஐம்பது அடியில்",
"in_100_feet":"நூறு அடியில்",
"in_200_feet":"இருநூறு அடியில்",
"in_300_feet":"முன்னூறு அடியில்",
"in_400_feet":"நானூறு அடியில்",
"in_500_feet":"ஐநூறு அடியில்",
"in_600_feet":"அறுநூறு அடியில்",
"in_700_feet":"எழுநூறு அடியில்",
"in_800_feet":"எண்ணூறு அடியில்",
"in_900_feet":"தொள்ளாயிரம் அடியில்",
"in_1000_feet":"ஆயிரம் அடியில்",
"in_1500_feet":"ஆயிரம் ஐநூறு அடியில்",
"in_2000_feet":"இரண்டு ஆயிரம் அடியில்",
"in_2500_feet":"இரண்டு ஆயிரம் ஐநூறு அடியில்",
"in_3000_feet":"மூன்று ஆயிரம் அடியில்",
"in_3500_feet":"மூன்று ஆயிரம் ஐநூறு அடியில்",
"in_4000_feet":"நான்கு ஆயிரம் அடியில்",
"in_4500_feet":"நான்கு ஆயிரம் ஐநூறு அடியில்",
"in_5000_feet":"ஐந்து ஆயிரம் அடியில்",
"in_1_mile":"ஒன்று மைலில்",
"in_1_5_miles":"ஒன்றரை மைலில்",
"in_2_miles":"இரண்டு மைலில்",
"unknown_camera":"கேமரா முன்னால் இருக்கிறது"
}

View File

@@ -449,7 +449,6 @@ area|z13-[landuse=quarry],
area|z13-[power=plant],
area|z13-[power=substation],
area|z13-[power=generator],
area|z13-[man_made=wastewater_plant]
{fill-opacity: 1; fill-color: @industrial;}
area|z13-[landuse=construction],

View File

@@ -592,7 +592,6 @@ area|z15-[landuse=industrial],
area|z15-[landuse=construction],
area|z15-[landuse=railway],
area|z15-[landuse=quarry],
area|z15-[man_made=wastewater_plant],
node|z15-[landuse=industrial],
node|z15-[landuse=construction],
node|z15-[landuse=landfill],

View File

@@ -208,7 +208,6 @@ landuse-industrial # area z13- (also has captio
landuse-industrial-mine # area z13- (also has icon z15-, caption(optional) z15-)
landuse-quarry # area z13- (also has icon z15-, caption(optional) z15-)
landuse-railway # area z13- (also has caption z15-)
man_made-wastewater_plant # area z13- (also has caption z15-)
man_made-works # area z13- (also has icon z16-, caption(optional) z17-)
power-generator # area z13- (also has icon z17-)
power-generator-gas # area z13- (also has icon z17-)

View File

@@ -1374,7 +1374,6 @@ leisure-slipway # icon z17- (also has captio
leisure-track # caption z16- (also has line z15-)
leisure-track-area # caption z16- (also has area z15-)
man_made-petroleum_well # icon z17- (also has caption(optional) z18-)
man_made-wastewater_plant # caption z15- (also has area z13-)
power-generator # icon z17- (also has area z13-)
power-generator-gas # icon z17- (also has area z13-)
power-generator-hydro # icon z17- (also has area z13-)

View File

@@ -208,7 +208,6 @@ landuse-industrial # area z13- (also has captio
landuse-industrial-mine # area z13- (also has icon z15-, caption(optional) z15-)
landuse-quarry # area z13- (also has icon z15-, caption(optional) z15-)
landuse-railway # area z13- (also has caption z15-)
man_made-wastewater_plant # area z13- (also has caption z15-)
man_made-works # area z13- (also has icon z16-, caption(optional) z17-)
power-generator # area z13- (also has icon z17-)
power-generator-gas # area z13- (also has icon z17-)

View File

@@ -1377,7 +1377,6 @@ leisure-slipway # icon z17- (also has captio
leisure-track # caption z16- (also has line z15-)
leisure-track-area # caption z16- (also has area z15-)
man_made-petroleum_well # icon z14- (also has caption(optional) z18-)
man_made-wastewater_plant # caption z15- (also has area z13-)
power-generator # icon z17- (also has area z13-)
power-generator-gas # icon z17- (also has area z13-)
power-generator-hydro # icon z17- (also has area z13-)

View File

@@ -310,7 +310,6 @@ area|z15-[landuse=quarry],
area|z15-[power=plant],
area|z15-[power=substation],
area|z15-[power=generator],
area|z15-[man_made=wastewater_plant],
{fill-opacity: 1; fill-color: @industrial;}
area|z15-[landuse=construction],

View File

@@ -110,7 +110,6 @@ landuse-industrial-mine # area z15-
landuse-landfill # area z15- (also has caption z15-)
landuse-quarry # area z15- (also has caption z15-)
landuse-railway # area z15- (also has caption z15-)
man_made-wastewater_plant # area z15-
man_made-works # area z15-
power-generator # area z15-
power-generator-gas # area z15-

View File

@@ -111,21 +111,6 @@ sudo apk add \
sqlite-dev
```
#### Void
```bash
xbps-install -S \
wget \
optipng \
cmake \
ninja \
qt6-base-devel \
qt6-svg-devel \
qt6-position-devel \
python3-pip
pip3 install "protobuf<3.21" --break-system-packages
```
#### macOS
```bash

View File

@@ -32,7 +32,7 @@ NSDate * _Nullable ParseDateString(NSString * _Nullable dateString) {
dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"yyyy-MM-dd";
dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
dateFormatter.timeZone = [NSTimeZone localTimeZone];
dateFormatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
});
return [dateFormatter dateFromString:dateString];

View File

@@ -239,7 +239,7 @@ final class CarPlayService: NSObject {
MapTemplateBuilder.configureBaseUI(mapTemplate: mapTemplate)
if currentPositionMode == .pendingPosition {
mapTemplate.leadingNavigationBarButtons = []
} else if currentPositionMode == .follow || currentPositionMode == .followAndRotate {
} else if currentPositionMode == .follow || currentPositionMode == .followAndRotateCompass || currentPositionMode == .followAndRotateRoute {
MapTemplateBuilder.setupDestinationButton(mapTemplate: mapTemplate)
} else {
MapTemplateBuilder.setupRecenterButton(mapTemplate: mapTemplate)
@@ -623,22 +623,32 @@ extension CarPlayService: CarPlayRouterListener {
extension CarPlayService: LocationModeListener {
func processMyPositionStateModeEvent(_ mode: MWMMyPositionMode) {
currentPositionMode = mode
guard let rootMapTemplate = rootMapTemplate,
let info = rootMapTemplate.userInfo as? MapInfo,
info.type == CPConstants.TemplateType.main else {
// make sure we have a rootMapTemplate
guard let rootMapTemplate = rootMapTemplate else {
return
}
// exit if we're navigating
guard let info = rootMapTemplate.userInfo as? MapInfo,
info.type == CPConstants.TemplateType.main else {
MapTemplateBuilder.updateMyPositionModeButton(mapTemplate: rootMapTemplate, newMode: mode)
return
}
switch mode {
case .follow, .followAndRotate:
case .follow, .followAndRotateCompass, .followAndRotateRoute:
if !rootMapTemplate.isPanningInterfaceVisible {
MapTemplateBuilder.setupDestinationButton(mapTemplate: rootMapTemplate)
MapTemplateBuilder.updateMyPositionModeButton(mapTemplate: rootMapTemplate, newMode: mode)
}
case .notFollow:
if !rootMapTemplate.isPanningInterfaceVisible {
MapTemplateBuilder.setupRecenterButton(mapTemplate: rootMapTemplate)
MapTemplateBuilder.updateMyPositionModeButton(mapTemplate: rootMapTemplate, newMode: mode)
}
case .pendingPosition, .notFollowNoPosition:
rootMapTemplate.leadingNavigationBarButtons = []
MapTemplateBuilder.updateMyPositionModeButton(mapTemplate: rootMapTemplate, newMode: mode)
}
}
}

View File

@@ -5,6 +5,7 @@ final class MapTemplateBuilder {
case startPanning
case zoomIn
case zoomOut
case myPositionMode
}
enum BarButtonType {
case dismissPaning
@@ -28,7 +29,7 @@ final class MapTemplateBuilder {
configureBaseUI(mapTemplate: mapTemplate)
if positionMode == .pendingPosition {
mapTemplate.leadingNavigationBarButtons = []
} else if positionMode == .follow || positionMode == .followAndRotate {
} else if positionMode == .follow || positionMode == .followAndRotateCompass || positionMode == .followAndRotateRoute {
setupDestinationButton(mapTemplate: mapTemplate)
} else {
setupRecenterButton(mapTemplate: mapTemplate)
@@ -69,7 +70,10 @@ final class MapTemplateBuilder {
let zoomOutButton = buildMapButton(type: .zoomOut) { _ in
FrameworkHelper.zoomMap(.out)
}
mapTemplate.mapButtons = [panningButton, zoomInButton, zoomOutButton]
let myPositionModeButton = buildMapButton(type: .myPositionMode) { _ in
FrameworkHelper.switchMyPositionMode()
}
mapTemplate.mapButtons = [myPositionModeButton, panningButton, zoomInButton, zoomOutButton]
let settingsButton = buildBarButton(type: .settings) { _ in
let gridTemplate = SettingsTemplateBuilder.buildGridTemplate()
@@ -99,7 +103,10 @@ final class MapTemplateBuilder {
let panningButton = buildMapButton(type: .startPanning) { _ in
mapTemplate.showPanningInterface(animated: true)
}
mapTemplate.mapButtons = [panningButton]
let myPositionModeButton = buildMapButton(type: .myPositionMode) { _ in
FrameworkHelper.switchMyPositionMode()
}
mapTemplate.mapButtons = [myPositionModeButton, panningButton]
setupMuteAndRedirectButtons(template: mapTemplate)
let endButton = buildBarButton(type: .endRoute) { _ in
CarPlayService.shared.cancelCurrentTrip()
@@ -117,6 +124,28 @@ final class MapTemplateBuilder {
mapTemplate.leadingNavigationBarButtons = [destinationButton]
}
class func updateMyPositionModeButton(mapTemplate: CPMapTemplate, newMode: MWMMyPositionMode) {
let button = CPMapButton(handler: { _ in
FrameworkHelper.switchMyPositionMode()
})
switch newMode {
case .pendingPosition:
button.image = UIImage(systemName: "location.fill")
case .notFollowNoPosition:
button.image = UIImage(systemName: "location")
case .notFollow:
button.image = UIImage(systemName: "location")
case .follow:
button.image = UIImage(systemName: "location.fill")
case .followAndRotate:
button.image = UIImage(systemName: "location.north.line.fill")
}
if mapTemplate.mapButtons.count > 0 {
mapTemplate.mapButtons[0] = button
}
}
class func setupRecenterButton(mapTemplate: CPMapTemplate) {
let recenterButton = buildBarButton(type: .recenter) { _ in
FrameworkHelper.switchMyPositionMode()
@@ -166,6 +195,8 @@ final class MapTemplateBuilder {
button.image = UIImage(systemName: "plus")
case .zoomOut:
button.image = UIImage(systemName: "minus")
case .myPositionMode:
button.image = UIImage(systemName: "location")
}
// Remove code below once Apple has fixed its issue with the button background
if #unavailable(iOS 26) {
@@ -176,6 +207,8 @@ final class MapTemplateBuilder {
button.focusedImage = UIImage(systemName: "plus.circle.fill")
case .zoomOut:
button.focusedImage = UIImage(systemName: "minus.circle.fill")
case .myPositionMode:
button.image = UIImage(systemName: "location.fill")
}
}
return button

View File

@@ -91,7 +91,8 @@ NSString * const kUDDidShowLongTapToShowSideButtonsToast = @"kUDDidShowLongTapTo
case MWMMyPositionModeNotFollow:
case MWMMyPositionModeNotFollowNoPosition: [locBtn setStyleNameAndApply: @"ButtonGetPosition"]; break;
case MWMMyPositionModeFollow: [locBtn setStyleNameAndApply: @"ButtonFollow"]; break;
case MWMMyPositionModeFollowAndRotate: [locBtn setStyleNameAndApply: @"ButtonFollowAndRotate"]; break;
case MWMMyPositionModeFollowAndRotateCompass: [locBtn setStyleNameAndApply: @"ButtonFollowAndRotateCompass"]; break;
case MWMMyPositionModeFollowAndRotateRoute: [locBtn setStyleNameAndApply: @"ButtonFollowAndRotateRoute"]; break;
}
}

View File

@@ -632,7 +632,8 @@ NSString *const kAboutSegue = @"Map2About";
case MWMMyPositionModeNotFollow:
break;
case MWMMyPositionModeFollow:
case MWMMyPositionModeFollowAndRotate:
case MWMMyPositionModeFollowAndRotateCompass:
case MWMMyPositionModeFollowAndRotateRoute:
self.disableStandbyOnLocationStateMode = YES;
break;
}

View File

@@ -32,7 +32,8 @@ static inline MWMMyPositionMode mwmMyPositionMode(location::EMyPositionMode mode
case location::EMyPositionMode::NotFollowNoPosition: return MWMMyPositionModeNotFollowNoPosition;
case location::EMyPositionMode::NotFollow: return MWMMyPositionModeNotFollow;
case location::EMyPositionMode::Follow: return MWMMyPositionModeFollow;
case location::EMyPositionMode::FollowAndRotate: return MWMMyPositionModeFollowAndRotate;
case location::EMyPositionMode::FollowAndRotateCompass: return MWMMyPositionModeFollowAndRotateCompass;
case location::EMyPositionMode::FollowAndRotateRoute: return MWMMyPositionModeFollowAndRotateRoute;
}
}
} // namespace location_helpers

View File

@@ -50,7 +50,8 @@ std::string DebugPrint(MWMMyPositionMode mode) {
case MWMMyPositionModeNotFollowNoPosition: return "MWMMyPositionModeNotFollowNoPosition";
case MWMMyPositionModeNotFollow: return "MWMMyPositionModeNotFollow";
case MWMMyPositionModeFollow: return "MWMMyPositionModeFollow";
case MWMMyPositionModeFollowAndRotate: return "MWMMyPositionModeFollowAndRotate";
case MWMMyPositionModeFollowAndRotateCompass: return "MWMMyPositionModeFollowAndRotateCompass";
case MWMMyPositionModeFollowAndRotateRoute: return "MWMMyPositionModeFollowAndRotateRoute";
}
CHECK(false, ("Unsupported value", static_cast<int>(mode)));
}
@@ -367,7 +368,8 @@ void setShowLocationAlert(BOOL needShow) {
case MWMMyPositionModeNotFollowNoPosition:
case MWMMyPositionModeNotFollow: manager.geoMode = GeoMode::NotInPosition; break;
case MWMMyPositionModeFollow: manager.geoMode = GeoMode::InPosition; break;
case MWMMyPositionModeFollowAndRotate: manager.geoMode = GeoMode::FollowAndRotate; break;
case MWMMyPositionModeFollowAndRotateCompass:
case MWMMyPositionModeFollowAndRotateRoute: manager.geoMode = GeoMode::FollowAndRotate; break;
}
}
}

View File

@@ -30,7 +30,7 @@ NSUInteger constexpr kMaxPredictionCount = 20;
- (void)setMyPositionMode:(MWMMyPositionMode)mode
{
self.isLastPositionModeValid = (mode == MWMMyPositionModeFollowAndRotate);
self.isLastPositionModeValid = (mode == MWMMyPositionModeFollowAndRotateCompass);
[self restart];
}

View File

@@ -3,5 +3,6 @@ typedef NS_CLOSED_ENUM(NSUInteger, MWMMyPositionMode) {
MWMMyPositionModeNotFollowNoPosition,
MWMMyPositionModeNotFollow,
MWMMyPositionModeFollow,
MWMMyPositionModeFollowAndRotate
MWMMyPositionModeFollowAndRotateCompass,
MWMMyPositionModeFollowAndRotateRoute
};

View File

@@ -41,13 +41,14 @@ final class ThemeManager: NSObject {
}
}(actualTheme)
if Settings.mapAppearance == .light {
let isCarPlayActive = CarPlayService.shared.isCarplayActivated
if !isCarPlayActive, Settings.mapAppearance == .light {
if actualTheme == .vehicleDay || actualTheme == .vehicleNight {
FrameworkHelper.setTheme(.vehicleDay)
} else {
FrameworkHelper.setTheme(.day)
}
} else if Settings.mapAppearance == .dark {
} else if !isCarPlayActive, Settings.mapAppearance == .dark {
if actualTheme == .vehicleDay || actualTheme == .vehicleNight {
FrameworkHelper.setTheme(.vehicleNight)
} else {

View File

@@ -7,7 +7,8 @@ enum MapStyleSheet: String, CaseIterable {
case mapButtonPending = "ButtonPending"
case mapButtonGetPosition = "ButtonGetPosition"
case mapButtonFollow = "ButtonFollow"
case mapButtonFollowAndRotate = "ButtonFollowAndRotate"
case mapButtonFollowAndRotateCompass = "ButtonFollowAndRotateCompass"
case mapButtonFollowAndRotateRoute = "ButtonFollowAndRotateRoute"
case mapButtonMapBookmarks = "ButtonMapBookmarks"
case mapPromoDiscoveryButton = "PromoDiscroveryButton"
case mapButtonBookmarksBack = "ButtonBookmarksBack"
@@ -67,10 +68,14 @@ extension MapStyleSheet: IStyleSheet {
return .add { s in
s.mwmImage = "btn_follow"
}
case .mapButtonFollowAndRotate:
case .mapButtonFollowAndRotateCompass:
return .add { s in
s.mwmImage = "btn_follow_and_rotate"
}
case .mapButtonFollowAndRotateRoute:
return .add { s in
s.mwmImage = "btn_follow_route"
}
case .mapButtonMapBookmarks:
return .add { s in
s.mwmImage = "ic_routing_bookmark"

View File

@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_follow_route_dark.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_follow_route_highlighted_dark.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_follow_route_highlighted_light.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "btn_follow_route_light.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -186,7 +186,7 @@ import AVFoundation
return mapAppearance
}
return .auto
return .light
}
set {
UserDefaults.standard.set(newValue.rawValue, forKey: userDefaultsKeyMapAppearance)

View File

@@ -85,27 +85,10 @@ class OpeningHoursViewController: UIViewController {
}
if let checkDate = self.openingHoursCheckDate, self.expanded {
let dateString: String
// Check if the date is strictly "Today" or "Yesterday"
if Calendar.current.isDateInToday(checkDate) || Calendar.current.isDateInYesterday(checkDate) {
// Case 1: Today/Yesterday -> Use "today" / "yesterday"
let df = DateFormatter()
df.dateStyle = .medium
df.timeStyle = .none
df.doesRelativeDateFormatting = true
let rawString = df.string(from: checkDate)
// Lowercase first letter: "Today" -> "today"
dateString = rawString.prefix(1).lowercased() + rawString.dropFirst()
} else {
// Case 2: Older -> Use "2 years ago"
let rdf = RelativeDateTimeFormatter()
rdf.unitsStyle = .spellOut
dateString = rdf.localizedString(for: checkDate, relativeTo: Date())
}
self.checkDateLabel.text = String(format: L("hours_confirmed_time_ago"), dateString)
let checkDateFormatter = RelativeDateTimeFormatter()
checkDateFormatter.unitsStyle = .spellOut
checkDateFormatter.localizedString(for: checkDate, relativeTo: Date.now)
self.checkDateLabel.text = String(format: L("hours_confirmed_time_ago"), checkDateFormatter.localizedString(for: checkDate, relativeTo: Date.now))
NSLayoutConstraint.activate([self.checkDateLabelTopLayoutConstraint])
NSLayoutConstraint.activate([self.checkDateLabelBottomLayoutConstraint])

View File

@@ -458,28 +458,11 @@ class PlacePageInfoViewController: UIViewController {
setupOpenWithAppView()
if let checkDate = placePageInfoData.checkDate {
let dateString: String
// Check if the date is strictly "Today" or "Yesterday"
if Calendar.current.isDateInToday(checkDate) || Calendar.current.isDateInYesterday(checkDate) {
// Case 1: Today/Yesterday -> Use "today" / "yesterday"
let df = DateFormatter()
df.dateStyle = .medium
df.timeStyle = .none
df.doesRelativeDateFormatting = true // Generates "Today"
let rawString = df.string(from: checkDate)
// Lowercase first letter: "Today" -> "today"
dateString = rawString.prefix(1).lowercased() + rawString.dropFirst()
} else {
// Case 2: Older -> Use "2 years ago"
let rdf = RelativeDateTimeFormatter()
rdf.unitsStyle = .spellOut
dateString = rdf.localizedString(for: checkDate, relativeTo: Date())
}
self.checkDateLabel.text = String(format: L("existence_confirmed_time_ago"), dateString)
checkDateLabel.isHidden = false
let checkDateFormatter = RelativeDateTimeFormatter()
checkDateFormatter.unitsStyle = .spellOut
checkDateFormatter.localizedString(for: checkDate, relativeTo: Date.now)
self.checkDateLabel.text = String(format: L("existence_confirmed_time_ago"), checkDateFormatter.localizedString(for: checkDate, relativeTo: Date.now))
checkDateLabel.isHidden = false
NSLayoutConstraint.activate([checkDateLabelLayoutConstraint])
} else {
checkDateLabel.text = String()

View File

@@ -9,6 +9,7 @@
#include "drape/support_manager.hpp"
#include "platform/settings.hpp"
#include "routing/base/followed_polyline.hpp"
#include <unordered_map>
@@ -40,7 +41,7 @@ DrapeEngine::DrapeEngine(Params && params)
using namespace location;
EMyPositionMode mode = PendingPosition;
if (settings::Get(kLocationStateMode, mode) && mode == FollowAndRotate)
if (settings::Get(kLocationStateMode, mode) && mode == FollowAndRotateCompass)
{
// If the screen rect setting in follow and rotate mode is missing or invalid, it could cause
// invalid animations, so the follow and rotate mode should be discarded.
@@ -441,13 +442,12 @@ void DrapeEngine::SetCompassInfo(location::CompassInfo const & info)
MessagePriority::Normal);
}
void DrapeEngine::SetGpsInfo(location::GpsInfo const & info, bool isNavigable, double distToNextTurn, double speedLimit,
void DrapeEngine::SetGpsInfo(location::GpsInfo const & info, df::NavigationContext const & navigationContext,
location::RouteMatchingInfo const & routeInfo)
{
m_threadCommutator->PostMessage(
ThreadsCommutator::RenderThread,
make_unique_dp<GpsInfoMessage>(info, isNavigable, distToNextTurn, speedLimit, routeInfo),
MessagePriority::Normal);
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<GpsInfoMessage>(info, navigationContext, routeInfo),
MessagePriority::Normal);
}
void DrapeEngine::SwitchMyPositionNextMode()
@@ -474,12 +474,13 @@ void DrapeEngine::StopLocationFollow()
MessagePriority::Normal);
}
void DrapeEngine::FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d, bool enableAutoZoom, bool isArrowGlued)
void DrapeEngine::FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d, bool enableAutoZoom, bool isArrowGlued,
bool allowRouteRotation)
{
m_threadCommutator->PostMessage(
ThreadsCommutator::RenderThread,
make_unique_dp<FollowRouteMessage>(preferredZoomLevel, preferredZoomLevel3d, enableAutoZoom, isArrowGlued),
MessagePriority::Normal);
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
make_unique_dp<FollowRouteMessage>(preferredZoomLevel, preferredZoomLevel3d,
enableAutoZoom, isArrowGlued, allowRouteRotation),
MessagePriority::Normal);
}
void DrapeEngine::SetModelViewListener(ModelViewChangedHandler && fn)

View File

@@ -1,5 +1,7 @@
#pragma once
#include "drape_frontend/my_position_controller.hpp"
#include "routing/base/followed_polyline.hpp"
#include "traffic/traffic_info.hpp"
#include "drape_frontend/backend_renderer.hpp"
@@ -154,7 +156,7 @@ public:
void UpdateMapStyle();
void SetCompassInfo(location::CompassInfo const & info);
void SetGpsInfo(location::GpsInfo const & info, bool isNavigable, double distToNextTurn, double speedLimit,
void SetGpsInfo(location::GpsInfo const & info, df::NavigationContext const & navigationContext,
location::RouteMatchingInfo const & routeInfo);
void SwitchMyPositionNextMode();
void LoseLocation();
@@ -171,7 +173,8 @@ public:
dp::DrapeID AddSubroute(SubrouteConstPtr subroute);
void RemoveSubroute(dp::DrapeID subrouteId, bool deactivateFollowing);
void FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d, bool enableAutoZoom, bool isArrowGlued);
void FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d, bool enableAutoZoom, bool isArrowGlued,
bool allowRouteRotation);
void DeactivateRouteFollowing();
void SetSubrouteVisibility(dp::DrapeID subrouteId, bool isVisible);
dp::DrapeID AddRoutePreviewSegment(m2::PointD const & startPt, m2::PointD const & finishPt);

View File

@@ -438,8 +438,8 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
break;
#endif
ref_ptr<GpsInfoMessage> msg = message;
m_myPositionController->OnLocationUpdate(msg->GetInfo(), msg->IsNavigable(), msg->GetDistanceToNextTurn(),
msg->GetSpeedLimit(), m_userEventStream.GetCurrentScreen());
m_myPositionController->OnLocationUpdate(msg->GetInfo(), msg->GetNavigationContext(),
m_userEventStream.GetCurrentScreen());
location::RouteMatchingInfo const & info = msg->GetRouteInfo();
if (info.HasDistanceFromBegin())
@@ -512,7 +512,8 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
if (m_pendingFollowRoute != nullptr)
{
FollowRoute(m_pendingFollowRoute->m_preferredZoomLevel, m_pendingFollowRoute->m_preferredZoomLevelIn3d,
m_pendingFollowRoute->m_enableAutoZoom, m_pendingFollowRoute->m_isArrowGlued);
m_pendingFollowRoute->m_enableAutoZoom, m_pendingFollowRoute->m_isArrowGlued,
m_pendingFollowRoute->m_allowRouteRotation);
m_pendingFollowRoute.reset();
}
break;
@@ -584,13 +585,14 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
// receive FollowRoute message before FlushSubroute message, so we need to postpone its processing.
if (m_routeRenderer->GetSubroutes().empty())
{
m_pendingFollowRoute = std::make_unique<FollowRouteData>(
msg->GetPreferredZoomLevel(), msg->GetPreferredZoomLevelIn3d(), msg->EnableAutoZoom(), msg->IsArrowGlued());
m_pendingFollowRoute =
std::make_unique<FollowRouteData>(msg->GetPreferredZoomLevel(), msg->GetPreferredZoomLevelIn3d(),
msg->EnableAutoZoom(), msg->IsArrowGlued(), msg->AllowRouteRotation());
}
else
{
FollowRoute(msg->GetPreferredZoomLevel(), msg->GetPreferredZoomLevelIn3d(), msg->EnableAutoZoom(),
msg->IsArrowGlued());
msg->IsArrowGlued(), msg->AllowRouteRotation());
}
break;
}
@@ -1057,10 +1059,11 @@ void FrontendRenderer::UpdateContextDependentResources()
}
void FrontendRenderer::FollowRoute(int preferredZoomLevel, int preferredZoomLevelIn3d, bool enableAutoZoom,
bool isArrowGlued)
bool isArrowGlued, bool allowRouteRotation)
{
m_myPositionController->ActivateRouting(
!m_enablePerspectiveInNavigation ? preferredZoomLevel : preferredZoomLevelIn3d, enableAutoZoom, isArrowGlued);
!m_enablePerspectiveInNavigation ? preferredZoomLevel : preferredZoomLevelIn3d, enableAutoZoom, isArrowGlued,
allowRouteRotation);
if (m_enablePerspectiveInNavigation)
AddUserEvent(make_unique_dp<SetAutoPerspectiveEvent>(true /* isAutoPerspective */));

View File

@@ -261,7 +261,8 @@ private:
using TRenderGroupRemovePredicate = std::function<bool(drape_ptr<RenderGroup> const &)>;
void RemoveRenderGroupsLater(TRenderGroupRemovePredicate const & predicate);
void FollowRoute(int preferredZoomLevel, int preferredZoomLevelIn3d, bool enableAutoZoom, bool isArrowGlued);
void FollowRoute(int preferredZoomLevel, int preferredZoomLevelIn3d, bool enableAutoZoom, bool isArrowGlued,
bool allowRouteRotation);
bool CheckRouteRecaching(ref_ptr<BaseSubrouteData> subrouteData);
@@ -372,17 +373,20 @@ private:
struct FollowRouteData
{
FollowRouteData(int preferredZoomLevel, int preferredZoomLevelIn3d, bool enableAutoZoom, bool isArrowGlued)
FollowRouteData(int preferredZoomLevel, int preferredZoomLevelIn3d, bool enableAutoZoom, bool isArrowGlued,
bool allowRouteRotation)
: m_preferredZoomLevel(preferredZoomLevel)
, m_preferredZoomLevelIn3d(preferredZoomLevelIn3d)
, m_enableAutoZoom(enableAutoZoom)
, m_isArrowGlued(isArrowGlued)
, m_allowRouteRotation(allowRouteRotation)
{}
int m_preferredZoomLevel;
int m_preferredZoomLevelIn3d;
bool m_enableAutoZoom;
bool m_isArrowGlued;
bool m_allowRouteRotation;
};
std::unique_ptr<FollowRouteData> m_pendingFollowRoute;

View File

@@ -10,6 +10,7 @@
#include "drape_frontend/gui/skin.hpp"
#include "drape_frontend/message.hpp"
#include "drape_frontend/my_position.hpp"
#include "drape_frontend/my_position_controller.hpp"
#include "drape_frontend/overlay_batcher.hpp"
#include "drape_frontend/postprocess_renderer.hpp"
#include "drape_frontend/render_node.hpp"
@@ -29,6 +30,7 @@
#include "geometry/rect2d.hpp"
#include "geometry/triangle2d.hpp"
#include "routing/base/followed_polyline.hpp"
#include <condition_variable>
#include <functional>
@@ -475,28 +477,22 @@ private:
class GpsInfoMessage : public Message
{
public:
GpsInfoMessage(location::GpsInfo const & info, bool isNavigable, double distToNextTurn, double speedLimit,
GpsInfoMessage(location::GpsInfo const & info, df::NavigationContext const & navigationContext,
location::RouteMatchingInfo const & routeInfo)
: m_info(info)
, m_isNavigable(isNavigable)
, m_distToNextTurn(distToNextTurn)
, m_speedLimit(speedLimit)
, m_navigationContext(navigationContext)
, m_routeInfo(routeInfo)
{}
Type GetType() const override { return Type::GpsInfo; }
location::GpsInfo const & GetInfo() const { return m_info; }
bool IsNavigable() const { return m_isNavigable; }
double const & GetSpeedLimit() const { return m_speedLimit; }
double const & GetDistanceToNextTurn() const { return m_distToNextTurn; }
df::NavigationContext const & GetNavigationContext() const { return m_navigationContext; }
location::RouteMatchingInfo const & GetRouteInfo() const { return m_routeInfo; }
private:
location::GpsInfo const m_info;
bool const m_isNavigable;
double const m_distToNextTurn;
double const m_speedLimit;
df::NavigationContext const m_navigationContext;
location::RouteMatchingInfo const m_routeInfo;
};
@@ -740,11 +736,13 @@ public:
class FollowRouteMessage : public Message
{
public:
FollowRouteMessage(int preferredZoomLevel, int preferredZoomLevelIn3d, bool enableAutoZoom, bool isArrowGlued)
FollowRouteMessage(int preferredZoomLevel, int preferredZoomLevelIn3d, bool enableAutoZoom, bool isArrowGlued,
bool allowRouteRotation)
: m_preferredZoomLevel(preferredZoomLevel)
, m_preferredZoomLevelIn3d(preferredZoomLevelIn3d)
, m_enableAutoZoom(enableAutoZoom)
, m_isArrowGlued(isArrowGlued)
, m_allowRouteRotation(allowRouteRotation)
{}
Type GetType() const override { return Type::FollowRoute; }
@@ -753,12 +751,14 @@ public:
int GetPreferredZoomLevelIn3d() const { return m_preferredZoomLevelIn3d; }
bool EnableAutoZoom() const { return m_enableAutoZoom; }
bool IsArrowGlued() const { return m_isArrowGlued; }
bool AllowRouteRotation() const { return m_allowRouteRotation; }
private:
int const m_preferredZoomLevel;
int const m_preferredZoomLevelIn3d;
bool const m_enableAutoZoom;
bool const m_isArrowGlued;
bool const m_allowRouteRotation;
};
class SwitchMapStyleMessage : public BaseBlockingMessage

View File

@@ -9,9 +9,11 @@
#include "geometry/mercator.hpp"
#include "platform/location.hpp"
#include "platform/measurement_utils.hpp"
#include "base/math.hpp"
#include "routing/base/followed_polyline.hpp"
#include <algorithm>
#include <array>
@@ -31,6 +33,9 @@ double constexpr kMaxTimeInBackgroundSec = 60.0 * 60 * 30; // 30 hours before s
double constexpr kMaxNotFollowRoutingTimeSec = 20.0;
double constexpr kMaxUpdateLocationInvervalSec = 30.0;
double constexpr kMaxBlockAutoZoomTimeSec = 10.0;
double constexpr kDefaultSpeedLimitKmpH = 50.0;
double constexpr kLookaheadTimeSpeedRatio = 0.3;
double constexpr kMaxLookaheadTimeSec = 25.0;
int constexpr kZoomThreshold = 10;
int constexpr kMaxScaleZoomLevel = 16;
@@ -66,7 +71,6 @@ double CalculateZoomByMaxSpeed(double speedMpS, bool isPerspectiveAllowed)
std::array<TSpeedScale, 2> const & scales = isPerspectiveAllowed ? scales3d : scales2d;
double constexpr kDefaultSpeedLimitKmpH = 50.0;
double const speedKmpH = speedMpS > 0 ? measurement_utils::MpsToKmph(speedMpS) : kDefaultSpeedLimitKmpH;
size_t i = 0;
@@ -143,7 +147,7 @@ void ResetNotification(uint64_t & notifyId)
bool IsModeChangeViewport(location::EMyPositionMode mode)
{
return mode == location::Follow || mode == location::FollowAndRotate;
return mode == location::Follow || mode == location::FollowAndRotateCompass || mode == location::FollowAndRotateRoute;
}
} // namespace
@@ -157,9 +161,11 @@ MyPositionController::MyPositionController(Params && params, ref_ptr<DrapeNotifi
, m_errorRadius(0.0)
, m_horizontalAccuracy(0.0)
, m_position(m2::PointD::Zero())
, m_drawDirection(0.0)
, m_direction(0.0)
, m_routeDirection(0.0)
, m_arrowDirection(0.0)
, m_oldPosition(m2::PointD::Zero())
, m_oldDrawDirection(0.0)
, m_oldArrowDirection(0.0)
, m_enablePerspectiveInRouting(false)
, m_enableAutoZoomInRouting(params.m_isAutozoomEnabled)
, m_autoScale2d(GetScreenScale(kDefaultAutoZoom))
@@ -171,7 +177,8 @@ MyPositionController::MyPositionController(Params && params, ref_ptr<DrapeNotifi
, m_isDirtyAutoZoom(false)
, m_isPendingAnimation(false)
, m_isPositionAssigned(false)
, m_isDirectionAssigned(false)
, m_isArrowDirectionAssigned(false)
, m_isRouteDirectionAssigned(false)
, m_isCompassAvailable(false)
, m_positionIsObsolete(false)
, m_needBlockAutoZoom(false)
@@ -290,7 +297,7 @@ void MyPositionController::ScaleEnded()
void MyPositionController::Rotated()
{
if (m_mode == location::FollowAndRotate)
if (m_mode == location::FollowAndRotateCompass)
m_wasRotationInScaling = true;
}
@@ -398,25 +405,32 @@ void MyPositionController::NextMode(ScreenBase const & screen)
// In routing not-follow -> follow-and-rotate, otherwise not-follow -> follow.
if (m_mode == location::NotFollow)
{
ChangeMode(m_isInRouting ? location::FollowAndRotate : location::Follow);
ChangeMode(m_isInRouting ? location::FollowAndRotateCompass : location::Follow);
UpdateViewport(preferredZoomLevel);
return;
}
// From follow mode we transit to follow-and-rotate if compass is available or
// routing is enabled.
// From follow mode we transit to follow-and-rotate-compass, if in routing
if (m_mode == location::Follow)
{
if (IsRotationAvailable() || m_isInRouting)
if (IsArrowRotationAvailable() || m_isInRouting)
{
ChangeMode(location::FollowAndRotate);
ChangeMode(location::FollowAndRotateCompass);
UpdateViewport(preferredZoomLevel);
}
return;
}
// From follow-and-rotate mode we can transit to follow mode.
if (m_mode == location::FollowAndRotate)
// From -rotate-compass mode we transit to -rotate-route mode, if allowed
if (m_mode == location::FollowAndRotateCompass && IsRouteRotationAvailable() && m_allowRouteRotationInRouting)
{
ChangeMode(location::FollowAndRotateRoute);
UpdateViewport(preferredZoomLevel);
return;
}
// From -rotate-route mode, or from -rotate-compass if -rotate-route is not allowed, we return to follow mode
if (m_mode == location::FollowAndRotateRoute || m_mode == location::FollowAndRotateCompass)
{
if (m_isInRouting && screen.isPerspective())
preferredZoomLevel = static_cast<int>(GetZoomLevel(ScreenBase::GetStartPerspectiveScale() * 1.1));
@@ -425,8 +439,8 @@ void MyPositionController::NextMode(ScreenBase const & screen)
}
}
void MyPositionController::OnLocationUpdate(location::GpsInfo const & info, bool isNavigable, double distanceToNextTurn,
double speedLimit, ScreenBase const & screen)
void MyPositionController::OnLocationUpdate(location::GpsInfo const & info,
df::NavigationContext const & navigationContext, ScreenBase const & screen)
{
m2::PointD const oldPos = GetDrawablePosition();
double const oldAzimut = GetDrawableAzimut();
@@ -438,33 +452,62 @@ void MyPositionController::OnLocationUpdate(location::GpsInfo const & info, bool
m_errorRadius = rect.SizeX() * 0.5;
m_horizontalAccuracy = info.m_horizontalAccuracy;
if (distanceToNextTurn >= 0.0 || speedLimit >= 0.0)
if (navigationContext.m_distanceToNextTurn >= 0.0 || navigationContext.m_speedLimit >= 0.0)
{
double const mercatorPerMeter = m_errorRadius / info.m_horizontalAccuracy;
m_autoScale2d =
mercatorPerMeter * CalculateAutoZoom(speedLimit, distanceToNextTurn, false /* isPerspectiveAllowed */);
mercatorPerMeter * CalculateAutoZoom(navigationContext.m_speedLimit, navigationContext.m_distanceToNextTurn,
false /* isPerspectiveAllowed */);
m_autoScale3d =
mercatorPerMeter * CalculateAutoZoom(speedLimit, distanceToNextTurn, true /* isPerspectiveAllowed */);
mercatorPerMeter * CalculateAutoZoom(navigationContext.m_speedLimit, navigationContext.m_distanceToNextTurn,
true /* isPerspectiveAllowed */);
}
else
{
m_autoScale2d = m_autoScale3d = kUnknownAutoZoom;
}
// Sets direction based on GPS if:
// Sets arrow direction based on GPS if:
// 1. Compass is not available.
// 2. Direction must be glued to the route during routing (route-corrected angle is set only in
// OnLocationUpdate(): in OnCompassUpdate() the angle always has the original value.
// 3. Device is moving faster then pedestrian.
bool const isMovingFast = info.HasSpeed() && info.m_speed > kMinSpeedThresholdMps;
bool const glueArrowInRouting = isNavigable && m_isArrowGluedInRouting;
bool const glueArrowInRouting = navigationContext.m_isNavigable && m_isArrowGluedInRouting;
// Calculate the route direction by looking ahead a distance in the route
// depending on the current speed
if (glueArrowInRouting && navigationContext.m_followedPolyline != nullptr)
{
double const speed =
(navigationContext.m_speedLimit > 0 ? measurement_utils::MpsToKmph(navigationContext.m_speedLimit)
: kDefaultSpeedLimitKmpH);
double const lookaheadTimeSec = std::min(speed * kLookaheadTimeSpeedRatio, kMaxLookaheadTimeSec);
double const lookaheadDistance = std::min(speed * lookaheadTimeSec, navigationContext.m_distanceToNextTurn);
auto const & iter = navigationContext.m_followedPolyline->GetCurrentIter();
m2::PointD const point = navigationContext.m_followedPolyline->GetLookaheadPoint(lookaheadDistance);
auto angle = math::RadToDeg(ang::AngleTo(iter.m_pt, point));
if (std::isnan(angle) || std::isinf(angle))
{
// fallback in case the current route becomes invalid for any reason
SetRouteDirection(info.m_bearing);
}
else
{
SetRouteDirection(math::DegToRad(location::AngleToBearing(angle)));
}
}
if ((!m_isCompassAvailable || glueArrowInRouting || isMovingFast) && info.HasBearing())
{
SetDirection(math::DegToRad(info.m_bearing));
SetArrowDirection(math::DegToRad(info.m_bearing));
m_lastGPSBearingTimer.Reset();
}
m_direction = m_mode == location::FollowAndRotateRoute ? m_routeDirection : m_arrowDirection;
if (m_isPositionAssigned && (!AlmostCurrentPosition(oldPos) || !AlmostCurrentAzimut(oldAzimut)))
{
CreateAnim(oldPos, oldAzimut, screen);
@@ -487,9 +530,9 @@ void MyPositionController::OnLocationUpdate(location::GpsInfo const & info, bool
{
ChangeModelView(m_position, kDoNotChangeZoom);
}
else if (m_mode == location::FollowAndRotate)
else if (m_mode == location::FollowAndRotateCompass || m_mode == location::FollowAndRotateRoute)
{
ChangeModelView(m_position, m_drawDirection,
ChangeModelView(m_position, m_direction,
m_isInRouting ? GetRoutingRotationPixelCenter() : m_visiblePixelRect.Center(),
kDoNotChangeZoom);
}
@@ -499,7 +542,7 @@ void MyPositionController::OnLocationUpdate(location::GpsInfo const & info, bool
{
if (m_isInRouting)
{
ChangeMode(location::FollowAndRotate);
ChangeMode(location::FollowAndRotateCompass);
UpdateViewport(kMaxScaleZoomLevel);
}
else
@@ -525,7 +568,7 @@ void MyPositionController::OnLocationUpdate(location::GpsInfo const & info, bool
{
if (m_isInRouting)
{
ChangeMode(location::FollowAndRotate);
ChangeMode(location::FollowAndRotateCompass);
UpdateViewport(kMaxScaleZoomLevel);
}
else
@@ -552,7 +595,8 @@ void MyPositionController::LoseLocation()
{
if (m_mode == location::NotFollowNoPosition)
return;
else if (m_mode == location::Follow || m_mode == location::FollowAndRotate)
else if (m_mode == location::Follow || m_mode == location::FollowAndRotateCompass ||
m_mode == location::FollowAndRotateRoute)
ChangeMode(location::PendingPosition);
else
ChangeMode(location::NotFollowNoPosition);
@@ -570,10 +614,11 @@ void MyPositionController::OnCompassUpdate(location::CompassInfo const & info, S
if ((IsInRouting() && m_isArrowGluedInRouting) || existsFreshGpsBearing)
return;
SetDirection(info.m_bearing);
SetArrowDirection(info.m_bearing);
if (m_isPositionAssigned && !AlmostCurrentAzimut(oldAzimut) && m_mode == location::FollowAndRotate)
if (m_isPositionAssigned && !AlmostCurrentAzimut(oldAzimut) && m_mode == location::FollowAndRotateCompass)
{
m_direction = info.m_bearing;
CreateAnim(GetDrawablePosition(), oldAzimut, screen);
m_isDirtyViewport = true;
}
@@ -582,10 +627,10 @@ void MyPositionController::OnCompassUpdate(location::CompassInfo const & info, S
bool MyPositionController::UpdateViewportWithAutoZoom()
{
double const autoScale = m_enablePerspectiveInRouting ? m_autoScale3d : m_autoScale2d;
if (autoScale > 0.0 && m_mode == location::FollowAndRotate && m_isInRouting && m_enableAutoZoomInRouting &&
!m_needBlockAutoZoom)
if (autoScale > 0.0 && (m_mode == location::FollowAndRotateCompass || m_mode == location::FollowAndRotateRoute) &&
m_isInRouting && m_enableAutoZoomInRouting && !m_needBlockAutoZoom)
{
ChangeModelView(autoScale, m_position, m_drawDirection, GetRoutingRotationPixelCenter());
ChangeModelView(autoScale, m_position, m_direction, GetRoutingRotationPixelCenter());
return true;
}
return false;
@@ -617,7 +662,7 @@ void MyPositionController::Render(ref_ptr<dp::GraphicsContext> context, ref_ptr<
m_shape->SetPositionObsolete(m_positionIsObsolete);
m_shape->SetPosition(m2::PointF(GetDrawablePosition()));
m_shape->SetAzimuth(static_cast<float>(GetDrawableAzimut()));
m_shape->SetIsValidAzimuth(IsRotationAvailable());
m_shape->SetIsValidAzimuth(IsArrowRotationAvailable());
m_shape->SetAccuracy(static_cast<float>(m_errorRadius));
m_shape->SetRoutingMode(IsInRouting());
@@ -631,7 +676,7 @@ void MyPositionController::Render(ref_ptr<dp::GraphicsContext> context, ref_ptr<
bool MyPositionController::IsRouteFollowingActive() const
{
return IsInRouting() && m_mode == location::FollowAndRotate;
return IsInRouting() && m_mode == location::FollowAndRotateCompass;
}
bool MyPositionController::AlmostCurrentPosition(m2::PointD const & pos) const
@@ -643,18 +688,25 @@ bool MyPositionController::AlmostCurrentPosition(m2::PointD const & pos) const
bool MyPositionController::AlmostCurrentAzimut(double azimut) const
{
double constexpr kDirectionEqualityDelta = 1e-3;
return AlmostEqualAbs(azimut, m_drawDirection, kDirectionEqualityDelta);
return AlmostEqualAbs(azimut, m_direction, kDirectionEqualityDelta);
}
void MyPositionController::SetDirection(double bearing)
void MyPositionController::SetRouteDirection(double bearing)
{
m_drawDirection = bearing;
m_isDirectionAssigned = true;
m_routeDirection = bearing;
m_isRouteDirectionAssigned = true;
}
void MyPositionController::SetArrowDirection(double bearing)
{
m_arrowDirection = bearing;
m_isArrowDirectionAssigned = true;
}
void MyPositionController::ChangeMode(location::EMyPositionMode newMode)
{
if (m_isInRouting && (m_mode != newMode) && (newMode == location::FollowAndRotate))
if (m_isInRouting && (m_mode != newMode) &&
(newMode == location::FollowAndRotateCompass || newMode == location::FollowAndRotateRoute))
ResetBlockAutoZoomTimer();
m_mode = newMode;
@@ -675,7 +727,8 @@ bool MyPositionController::IsWaitingForLocation() const
void MyPositionController::StopLocationFollow()
{
if (m_mode == location::Follow || m_mode == location::FollowAndRotate)
if (m_mode == location::Follow || m_mode == location::FollowAndRotateCompass ||
m_mode == location::FollowAndRotateRoute)
ChangeMode(location::NotFollow);
m_desiredInitMode = location::NotFollow;
@@ -690,7 +743,7 @@ void MyPositionController::OnEnterForeground(double backgroundTime)
// When location was active during previous session the app will try to follow the user.
if (m_mode == location::NotFollow)
{
ChangeMode(m_isInRouting ? location::FollowAndRotate : location::Follow);
ChangeMode(m_isInRouting ? location::FollowAndRotateCompass : location::Follow);
UpdateViewport(kDoNotChangeZoom);
}
@@ -706,7 +759,7 @@ void MyPositionController::OnEnterBackground() {}
void MyPositionController::OnCompassTapped()
{
if (m_mode == location::FollowAndRotate)
if (m_mode == location::FollowAndRotateCompass)
{
ChangeMode(location::Follow);
ChangeModelView(m_position, 0.0, m_visiblePixelRect.Center(), kDoNotChangeZoom);
@@ -763,9 +816,9 @@ void MyPositionController::UpdateViewport(int zoomLevel)
{
ChangeModelView(m_position, zoomLevel);
}
else if (m_mode == location::FollowAndRotate)
else if (m_mode == location::FollowAndRotateCompass || m_mode == location::FollowAndRotateRoute)
{
ChangeModelView(m_position, m_drawDirection,
ChangeModelView(m_position, m_direction,
m_isInRouting ? GetRoutingRotationPixelCenter() : m_visiblePixelRect.Center(), zoomLevel);
}
}
@@ -775,7 +828,7 @@ m2::PointD MyPositionController::GetRotationPixelCenter() const
if (m_mode == location::Follow)
return m_visiblePixelRect.Center();
if (m_mode == location::FollowAndRotate)
if (m_mode == location::FollowAndRotateCompass || m_mode == location::FollowAndRotateRoute)
return m_isInRouting ? GetRoutingRotationPixelCenter() : m_visiblePixelRect.Center();
return m2::PointD::Zero();
@@ -817,15 +870,15 @@ double MyPositionController::GetDrawableAzimut()
}
if (m_isPendingAnimation)
return m_oldDrawDirection;
return m_oldArrowDirection;
return m_drawDirection;
return m_arrowDirection;
}
void MyPositionController::CreateAnim(m2::PointD const & oldPos, double oldAzimut, ScreenBase const & screen)
{
double const moveDuration = PositionInterpolator::GetMoveDuration(oldPos, m_position, screen);
double const rotateDuration = AngleInterpolator::GetRotateDuration(oldAzimut, m_drawDirection);
double const rotateDuration = AngleInterpolator::GetRotateDuration(oldAzimut, m_arrowDirection);
if (df::IsAnimationAllowed(std::max(moveDuration, rotateDuration), screen))
{
if (IsModeChangeViewport())
@@ -834,7 +887,7 @@ void MyPositionController::CreateAnim(m2::PointD const & oldPos, double oldAzimu
{
drape_ptr<Animation> anim = make_unique_dp<ArrowAnimation>(
GetDrawablePosition(), m_position, syncAnim == nullptr ? moveDuration : syncAnim->GetDuration(),
GetDrawableAzimut(), m_drawDirection);
GetDrawableAzimut(), m_arrowDirection);
if (syncAnim != nullptr)
{
anim->SetMaxDuration(syncAnim->GetMaxDuration());
@@ -843,13 +896,13 @@ void MyPositionController::CreateAnim(m2::PointD const & oldPos, double oldAzimu
return anim;
};
m_oldPosition = oldPos;
m_oldDrawDirection = oldAzimut;
m_oldArrowDirection = oldAzimut;
m_isPendingAnimation = true;
}
else
{
AnimationSystem::Instance().CombineAnimation(
make_unique_dp<ArrowAnimation>(oldPos, m_position, moveDuration, oldAzimut, m_drawDirection));
make_unique_dp<ArrowAnimation>(oldPos, m_position, moveDuration, oldAzimut, m_arrowDirection));
}
}
}
@@ -868,16 +921,18 @@ void MyPositionController::EnableAutoZoomInRouting(bool enableAutoZoom)
}
}
void MyPositionController::ActivateRouting(int zoomLevel, bool enableAutoZoom, bool isArrowGlued)
void MyPositionController::ActivateRouting(int zoomLevel, bool enableAutoZoom, bool isArrowGlued,
bool allowRouteRotation)
{
if (!m_isInRouting)
{
m_isInRouting = true;
m_isArrowGluedInRouting = isArrowGlued;
m_enableAutoZoomInRouting = enableAutoZoom;
m_allowRouteRotationInRouting = allowRouteRotation;
ChangeMode(location::FollowAndRotate);
ChangeModelView(m_position, m_isDirectionAssigned ? m_drawDirection : 0.0, GetRoutingRotationPixelCenter(),
ChangeMode(location::FollowAndRotateCompass);
ChangeModelView(m_position, m_isRouteDirectionAssigned ? m_routeDirection : 0.0, GetRoutingRotationPixelCenter(),
zoomLevel, [this](ref_ptr<Animation> anim) { UpdateViewport(kDoNotChangeZoom); });
ResetRoutingNotFollowTimer();
}
@@ -889,8 +944,10 @@ void MyPositionController::DeactivateRouting()
{
m_isInRouting = false;
m_isArrowGluedInRouting = false;
m_allowRouteRotationInRouting = false;
m_isDirectionAssigned = m_isCompassAvailable && m_isDirectionAssigned;
m_isArrowDirectionAssigned = m_isCompassAvailable && m_isArrowDirectionAssigned;
m_isRouteDirectionAssigned = false;
ChangeMode(location::Follow);
ChangeModelView(m_position, 0.0, m_visiblePixelRect.Center(), kDoNotChangeZoom);
@@ -919,7 +976,7 @@ void MyPositionController::CheckNotFollowRouting()
CHECK_ON_TIMEOUT(m_routingNotFollowNotifyId, kMaxNotFollowRoutingTimeSec, CheckNotFollowRouting);
if (m_routingNotFollowTimer.ElapsedSeconds() >= kMaxNotFollowRoutingTimeSec)
{
ChangeMode(location::FollowAndRotate);
ChangeMode(location::FollowAndRotateCompass);
UpdateViewport(kDoNotChangeZoom);
}
}

View File

@@ -7,6 +7,7 @@
#include "drape/pointers.hpp"
#include "routing/base/followed_polyline.hpp"
#include "shaders/program_manager.hpp"
#include "platform/location.hpp"
@@ -24,6 +25,24 @@ using TAnimationCreator = std::function<drape_ptr<Animation>(ref_ptr<Animation>)
class DrapeNotifier;
struct NavigationContext
{
bool m_isNavigable = false;
double m_distanceToNextTurn = 0.0;
double m_speedLimit = 0.0;
routing::FollowedPolyline const * m_followedPolyline = nullptr;
NavigationContext() = default;
NavigationContext(bool navigable, double distanceToTurn, double speedLimit,
routing::FollowedPolyline const & followedPolyline)
: m_isNavigable(navigable)
, m_distanceToNextTurn(distanceToTurn)
, m_speedLimit(speedLimit)
, m_followedPolyline(&followedPolyline)
{}
};
class MyPositionController
{
public:
@@ -102,7 +121,7 @@ public:
drape_ptr<MyPosition> && shape, Arrow3d::PreloadedData && preloadedData);
void ResetRenderShape();
void ActivateRouting(int zoomLevel, bool enableAutoZoom, bool isArrowGlued);
void ActivateRouting(int zoomLevel, bool enableAutoZoom, bool isArrowGlued, bool allowRouteRotation);
void DeactivateRouting();
void EnablePerspectiveInRouting(bool enablePerspective);
@@ -117,14 +136,15 @@ public:
void OnEnterBackground();
void OnCompassTapped();
void OnLocationUpdate(location::GpsInfo const & info, bool isNavigable, double distanceToNextTurn, double speedLimit,
void OnLocationUpdate(location::GpsInfo const & info, df::NavigationContext const & navigationContext,
ScreenBase const & screen);
void OnCompassUpdate(location::CompassInfo const & info, ScreenBase const & screen);
void Render(ref_ptr<dp::GraphicsContext> context, ref_ptr<gpu::ProgramManager> mng, ScreenBase const & screen,
int zoomLevel, FrameValues const & frameValues);
bool IsRotationAvailable() const { return m_isDirectionAssigned; }
bool IsArrowRotationAvailable() const { return m_isArrowDirectionAssigned; }
bool IsRouteRotationAvailable() const { return m_isRouteDirectionAssigned; }
bool IsInRouting() const { return m_isInRouting; }
bool IsRouteFollowingActive() const;
bool IsModeChangeViewport() const;
@@ -135,7 +155,8 @@ public:
private:
void ChangeMode(location::EMyPositionMode newMode);
void SetDirection(double bearing);
void SetRouteDirection(double bearing);
void SetArrowDirection(double bearing);
void ChangeModelView(m2::PointD const & center, int zoomLevel);
void ChangeModelView(double azimuth);
@@ -178,12 +199,15 @@ private:
double m_errorRadius; // error radius in mercator.
double m_horizontalAccuracy;
m2::PointD m_position; // position in mercator.
double m_drawDirection;
double m_direction;
double m_routeDirection;
double m_arrowDirection;
m2::PointD m_oldPosition; // position in mercator.
double m_oldDrawDirection;
double m_oldArrowDirection;
bool m_enablePerspectiveInRouting;
bool m_enableAutoZoomInRouting;
bool m_allowRouteRotationInRouting;
double m_autoScale2d;
double m_autoScale3d;
@@ -205,7 +229,8 @@ private:
TAnimationCreator m_animCreator;
bool m_isPositionAssigned;
bool m_isDirectionAssigned;
bool m_isArrowDirectionAssigned;
bool m_isRouteDirectionAssigned;
bool m_isCompassAvailable;
bool m_positionIsObsolete;

Some files were not shown because too many files have changed in this diff Show More