am f5a30690: Use SYSTEM_UI_FLAG_FULLSCREEN for all uses of lights out mode in JellyBean.
* commit 'f5a30690749a354cbbf8c8d9ad4fd5ed84e7d41e':
Use SYSTEM_UI_FLAG_FULLSCREEN for all uses of lights out mode in JellyBean.
diff --git a/src/com/android/ex/photo/Intents.java b/src/com/android/ex/photo/Intents.java
index e5406c0..1087339 100644
--- a/src/com/android/ex/photo/Intents.java
+++ b/src/com/android/ex/photo/Intents.java
@@ -199,6 +199,17 @@
return this;
}
+ /**
+ * Enable a scale animation that animates the initial photo URI passed in using
+ * {@link #setInitialPhotoUri}.
+ *
+ * Note: To avoid janky transitions, particularly when exiting the photoviewer, ensure the
+ * following system UI flags are set on the root view of the relying app's activity
+ * (via @{link View.setSystemUiVisibility(int)}):
+ * {@code View.SYSTEM_UI_FLAG_VISIBLE | View.SYSTEM_UI_FLAG_LAYOUT_STABLE}
+ * As well, client should ensure {@code android:fitsSystemWindows} is set on the root
+ * content view.
+ */
public PhotoViewIntentBuilder setScaleAnimation(int startX, int startY,
int startWidth, int startHeight) {
mScaleAnimation = true;
diff --git a/src/com/android/ex/photo/PhotoViewController.java b/src/com/android/ex/photo/PhotoViewController.java
index 469d266..3b43232 100644
--- a/src/com/android/ex/photo/PhotoViewController.java
+++ b/src/com/android/ex/photo/PhotoViewController.java
@@ -42,8 +42,7 @@
public void setImmersiveMode(boolean enabled) {
int flags = 0;
final int version = Build.VERSION.SDK_INT;
- final boolean manuallyUpdateActionBar = version < Build.VERSION_CODES.JELLY_BEAN ||
- (version < Build.VERSION_CODES.KITKAT && mCallback.isScaleAnimationEnabled());
+ final boolean manuallyUpdateActionBar = version < Build.VERSION_CODES.JELLY_BEAN;
if (enabled &&
(!mCallback.isScaleAnimationEnabled() || mCallback.isEnterAnimationFinished())) {
// Turning on immersive mode causes an animation. If the scale animation is enabled and
@@ -58,21 +57,15 @@
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE;
} else if (version >= Build.VERSION_CODES.JELLY_BEAN) {
+ // Clients that use the scale animation should set the following system UI flags to
+ // prevent janky animations on exit when the status bar is hidden:
+ // View.SYSTEM_UI_FLAG_VISIBLE | View.SYSTEM_UI_FLAG_STABLE
+ // As well, client should ensure `android:fitsSystemWindows` is set on the root
+ // content view.
flags = View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
- if (!mCallback.isScaleAnimationEnabled()) {
- // If we are using the scale animation for intro and exit,
- // we can't go into fullscreen mode. The issue is that the
- // activity that invoked this will not be in fullscreen, so
- // as we transition out, the background activity will be
- // temporarily rendered without an actionbar, and the shrinking
- // photo will not line up properly. After that it redraws
- // in the correct location, but it still looks janks.
- // FLAG: there may be a better way to fix this, but I don't
- // yet know what it is.
- flags |= View.SYSTEM_UI_FLAG_FULLSCREEN;
- }
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_FULLSCREEN;
} else if (version >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
flags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
} else if (version >= Build.VERSION_CODES.HONEYCOMB) {
@@ -86,7 +79,7 @@
if (version >= Build.VERSION_CODES.KITKAT) {
flags = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;;
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
} else if (version >= Build.VERSION_CODES.JELLY_BEAN) {
flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;