Permalink
Browse files

android: fix orientation setting on resume. Closes #1662

  • Loading branch information...
1 parent 710d781 commit 87cbf1b3992950cce1e29d70f3e84bf823cbf5ce @arturoc arturoc committed Oct 30, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 addons/ofxAndroid/ofAndroidLib/src/cc/openframeworks/OFAndroid.java
@@ -246,12 +246,14 @@ public void resume(){
Log.i("OF","onResume");
enableTouchEvents();
mGLView.onResume();
-
+
for(OFAndroidObject object : OFAndroidObject.ofObjects){
object.onResume();
}
onResume();
+
+ if(OFAndroid::orientation!=-1) OFAndroid::setOrientation(OFAndroid::orientation)
@Maigre

Maigre Oct 30, 2012

replace with
if(OFAndroid.orientation != -1) OFAndroid.setScreenOrientation(OFAndroid.orientation);
?

if(wl!=null) lockScreenSleep();
}
@@ -512,7 +514,10 @@ public static void setFullscreen(boolean fs){
//ofActivity.getWindow().setAttributes(attrs);
}
+
+ private static int orientation=-1;
public static void setScreenOrientation(int orientation){
+ OFAndroid::orientation = orientation;
@Maigre

Maigre Oct 30, 2012

replace with
OFAndroid.orientation = orientation;
?

switch(orientation){
case 0:
ofActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
@@ -1095,4 +1100,4 @@ public void onDrawFrame(GL10 gl) {
static boolean initialized;
static boolean setup;
int w,h;
-}
+}

0 comments on commit 87cbf1b

Please sign in to comment.