From 4d56714de8d5b94159e6a09c83d422323805a4d0 Mon Sep 17 00:00:00 2001 From: rachytski Date: Mon, 30 Jul 2012 00:40:11 -0700 Subject: [PATCH] MWMActivity doesn't recreate itself after orientation changes. --- android/MapsWithMeLite/AndroidManifest.xml | 3 ++- android/MapsWithMePro/AndroidManifest.xml | 3 ++- android/jni/com/mapswithme/maps/Lifecycle.cpp | 1 + .../src/com/mapswithme/maps/MWMActivity.java | 17 +++++++++++++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/android/MapsWithMeLite/AndroidManifest.xml b/android/MapsWithMeLite/AndroidManifest.xml index e28a1329ca..f0a729f1d6 100644 --- a/android/MapsWithMeLite/AndroidManifest.xml +++ b/android/MapsWithMeLite/AndroidManifest.xml @@ -42,7 +42,8 @@ + android:theme="@style/MWMNoTitle" + android:configChanges="orientation|screenLayout|screenSize"> + android:theme="@style/MWMNoTitle" + android:configChanges="orientation|screenLayout|screenSize"> m_data.m_size.m_density; g_framework->Resize(s_winWidth, s_winHeight); + g_framework->NativeFramework()->Invalidate(true); /* if (shouldLoadState) { g_framework->LoadState(); diff --git a/android/src/com/mapswithme/maps/MWMActivity.java b/android/src/com/mapswithme/maps/MWMActivity.java index 0e8fdb4c7e..27aa2af271 100644 --- a/android/src/com/mapswithme/maps/MWMActivity.java +++ b/android/src/com/mapswithme/maps/MWMActivity.java @@ -8,6 +8,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.net.Uri; import android.os.Bundle; import android.os.Environment; @@ -234,6 +235,13 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService } } + @Override + public void onConfigurationChanged(Configuration newConfig) + { + super.onConfigurationChanged(newConfig); + alignZoomButtons(); + } + private void showFacebookPage() { Intent intent = null; @@ -401,6 +409,13 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService nativeConnectDownloadButton(); + alignZoomButtons(); + + //m_timer = new VideoTimer(); + } + + private void alignZoomButtons() + { // Get screen density DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); @@ -413,8 +428,6 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService LinearLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(margin, (metrics.heightPixels / 4) - offs, margin, margin); findViewById(R.id.map_button_plus).setLayoutParams(lp); - - //m_timer = new VideoTimer(); } /// @name From Location interface