diff options
author | Hak Matsuda <hakuro@google.com> | 2013-12-05 15:03:26 -0800 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2013-12-30 13:49:54 +0800 |
commit | 78bf63517058adcb5f8c1057e51f9a70598e4788 (patch) | |
tree | 9a43d557311de1ae08846a2eaa260593697144eb /ndk/platforms/android-17 | |
parent | 2a0781b43d7187d687b646f0dabff2af12f3146c (diff) | |
download | android_development-78bf63517058adcb5f8c1057e51f9a70598e4788.tar.gz android_development-78bf63517058adcb5f8c1057e51f9a70598e4788.tar.bz2 android_development-78bf63517058adcb5f8c1057e51f9a70598e4788.zip |
Restore immersive mode when volume button has been pressed.
Workaround issue where SYSTEM_UI_FLAG_IMMERSIVE_STICKY is invalidated
when a volume button is pressed (internal bug ref b/11986621)
Immersive mode still does not recover when the screen has been
rotated, due to onSystemUiVisibilityChange is not triggered
when screen is rotated (internal bug ref b/11990702)
Change-Id: Ifdfe9b24d5c3c208441aeca0fbb2b1eaee39da95
Diffstat (limited to 'ndk/platforms/android-17')
-rw-r--r-- | ndk/platforms/android-17/samples/Teapot/src/com/sample/teapot/TeapotNativeActivity.java | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/ndk/platforms/android-17/samples/Teapot/src/com/sample/teapot/TeapotNativeActivity.java b/ndk/platforms/android-17/samples/Teapot/src/com/sample/teapot/TeapotNativeActivity.java index 32696b8ff..9e296e447 100644 --- a/ndk/platforms/android-17/samples/Teapot/src/com/sample/teapot/TeapotNativeActivity.java +++ b/ndk/platforms/android-17/samples/Teapot/src/com/sample/teapot/TeapotNativeActivity.java @@ -31,6 +31,22 @@ public class TeapotNativeActivity extends NativeActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + //Hide toolbar + int SDK_INT = android.os.Build.VERSION.SDK_INT; + if(SDK_INT >= 19) + { + setImmersiveSticky(); + + View decorView = getWindow().getDecorView(); + decorView.setOnSystemUiVisibilityChangeListener + (new View.OnSystemUiVisibilityChangeListener() { + @Override + public void onSystemUiVisibilityChange(int visibility) { + setImmersiveSticky(); + } + }); + } + } protected void onResume() { @@ -48,14 +64,22 @@ public class TeapotNativeActivity extends NativeActivity { } else if(SDK_INT >= 19) { - getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + setImmersiveSticky(); } } // Our popup window, you will call it from your C/C++ code later + void setImmersiveSticky() { + View decorView = getWindow().getDecorView(); + decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); + } + TeapotNativeActivity _activity; PopupWindow _popupWindow; TextView _label; |