platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java in rhodes-3.3.2.beta.1 vs platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/GoogleMapView.java in rhodes-3.3.2.beta.2

- old
+ new

@@ -41,19 +41,19 @@ import android.graphics.drawable.Drawable; import android.location.Address; import android.location.Geocoder; import android.os.Bundle; import android.os.IBinder; -import android.view.Display; import android.view.ViewGroup.LayoutParams; import android.widget.RelativeLayout; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MyLocationOverlay; import com.rhomobile.rhodes.AndroidR; +import com.rhomobile.rhodes.BaseActivity; import com.rhomobile.rhodes.Logger; import com.rhomobile.rhodes.RhoConf; import com.rhomobile.rhodes.RhodesActivity; import com.rhomobile.rhodes.RhodesService; import com.rhomobile.rhodes.util.PerformOnUiThread; @@ -79,12 +79,10 @@ private String apiKey; private Vector<Annotation> annotations; - private int mRuntimeOrientation; - static private ExtrasHolder mHolder = null; private static class Coordinates { public double latitude; public double longitude; @@ -117,33 +115,11 @@ public void run() { mCalloutOverlay.selectAnnotation(fann); } }, false); } - - protected int getScreenOrientation() { - Display display = getWindowManager().getDefaultDisplay(); - int orientation = display.getOrientation(); - if (orientation == Configuration.ORIENTATION_UNDEFINED) - { - orientation = getResources().getConfiguration().orientation; - - if (orientation == Configuration.ORIENTATION_UNDEFINED) { - if (display.getWidth() == display.getHeight()) - orientation = Configuration.ORIENTATION_SQUARE; - else if(display.getWidth() < display.getHeight()) - orientation = Configuration.ORIENTATION_PORTRAIT; - else - orientation = Configuration.ORIENTATION_LANDSCAPE; - } - } - return orientation; - } - - - @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Intent intent = new Intent(this, RhodesService.class); @@ -304,27 +280,26 @@ public void run() { doGeocoding(); } }); geocoding.start(); - - mRuntimeOrientation = this.getScreenOrientation(); + if (RhoConf.getBool("disable_screen_rotation")) + setRequestedOrientation(BaseActivity.getScreenProperties().getOrientation()); } @Override public void onConfigurationChanged(Configuration newConfig) { Logger.T(TAG, "+++ onConfigurationChanged"); if (RhoConf.getBool("disable_screen_rotation")) { super.onConfigurationChanged(newConfig); - this.setRequestedOrientation(mRuntimeOrientation); + setRequestedOrientation(BaseActivity.getScreenProperties().getOrientation()); } else { - mRuntimeOrientation = this.getScreenOrientation(); - super.onConfigurationChanged(newConfig); - RhodesService.getInstance().rereadScreenProperties(); + super.onConfigurationChanged(newConfig); + BaseActivity.getScreenProperties().reread(this); } }