summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android
diff options
context:
space:
mode:
authorQi Wang <wangqi@google.com>2016-02-24 01:07:41 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-02-24 01:07:41 +0000
commit386c22909c4166bee7c2461de7a5bfe617478ff1 (patch)
tree6de5d252a8d0078e2625b7564f1c3d9e994f3adc /InCallUI/src/com/android
parent3f235762e070ab6bae358b8c9df7252f45115737 (diff)
parent3f07759954ffed1ea48d6f345098e2d97b79b33a (diff)
Merge "Let InCallActivity handle resize config change." into nyc-dev am: 82557da65e
am: 3f07759954 * commit '3f07759954ffed1ea48d6f345098e2d97b79b33a': Let InCallActivity handle resize config change.
Diffstat (limited to 'InCallUI/src/com/android')
-rw-r--r--InCallUI/src/com/android/incallui/InCallActivity.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index 5cd21a555..eca79f8a7 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -88,6 +88,12 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD
private static final int DIALPAD_REQUEST_SHOW = 2;
private static final int DIALPAD_REQUEST_HIDE = 3;
+ /**
+ * This is used to relaunch the activity if resizing beyond which it needs to load different
+ * layout file.
+ */
+ private static final int SCREEN_HEIGHT_RESIZE_THRESHOLD = 500;
+
private CallButtonFragment mCallButtonFragment;
private CallCardFragment mCallCardFragment;
private AnswerFragment mAnswerFragment;
@@ -252,7 +258,7 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD
// setting activity should be last thing in setup process
InCallPresenter.getInstance().setActivity(this);
enableInCallOrientationEventListener(getRequestedOrientation() ==
- InCallOrientationEventListener.FULL_SENSOR_SCREEN_ORIENTATION);
+ InCallOrientationEventListener.FULL_SENSOR_SCREEN_ORIENTATION);
InCallPresenter.getInstance().onActivityStarted();
}
@@ -353,6 +359,27 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD
}
}
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ Configuration oldConfig = getResources().getConfiguration();
+ Log.v(this, String.format(
+ "incallui config changed, screen size: w%ddp x h%ddp old:w%ddp x h%ddp",
+ newConfig.screenWidthDp, newConfig.screenHeightDp,
+ oldConfig.screenWidthDp, oldConfig.screenHeightDp));
+ // Recreate this activity if height is changing beyond the threshold to load different
+ // layout file.
+ if (oldConfig.screenHeightDp < SCREEN_HEIGHT_RESIZE_THRESHOLD &&
+ newConfig.screenHeightDp > SCREEN_HEIGHT_RESIZE_THRESHOLD ||
+ oldConfig.screenHeightDp > SCREEN_HEIGHT_RESIZE_THRESHOLD &&
+ newConfig.screenHeightDp < SCREEN_HEIGHT_RESIZE_THRESHOLD) {
+ Log.i(this, String.format(
+ "Recreate activity due to resize beyond threshold: %d dp",
+ SCREEN_HEIGHT_RESIZE_THRESHOLD));
+ recreate();
+ }
+ }
+
/**
* Returns true when the Activity is currently visible.
*/