summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android/incallui/InCallActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'InCallUI/src/com/android/incallui/InCallActivity.java')
-rw-r--r--InCallUI/src/com/android/incallui/InCallActivity.java34
1 files changed, 24 insertions, 10 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index f75c33b23..873c288a4 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -105,10 +105,9 @@ public class InCallActivity extends Activity {
};
/**
- * Stores the current orientation of the activity. Used to determine if a change in orientation
- * has occurred.
+ * Used to determine if a change in orientation has occurred.
*/
- private int mCurrentOrientation;
+ private static int sCurrentOrientation = Configuration.ORIENTATION_UNDEFINED;
@Override
protected void onCreate(Bundle icicle) {
@@ -143,9 +142,8 @@ public class InCallActivity extends Activity {
internalResolveIntent(getIntent());
- mCurrentOrientation = getResources().getConfiguration().orientation;
- mIsLandscape = getResources().getConfiguration().orientation
- == Configuration.ORIENTATION_LANDSCAPE;
+ mIsLandscape = getResources().getConfiguration().orientation ==
+ Configuration.ORIENTATION_LANDSCAPE;
final boolean isRtl = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) ==
View.LAYOUT_DIRECTION_RTL;
@@ -193,6 +191,11 @@ public class InCallActivity extends Activity {
// setting activity should be last thing in setup process
InCallPresenter.getInstance().setActivity(this);
+
+ // It is possible that the activity restarted because orientation changed.
+ // Notify listeners if orientation changed.
+ doOrientationChanged(getResources().getConfiguration().orientation);
+ InCallPresenter.getInstance().onActivityStarted();
}
@Override
@@ -244,6 +247,9 @@ public class InCallActivity extends Activity {
@Override
protected void onStop() {
Log.d(this, "onStop()...");
+
+ InCallPresenter.getInstance().updateIsChangingConfigurations();
+ InCallPresenter.getInstance().onActivityStopped();
super.onStop();
}
@@ -251,6 +257,7 @@ public class InCallActivity extends Activity {
protected void onDestroy() {
Log.d(this, "onDestroy()... this = " + this);
InCallPresenter.getInstance().unsetActivity(this);
+ InCallPresenter.getInstance().updateIsChangingConfigurations();
super.onDestroy();
}
@@ -446,15 +453,22 @@ public class InCallActivity extends Activity {
InCallPresenter.getInstance().getProximitySensor().onConfigurationChanged(config);
Log.d(this, "onConfigurationChanged "+config.orientation);
+ doOrientationChanged(config.orientation);
+ super.onConfigurationChanged(config);
+ }
+
+
+ private void doOrientationChanged(int orientation) {
+ Log.d(this, "doOrientationChanged prevOrientation=" + sCurrentOrientation +
+ " newOrientation=" + orientation);
// Check to see if the orientation changed to prevent triggering orientation change events
// for other configuration changes.
- if (config.orientation != mCurrentOrientation) {
- mCurrentOrientation = config.orientation;
+ if (orientation != sCurrentOrientation) {
+ sCurrentOrientation = orientation;
InCallPresenter.getInstance().onDeviceRotationChange(
getWindowManager().getDefaultDisplay().getRotation());
- InCallPresenter.getInstance().onDeviceOrientationChange(mCurrentOrientation);
+ InCallPresenter.getInstance().onDeviceOrientationChange(sCurrentOrientation);
}
- super.onConfigurationChanged(config);
}
public CallButtonFragment getCallButtonFragment() {