summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2012-05-17 16:45:12 -0700
committerChih-Chung Chang <chihchung@google.com>2012-05-17 18:26:20 -0700
commit0b2486cff0c1b951c54325596256b986307f7f3a (patch)
tree3811b5690d8554d298f6504b362a1dcffe95fc96 /src
parent0f2db4b94d2824db2e5be748924cd51fcc8b9498 (diff)
downloadandroid_packages_apps_Gallery2-0b2486cff0c1b951c54325596256b986307f7f3a.tar.gz
android_packages_apps_Gallery2-0b2486cff0c1b951c54325596256b986307f7f3a.tar.bz2
android_packages_apps_Gallery2-0b2486cff0c1b951c54325596256b986307f7f3a.zip
Use View.setSystemUiVisibility to enter/leave lights-out mode.
Bug: 6451200 Change-Id: I8e27b3e5eedfa2652f06dfc8f377c9cef8100160
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/ActivityState.java23
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java12
-rw-r--r--src/com/android/gallery3d/ui/GLRoot.java1
-rw-r--r--src/com/android/gallery3d/ui/GLRootView.java6
4 files changed, 18 insertions, 24 deletions
diff --git a/src/com/android/gallery3d/app/ActivityState.java b/src/com/android/gallery3d/app/ActivityState.java
index 233b3986d..66b4a2279 100644
--- a/src/com/android/gallery3d/app/ActivityState.java
+++ b/src/com/android/gallery3d/app/ActivityState.java
@@ -108,21 +108,21 @@ abstract public class ActivityState {
if (plugged != mPlugged) {
mPlugged = plugged;
- final Window win = ((Activity) mActivity).getWindow();
- final WindowManager.LayoutParams params = win.getAttributes();
- setScreenOnFlags(params);
- win.setAttributes(params);
+ setScreenOnFlags();
}
}
}
};
- void setScreenOnFlags(WindowManager.LayoutParams params) {
+ void setScreenOnFlags() {
+ final Window win = ((Activity) mActivity).getWindow();
+ final WindowManager.LayoutParams params = win.getAttributes();
if (mPlugged && 0 != (mFlags & FLAG_SCREEN_ON)) {
params.flags |= SCREEN_ON_FLAGS;
} else {
params.flags &= ~SCREEN_ON_FLAGS;
}
+ win.setAttributes(params);
}
protected void onPause() {
@@ -149,17 +149,10 @@ abstract public class ActivityState {
activity.invalidateOptionsMenu();
- final Window win = activity.getWindow();
- final WindowManager.LayoutParams params = win.getAttributes();
+ setScreenOnFlags();
- if ((mFlags & FLAG_HIDE_STATUS_BAR) != 0) {
- params.systemUiVisibility = View.SYSTEM_UI_FLAG_LOW_PROFILE;
- } else {
- params.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE;
- }
-
- setScreenOnFlags(params);
- win.setAttributes(params);
+ boolean lightsOut = ((mFlags & FLAG_HIDE_STATUS_BAR) != 0);
+ mActivity.getGLRoot().setLightsOutMode(lightsOut);
ResultEntry entry = mReceivedResults;
if (entry != null) {
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 68406ccd2..4d2d699f0 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -205,7 +205,7 @@ public class PhotoPage extends ActivityState implements
itemPath = screenNailItemPath;
// Action bar should not be displayed when camera starts.
- mFlags |= FLAG_HIDE_ACTION_BAR;
+ mFlags |= FLAG_HIDE_ACTION_BAR | FLAG_HIDE_STATUS_BAR;
mShowBars = false;
}
@@ -376,10 +376,7 @@ public class PhotoPage extends ActivityState implements
if (mShowBars) return;
mShowBars = true;
mActionBar.show();
- WindowManager.LayoutParams params =
- ((Activity) mActivity).getWindow().getAttributes();
- params.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE;
- ((Activity) mActivity).getWindow().setAttributes(params);
+ mActivity.getGLRoot().setLightsOutMode(false);
refreshHidingMessage();
}
@@ -387,10 +384,7 @@ public class PhotoPage extends ActivityState implements
if (!mShowBars) return;
mShowBars = false;
mActionBar.hide();
- WindowManager.LayoutParams params =
- ((Activity) mActivity).getWindow().getAttributes();
- params.systemUiVisibility = View.SYSTEM_UI_FLAG_LOW_PROFILE;
- ((Activity) mActivity).getWindow().setAttributes(params);
+ mActivity.getGLRoot().setLightsOutMode(true);
mHandler.removeMessages(MSG_HIDE_BARS);
}
diff --git a/src/com/android/gallery3d/ui/GLRoot.java b/src/com/android/gallery3d/ui/GLRoot.java
index f4b7572a7..1651b4361 100644
--- a/src/com/android/gallery3d/ui/GLRoot.java
+++ b/src/com/android/gallery3d/ui/GLRoot.java
@@ -44,4 +44,5 @@ public interface GLRoot {
public Matrix getCompensationMatrix();
public void freeze();
public void unfreeze();
+ public void setLightsOutMode(boolean enabled);
}
diff --git a/src/com/android/gallery3d/ui/GLRootView.java b/src/com/android/gallery3d/ui/GLRootView.java
index 73e982509..987e9a2ae 100644
--- a/src/com/android/gallery3d/ui/GLRootView.java
+++ b/src/com/android/gallery3d/ui/GLRootView.java
@@ -512,6 +512,12 @@ public class GLRootView extends GLSurfaceView
mRenderLock.unlock();
}
+ @Override
+ public void setLightsOutMode(boolean enabled) {
+ int flags = enabled ? SYSTEM_UI_FLAG_LOW_PROFILE : 0;
+ setSystemUiVisibility(flags);
+ }
+
// We need to unfreeze in the following methods and in onPause().
// These methods will wait on GLThread. If we have freezed the GLRootView,
// the GLThread will wait on main thread to call unfreeze and cause dead