| Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 1 | |
| Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 2 | Android AdvancedImmersiveMode Sample |
| Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 3 | =================================== |
| Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 4 | |
| Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 5 | Immersive Mode, added in Android 4.4, improves the "hide full screen" and |
| 6 | "hide nav bar" modes by letting users swipe the bars in and out. This sample |
| Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 7 | lets the user experiment with immersive mode by seeing how it interacts |
| 8 | with some of the other UI flags related to full-screen apps. |
| 9 | |
| Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 10 | Introduction |
| 11 | ------------ |
| 12 | |
| 13 | Android 4.4 (API Level 19) introduces a new `SYSTEM_UI_FLAG_IMMERSIVE` |
| 14 | flag for [setSystemUiVisibility()][1] that lets your app go truly "full |
| 15 | screen." This flag, when combined with the `SYSTEM_UI_FLAG_HIDE_NAVIGATION` and |
| 16 | `SYSTEM_UI_FLAG_FULLSCREEN` flags, hides the navigation and status bars |
| 17 | and lets your app capture all touch events on the screen. |
| 18 | |
| 19 | When immersive full-screen mode is enabled, your activity continues |
| 20 | to receive all touch events. The user can reveal the system bars with |
| 21 | an inward swipe along the region where the system bars normally |
| 22 | appear. |
| 23 | |
| 24 | [1]: http://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int) |
| 25 | |
| Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 26 | Pre-requisites |
| 27 | -------------- |
| 28 | |
| Yuichi Araki | f302c13 | 2019-01-11 17:19:47 +0900 | [diff] [blame^] | 29 | - Android SDK 28 |
| 30 | - Android Build Tools v28.0.3 |
| Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 31 | - Android Support Repository |
| 32 | |
| Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 33 | Screenshots |
| 34 | ------------- |
| 35 | |
| 36 | <img src="screenshots/immersion.png" height="400" alt="Screenshot"/> <img src="screenshots/leanback.png" height="400" alt="Screenshot"/> |
| 37 | |
| Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 38 | Getting Started |
| 39 | --------------- |
| 40 | |
| 41 | This sample uses the Gradle build system. To build this project, use the |
| 42 | "gradlew build" command or use "Import Project" in Android Studio. |
| 43 | |
| 44 | Support |
| 45 | ------- |
| 46 | |
| 47 | - Google+ Community: https://plus.google.com/communities/105153134372062985968 |
| 48 | - Stack Overflow: http://stackoverflow.com/questions/tagged/android |
| 49 | |
| 50 | If you've found an error in this sample, please file an issue: |
| 51 | https://github.com/googlesamples/android-AdvancedImmersiveMode |
| 52 | |
| 53 | Patches are encouraged, and may be submitted by forking this project and |
| 54 | submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. |
| 55 | |
| 56 | License |
| 57 | ------- |
| 58 | |
| Yuichi Araki | f302c13 | 2019-01-11 17:19:47 +0900 | [diff] [blame^] | 59 | Copyright 2019 The Android Open Source Project, Inc. |
| Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 60 | |
| 61 | Licensed to the Apache Software Foundation (ASF) under one or more contributor |
| 62 | license agreements. See the NOTICE file distributed with this work for |
| 63 | additional information regarding copyright ownership. The ASF licenses this |
| 64 | file to you under the Apache License, Version 2.0 (the "License"); you may not |
| 65 | use this file except in compliance with the License. You may obtain a copy of |
| 66 | the License at |
| 67 | |
| Trevor Johns | 89d2da0 | 2015-08-13 18:28:15 -0700 | [diff] [blame] | 68 | http://www.apache.org/licenses/LICENSE-2.0 |
| Trevor Johns | e904b62 | 2014-08-27 18:30:35 -0700 | [diff] [blame] | 69 | |
| 70 | Unless required by applicable law or agreed to in writing, software |
| 71 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 72 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 73 | License for the specific language governing permissions and limitations under |
| 74 | the License. |