Class OsUtils


  • public class OsUtils
    extends java.lang.Object
    Operating system related utils.
    • Constructor Summary

      Constructors 
      Constructor Description
      OsUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getAndroidApiLevel()
      Returns the Android API level it's basically the same as android.os.Build.VERSION.SDK_INT
      static java.lang.String getShortcutFor​(int... keycodes)
      Creates platform dependant shortcut text.
      static boolean isAndroid()  
      static boolean isIos()  
      static boolean isMac()  
      static boolean isUnix()  
      static boolean isWindows()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OsUtils

        public OsUtils()
    • Method Detail

      • isWindows

        public static boolean isWindows()
        Returns:
        true if the current OS is Windows
      • isMac

        public static boolean isMac()
        Returns:
        true if the current OS is Mac
      • isUnix

        public static boolean isUnix()
        Returns:
        true if the current OS is Unix
      • isIos

        public static boolean isIos()
        Returns:
        true if the current OS is iOS
      • isAndroid

        public static boolean isAndroid()
        Returns:
        true if the current OS is Android
      • getAndroidApiLevel

        public static int getAndroidApiLevel()
        Returns the Android API level it's basically the same as android.os.Build.VERSION.SDK_INT
        Returns:
        the API level. Returns 0 if the current OS isn't Android
      • getShortcutFor

        public static java.lang.String getShortcutFor​(int... keycodes)
        Creates platform dependant shortcut text. Converts int keycodes to String text. Eg. Keys.CONTROL_LEFT, Keys.SHIFT_LEFT, Keys.F5 will be converted to Ctrl+Shift+F5 on Windows and Linux, and to ⌘⇧F5 on Mac.

        CONTROL_LEFT and CONTROL_RIGHT and SYM are mapped to Ctrl. The same goes for Alt (ALT_LEFT, ALT_RIGHT) and Shift (SHIFT_LEFT, SHIFT_RIGHT).

        Keycodes equal to Integer.MIN_VALUE will be ignored.

        Parameters:
        keycodes - keycodes from Input.Keys that are used to create shortcut text
        Returns:
        the platform dependent shortcut text