Move landscape check to map framework

Signed-off-by: Jeremiah Miller <jmil@tuta.io>
This commit is contained in:
Jeremiah Miller 2024-01-19 18:54:31 -07:00
parent 6bc1c28a7f
commit a9155040a1
7 changed files with 2 additions and 18 deletions

View file

@ -1144,12 +1144,6 @@ Java_app_organicmaps_Framework_nativeChangeWritableDir(JNIEnv * env, jclass, jst
g_framework->AddLocalMaps();
}
JNIEXPORT void JNICALL
Java_app_organicmaps_Framework_nativeSetIsLandscape(JNIEnv * env, jclass, jboolean isLandscape)
{
return frm()->GetRoutingManager().SetIsLandscape(static_cast<bool>(isLandscape));
}
JNIEXPORT jboolean JNICALL
Java_app_organicmaps_Framework_nativeIsRoutingActive(JNIEnv * env, jclass)
{

View file

@ -255,8 +255,6 @@ public class Framework
public static native void nativeChangeWritableDir(String newPath);
// Routing.
public static native void nativeSetIsLandscape(boolean isLandscape);
public static native boolean nativeIsRoutingActive();
public static native boolean nativeIsRouteBuilt();

View file

@ -448,7 +448,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
final boolean newUiModeIsCarConnected = newUiMode == Configuration.UI_MODE_TYPE_CAR;
final boolean newUiModeIsCarDisconnected = mLastUiMode == Configuration.UI_MODE_TYPE_CAR && newUiMode == Configuration.UI_MODE_TYPE_NORMAL;
mLastUiMode = newUiMode;
Framework.nativeSetIsLandscape(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
if (newUiModeIsCarConnected || newUiModeIsCarDisconnected)
return;
recreate();
@ -568,8 +568,6 @@ public class MwmActivity extends BaseMwmFragmentActivity
initMainMenu();
initOnmapDownloader();
initPositionChooser();
Framework.nativeSetIsLandscape(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
}
private void initPositionChooser()

View file

@ -354,8 +354,6 @@ void setShowLocationAlert(BOOL needShow) {
- (void)orientationChanged
{
GetFramework().GetRoutingManager().SetIsLandscape((CLDeviceOrientation)UIDevice.currentDevice.orientation == landscapeLeft
|| (CLDeviceOrientation)UIDevice.currentDevice.orientation == landscapeRight);
self.locationManager.headingOrientation = (CLDeviceOrientation)UIDevice.currentDevice.orientation;
}

View file

@ -59,8 +59,6 @@ class AvailableArea: UIView {
let orientation = UIDevice.current.orientation
guard !orientation.isFlat && orientation != .portraitUpsideDown else { return }
self.orientation = orientation
GetFramework().GetRoutingManager().SetIsLandscape(orientation == landscapeLeft
|| orientation == landscapeRight);
}
}

View file

@ -29,10 +29,7 @@ class DirectionView: SolidTouchView {
override func layoutSubviews() {
var textAlignment = NSTextAlignment.center
if UIDevice.current.orientation == .landscapeLeft || UIDevice.current.orientation == .landscapeRight {
GetFramework().GetRoutingManager().SetIsLandscape(true);
textAlignment = alternative(iPhone: .left, iPad: .center)
} else {
GetFramework().GetRoutingManager().SetIsLandscape(false);
}
titleLabel.textAlignment = textAlignment
typeLabel.textAlignment = textAlignment

View file

@ -265,6 +265,7 @@ void Framework::OnViewportChanged(ScreenBase const & screen)
m_trafficManager.UpdateViewport(m_currentModelView);
m_transitManager.UpdateViewport(m_currentModelView);
m_isolinesManager.UpdateViewport(m_currentModelView);
m_routingManager.SetIsLandscape(m_currentModelView.GetWidth() > m_currentModelView.GetHeight());
if (m_viewportChangedFn != nullptr)
m_viewportChangedFn(screen);