diff options
author | Pin Ting <pinting@google.com> | 2012-02-05 22:24:13 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-02-05 22:24:13 -0800 |
commit | feef78c1ecf63c88e052698040e809f25ffef0c4 (patch) | |
tree | 8c5da11a1409d25964dd4354455c8a72fa9f8c0a /src/com | |
parent | 3f68238643791c0cba312df8549d5dfcd1ef188c (diff) | |
parent | 60e1f075be818f37472607cee30a88cf3cd87c30 (diff) | |
download | android_packages_apps_Snap-feef78c1ecf63c88e052698040e809f25ffef0c4.tar.gz android_packages_apps_Snap-feef78c1ecf63c88e052698040e809f25ffef0c4.tar.bz2 android_packages_apps_Snap-feef78c1ecf63c88e052698040e809f25ffef0c4.zip |
Merge "Shows status bar in gallery when in portrait view."
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/gallery3d/app/AbstractGalleryActivity.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/app/AbstractGalleryActivity.java b/src/com/android/gallery3d/app/AbstractGalleryActivity.java index d25f60ebe..b3856ad4d 100644 --- a/src/com/android/gallery3d/app/AbstractGalleryActivity.java +++ b/src/com/android/gallery3d/app/AbstractGalleryActivity.java @@ -36,6 +36,8 @@ import android.content.Intent; 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 @@ public class AbstractGalleryActivity extends Activity implements GalleryActivity 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 @@ public class AbstractGalleryActivity extends Activity implements GalleryActivity super.onConfigurationChanged(config); mStateManager.onConfigurationChange(config); invalidateOptionsMenu(); + toggleStatusBarByOrientation(); } public Context getAndroidContext() { @@ -203,4 +212,14 @@ public class AbstractGalleryActivity extends Activity implements GalleryActivity 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); + } + } } |