mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-05 20:23:48 +00:00
[android] Handle distinct FollowAndRotateRoute and FollowAndRotateCompass modes
Signed-off-by: Leonardo Bishop <me@leonardobishop.net>
This commit is contained in:
committed by
Konstantin Pastbin
parent
515cf98cef
commit
ee4675b388
@@ -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;
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
30
android/app/src/main/res/drawable/ic_follow_route.xml
Normal file
30
android/app/src/main/res/drawable/ic_follow_route.xml
Normal 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>
|
||||
Reference in New Issue
Block a user