Class ShadowUIModeManager

java.lang.Object
org.robolectric.shadows.ShadowUIModeManager

@Implements(android.app.UiModeManager.class) public class ShadowUIModeManager extends Object
Shadow for UiModeManager.
  • Field Details

  • Constructor Details

    • ShadowUIModeManager

      public ShadowUIModeManager()
  • Method Details

    • getCurrentModeType

      @Implementation protected int getCurrentModeType()
    • setCurrentModeType

      public void setCurrentModeType(int modeType)
    • enableCarMode

      @Implementation(maxSdk=29) protected void enableCarMode(int flags)
    • enableCarMode

      @Implementation(minSdk=30) protected void enableCarMode(int priority, int flags)
    • disableCarMode

      @Implementation protected void disableCarMode(int flags)
    • getLastCarModePriority

      public int getLastCarModePriority()
      Returns the last set car mode priority

      It is changed by UiModeManager.enableCarMode(int) or UiModeManager.enableCarMode(int, int), and tracked by Robolectric for test purpose.

      Returns:
      The tracked last set car mode priority.
    • getLastFlags

      public int getLastFlags()
      Returns the last set flags.

      It is changed by UiModeManager.enableCarMode(int), UiModeManager.enableCarMode(int, int) or UiModeManager.disableCarMode(int), and tracked by Robolectric for test purpose.

      Returns:
      The tracked last set flags.
    • getNightMode

      @Implementation protected int getNightMode()
    • setNightMode

      @Implementation protected void setNightMode(int mode)
    • getProjectingPackages

      @Implementation(minSdk=31) protected Set<String> getProjectingPackages(int projectionType)
    • getApplicationNightMode

      public int getApplicationNightMode()
    • getActiveProjectionTypes

      public Set<Integer> getActiveProjectionTypes()
    • setFailOnProjectionToggle

      public void setFailOnProjectionToggle(boolean failOnProjectionToggle)
    • setApplicationNightMode

      @Implementation(minSdk=31) @HiddenApi protected void setApplicationNightMode(int mode)
    • requestProjection

      @Implementation(minSdk=31) protected boolean requestProjection(int projectionType)
    • releaseProjection

      @Implementation(minSdk=31) protected boolean releaseProjection(int projectionType)
    • getNightModeCustomType

      @Implementation(minSdk=33) protected int getNightModeCustomType()
    • isNightModeOn

      public boolean isNightModeOn()
      Returns whether night mode is currently on when a custom night mode type is selected.
    • setNightModeCustomType

      @Implementation(minSdk=33) protected void setNightModeCustomType(int mode)
    • setNightModeActivatedForCustomMode

      @Implementation(minSdk=33) protected boolean setNightModeActivatedForCustomMode(int mode, boolean active)
    • setContrast

      public void setContrast(float contrast)
      Sets the contrast value.

      The default value for contrast is 0.0f. The permitted values are between -1.0f and 1.0f inclusive.

    • reset

      @Resetter public static void reset()