Merge "Shows status bar in gallery when in portrait view."
diff --git a/src/com/android/gallery3d/app/AbstractGalleryActivity.java b/src/com/android/gallery3d/app/AbstractGalleryActivity.java
index d25f60e..b3856ad 100644
--- a/src/com/android/gallery3d/app/AbstractGalleryActivity.java
+++ b/src/com/android/gallery3d/app/AbstractGalleryActivity.java
@@ -36,6 +36,8 @@
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.os.Bundle;
+import android.view.Window;
+import android.view.WindowManager;
public class AbstractGalleryActivity extends Activity implements GalleryActivity {
@SuppressWarnings("unused")
@@ -54,6 +56,12 @@
private IntentFilter mMountFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
@Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ toggleStatusBarByOrientation();
+ }
+
+ @Override
protected void onSaveInstanceState(Bundle outState) {
mGLRootView.lockRenderThread();
try {
@@ -69,6 +77,7 @@
super.onConfigurationChanged(config);
mStateManager.onConfigurationChange(config);
invalidateOptionsMenu();
+ toggleStatusBarByOrientation();
}
public Context getAndroidContext() {
@@ -203,4 +212,14 @@
public GalleryActionBar getGalleryActionBar() {
return null;
}
+
+ // Shows status bar in portrait view, hide in landscape view
+ private void toggleStatusBarByOrientation() {
+ Window win = getWindow();
+ if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
+ win.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ } else {
+ win.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+ }
}