private void vibrateIfEnabled ( ) { final boolean enabled = styledAttributes . getBoolean ( R . styleable . PinLock_vibrateOnClick , false ) ; if ( enabled ) { Vibrator v = ( Vibrator ) context . getSystemService ( Context . VIBRATOR_SERVICE ) ; final int duration = styledAttributes . getInt ( R . styleable . PinLock_vibrateDuration , 20 ) ; v . vibrate ( duration ) ; } }
Vibrate device on each key press if the feature is enabled