Class AndroidPreconditions


  • public class AndroidPreconditions
    extends java.lang.Object
    Helper class for common android specific preconditions used inside of RenderCore.
    • Constructor Detail

      • AndroidPreconditions

        public AndroidPreconditions()
    • Method Detail

      • checkUiThread

        public static void checkUiThread()
        Ensure that the code is being executed on Android's UI thread. Null-Op if the Android API isn't available (i.e. for unit tests.
      • checkMinAndroidApiLevel

        public static void checkMinAndroidApiLevel()
        Enforce the minimum Android api level
        Throws:
        java.lang.IllegalStateException - if the api level is not high enough
      • isAndroidApiAvailable

        public static boolean isAndroidApiAvailable()
        Returns true if the Android API is currently available. Useful for branching functionality to make it testable via junit. The android API is available for Robolectric tests and android emulator tests.
      • isUnderTesting

        public static boolean isUnderTesting()
      • isMinAndroidApiLevel

        public static boolean isMinAndroidApiLevel()
        Returns true if the Android api level is above the minimum or if not on Android.

        Also returns true if not on Android or in a test.

      • setUnderTesting

        public static void setUnderTesting​(boolean isUnderTesting)