Assure we use only landscape dimensions

This commit is contained in:
Aaron Culliney 2015-04-11 11:42:40 -07:00
parent e876cd03b6
commit 101d78d160

View File

@ -166,6 +166,13 @@ public class Apple2Activity extends Activity {
Rect rect = new Rect(); Rect rect = new Rect();
mView.getWindowVisibleDisplayFrame(rect); mView.getWindowVisibleDisplayFrame(rect);
int h = rect.height(); int h = rect.height();
int w = rect.width();
if (w < h) {
// assure landscape dimensions
final int w_ = w;
w = h;
h = w_;
}
if (mView.getHeight() - h > SOFTKEYBOARD_THRESHOLD) { if (mView.getHeight() - h > SOFTKEYBOARD_THRESHOLD) {
Log.d(TAG, "Soft keyboard appears to be occupying screen real estate ..."); Log.d(TAG, "Soft keyboard appears to be occupying screen real estate ...");
Apple2Activity.this.mSoftKeyboardShowing = true; Apple2Activity.this.mSoftKeyboardShowing = true;
@ -173,7 +180,7 @@ public class Apple2Activity extends Activity {
Log.d(TAG, "Soft keyboard appears to be gone ..."); Log.d(TAG, "Soft keyboard appears to be gone ...");
Apple2Activity.this.mSoftKeyboardShowing = false; Apple2Activity.this.mSoftKeyboardShowing = false;
} }
nativeGraphicsChanged(rect.width(), h); nativeGraphicsChanged(w, h);
} }
}); });
@ -404,10 +411,18 @@ public class Apple2Activity extends Activity {
} }
} }
public void graphicsInitialized(int width, int height) { public void graphicsInitialized(int w, int h) {
mWidth = width; if (w < h) {
mHeight = height; // assure landscape dimensions
nativeGraphicsInitialized(width, height); final int w_ = w;
w = h;
h = w_;
}
mWidth = w;
mHeight = h;
nativeGraphicsInitialized(w, h);
} }
public Apple2View getView() { public Apple2View getView() {