summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android/incallui
diff options
context:
space:
mode:
authorQi Wang <wangqi@google.com>2016-02-24 00:51:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-02-24 00:51:10 +0000
commit82557da65e5b16ac9d95e2bb5b73c2e5c1e88a89 (patch)
tree1218e5e93a1c41b1f57e8ec66e34a0e9256329f3 /InCallUI/src/com/android/incallui
parentc6d87e2b321155ce80979516d4eb7b8ea17af822 (diff)
parent40de598bb9559d038f3774e69365af2f856bd7f4 (diff)
Merge "Let InCallActivity handle resize config change." into nyc-dev
Diffstat (limited to 'InCallUI/src/com/android/incallui')
-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.
*/