Merge pull request #927 from jtrax/bugfixes

Fixed crash when pressed back on map in Android version 2.3
This commit is contained in:
vshcherb 2014-10-20 20:54:05 +02:00
commit e019bc44d2
3 changed files with 15 additions and 7 deletions

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<android.opengl.GLSurfaceView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/glSurfaceView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</android.opengl.GLSurfaceView>

View file

@ -12,11 +12,11 @@
android:keepScreenOn="true"
android:orientation="vertical" >
<android.opengl.GLSurfaceView
android:id="@+id/glSurfaceView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<ViewStub android:id="@+id/glSurfaceStub"
android:inflatedId="@+id/glSurfaceView"
android:layout="@layout/gl_surface"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<net.osmand.plus.views.OsmAndMapSurfaceView
android:id="@+id/MapView"

View file

@ -68,6 +68,7 @@ import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewStub;
import android.view.Window;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
@ -138,8 +139,8 @@ public class MapActivity extends AccessibleActivity {
parseLaunchIntentLocation();
if(settings.USE_NATIVE_RENDER.get() && NativeQtLibrary.isInit()) {
glSurfaceView = (GLSurfaceView) findViewById(R.id.glSurfaceView);
glSurfaceView.setVisibility(View.VISIBLE);
ViewStub stub = (ViewStub) findViewById(R.id.glSurfaceStub);
glSurfaceView = (GLSurfaceView) stub.inflate();
OsmAndMapLayersView ml = (OsmAndMapLayersView) findViewById(R.id.MapLayersView);
ml.setVisibility(View.VISIBLE);
NativeQtLibrary.initView(glSurfaceView);