Class ShadowVibrator

    • Constructor Detail

      • ShadowVibrator

        public ShadowVibrator()
    • Method Detail

      • setHasVibrator

        public void setHasVibrator​(boolean hasVibrator)
        Controls the return value of Vibrator.hasVibrator() the default is true.
      • setHasAmplitudeControl

        public void setHasAmplitudeControl​(boolean hasAmplitudeControl)
        Controls the return value of Vibrator.hasAmplitudeControl() the default is false.
      • isCancelled

        public boolean isCancelled()
        Returns true if the Vibrator has been cancelled.
      • getMilliseconds

        public long getMilliseconds()
        Returns the last vibration duration in MS.
      • getPattern

        public long[] getPattern()
        Returns the last vibration pattern.
      • getEffectId

        public int getEffectId()
        Returns the last vibration effect ID of a VibrationEffect#Prebaked (e.g. VibrationEffect.EFFECT_CLICK).

        This field is non-zero only if a VibrationEffect#Prebaked was ever requested.

      • getRepeat

        public int getRepeat()
        Returns the last vibration repeat times.
      • areAllPrimitivesSupported

        @Implementation(minSdk=30)
        protected boolean areAllPrimitivesSupported​(int... primitiveIds)
      • setSupportedPrimitives

        public void setSupportedPrimitives​(Collection<Integer> primitives)
        Adds supported vibration primitives.