Class LayoutSonifier

  • java.lang.Object

  • public class LayoutSonifier
    extends java.lang.Object
    The LayoutSonifier provides the sonification of a View. When a View is sonified the user can swipe on it with their finger and receive audio and haptic cues about it. The View is rendered in audio by uttering (through the Android test to speech synthesizer) the content description, as per getContentDescription(). Furthermore, if the View is also a TextView the text is uttered too, right after the content description. Haptic rendering is just a vibration of the device. A View that is also a ViewGroup is recursively searched in its children until the non ViewGruop that is under the coordinates of the user touch is found. The way each View is sonified can be customized by subclassing this class and providing a custom implementation of SonifyView().
    • Constructor Summary

      Modifier Constructor and Description
      protected LayoutSonifier() 
    • Constructor Detail

      • LayoutSonifier

        protected LayoutSonifier()
    • Method Detail

      • getInstance

        public static LayoutSonifier getInstance()
        static factory method enforces the existance of only one instance of this class at time (singleton)
        an instance of LayoutSonifier
      • onTouch

        public boolean onTouch(View view,
                               MotionEvent evt,
                               AccessibilityService accessibilityService)
      • sonifyView

        protected void sonifyView(View v,
                                  AccessibilityService accessibilityService)
        This method is called when the view under the user's finger is found. The content description (as per View.getContentDesctpion() is uttered if not null, otherwise, if the View is a text view, the string returned by TextView.getText() is uttered. A vibration is triggered regardless of the type of the View. Subclasses can overwrite this method to provide their own sonification of the view touched by the user. Unless it's an AccessibleSpinner or a AccessibleCheckbox is never a ViewGroup as if a ViewGroup is met the view it contains are recursively searched for the one under the user's finger.
        v - the view touched by the user
        accessibilityService - the accessibility service used to sonify the view