Skip to content

Commit

Permalink
Android prevent from changing orientation
Browse files Browse the repository at this point in the history
  • Loading branch information
Andriy Chaika committed Feb 14, 2014
1 parent 8604163 commit e0111f9
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ of this software and associated documentation files (the "Software"), to deal
import android.view.ViewGroup;
import android.util.Log;
import android.widget.FrameLayout;
import android.content.res.Configuration;

public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelperListener {
// ===========================================================
Expand Down Expand Up @@ -91,7 +92,21 @@ protected void onPause() {
Cocos2dxHelper.onPause();
this.mGLSurfaceView.onPause();
}

@Override
public void onConfigurationChanged (Configuration newConfig)
{
int current_orientation = getResources().getConfiguration().orientation;
//Log.d("act", "Configuration changed");
if(newConfig.orientation != current_orientation)
{
//Log.d("act", "Configuration restored");
newConfig.orientation = current_orientation;
}
super.onConfigurationChanged(newConfig);

}

@Override
public void showDialog(final String pTitle, final String pMessage) {
Message msg = new Message();
Expand Down

0 comments on commit e0111f9

Please sign in to comment.