com.virtual.tour.road.util

## Class SystemUiHider

- java.lang.Object
- - com.virtual.tour.road.util.SystemUiHider

- Direct Known Subclasses:
    SystemUiHiderBase

      public abstract class SystemUiHider
      extends java.lang.Object

  A utility class that helps with showing and hiding system UI such as the status bar and navigation/system bar. This class uses backward-compatibility techniques described in Creating Backward-Compatible UIs to ensure that devices running any version of ndroid OS are supported. More specifically, there are separate implementations of this abstract class: for newer devices, `getInstance(android.app.Activity, android.view.View, int)` will return a `SystemUiHiderHoneycomb` instance, while on older devices `getInstance(android.app.Activity, android.view.View, int)` will return a `SystemUiHiderBase` instance.

  For more on system bars, see System Bars.
  See Also:
    `View.setSystemUiVisibility(int)`, `WindowManager.LayoutParams.FLAG_FULLSCREEN`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `SystemUiHider.OnVisibilityChangeListener` A callback interface used to listen for system UI visibility changes.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `FLAG_FULLSCREEN` When this flag is set, `show()` and `hide()` will toggle the visibility of the status bar.
    `static int` | `FLAG_HIDE_NAVIGATION` When this flag is set, `show()` and `hide()` will toggle the visibility of the navigation bar, if it's present on the device and the device allows hiding it.
    `static int` | `FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES` When this flag is set, the `WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN` flag will be set on older devices, making the status bar "float" on top of the activity layout.
    `protected android.app.Activity` | `mActivity` The activity associated with this UI hider object.
    `protected android.view.View` | `mAnchorView` The view on which `View.setSystemUiVisibility(int)` will be called.
    `protected int` | `mFlags` The current UI hider flags.
    `protected SystemUiHider.OnVisibilityChangeListener` | `mOnVisibilityChangeListener` The current visibility callback.
    `private static SystemUiHider.OnVisibilityChangeListener` | `sDummyListener` A dummy no-op callback for use when there is no other listener set.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SystemUiHider(android.app.Activity activity, android.view.View anchorView, int flags)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SystemUiHider` | `getInstance(android.app.Activity activity, android.view.View anchorView, int flags)` Creates and returns an instance of `SystemUiHider` that is appropriate for this device.
    `abstract void` | `hide()` Hide the system UI.
    `abstract boolean` | `isVisible()` Returns whether or not the system UI is visible.
    `void` | `setOnVisibilityChangeListener(SystemUiHider.OnVisibilityChangeListener listener)` Registers a callback, to be triggered when the system UI visibility changes.
    `abstract void` | `setup()` Sets up the system UI hider.
    `abstract void` | `show()` Show the system UI.
    `void` | `toggle()` Toggle the visibility of the system UI.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### FLAG_FULLSCREEN

          public static final int FLAG_FULLSCREEN

      When this flag is set, `show()` and `hide()` will toggle the visibility of the status bar. If there is a navigation bar, show and hide will toggle low profile mode.
      See Also:
        Constant Field Values

    - #### FLAG_HIDE_NAVIGATION

          public static final int FLAG_HIDE_NAVIGATION

      When this flag is set, `show()` and `hide()` will toggle the visibility of the navigation bar, if it's present on the device and the device allows hiding it. In cases where the navigation bar is present but cannot be hidden, show and hide will toggle low profile mode.
      See Also:
        Constant Field Values

    - #### FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES

          public static final int FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES

      When this flag is set, the `WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN` flag will be set on older devices, making the status bar "float" on top of the activity layout. This is most useful when there are no controls at the top of the activity layout.

      This flag isn't used on newer devices because the action bar, the most important structural element of an Android app, should be visible and not obscured by the system UI.
      See Also:
        Constant Field Values

    - #### mActivity

          protected android.app.Activity mActivity

      The activity associated with this UI hider object.

    - #### mAnchorView

          protected android.view.View mAnchorView

      The view on which `View.setSystemUiVisibility(int)` will be called.

    - #### mFlags

          protected int mFlags

      The current UI hider flags.
      See Also:
        `FLAG_FULLSCREEN`, `FLAG_HIDE_NAVIGATION`, `FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES`

    - #### mOnVisibilityChangeListener

          protected SystemUiHider.OnVisibilityChangeListener mOnVisibilityChangeListener

      The current visibility callback.

    - #### sDummyListener

          private static SystemUiHider.OnVisibilityChangeListener sDummyListener

      A dummy no-op callback for use when there is no other listener set.

  - ### Constructor Detail

    - #### SystemUiHider

          protected SystemUiHider(android.app.Activity activity,
                                  android.view.View anchorView,
                                  int flags)

  - ### Method Detail

    - #### getInstance

          public static SystemUiHider getInstance(android.app.Activity activity,
                                                  android.view.View anchorView,
                                                  int flags)

      Creates and returns an instance of `SystemUiHider` that is appropriate for this device. The object will be either a `SystemUiHiderBase` or `SystemUiHiderHoneycomb` depending on the device.
      Parameters:
        `activity` - The activity whose window's system UI should be controlled by this class.
        `anchorView` - The view on which `View.setSystemUiVisibility(int)` will be called.
        `flags` - Either 0 or any combination of `FLAG_FULLSCREEN`, `FLAG_HIDE_NAVIGATION`, and `FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES`.

    - #### hide

          public abstract void hide()

      Hide the system UI.

    - #### isVisible

          public abstract boolean isVisible()

      Returns whether or not the system UI is visible.

    - #### setOnVisibilityChangeListener

          public void setOnVisibilityChangeListener(SystemUiHider.OnVisibilityChangeListener listener)

      Registers a callback, to be triggered when the system UI visibility changes.

    - #### setup

          public abstract void setup()

      Sets up the system UI hider. Should be called from `Activity.onCreate(android.os.Bundle)`.

    - #### show

          public abstract void show()

      Show the system UI.

    - #### toggle

          public void toggle()

      Toggle the visibility of the system UI.