@rafaelaugusto/jolt 0.1.0-beta.9 → 0.1.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +167 -21
- package/dist/animate.d.ts +25 -4
- package/dist/animate.d.ts.map +1 -1
- package/dist/animate.js +67 -26
- package/dist/animate.js.map +1 -1
- package/dist/blur/index.d.ts +6 -0
- package/dist/blur/index.d.ts.map +1 -0
- package/dist/blur/index.js +196 -0
- package/dist/blur/index.js.map +1 -0
- package/dist/blur/native.d.ts +17 -0
- package/dist/blur/native.d.ts.map +1 -0
- package/dist/blur/native.js +44 -0
- package/dist/blur/native.js.map +1 -0
- package/dist/blur/types.d.ts +32 -0
- package/dist/blur/types.d.ts.map +1 -0
- package/dist/blur/types.js +2 -0
- package/dist/blur/types.js.map +1 -0
- package/dist/bottom-sheet/geometry.d.ts +18 -0
- package/dist/bottom-sheet/geometry.d.ts.map +1 -0
- package/dist/bottom-sheet/geometry.js +51 -0
- package/dist/bottom-sheet/geometry.js.map +1 -0
- package/dist/bottom-sheet/index.d.ts +56 -0
- package/dist/bottom-sheet/index.d.ts.map +1 -0
- package/dist/bottom-sheet/index.js +462 -0
- package/dist/bottom-sheet/index.js.map +1 -0
- package/dist/bottom-sheet/native.d.ts +11 -0
- package/dist/bottom-sheet/native.d.ts.map +1 -0
- package/dist/bottom-sheet/native.js +173 -0
- package/dist/bottom-sheet/native.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +40 -1
- package/dist/config.js.map +1 -1
- package/dist/decay.d.ts +1 -0
- package/dist/decay.d.ts.map +1 -1
- package/dist/decay.js +7 -0
- package/dist/decay.js.map +1 -1
- package/dist/drag-physics.d.ts +6 -1
- package/dist/drag-physics.d.ts.map +1 -1
- package/dist/drag.d.ts +17 -3
- package/dist/drag.d.ts.map +1 -1
- package/dist/drag.js +34 -11
- package/dist/drag.js.map +1 -1
- package/dist/driver/android-gradient.d.ts +5 -0
- package/dist/driver/android-gradient.d.ts.map +1 -0
- package/dist/driver/android-gradient.js +99 -0
- package/dist/driver/android-gradient.js.map +1 -0
- package/dist/driver/android-particles.d.ts +6 -0
- package/dist/driver/android-particles.d.ts.map +1 -0
- package/dist/driver/android-particles.js +93 -0
- package/dist/driver/android-particles.js.map +1 -0
- package/dist/driver/android.d.ts.map +1 -1
- package/dist/driver/android.js +27 -1
- package/dist/driver/android.js.map +1 -1
- package/dist/driver/frame.d.ts +3 -0
- package/dist/driver/frame.d.ts.map +1 -0
- package/dist/driver/frame.js +7 -0
- package/dist/driver/frame.js.map +1 -0
- package/dist/driver/index.d.ts +4 -0
- package/dist/driver/index.d.ts.map +1 -1
- package/dist/driver/index.js.map +1 -1
- package/dist/driver/ios-gradient.d.ts +5 -0
- package/dist/driver/ios-gradient.d.ts.map +1 -0
- package/dist/driver/ios-gradient.js +131 -0
- package/dist/driver/ios-gradient.js.map +1 -0
- package/dist/driver/ios-scroll-delegate.d.ts +4 -0
- package/dist/driver/ios-scroll-delegate.d.ts.map +1 -0
- package/dist/driver/ios-scroll-delegate.js +26 -0
- package/dist/driver/ios-scroll-delegate.js.map +1 -0
- package/dist/driver/ios.d.ts.map +1 -1
- package/dist/driver/ios.js +9 -0
- package/dist/driver/ios.js.map +1 -1
- package/dist/easing.d.ts +3 -1
- package/dist/easing.d.ts.map +1 -1
- package/dist/easing.js +18 -1
- package/dist/easing.js.map +1 -1
- package/dist/engine.d.ts +31 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +194 -42
- package/dist/engine.js.map +1 -1
- package/dist/gesture-native.d.ts +28 -0
- package/dist/gesture-native.d.ts.map +1 -0
- package/dist/gesture-native.js +61 -0
- package/dist/gesture-native.js.map +1 -0
- package/dist/gestures/index.d.ts +69 -0
- package/dist/gestures/index.d.ts.map +1 -0
- package/dist/gestures/index.js +262 -0
- package/dist/gestures/index.js.map +1 -0
- package/dist/glass/index.d.ts +55 -0
- package/dist/glass/index.d.ts.map +1 -0
- package/dist/glass/index.js +205 -0
- package/dist/glass/index.js.map +1 -0
- package/dist/gradient-binding.d.ts +38 -0
- package/dist/gradient-binding.d.ts.map +1 -0
- package/dist/gradient-binding.js +128 -0
- package/dist/gradient-binding.js.map +1 -0
- package/dist/gradient.d.ts +105 -0
- package/dist/gradient.d.ts.map +1 -0
- package/dist/gradient.js +514 -0
- package/dist/gradient.js.map +1 -0
- package/dist/gravity.d.ts +13 -0
- package/dist/gravity.d.ts.map +1 -0
- package/dist/gravity.js +84 -0
- package/dist/gravity.js.map +1 -0
- package/dist/haptics.d.ts.map +1 -1
- package/dist/haptics.js +101 -28
- package/dist/haptics.js.map +1 -1
- package/dist/image-effect.d.ts +1 -0
- package/dist/image-effect.d.ts.map +1 -1
- package/dist/image-effect.js +10 -2
- package/dist/image-effect.js.map +1 -1
- package/dist/index.d.ts +19 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/inspector/index.d.ts +86 -0
- package/dist/inspector/index.d.ts.map +1 -0
- package/dist/inspector/index.js +419 -0
- package/dist/inspector/index.js.map +1 -0
- package/dist/inspector/plot.d.ts +4 -0
- package/dist/inspector/plot.d.ts.map +1 -0
- package/dist/inspector/plot.js +23 -0
- package/dist/inspector/plot.js.map +1 -0
- package/dist/inspector/probe.d.ts +19 -0
- package/dist/inspector/probe.d.ts.map +1 -0
- package/dist/inspector/probe.js +37 -0
- package/dist/inspector/probe.js.map +1 -0
- package/dist/inspector/tuning.d.ts +19 -0
- package/dist/inspector/tuning.d.ts.map +1 -0
- package/dist/inspector/tuning.js +37 -0
- package/dist/inspector/tuning.js.map +1 -0
- package/dist/interactive-navigation/index.d.ts +44 -0
- package/dist/interactive-navigation/index.d.ts.map +1 -0
- package/dist/interactive-navigation/index.js +350 -0
- package/dist/interactive-navigation/index.js.map +1 -0
- package/dist/keyboard.d.ts +24 -0
- package/dist/keyboard.d.ts.map +1 -1
- package/dist/keyboard.js +199 -6
- package/dist/keyboard.js.map +1 -1
- package/dist/live-spring-driver.d.ts +52 -0
- package/dist/live-spring-driver.d.ts.map +1 -0
- package/dist/live-spring-driver.js +104 -0
- package/dist/live-spring-driver.js.map +1 -0
- package/dist/mixer.d.ts +55 -0
- package/dist/mixer.d.ts.map +1 -0
- package/dist/mixer.js +286 -0
- package/dist/mixer.js.map +1 -0
- package/dist/motion-scope.d.ts +8 -2
- package/dist/motion-scope.d.ts.map +1 -1
- package/dist/motion-scope.js +24 -3
- package/dist/motion-scope.js.map +1 -1
- package/dist/motion-states.d.ts +19 -7
- package/dist/motion-states.d.ts.map +1 -1
- package/dist/motion-states.js +116 -26
- package/dist/motion-states.js.map +1 -1
- package/dist/motion-value.d.ts +227 -0
- package/dist/motion-value.d.ts.map +1 -0
- package/dist/motion-value.js +1074 -0
- package/dist/motion-value.js.map +1 -0
- package/dist/native/index.d.ts +10 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +6 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native-properties.d.ts +28 -0
- package/dist/native-properties.d.ts.map +1 -0
- package/dist/native-properties.js +154 -0
- package/dist/native-properties.js.map +1 -0
- package/dist/native-property-driver.d.ts +19 -0
- package/dist/native-property-driver.d.ts.map +1 -0
- package/dist/native-property-driver.js +69 -0
- package/dist/native-property-driver.js.map +1 -0
- package/dist/native-property.d.ts +37 -0
- package/dist/native-property.d.ts.map +1 -0
- package/dist/native-property.js +285 -0
- package/dist/native-property.js.map +1 -0
- package/dist/particles.d.ts +5 -2
- package/dist/particles.d.ts.map +1 -1
- package/dist/particles.js +16 -10
- package/dist/particles.js.map +1 -1
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +2 -2
- package/dist/path.js.map +1 -1
- package/dist/physics/index.d.ts +139 -0
- package/dist/physics/index.d.ts.map +1 -0
- package/dist/physics/index.js +316 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/native.d.ts +54 -0
- package/dist/physics/native.d.ts.map +1 -0
- package/dist/physics/native.js +64 -0
- package/dist/physics/native.js.map +1 -0
- package/dist/playback-group.d.ts.map +1 -1
- package/dist/playback-group.js +17 -1
- package/dist/playback-group.js.map +1 -1
- package/dist/playback.d.ts +15 -0
- package/dist/playback.d.ts.map +1 -1
- package/dist/playback.js +23 -0
- package/dist/playback.js.map +1 -1
- package/dist/predictive-back/index.d.ts +45 -0
- package/dist/predictive-back/index.d.ts.map +1 -0
- package/dist/predictive-back/index.js +220 -0
- package/dist/predictive-back/index.js.map +1 -0
- package/dist/predictive-back/presentation.d.ts +4 -0
- package/dist/predictive-back/presentation.d.ts.map +1 -0
- package/dist/predictive-back/presentation.js +3 -0
- package/dist/predictive-back/presentation.js.map +1 -0
- package/dist/press.d.ts.map +1 -1
- package/dist/press.js +11 -2
- package/dist/press.js.map +1 -1
- package/dist/reorder/handle.d.ts +6 -0
- package/dist/reorder/handle.d.ts.map +1 -0
- package/dist/reorder/handle.js +10 -0
- package/dist/reorder/handle.js.map +1 -0
- package/dist/reorder/index.d.ts +10 -0
- package/dist/reorder/index.d.ts.map +1 -0
- package/dist/reorder/index.js +233 -0
- package/dist/reorder/index.js.map +1 -0
- package/dist/reorder/list-view.d.ts +5 -0
- package/dist/reorder/list-view.d.ts.map +1 -0
- package/dist/reorder/list-view.js +238 -0
- package/dist/reorder/list-view.js.map +1 -0
- package/dist/reorder/model.d.ts +6 -0
- package/dist/reorder/model.d.ts.map +1 -0
- package/dist/reorder/model.js +30 -0
- package/dist/reorder/model.js.map +1 -0
- package/dist/reorder/surface.d.ts +6 -0
- package/dist/reorder/surface.d.ts.map +1 -0
- package/dist/reorder/surface.js +10 -0
- package/dist/reorder/surface.js.map +1 -0
- package/dist/reorder/types.d.ts +92 -0
- package/dist/reorder/types.d.ts.map +1 -0
- package/dist/reorder/types.js +2 -0
- package/dist/reorder/types.js.map +1 -0
- package/dist/sampling.d.ts +35 -0
- package/dist/sampling.d.ts.map +1 -0
- package/dist/sampling.js +123 -0
- package/dist/sampling.js.map +1 -0
- package/dist/scene-appearance.d.ts +14 -0
- package/dist/scene-appearance.d.ts.map +1 -0
- package/dist/scene-appearance.js +68 -0
- package/dist/scene-appearance.js.map +1 -0
- package/dist/scene-camera.d.ts +5 -0
- package/dist/scene-camera.d.ts.map +1 -0
- package/dist/scene-camera.js +23 -0
- package/dist/scene-camera.js.map +1 -0
- package/dist/scene-shader.d.ts +18 -0
- package/dist/scene-shader.d.ts.map +1 -0
- package/dist/scene-shader.js +76 -0
- package/dist/scene-shader.js.map +1 -0
- package/dist/scroll-header/geometry.d.ts +18 -0
- package/dist/scroll-header/geometry.d.ts.map +1 -0
- package/dist/scroll-header/geometry.js +46 -0
- package/dist/scroll-header/geometry.js.map +1 -0
- package/dist/scroll-header/index.d.ts +48 -0
- package/dist/scroll-header/index.d.ts.map +1 -0
- package/dist/scroll-header/index.js +399 -0
- package/dist/scroll-header/index.js.map +1 -0
- package/dist/scroll-header/native.d.ts +28 -0
- package/dist/scroll-header/native.d.ts.map +1 -0
- package/dist/scroll-header/native.js +43 -0
- package/dist/scroll-header/native.js.map +1 -0
- package/dist/sensors/index.d.ts +69 -0
- package/dist/sensors/index.d.ts.map +1 -0
- package/dist/sensors/index.js +149 -0
- package/dist/sensors/index.js.map +1 -0
- package/dist/sensors/native.d.ts +20 -0
- package/dist/sensors/native.d.ts.map +1 -0
- package/dist/sensors/native.js +48 -0
- package/dist/sensors/native.js.map +1 -0
- package/dist/sequence.d.ts +24 -0
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +181 -19
- package/dist/sequence.js.map +1 -1
- package/dist/shapes/android.d.ts +3 -0
- package/dist/shapes/android.d.ts.map +1 -0
- package/dist/shapes/android.js +51 -0
- package/dist/shapes/android.js.map +1 -0
- package/dist/shapes/index.d.ts +6 -0
- package/dist/shapes/index.d.ts.map +1 -0
- package/dist/shapes/index.js +238 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/ios.d.ts +3 -0
- package/dist/shapes/ios.d.ts.map +1 -0
- package/dist/shapes/ios.js +164 -0
- package/dist/shapes/ios.js.map +1 -0
- package/dist/shapes/native.d.ts +18 -0
- package/dist/shapes/native.d.ts.map +1 -0
- package/dist/shapes/native.js +10 -0
- package/dist/shapes/native.js.map +1 -0
- package/dist/shapes/path.d.ts +10 -0
- package/dist/shapes/path.d.ts.map +1 -0
- package/dist/shapes/path.js +106 -0
- package/dist/shapes/path.js.map +1 -0
- package/dist/shapes/types.d.ts +55 -0
- package/dist/shapes/types.d.ts.map +1 -0
- package/dist/shapes/types.js +11 -0
- package/dist/shapes/types.js.map +1 -0
- package/dist/shared-layout/index.d.ts +40 -0
- package/dist/shared-layout/index.d.ts.map +1 -0
- package/dist/shared-layout/index.js +267 -0
- package/dist/shared-layout/index.js.map +1 -0
- package/dist/shared-layout/native.d.ts +15 -0
- package/dist/shared-layout/native.d.ts.map +1 -0
- package/dist/shared-layout/native.js +79 -0
- package/dist/shared-layout/native.js.map +1 -0
- package/dist/shared-layout/timing.d.ts +9 -0
- package/dist/shared-layout/timing.d.ts.map +1 -0
- package/dist/shared-layout/timing.js +68 -0
- package/dist/shared-layout/timing.js.map +1 -0
- package/dist/shared-navigation/entry.d.ts +51 -0
- package/dist/shared-navigation/entry.d.ts.map +1 -0
- package/dist/shared-navigation/entry.js +619 -0
- package/dist/shared-navigation/entry.js.map +1 -0
- package/dist/shared-navigation/index.d.ts +58 -0
- package/dist/shared-navigation/index.d.ts.map +1 -0
- package/dist/shared-navigation/index.js +318 -0
- package/dist/shared-navigation/index.js.map +1 -0
- package/dist/shared-navigation/return-signal.d.ts +16 -0
- package/dist/shared-navigation/return-signal.d.ts.map +1 -0
- package/dist/shared-navigation/return-signal.js +35 -0
- package/dist/shared-navigation/return-signal.js.map +1 -0
- package/dist/shared-navigation/return-target.d.ts +32 -0
- package/dist/shared-navigation/return-target.d.ts.map +1 -0
- package/dist/shared-navigation/return-target.js +168 -0
- package/dist/shared-navigation/return-target.js.map +1 -0
- package/dist/shared-navigation/scope.d.ts +4 -0
- package/dist/shared-navigation/scope.d.ts.map +1 -0
- package/dist/shared-navigation/scope.js +2 -0
- package/dist/shared-navigation/scope.js.map +1 -0
- package/dist/shared-navigation/targets.d.ts +6 -0
- package/dist/shared-navigation/targets.d.ts.map +1 -0
- package/dist/shared-navigation/targets.js +36 -0
- package/dist/shared-navigation/targets.js.map +1 -0
- package/dist/size-layout.d.ts +19 -0
- package/dist/size-layout.d.ts.map +1 -0
- package/dist/size-layout.js +216 -0
- package/dist/size-layout.js.map +1 -0
- package/dist/size.d.ts +19 -0
- package/dist/size.d.ts.map +1 -0
- package/dist/size.js +251 -0
- package/dist/size.js.map +1 -0
- package/dist/spring.d.ts +2 -0
- package/dist/spring.d.ts.map +1 -1
- package/dist/spring.js +11 -0
- package/dist/spring.js.map +1 -1
- package/dist/svg-path.d.ts +18 -0
- package/dist/svg-path.d.ts.map +1 -1
- package/dist/svg-path.js +3 -2
- package/dist/svg-path.js.map +1 -1
- package/dist/testing/clock.d.ts +40 -0
- package/dist/testing/clock.d.ts.map +1 -0
- package/dist/testing/clock.js +116 -0
- package/dist/testing/clock.js.map +1 -0
- package/dist/testing/handoff-recorder.d.ts +8 -0
- package/dist/testing/handoff-recorder.d.ts.map +1 -0
- package/dist/testing/handoff-recorder.js +77 -0
- package/dist/testing/handoff-recorder.js.map +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/native.d.ts +46 -0
- package/dist/testing/native.d.ts.map +1 -0
- package/dist/testing/native.js +313 -0
- package/dist/testing/native.js.map +1 -0
- package/dist/testing/presentation.d.ts +11 -0
- package/dist/testing/presentation.d.ts.map +1 -0
- package/dist/testing/presentation.js +45 -0
- package/dist/testing/presentation.js.map +1 -0
- package/dist/testing/replay.d.ts +39 -0
- package/dist/testing/replay.d.ts.map +1 -0
- package/dist/testing/replay.js +99 -0
- package/dist/testing/replay.js.map +1 -0
- package/dist/testing/scroll-handoff-native.d.ts +10 -0
- package/dist/testing/scroll-handoff-native.d.ts.map +1 -0
- package/dist/testing/scroll-handoff-native.js +151 -0
- package/dist/testing/scroll-handoff-native.js.map +1 -0
- package/dist/testing/scroll-handoff.d.ts +25 -0
- package/dist/testing/scroll-handoff.d.ts.map +1 -0
- package/dist/testing/scroll-handoff.js +127 -0
- package/dist/testing/scroll-handoff.js.map +1 -0
- package/dist/testing/sensors.d.ts +13 -0
- package/dist/testing/sensors.d.ts.map +1 -0
- package/dist/testing/sensors.js +26 -0
- package/dist/testing/sensors.js.map +1 -0
- package/dist/testing/trace.d.ts +101 -0
- package/dist/testing/trace.d.ts.map +1 -0
- package/dist/testing/trace.js +263 -0
- package/dist/testing/trace.js.map +1 -0
- package/dist/timed-animation.d.ts +38 -0
- package/dist/timed-animation.d.ts.map +1 -0
- package/dist/timed-animation.js +177 -0
- package/dist/timed-animation.js.map +1 -0
- package/dist/track.d.ts +3 -0
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +281 -40
- package/dist/track.js.map +1 -1
- package/dist/transition.d.ts +54 -2
- package/dist/transition.d.ts.map +1 -1
- package/dist/transition.js +128 -8
- package/dist/transition.js.map +1 -1
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/value-observers.d.ts +22 -0
- package/dist/value-observers.d.ts.map +1 -0
- package/dist/value-observers.js +122 -0
- package/dist/value-observers.js.map +1 -0
- package/dist/value-track.d.ts +13 -0
- package/dist/value-track.d.ts.map +1 -0
- package/dist/value-track.js +59 -0
- package/dist/value-track.js.map +1 -0
- package/dist/vue/index.d.ts +33 -3
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +118 -3
- package/dist/vue/index.js.map +1 -1
- package/dist/zoomable.d.ts +1 -1
- package/dist/zoomable.d.ts.map +1 -1
- package/package.json +68 -3
- package/platforms/android/include.gradle +10 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/BlurEffect.java +89 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/CircleMath.java +158 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/CircleWorld.java +221 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GestureSession.java +227 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GestureSurface.java +54 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GradientLayer.java +224 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrame.java +53 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrameFollower.java +57 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardObserver.java +97 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/LiveSpring.java +277 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/MotionProbe.java +70 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ParticleEmitter.java +192 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ParticleSimulation.java +114 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/PredictiveBackSession.java +212 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderHandle.java +25 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSession.java +213 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSurface.java +27 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ScrollHeader.java +84 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SensorMath.java +28 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SensorSource.java +217 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ShapeLayer.java +120 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SharedLayoutFlight.java +287 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SharedNavigationScene.java +115 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SpringState.java +39 -0
- package/platforms/android/proguard-rules.pro +20 -0
- package/platforms/ios/build.xcconfig +1 -1
- package/platforms/ios/src/JoltBlur.h +14 -0
- package/platforms/ios/src/JoltBlur.m +86 -0
- package/platforms/ios/src/JoltCircleMath.h +191 -0
- package/platforms/ios/src/JoltCircleWorld.h +18 -0
- package/platforms/ios/src/JoltCircleWorld.m +218 -0
- package/platforms/ios/src/JoltGestureSession.h +23 -0
- package/platforms/ios/src/JoltGestureSession.m +251 -0
- package/platforms/ios/src/JoltInteractiveNavigation.h +23 -0
- package/platforms/ios/src/JoltInteractiveNavigation.m +255 -0
- package/platforms/ios/src/JoltLiveSpring.h +29 -0
- package/platforms/ios/src/JoltLiveSpring.m +243 -0
- package/platforms/ios/src/JoltMotionProbe.h +9 -0
- package/platforms/ios/src/JoltMotionProbe.m +72 -0
- package/platforms/ios/src/JoltReorderSession.h +15 -0
- package/platforms/ios/src/JoltReorderSession.m +205 -0
- package/platforms/ios/src/JoltScrollHeader.h +13 -0
- package/platforms/ios/src/JoltScrollHeader.m +101 -0
- package/platforms/ios/src/JoltSensorMath.h +39 -0
- package/platforms/ios/src/JoltSensorSource.h +13 -0
- package/platforms/ios/src/JoltSensorSource.m +201 -0
- package/platforms/ios/src/JoltSharedLayoutFlight.h +19 -0
- package/platforms/ios/src/JoltSharedLayoutFlight.m +250 -0
- package/platforms/ios/src/JoltSpringState.h +35 -0
- package/platforms/ios/src/module.modulemap +10 -0
- package/src/android-plugin.d.ts +464 -0
- package/src/animate.ts +129 -15
- package/src/blur/index.ts +195 -0
- package/src/blur/native.ts +70 -0
- package/src/blur/types.ts +32 -0
- package/src/bottom-sheet/geometry.ts +84 -0
- package/src/bottom-sheet/index.ts +536 -0
- package/src/bottom-sheet/native.ts +214 -0
- package/src/config.ts +39 -1
- package/src/decay.ts +9 -0
- package/src/drag.ts +67 -21
- package/src/driver/android-gradient.ts +116 -0
- package/src/driver/android-particles.ts +118 -0
- package/src/driver/android.ts +31 -1
- package/src/driver/frame.ts +10 -0
- package/src/driver/index.ts +4 -0
- package/src/driver/ios-gradient.ts +136 -0
- package/src/driver/ios-scroll-delegate.ts +23 -0
- package/src/driver/ios.ts +10 -0
- package/src/easing.ts +21 -1
- package/src/engine.ts +209 -60
- package/src/gesture-native.ts +139 -0
- package/src/gestures/index.ts +365 -0
- package/src/glass/index.ts +218 -0
- package/src/gradient-binding.ts +158 -0
- package/src/gradient.ts +663 -0
- package/src/gravity.ts +107 -0
- package/src/haptics.ts +106 -28
- package/src/image-effect.ts +10 -2
- package/src/index.ts +56 -7
- package/src/inspector/index.ts +523 -0
- package/src/inspector/plot.ts +27 -0
- package/src/inspector/probe.ts +50 -0
- package/src/inspector/tuning.ts +51 -0
- package/src/interactive-navigation/index.ts +427 -0
- package/src/ios-plugin.d.ts +280 -0
- package/src/keyboard.ts +231 -7
- package/src/live-spring-driver.ts +181 -0
- package/src/mixer.ts +312 -0
- package/src/motion-scope.ts +39 -6
- package/src/motion-states.ts +149 -42
- package/src/motion-value.ts +1289 -0
- package/src/native/index.ts +30 -0
- package/src/native-properties.ts +188 -0
- package/src/native-property-driver.ts +123 -0
- package/src/native-property.ts +366 -0
- package/src/particles.ts +18 -17
- package/src/path.ts +2 -1
- package/src/physics/index.ts +476 -0
- package/src/physics/native.ts +121 -0
- package/src/playback-group.ts +17 -1
- package/src/playback.ts +41 -0
- package/src/predictive-back/index.ts +280 -0
- package/src/predictive-back/presentation.ts +6 -0
- package/src/press.ts +10 -2
- package/src/reorder/handle.ts +9 -0
- package/src/reorder/index.ts +243 -0
- package/src/reorder/list-view.ts +262 -0
- package/src/reorder/model.ts +47 -0
- package/src/reorder/surface.ts +10 -0
- package/src/reorder/types.ts +87 -0
- package/src/sampling.ts +173 -0
- package/src/scene-appearance.ts +92 -0
- package/src/scene-camera.ts +30 -0
- package/src/scene-shader.ts +139 -0
- package/src/scroll-header/geometry.ts +88 -0
- package/src/scroll-header/index.ts +530 -0
- package/src/scroll-header/native.ts +89 -0
- package/src/sensors/index.ts +246 -0
- package/src/sensors/native.ts +72 -0
- package/src/sequence.ts +209 -20
- package/src/shapes/android.ts +63 -0
- package/src/shapes/index.ts +267 -0
- package/src/shapes/ios.ts +194 -0
- package/src/shapes/native.ts +27 -0
- package/src/shapes/path.ts +127 -0
- package/src/shapes/types.ts +63 -0
- package/src/shared-layout/index.ts +343 -0
- package/src/shared-layout/native.ts +138 -0
- package/src/shared-layout/timing.ts +87 -0
- package/src/shared-navigation/entry.ts +695 -0
- package/src/shared-navigation/index.ts +414 -0
- package/src/shared-navigation/return-signal.ts +41 -0
- package/src/shared-navigation/return-target.ts +197 -0
- package/src/shared-navigation/scope.ts +3 -0
- package/src/shared-navigation/targets.ts +38 -0
- package/src/size-layout.ts +237 -0
- package/src/size.ts +302 -0
- package/src/spring.ts +18 -0
- package/src/svg-path.ts +8 -3
- package/src/testing/clock.ts +128 -0
- package/src/testing/handoff-recorder.ts +98 -0
- package/src/testing/index.ts +4 -0
- package/src/testing/native.ts +386 -0
- package/src/testing/presentation.ts +46 -0
- package/src/testing/replay.ts +149 -0
- package/src/testing/scroll-handoff-native.ts +201 -0
- package/src/testing/scroll-handoff.ts +140 -0
- package/src/testing/sensors.ts +41 -0
- package/src/testing/trace.ts +340 -0
- package/src/timed-animation.ts +192 -0
- package/src/track.ts +334 -38
- package/src/transition.ts +197 -9
- package/src/types.ts +11 -1
- package/src/value-observers.ts +147 -0
- package/src/value-track.ts +71 -0
- package/src/vue/index.ts +147 -1
- package/src/zoomable.ts +1 -1
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
package org.rafaelaugusto.jolt;
|
|
2
|
+
|
|
3
|
+
import android.animation.Animator;
|
|
4
|
+
import android.animation.AnimatorListenerAdapter;
|
|
5
|
+
import android.animation.ValueAnimator;
|
|
6
|
+
import android.graphics.Canvas;
|
|
7
|
+
import android.graphics.ColorFilter;
|
|
8
|
+
import android.graphics.LinearGradient;
|
|
9
|
+
import android.graphics.Matrix;
|
|
10
|
+
import android.graphics.Paint;
|
|
11
|
+
import android.graphics.PixelFormat;
|
|
12
|
+
import android.graphics.RadialGradient;
|
|
13
|
+
import android.graphics.Rect;
|
|
14
|
+
import android.graphics.RectF;
|
|
15
|
+
import android.graphics.Shader;
|
|
16
|
+
import android.graphics.SweepGradient;
|
|
17
|
+
import android.view.animation.LinearInterpolator;
|
|
18
|
+
|
|
19
|
+
/** Paints a linear, radial or conic gradient and plays sampled frames. All frame updates stay in native code. */
|
|
20
|
+
public final class GradientLayer extends android.graphics.drawable.Drawable {
|
|
21
|
+
public interface Listener {
|
|
22
|
+
void onEnd(boolean finished);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 0 = linear, 1 = radial, 2 = conic.
|
|
26
|
+
private final int type;
|
|
27
|
+
private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
|
28
|
+
private final RectF area = new RectF();
|
|
29
|
+
private final Matrix matrix = new Matrix();
|
|
30
|
+
private int[] colors = new int[0];
|
|
31
|
+
private float[] stops = new float[0];
|
|
32
|
+
// angle, x, y, radius
|
|
33
|
+
private final float[] geometry = new float[4];
|
|
34
|
+
private float corner;
|
|
35
|
+
private ValueAnimator animator;
|
|
36
|
+
private Listener listener;
|
|
37
|
+
|
|
38
|
+
private float[] times;
|
|
39
|
+
private int[] frameColors;
|
|
40
|
+
private float[] frameStops;
|
|
41
|
+
private float[] frameGeometry;
|
|
42
|
+
|
|
43
|
+
public GradientLayer(int type) {
|
|
44
|
+
this.type = type;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public void setCorner(float radius) {
|
|
48
|
+
corner = radius;
|
|
49
|
+
invalidateSelf();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public void paint(int[] colors, float[] stops, float angle, float x, float y, float radius) {
|
|
53
|
+
cancel();
|
|
54
|
+
this.colors = colors;
|
|
55
|
+
this.stops = stops;
|
|
56
|
+
geometry[0] = angle;
|
|
57
|
+
geometry[1] = x;
|
|
58
|
+
geometry[2] = y;
|
|
59
|
+
geometry[3] = radius;
|
|
60
|
+
invalidateSelf();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Frames are flattened: `colors.length / times.length` colors and stops per frame, four geometry values per frame. */
|
|
64
|
+
public void play(float[] times, int[] colors, float[] stops, float[] geometry, long duration, long delay, int repeat, boolean reverse, Listener listener) {
|
|
65
|
+
cancel();
|
|
66
|
+
this.times = times;
|
|
67
|
+
frameColors = colors;
|
|
68
|
+
frameStops = stops;
|
|
69
|
+
frameGeometry = geometry;
|
|
70
|
+
this.listener = listener;
|
|
71
|
+
int count = colors.length / times.length;
|
|
72
|
+
this.colors = new int[count];
|
|
73
|
+
this.stops = new float[count];
|
|
74
|
+
apply(0);
|
|
75
|
+
final ValueAnimator animation = ValueAnimator.ofFloat(0f, 1f);
|
|
76
|
+
animation.setDuration(Math.max(duration, 1));
|
|
77
|
+
animation.setStartDelay(delay);
|
|
78
|
+
animation.setInterpolator(new LinearInterpolator());
|
|
79
|
+
if (repeat != 0) {
|
|
80
|
+
animation.setRepeatCount(repeat < 0 ? ValueAnimator.INFINITE : repeat);
|
|
81
|
+
animation.setRepeatMode(reverse ? ValueAnimator.REVERSE : ValueAnimator.RESTART);
|
|
82
|
+
}
|
|
83
|
+
animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
|
84
|
+
@Override
|
|
85
|
+
public void onAnimationUpdate(ValueAnimator updated) {
|
|
86
|
+
apply(updated.getAnimatedFraction());
|
|
87
|
+
invalidateSelf();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
animation.addListener(new AnimatorListenerAdapter() {
|
|
91
|
+
private boolean cancelled;
|
|
92
|
+
|
|
93
|
+
@Override
|
|
94
|
+
public void onAnimationCancel(Animator ended) {
|
|
95
|
+
cancelled = true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@Override
|
|
99
|
+
public void onAnimationEnd(Animator ended) {
|
|
100
|
+
if (animator != animation) return;
|
|
101
|
+
animator = null;
|
|
102
|
+
Listener done = GradientLayer.this.listener;
|
|
103
|
+
GradientLayer.this.listener = null;
|
|
104
|
+
if (done != null) done.onEnd(!cancelled);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
animator = animation;
|
|
108
|
+
animation.start();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Rejoin the source position. Binding windows include delays in their frames. */
|
|
112
|
+
public void control(long elapsed, boolean paused) {
|
|
113
|
+
if (animator == null) return;
|
|
114
|
+
animator.setCurrentPlayTime(Math.max(0, elapsed - animator.getStartDelay()));
|
|
115
|
+
if (paused) animator.pause(); else animator.resume();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public boolean isPlaying() { return animator != null; }
|
|
119
|
+
public float getCorner() { return corner; }
|
|
120
|
+
public float[] getGeometry() { return geometry.clone(); }
|
|
121
|
+
public float[] getStops() { return stops.clone(); }
|
|
122
|
+
public int[] getColors() { return colors.clone(); }
|
|
123
|
+
public int getSampleCount() { return times == null ? 0 : times.length; }
|
|
124
|
+
|
|
125
|
+
public void dispose() {
|
|
126
|
+
cancel();
|
|
127
|
+
colors = new int[0];
|
|
128
|
+
stops = new float[0];
|
|
129
|
+
setCallback(null);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
public void cancel() {
|
|
133
|
+
ValueAnimator running = animator;
|
|
134
|
+
animator = null;
|
|
135
|
+
listener = null;
|
|
136
|
+
if (running != null) {
|
|
137
|
+
running.removeAllUpdateListeners();
|
|
138
|
+
running.removeAllListeners();
|
|
139
|
+
running.cancel();
|
|
140
|
+
}
|
|
141
|
+
times = null;
|
|
142
|
+
frameColors = null;
|
|
143
|
+
frameStops = null;
|
|
144
|
+
frameGeometry = null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private void apply(float fraction) {
|
|
148
|
+
int frames = times.length;
|
|
149
|
+
int count = colors.length;
|
|
150
|
+
int i = 0;
|
|
151
|
+
while (i < frames - 2 && fraction > times[i + 1]) i++;
|
|
152
|
+
float span = times[i + 1] - times[i];
|
|
153
|
+
float t = span > 0 ? Math.max(0f, Math.min(1f, (fraction - times[i]) / span)) : 1f;
|
|
154
|
+
for (int c = 0; c < count; c++) {
|
|
155
|
+
colors[c] = lerpColor(frameColors[i * count + c], frameColors[(i + 1) * count + c], t);
|
|
156
|
+
stops[c] = lerp(frameStops[i * count + c], frameStops[(i + 1) * count + c], t);
|
|
157
|
+
}
|
|
158
|
+
for (int g = 0; g < 4; g++) geometry[g] = lerp(frameGeometry[i * 4 + g], frameGeometry[(i + 1) * 4 + g], t);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private static float lerp(float a, float b, float t) {
|
|
162
|
+
return a + (b - a) * t;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private static int lerpColor(int a, int b, float t) {
|
|
166
|
+
int alpha = Math.round(lerp((a >>> 24) & 0xff, (b >>> 24) & 0xff, t));
|
|
167
|
+
int red = Math.round(lerp((a >> 16) & 0xff, (b >> 16) & 0xff, t));
|
|
168
|
+
int green = Math.round(lerp((a >> 8) & 0xff, (b >> 8) & 0xff, t));
|
|
169
|
+
int blue = Math.round(lerp(a & 0xff, b & 0xff, t));
|
|
170
|
+
return (alpha << 24) | (red << 16) | (green << 8) | blue;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@Override
|
|
174
|
+
public void draw(Canvas canvas) {
|
|
175
|
+
Rect bounds = getBounds();
|
|
176
|
+
float width = bounds.width();
|
|
177
|
+
float height = bounds.height();
|
|
178
|
+
if (width <= 0 || height <= 0 || colors.length < 2) return;
|
|
179
|
+
double radians = Math.toRadians(geometry[0]);
|
|
180
|
+
float sin = (float) Math.sin(radians);
|
|
181
|
+
float cos = (float) Math.cos(radians);
|
|
182
|
+
float left = bounds.left;
|
|
183
|
+
float top = bounds.top;
|
|
184
|
+
Shader shader;
|
|
185
|
+
if (type == 0) {
|
|
186
|
+
float half = (Math.abs(width * sin) + Math.abs(height * cos)) / 2f;
|
|
187
|
+
float cx = left + width / 2f;
|
|
188
|
+
float cy = top + height / 2f;
|
|
189
|
+
shader = new LinearGradient(cx - sin * half, cy + cos * half, cx + sin * half, cy - cos * half, colors, stops, Shader.TileMode.CLAMP);
|
|
190
|
+
} else if (type == 1) {
|
|
191
|
+
float radius = Math.max(geometry[3] * Math.min(width, height), 0.01f);
|
|
192
|
+
shader = new RadialGradient(left + geometry[1] * width, top + geometry[2] * height, radius, colors, stops, Shader.TileMode.CLAMP);
|
|
193
|
+
} else {
|
|
194
|
+
float cx = left + geometry[1] * width;
|
|
195
|
+
float cy = top + geometry[2] * height;
|
|
196
|
+
SweepGradient sweep = new SweepGradient(cx, cy, colors, stops);
|
|
197
|
+
// Turned so the first color starts at 12 o'clock and sweeps clockwise, as on iOS and in CSS.
|
|
198
|
+
matrix.setRotate(geometry[0] + 90f, cx, cy);
|
|
199
|
+
sweep.setLocalMatrix(matrix);
|
|
200
|
+
shader = sweep;
|
|
201
|
+
}
|
|
202
|
+
paint.setShader(shader);
|
|
203
|
+
area.set(bounds);
|
|
204
|
+
if (corner > 0) canvas.drawRoundRect(area, corner, corner, paint);
|
|
205
|
+
else canvas.drawRect(area, paint);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@Override
|
|
209
|
+
public void setAlpha(int alpha) {
|
|
210
|
+
paint.setAlpha(alpha);
|
|
211
|
+
invalidateSelf();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@Override
|
|
215
|
+
public void setColorFilter(ColorFilter filter) {
|
|
216
|
+
paint.setColorFilter(filter);
|
|
217
|
+
invalidateSelf();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@Override
|
|
221
|
+
public int getOpacity() {
|
|
222
|
+
return PixelFormat.TRANSLUCENT;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
package org.rafaelaugusto.jolt;
|
|
2
|
+
|
|
3
|
+
import android.graphics.Rect;
|
|
4
|
+
import android.view.View;
|
|
5
|
+
import android.view.ViewTreeObserver;
|
|
6
|
+
import android.view.WindowInsets;
|
|
7
|
+
|
|
8
|
+
/** Before Android 11: how much of the window the keyboard covers, read from the visible frame on each layout. */
|
|
9
|
+
public final class KeyboardFrame implements ViewTreeObserver.OnGlobalLayoutListener {
|
|
10
|
+
public interface Listener {
|
|
11
|
+
void onChange(int height);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
private final View root;
|
|
15
|
+
private final Listener listener;
|
|
16
|
+
private int height;
|
|
17
|
+
|
|
18
|
+
public KeyboardFrame(View root, Listener listener) {
|
|
19
|
+
this.root = root;
|
|
20
|
+
this.listener = listener;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public void attach() {
|
|
24
|
+
height = covered(root);
|
|
25
|
+
root.getViewTreeObserver().addOnGlobalLayoutListener(this);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public void detach() {
|
|
29
|
+
root.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public int height() {
|
|
33
|
+
return height;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Pixels of the window below the visible frame, when that is more than the navigation bar. */
|
|
37
|
+
static int covered(View root) {
|
|
38
|
+
Rect frame = new Rect();
|
|
39
|
+
root.getWindowVisibleDisplayFrame(frame);
|
|
40
|
+
int below = root.getHeight() - frame.bottom;
|
|
41
|
+
WindowInsets insets = root.getRootWindowInsets();
|
|
42
|
+
int bars = insets == null ? 0 : insets.getStableInsetBottom();
|
|
43
|
+
return below > bars ? below : 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@Override
|
|
47
|
+
public void onGlobalLayout() {
|
|
48
|
+
int next = covered(root);
|
|
49
|
+
if (next == height) return;
|
|
50
|
+
height = next;
|
|
51
|
+
listener.onChange(next);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
package org.rafaelaugusto.jolt;
|
|
2
|
+
|
|
3
|
+
import android.view.View;
|
|
4
|
+
import android.view.ViewTreeObserver;
|
|
5
|
+
|
|
6
|
+
/** Before Android 11: catches the view where it was when a keyboard layout moves it, and says where it should end up. */
|
|
7
|
+
public final class KeyboardFrameFollower implements ViewTreeObserver.OnGlobalLayoutListener {
|
|
8
|
+
public interface Listener {
|
|
9
|
+
void onMove(float from, float to, int keyboard);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
private final View view;
|
|
13
|
+
private final float offset;
|
|
14
|
+
private final Listener listener;
|
|
15
|
+
private int keyboard;
|
|
16
|
+
private float visualBottom;
|
|
17
|
+
|
|
18
|
+
public KeyboardFrameFollower(View view, float offset, Listener listener) {
|
|
19
|
+
this.view = view;
|
|
20
|
+
this.offset = offset;
|
|
21
|
+
this.listener = listener;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public void attach() {
|
|
25
|
+
keyboard = KeyboardFrame.covered(view.getRootView());
|
|
26
|
+
visualBottom = bottom();
|
|
27
|
+
view.getViewTreeObserver().addOnGlobalLayoutListener(this);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public void detach() {
|
|
31
|
+
view.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private float bottom() {
|
|
35
|
+
int[] location = new int[2];
|
|
36
|
+
view.getLocationInWindow(location);
|
|
37
|
+
return location[1] + view.getHeight();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Override
|
|
41
|
+
public void onGlobalLayout() {
|
|
42
|
+
int next = KeyboardFrame.covered(view.getRootView());
|
|
43
|
+
if (next == keyboard) {
|
|
44
|
+
visualBottom = bottom();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
keyboard = next;
|
|
48
|
+
// The layout for the keyboard is done; the view may already have jumped with it.
|
|
49
|
+
float untranslated = bottom() - view.getTranslationY();
|
|
50
|
+
float top = view.getRootView().getHeight() - next;
|
|
51
|
+
float to = next > 0 ? -Math.max(0, untranslated + offset - top) : 0;
|
|
52
|
+
float from = visualBottom - untranslated;
|
|
53
|
+
view.setTranslationY(from);
|
|
54
|
+
visualBottom = untranslated + to;
|
|
55
|
+
listener.onMove(from, to, next);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
package org.rafaelaugusto.jolt;
|
|
2
|
+
|
|
3
|
+
import android.view.View;
|
|
4
|
+
import android.view.ViewTreeObserver;
|
|
5
|
+
import android.view.WindowInsets;
|
|
6
|
+
import android.view.WindowInsetsAnimation;
|
|
7
|
+
import android.view.animation.Interpolator;
|
|
8
|
+
import java.util.List;
|
|
9
|
+
|
|
10
|
+
/** Reports how much of a window the keyboard covers, and how it gets there. Moves nothing. */
|
|
11
|
+
public final class KeyboardObserver extends WindowInsetsAnimation.Callback
|
|
12
|
+
implements ViewTreeObserver.OnGlobalLayoutListener {
|
|
13
|
+
public interface Listener {
|
|
14
|
+
void onChange(int height, long duration, float[] curve);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
private static final int SAMPLES = 32;
|
|
18
|
+
|
|
19
|
+
private final View root;
|
|
20
|
+
private final Listener listener;
|
|
21
|
+
private int height;
|
|
22
|
+
private boolean animating;
|
|
23
|
+
|
|
24
|
+
public KeyboardObserver(View root, Listener listener) {
|
|
25
|
+
super(DISPATCH_MODE_CONTINUE_ON_SUBTREE);
|
|
26
|
+
this.root = root;
|
|
27
|
+
this.listener = listener;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public void attach() {
|
|
31
|
+
height = covered();
|
|
32
|
+
root.setWindowInsetsAnimationCallback(this);
|
|
33
|
+
root.getViewTreeObserver().addOnGlobalLayoutListener(this);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public void detach() {
|
|
37
|
+
root.setWindowInsetsAnimationCallback(null);
|
|
38
|
+
root.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public int height() {
|
|
42
|
+
return height;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private int covered() {
|
|
46
|
+
WindowInsets insets = root.getRootWindowInsets();
|
|
47
|
+
return insets == null ? 0 : insets.getInsets(WindowInsets.Type.ime()).bottom;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private static boolean keyboard(WindowInsetsAnimation animation) {
|
|
51
|
+
return (animation.getTypeMask() & WindowInsets.Type.ime()) != 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private static float[] sample(Interpolator interpolator) {
|
|
55
|
+
if (interpolator == null) return null;
|
|
56
|
+
float[] curve = new float[SAMPLES + 1];
|
|
57
|
+
for (int i = 0; i <= SAMPLES; i++) curve[i] = interpolator.getInterpolation(i / (float) SAMPLES);
|
|
58
|
+
return curve;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private void report(int next, long duration, float[] curve) {
|
|
62
|
+
if (next == height) return;
|
|
63
|
+
height = next;
|
|
64
|
+
listener.onChange(next, duration, curve);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@Override
|
|
68
|
+
public void onPrepare(WindowInsetsAnimation animation) {
|
|
69
|
+
// The layout for the end state comes before onStart; let onStart report it with its timing.
|
|
70
|
+
if (keyboard(animation)) animating = true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@Override
|
|
74
|
+
public WindowInsetsAnimation.Bounds onStart(WindowInsetsAnimation animation, WindowInsetsAnimation.Bounds bounds) {
|
|
75
|
+
if (!keyboard(animation)) return bounds;
|
|
76
|
+
// The end state is already in the root insets when the animation starts.
|
|
77
|
+
report(covered(), animation.getDurationMillis(), sample(animation.getInterpolator()));
|
|
78
|
+
return bounds;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@Override
|
|
82
|
+
public WindowInsets onProgress(WindowInsets insets, List<WindowInsetsAnimation> running) {
|
|
83
|
+
return insets;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@Override
|
|
87
|
+
public void onEnd(WindowInsetsAnimation animation) {
|
|
88
|
+
if (!keyboard(animation)) return;
|
|
89
|
+
animating = false;
|
|
90
|
+
report(covered(), 0, null);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@Override
|
|
94
|
+
public void onGlobalLayout() {
|
|
95
|
+
if (!animating) report(covered(), 0, null);
|
|
96
|
+
}
|
|
97
|
+
}
|