Class DisplayHelper


  • public class DisplayHelper
    extends java.lang.Object
    DisplayHelper is here to help managing a Display, for instance being notified when its resolution or refresh rate changes.
    • Constructor Detail

      • DisplayHelper

        public DisplayHelper​(@NonNull
                             android.content.Context context,
                             @NonNull
                             android.os.Handler handler)
        Creates a DisplayHelper which helps manage a Display and provides a Handler where callbacks can execute filament code. Use this method if filament is executing on another thread.
        Parameters:
        context - a Context to used to retrieve teh DisplayManager
        handler - a Handler used to run callbacks accessing filament
    • Method Detail

      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • getAppVsyncOffsetNanos

        public static long getAppVsyncOffsetNanos​(@NonNull
                                                  android.view.Display display)
        Returns:
        the Display application vsync offset 0 if not supported
        See Also:
        Display.getAppVsyncOffsetNanos()
      • getPresentationDeadlineNanos

        public static long getPresentationDeadlineNanos​(@NonNull
                                                        android.view.Display display)
        Returns:
        the Display presentation deadline before the h/w vsync event in nanoseconds
        See Also:
        Display.getPresentationDeadlineNanos()
      • getRefreshRate

        public static float getRefreshRate​(@NonNull
                                           android.view.Display display)
        Returns:
        the Display refresh rate in Hz
        See Also:
        Display.getRefreshRate()
      • getRefreshPeriodNanos

        public static long getRefreshPeriodNanos​(@NonNull
                                                 android.view.Display display)
        Returns a Display's refresh period in nanoseconds
        Parameters:
        display - the Display to get the refresh period from
        Returns:
        the Display refresh period in nanoseconds