Compare commits

..

4 Commits

Author SHA1 Message Date
matheusgomesms
505a5c20de Update core to better remove 3D buildings only in navigation
Signed-off-by: matheusgomesms <matheusgomesms@noreply.codeberg.org>
2026-01-03 18:55:16 +01:00
matheusgomesms
f5af8c8cd5 Disable 3D buildings for Android Auto
Signed-off-by: matheusgomesms <matheusgomesms@noreply.codeberg.org>
2026-01-03 18:55:16 +01:00
matheusgomesms
10398acedb Disable 3D setting for CarPlay mode (iOS)
Signed-off-by: matheusgomesms <matheusgomesms@noreply.codeberg.org>
2026-01-03 18:55:16 +01:00
matheusgomesms
38fc18b6e6 Disable 3D settings in the core for CarScreen mode
Signed-off-by: matheusgomesms <matheusgomesms@noreply.codeberg.org>
2026-01-03 18:55:16 +01:00
9 changed files with 71 additions and 7 deletions

View File

@@ -114,6 +114,7 @@ public final class CarAppSession extends Session implements DefaultLifecycleObse
public void onCreate(@NonNull LifecycleOwner owner)
{
Logger.d(TAG);
Framework.nativeSetCarScreenMode(true);
mSensorsManager = new CarSensorsManager(getCarContext());
mDisplayManager = MwmApplication.from(getCarContext()).getDisplayManager();
mDisplayManager.addListener(DisplayType.Car, this);
@@ -159,6 +160,7 @@ public final class CarAppSession extends Session implements DefaultLifecycleObse
public void onDestroy(@NonNull LifecycleOwner owner)
{
mDisplayManager.removeListener(DisplayType.Car);
Framework.nativeSetCarScreenMode(false);
}
private void init()

View File

@@ -1490,6 +1490,12 @@ JNIEXPORT void JNICALL Java_app_organicmaps_sdk_Framework_nativeSet3dMode(JNIEnv
g_framework->Set3dMode(allow3d, allow3dBuildings);
}
JNIEXPORT void JNICALL Java_app_organicmaps_sdk_Framework_nativeSetCarScreenMode(JNIEnv * env, jclass, jboolean enabled)
{
if (g_framework)
frm()->SetCarScreenMode(static_cast<bool>(enabled));
}
JNIEXPORT void JNICALL Java_app_organicmaps_sdk_Framework_nativeGet3dMode(JNIEnv * env, jclass, jobject result)
{
bool enabled;

View File

@@ -280,6 +280,8 @@ public class Framework
public static native void nativeSet3dMode(boolean allow3d, boolean allow3dBuildings);
public static native void nativeSetCarScreenMode(boolean enabled);
public static native boolean nativeGetAutoZoomEnabled();
public static native void nativeSetAutoZoomEnabled(boolean enabled);

View File

@@ -59,6 +59,7 @@ NS_SWIFT_NAME(FrameworkHelper)
+ (void)updatePlacePageData;
+ (void)updateAfterDeleteBookmark;
+ (int)currentZoomLevel;
+ (void)setCarScreenMode:(BOOL)enabled;
@end

View File

@@ -241,4 +241,8 @@
return [[ElevationProfileData alloc] initWithElevationInfo:GetFramework().GetTrackRecordingElevationInfo()];
}
+ (void)setCarScreenMode:(BOOL)enabled {
GetFramework().SetCarScreenMode(enabled);
}
@end

View File

@@ -62,6 +62,8 @@ final class CarPlayService: NSObject {
toWindow: window,
isCarplayActivated: true
)
FrameworkHelper.setCarScreenMode(true)
}
private var savedInterfaceController: CPInterfaceController?
@@ -126,6 +128,7 @@ final class CarPlayService: NSObject {
isCarplayActivated: false
)
}
FrameworkHelper.setCarScreenMode(false)
}
@objc func destroy() {

View File

@@ -43,8 +43,8 @@ final class InfoItemView: UIView {
addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(onInfoLabelTap)))
addGestureRecognizer(UILongPressGestureRecognizer(target: self, action: #selector(onInfoLabelLongPress(_:))))
infoLabel.lineBreakMode = .byWordWrapping
infoLabel.numberOfLines = 0
infoLabel.lineBreakMode = .byTruncatingTail
infoLabel.numberOfLines = 1
infoLabel.allowsDefaultTighteningForTruncation = true
infoLabel.isUserInteractionEnabled = false
@@ -66,17 +66,17 @@ final class InfoItemView: UIView {
accessoryButton.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
heightAnchor.constraint(greaterThanOrEqualToConstant: Constants.viewHeight),
heightAnchor.constraint(equalToConstant: Constants.viewHeight),
iconButton.leadingAnchor.constraint(equalTo: leadingAnchor),
iconButton.centerYAnchor.constraint(equalTo: centerYAnchor),
iconButton.widthAnchor.constraint(equalToConstant: Constants.iconButtonSize),
iconButton.topAnchor.constraint(greaterThanOrEqualTo: topAnchor),
iconButton.bottomAnchor.constraint(lessThanOrEqualTo: bottomAnchor),
iconButton.topAnchor.constraint(equalTo: topAnchor),
iconButton.bottomAnchor.constraint(equalTo: bottomAnchor),
infoLabel.leadingAnchor.constraint(equalTo: iconButton.trailingAnchor),
infoLabel.topAnchor.constraint(equalTo: topAnchor, constant: Constants.infoLabelTopBottomSpacing),
infoLabel.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -Constants.infoLabelTopBottomSpacing),
infoLabel.topAnchor.constraint(equalTo: topAnchor),
infoLabel.bottomAnchor.constraint(equalTo: bottomAnchor),
infoLabel.trailingAnchor.constraint(equalTo: accessoryButton.leadingAnchor),
accessoryButton.trailingAnchor.constraint(equalTo: trailingAnchor),

View File

@@ -175,6 +175,16 @@ void Framework::OnLocationUpdate(GpsInfo const & info)
#endif
m_routingManager.OnLocationUpdate(rInfo);
bool const isRoutingActive = m_routingManager.IsRoutingActive();
if (m_wasRoutingActive != isRoutingActive)
{
m_wasRoutingActive = isRoutingActive;
/// State changed (Started OR Stopped) -> Refresh 3D Buildings
Refresh3dMode();
}
}
void Framework::OnCompassUpdate(CompassInfo const & info)
@@ -2424,6 +2434,10 @@ void Framework::Allow3dMode(bool allow3d, bool allow3dBuildings)
if (!m_powerManager.IsFacilityEnabled(power_management::Facility::Buildings3d))
allow3dBuildings = false;
/// If we are in CarPlay/AA mode and Navigation is active, force 3D buildings off.
if (m_isCarScreenMode && m_routingManager.IsRoutingActive())
allow3dBuildings = false;
m_drapeEngine->Allow3dMode(allow3d, allow3dBuildings);
}
@@ -3224,6 +3238,7 @@ void Framework::OnRouteFollow(routing::RouterType type)
// GetRoutingSettings(type).m_matchRoute to the FollowRoute() instead of |isPedestrianRoute|.
// |isArrowGlued| parameter fully corresponds to |m_matchRoute| in RoutingSettings.
m_drapeEngine->FollowRoute(scale, scale3d, enableAutoZoom, !isPedestrianRoute /* isArrowGlued */);
Refresh3dMode();
}
// RoutingManager::Delegate
@@ -3292,3 +3307,25 @@ void Framework::OnPowerSchemeChanged(power_management::Scheme const actualScheme
if (actualScheme == power_management::Scheme::EconomyMaximum && GetTrafficManager().IsEnabled())
GetTrafficManager().SetEnabled(false);
}
void Framework::SetCarScreenMode(bool enabled)
{
if (m_isCarScreenMode == enabled)
return;
m_isCarScreenMode = enabled;
bool allow3d, allow3dBuildings;
Load3dMode(allow3d, allow3dBuildings);
Allow3dMode(allow3d, allow3dBuildings);
}
void Framework::Refresh3dMode()
{
bool allow3d = true;
bool allow3dBuildings = true;
/// Load User Preferences and apply logic
Load3dMode(allow3d, allow3dBuildings);
Allow3dMode(allow3d, allow3dBuildings);
}

View File

@@ -769,4 +769,13 @@ public:
// PowerManager::Subscriber override.
void OnPowerFacilityChanged(power_management::Facility const facility, bool enabled) override;
void OnPowerSchemeChanged(power_management::Scheme const actualScheme) override;
public:
/// Call this from iOS/Android when CarPlay/AA session starts/ends
void SetCarScreenMode(bool enabled);
bool m_isCarScreenMode = false;
private:
void Refresh3dMode();
bool m_wasRoutingActive = false;
};