@luckylca/react-native-liquid-glass 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +307 -2
- package/README.zh-CN.md +310 -0
- package/THIRD_PARTY_NOTICES.md +98 -0
- package/android/build.gradle +19 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/expo/modules/localglass/ExpoLocalGlassEngineModule.kt +141 -0
- package/android/src/main/java/expo/modules/localglass/ExpoLocalGlassModule.kt +341 -0
- package/android/src/main/java/expo/modules/localglass/LocalGlassShader.kt +59 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/CoreLiquidGlassRegistry.kt +75 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/EffectiveScrollInputBridge.kt +47 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/ExpoGlassCoreModule.kt +226 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/ExpoGlassProviderCoreView.kt +1125 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/ExpoGlassSurfaceCoreView.kt +571 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/PassSurfaceSuppression.kt +39 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/SharedGlassPassProbeLog.kt +23 -0
- package/android/src/main/java/expo/modules/newhuliquidglass/SharedGlassPassWiring.kt +59 -0
- package/android-core/build.gradle +36 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/BackdropRecorder.kt +930 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/FrozenBackdrop.kt +66 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassBackdropCoordinator.kt +624 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassBackdropSourceHandle.kt +8 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassScrollSource.kt +13 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/GlassViewController.kt +1605 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/LiquidGlassProviderLayout.kt +340 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/LiquidGlassView.kt +103 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/ReferenceSourceWindowPolicy.kt +13 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/StableSceneTexturePolicy.kt +43 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/internal/GlassViewRenderer.kt +1459 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/internal/ReferenceTabSampling.kt +15 -0
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/internal/SharedSceneCapture.kt +163 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassCapabilities.kt +21 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassEngine.kt +131 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassMaterial.kt +89 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassMath.kt +131 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassOpticalInsets.kt +8 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassRenderTier.kt +54 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassShapePacker.kt +77 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassSurfaceState.kt +11 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/GlassUniforms.kt +113 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/LiquidGlassShaders.kt +234 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/SharedGlassPass.kt +456 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/geometry/G2RoundedRectangle.kt +207 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/geometry/ReferenceG2MaskTexture.kt +334 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/HeightFieldGlassShader.kt +7 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceBackdropBlurShader.kt +58 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceGaussianDiscBackdropBlur.kt +42 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceGlassUniforms.kt +111 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceParityGlassShader.kt +613 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/ReferenceParityMultiShapeShader.kt +128 -0
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/SdfScaleLensShader.kt +144 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassHardwareLayerExperiment.kt +29 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassMaterial.kt +14 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassRenderer.kt +126 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassRuntimeShader.kt +50 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassShader.kt +59 -0
- package/android-core/src/main/java/com/newhu/liquidglass/local/LocalGlassView.kt +47 -0
- package/android-core/src/main/java/com/newhu/liquidglass/motion/GlassMotionDriver.kt +824 -0
- package/android-core/src/main/java/com/newhu/liquidglass/motion/GlassMotionState.kt +359 -0
- package/android-core/src/main/java/com/newhu/liquidglass/motion/PointerVelocityTracker.kt +109 -0
- package/android-core/src/main/java/com/newhu/liquidglass/motion/SpringSpec.kt +209 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/G2Corner.kt +194 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassMaterial.kt +250 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassOpticsShader.kt +696 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassParityProbe.kt +342 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassShapeGeometry.kt +317 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/GlassUniformBinder.kt +308 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/PixelDiff.kt +363 -0
- package/android-core/src/main/java/com/newhu/liquidglass/optics/ReferenceOptics.kt +568 -0
- package/android-core/src/main/java/com/newhu/liquidglass/rendering/GlassEngineSelection.kt +30 -0
- package/android-core/src/main/java/com/newhu/liquidglass/rendering/GlassSurfaceHost.kt +317 -0
- package/android-core/src/main/java/com/newhu/liquidglass/rendering/GlassSurfaceRenderer.kt +847 -0
- package/android-core/src/main/java/com/newhu/liquidglass/rendering/RetainedBackdropLayer.kt +83 -0
- package/android-core/src/main/java/com/newhu/liquidglass/scheduler/GlassFrameScheduler.kt +27 -0
- package/android-core/src/main/java/com/newhu/liquidglass/telemetry/EffectiveScrollFpsProbe.kt +965 -0
- package/android-core/src/main/java/com/newhu/liquidglass/telemetry/GlassTelemetry.kt +16 -0
- package/android-core/src/main/java/com/newhu/liquidglass/telemetry/LiquidGlassPerfTelemetry.kt +676 -0
- package/android-core/src/main/java/com/newhu/liquidglass/telemetry/LiquidGlassTrace.kt +30 -0
- package/android-core/src/main/java/com/newhu/liquidglass/telemetry/LocalGlassTelemetry.kt +55 -0
- package/app.plugin.js +25 -0
- package/docs/images/buttons.webp +0 -0
- package/docs/images/controls.webp +0 -0
- package/docs/images/tabs.webp +0 -0
- package/docs/publishing.md +84 -0
- package/expo-module.config.json +10 -0
- package/lib/commonjs/GlassSurface.js +832 -0
- package/lib/commonjs/GlassSurface.js.map +1 -0
- package/lib/commonjs/GlassTabBar.js +976 -0
- package/lib/commonjs/GlassTabBar.js.map +1 -0
- package/lib/commonjs/GlassTabLens.js +67 -0
- package/lib/commonjs/GlassTabLens.js.map +1 -0
- package/lib/commonjs/LiquidGlassProvider.js +40 -0
- package/lib/commonjs/LiquidGlassProvider.js.map +1 -0
- package/lib/commonjs/LocalGlassMaterial.js +194 -0
- package/lib/commonjs/LocalGlassMaterial.js.map +1 -0
- package/lib/commonjs/adaptiveLuminance.js +14 -0
- package/lib/commonjs/adaptiveLuminance.js.map +1 -0
- package/lib/commonjs/badgePalette.js +46 -0
- package/lib/commonjs/badgePalette.js.map +1 -0
- package/lib/commonjs/buttonGesturePolicy.js +22 -0
- package/lib/commonjs/buttonGesturePolicy.js.map +1 -0
- package/lib/commonjs/components/AdaptiveLuminance.js +20 -0
- package/lib/commonjs/components/AdaptiveLuminance.js.map +1 -0
- package/lib/commonjs/components/BottomSheet.js +222 -0
- package/lib/commonjs/components/BottomSheet.js.map +1 -0
- package/lib/commonjs/components/Button.js +20 -0
- package/lib/commonjs/components/Button.js.map +1 -0
- package/lib/commonjs/components/Card.js +206 -0
- package/lib/commonjs/components/Card.js.map +1 -0
- package/lib/commonjs/components/Checkbox.js +123 -0
- package/lib/commonjs/components/Checkbox.js.map +1 -0
- package/lib/commonjs/components/ControlPressContext.js +8 -0
- package/lib/commonjs/components/ControlPressContext.js.map +1 -0
- package/lib/commonjs/components/Dialog.js +122 -0
- package/lib/commonjs/components/Dialog.js.map +1 -0
- package/lib/commonjs/components/DialogAction.js +124 -0
- package/lib/commonjs/components/DialogAction.js.map +1 -0
- package/lib/commonjs/components/DialogContent.js +23 -0
- package/lib/commonjs/components/DialogContent.js.map +1 -0
- package/lib/commonjs/components/GlassButton.js +96 -0
- package/lib/commonjs/components/GlassButton.js.map +1 -0
- package/lib/commonjs/components/GlassFab.js +43 -0
- package/lib/commonjs/components/GlassFab.js.map +1 -0
- package/lib/commonjs/components/GlassMagnifier.js +135 -0
- package/lib/commonjs/components/GlassMagnifier.js.map +1 -0
- package/lib/commonjs/components/GlassPlayground.js +158 -0
- package/lib/commonjs/components/GlassPlayground.js.map +1 -0
- package/lib/commonjs/components/GlassSlider.js +364 -0
- package/lib/commonjs/components/GlassSlider.js.map +1 -0
- package/lib/commonjs/components/GlassSwitch.js +334 -0
- package/lib/commonjs/components/GlassSwitch.js.map +1 -0
- package/lib/commonjs/components/GlassTabBar.js +387 -0
- package/lib/commonjs/components/GlassTabBar.js.map +1 -0
- package/lib/commonjs/components/Input.js +180 -0
- package/lib/commonjs/components/Input.js.map +1 -0
- package/lib/commonjs/components/ListRow.js +64 -0
- package/lib/commonjs/components/ListRow.js.map +1 -0
- package/lib/commonjs/components/Menu.js +214 -0
- package/lib/commonjs/components/Menu.js.map +1 -0
- package/lib/commonjs/components/NavigationBar.js +20 -0
- package/lib/commonjs/components/NavigationBar.js.map +1 -0
- package/lib/commonjs/components/NumberWheel.js +273 -0
- package/lib/commonjs/components/NumberWheel.js.map +1 -0
- package/lib/commonjs/components/PageFeedList.js +25 -0
- package/lib/commonjs/components/PageFeedList.js.map +1 -0
- package/lib/commonjs/components/PageScaffold.js +161 -0
- package/lib/commonjs/components/PageScaffold.js.map +1 -0
- package/lib/commonjs/components/PreferenceGroup.js +34 -0
- package/lib/commonjs/components/PreferenceGroup.js.map +1 -0
- package/lib/commonjs/components/ProgressIndicator.js +79 -0
- package/lib/commonjs/components/ProgressIndicator.js.map +1 -0
- package/lib/commonjs/components/ProgressiveBlur.js +29 -0
- package/lib/commonjs/components/ProgressiveBlur.js.map +1 -0
- package/lib/commonjs/components/ReferenceSlider.js +304 -0
- package/lib/commonjs/components/ReferenceSlider.js.map +1 -0
- package/lib/commonjs/components/ReferenceTabBar.js +381 -0
- package/lib/commonjs/components/ReferenceTabBar.js.map +1 -0
- package/lib/commonjs/components/SearchBar.js +200 -0
- package/lib/commonjs/components/SearchBar.js.map +1 -0
- package/lib/commonjs/components/SegmentedControl.js +62 -0
- package/lib/commonjs/components/SegmentedControl.js.map +1 -0
- package/lib/commonjs/components/Slider.js +12 -0
- package/lib/commonjs/components/Slider.js.map +1 -0
- package/lib/commonjs/components/Snackbar.js +11 -0
- package/lib/commonjs/components/Snackbar.js.map +1 -0
- package/lib/commonjs/components/SurfaceEnvironmentContext.js +35 -0
- package/lib/commonjs/components/SurfaceEnvironmentContext.js.map +1 -0
- package/lib/commonjs/components/SurfaceGroup.js +39 -0
- package/lib/commonjs/components/SurfaceGroup.js.map +1 -0
- package/lib/commonjs/components/Switch.js +11 -0
- package/lib/commonjs/components/Switch.js.map +1 -0
- package/lib/commonjs/components/Toast.js +110 -0
- package/lib/commonjs/components/Toast.js.map +1 -0
- package/lib/commonjs/components/TopAppBar.js +107 -0
- package/lib/commonjs/components/TopAppBar.js.map +1 -0
- package/lib/commonjs/components/bottomSheetMotion.js +14 -0
- package/lib/commonjs/components/bottomSheetMotion.js.map +1 -0
- package/lib/commonjs/components/glassControlMaterial.js +22 -0
- package/lib/commonjs/components/glassControlMaterial.js.map +1 -0
- package/lib/commonjs/components/menuPosition.js +42 -0
- package/lib/commonjs/components/menuPosition.js.map +1 -0
- package/lib/commonjs/components/pages/FeedPage.js +15 -0
- package/lib/commonjs/components/pages/FeedPage.js.map +1 -0
- package/lib/commonjs/components/pages/PageBenchmarkContext.js +123 -0
- package/lib/commonjs/components/pages/PageBenchmarkContext.js.map +1 -0
- package/lib/commonjs/components/pages/SettingsPage.js +47 -0
- package/lib/commonjs/components/pages/SettingsPage.js.map +1 -0
- package/lib/commonjs/components/pages/SettingsSection.js +14 -0
- package/lib/commonjs/components/pages/SettingsSection.js.map +1 -0
- package/lib/commonjs/components/pages/StaticSettingsPage.js +16 -0
- package/lib/commonjs/components/pages/StaticSettingsPage.js.map +1 -0
- package/lib/commonjs/fallbackKnobGeometry.js +19 -0
- package/lib/commonjs/fallbackKnobGeometry.js.map +1 -0
- package/lib/commonjs/glassController.js +65 -0
- package/lib/commonjs/glassController.js.map +1 -0
- package/lib/commonjs/glassNativeEngine.js +16 -0
- package/lib/commonjs/glassNativeEngine.js.map +1 -0
- package/lib/commonjs/glassRuntime.js +27 -0
- package/lib/commonjs/glassRuntime.js.map +1 -0
- package/lib/commonjs/index.js +218 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/inputPresentation.js +17 -0
- package/lib/commonjs/inputPresentation.js.map +1 -0
- package/lib/commonjs/localGlassTelemetry.js +113 -0
- package/lib/commonjs/localGlassTelemetry.js.map +1 -0
- package/lib/commonjs/motion/MotionProvider.js +15 -0
- package/lib/commonjs/motion/MotionProvider.js.map +1 -0
- package/lib/commonjs/motion/easings.js +71 -0
- package/lib/commonjs/motion/easings.js.map +1 -0
- package/lib/commonjs/motion/folmeSpring.js +24 -0
- package/lib/commonjs/motion/folmeSpring.js.map +1 -0
- package/lib/commonjs/motion/folmeSpringByResponse.js +22 -0
- package/lib/commonjs/motion/folmeSpringByResponse.js.map +1 -0
- package/lib/commonjs/motion/index.js +57 -0
- package/lib/commonjs/motion/index.js.map +1 -0
- package/lib/commonjs/motion/presets.js +101 -0
- package/lib/commonjs/motion/presets.js.map +1 -0
- package/lib/commonjs/nativeGlassViews.js +33 -0
- package/lib/commonjs/nativeGlassViews.js.map +1 -0
- package/lib/commonjs/performanceTelemetry.js +28 -0
- package/lib/commonjs/performanceTelemetry.js.map +1 -0
- package/lib/commonjs/pointerEventBridge.js +17 -0
- package/lib/commonjs/pointerEventBridge.js.map +1 -0
- package/lib/commonjs/pointerGeometry.js +12 -0
- package/lib/commonjs/pointerGeometry.js.map +1 -0
- package/lib/commonjs/pressVelocity.js +34 -0
- package/lib/commonjs/pressVelocity.js.map +1 -0
- package/lib/commonjs/primitives/Divider.js +32 -0
- package/lib/commonjs/primitives/Divider.js.map +1 -0
- package/lib/commonjs/primitives/Icon.js +22 -0
- package/lib/commonjs/primitives/Icon.js.map +1 -0
- package/lib/commonjs/primitives/PressIndication.js +58 -0
- package/lib/commonjs/primitives/PressIndication.js.map +1 -0
- package/lib/commonjs/primitives/Pressable.js +28 -0
- package/lib/commonjs/primitives/Pressable.js.map +1 -0
- package/lib/commonjs/primitives/PressableScale.js +64 -0
- package/lib/commonjs/primitives/PressableScale.js.map +1 -0
- package/lib/commonjs/primitives/Surface.js +122 -0
- package/lib/commonjs/primitives/Surface.js.map +1 -0
- package/lib/commonjs/primitives/Text.js +43 -0
- package/lib/commonjs/primitives/Text.js.map +1 -0
- package/lib/commonjs/primitives/index.js +18 -0
- package/lib/commonjs/primitives/index.js.map +1 -0
- package/lib/commonjs/renderer.js +58 -0
- package/lib/commonjs/renderer.js.map +1 -0
- package/lib/commonjs/sliderValue.js +28 -0
- package/lib/commonjs/sliderValue.js.map +1 -0
- package/lib/commonjs/surfaceRendererPolicy.js +32 -0
- package/lib/commonjs/surfaceRendererPolicy.js.map +1 -0
- package/lib/commonjs/theme/ThemeProvider.js +37 -0
- package/lib/commonjs/theme/ThemeProvider.js.map +1 -0
- package/lib/commonjs/theme/buildTheme.js +157 -0
- package/lib/commonjs/theme/buildTheme.js.map +1 -0
- package/lib/commonjs/theme/glassColors.js +17 -0
- package/lib/commonjs/theme/glassColors.js.map +1 -0
- package/lib/commonjs/theme/index.js +38 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/liquidGlass.js +24 -0
- package/lib/commonjs/theme/liquidGlass.js.map +1 -0
- package/lib/commonjs/theme/presentation.js +14 -0
- package/lib/commonjs/theme/presentation.js.map +1 -0
- package/lib/commonjs/theme/registry.js +17 -0
- package/lib/commonjs/theme/registry.js.map +1 -0
- package/lib/commonjs/theme/selectVariant.js +13 -0
- package/lib/commonjs/theme/selectVariant.js.map +1 -0
- package/lib/commonjs/theme/tokens.js +266 -0
- package/lib/commonjs/theme/tokens.js.map +1 -0
- package/lib/commonjs/theme/types.js +3 -0
- package/lib/commonjs/theme/types.js.map +1 -0
- package/lib/commonjs/theme/wallpaper.js +91 -0
- package/lib/commonjs/theme/wallpaper.js.map +1 -0
- package/lib/commonjs/types.js +3 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/useButtonGesture.js +135 -0
- package/lib/commonjs/useButtonGesture.js.map +1 -0
- package/lib/commonjs/useGlassKnobMotion.js +115 -0
- package/lib/commonjs/useGlassKnobMotion.js.map +1 -0
- package/lib/commonjs/useGlassPressMotion.js +147 -0
- package/lib/commonjs/useGlassPressMotion.js.map +1 -0
- package/lib/module/GlassSurface.js +782 -0
- package/lib/module/GlassSurface.js.map +1 -0
- package/lib/module/GlassTabBar.js +939 -0
- package/lib/module/GlassTabBar.js.map +1 -0
- package/lib/module/GlassTabLens.js +64 -0
- package/lib/module/GlassTabLens.js.map +1 -0
- package/lib/module/LiquidGlassProvider.js +37 -0
- package/lib/module/LiquidGlassProvider.js.map +1 -0
- package/lib/module/LocalGlassMaterial.js +191 -0
- package/lib/module/LocalGlassMaterial.js.map +1 -0
- package/lib/module/adaptiveLuminance.js +11 -0
- package/lib/module/adaptiveLuminance.js.map +1 -0
- package/lib/module/badgePalette.js +40 -0
- package/lib/module/badgePalette.js.map +1 -0
- package/lib/module/buttonGesturePolicy.js +17 -0
- package/lib/module/buttonGesturePolicy.js.map +1 -0
- package/lib/module/components/AdaptiveLuminance.js +16 -0
- package/lib/module/components/AdaptiveLuminance.js.map +1 -0
- package/lib/module/components/BottomSheet.js +186 -0
- package/lib/module/components/BottomSheet.js.map +1 -0
- package/lib/module/components/Button.js +17 -0
- package/lib/module/components/Button.js.map +1 -0
- package/lib/module/components/Card.js +170 -0
- package/lib/module/components/Card.js.map +1 -0
- package/lib/module/components/Checkbox.js +84 -0
- package/lib/module/components/Checkbox.js.map +1 -0
- package/lib/module/components/ControlPressContext.js +4 -0
- package/lib/module/components/ControlPressContext.js.map +1 -0
- package/lib/module/components/Dialog.js +86 -0
- package/lib/module/components/Dialog.js.map +1 -0
- package/lib/module/components/DialogAction.js +88 -0
- package/lib/module/components/DialogAction.js.map +1 -0
- package/lib/module/components/DialogContent.js +20 -0
- package/lib/module/components/DialogContent.js.map +1 -0
- package/lib/module/components/GlassButton.js +93 -0
- package/lib/module/components/GlassButton.js.map +1 -0
- package/lib/module/components/GlassFab.js +37 -0
- package/lib/module/components/GlassFab.js.map +1 -0
- package/lib/module/components/GlassMagnifier.js +99 -0
- package/lib/module/components/GlassMagnifier.js.map +1 -0
- package/lib/module/components/GlassPlayground.js +122 -0
- package/lib/module/components/GlassPlayground.js.map +1 -0
- package/lib/module/components/GlassSlider.js +328 -0
- package/lib/module/components/GlassSlider.js.map +1 -0
- package/lib/module/components/GlassSwitch.js +298 -0
- package/lib/module/components/GlassSwitch.js.map +1 -0
- package/lib/module/components/GlassTabBar.js +351 -0
- package/lib/module/components/GlassTabBar.js.map +1 -0
- package/lib/module/components/Input.js +144 -0
- package/lib/module/components/Input.js.map +1 -0
- package/lib/module/components/ListRow.js +61 -0
- package/lib/module/components/ListRow.js.map +1 -0
- package/lib/module/components/Menu.js +178 -0
- package/lib/module/components/Menu.js.map +1 -0
- package/lib/module/components/NavigationBar.js +14 -0
- package/lib/module/components/NavigationBar.js.map +1 -0
- package/lib/module/components/NumberWheel.js +238 -0
- package/lib/module/components/NumberWheel.js.map +1 -0
- package/lib/module/components/PageFeedList.js +19 -0
- package/lib/module/components/PageFeedList.js.map +1 -0
- package/lib/module/components/PageScaffold.js +114 -0
- package/lib/module/components/PageScaffold.js.map +1 -0
- package/lib/module/components/PreferenceGroup.js +28 -0
- package/lib/module/components/PreferenceGroup.js.map +1 -0
- package/lib/module/components/ProgressIndicator.js +44 -0
- package/lib/module/components/ProgressIndicator.js.map +1 -0
- package/lib/module/components/ProgressiveBlur.js +26 -0
- package/lib/module/components/ProgressiveBlur.js.map +1 -0
- package/lib/module/components/ReferenceSlider.js +268 -0
- package/lib/module/components/ReferenceSlider.js.map +1 -0
- package/lib/module/components/ReferenceTabBar.js +344 -0
- package/lib/module/components/ReferenceTabBar.js.map +1 -0
- package/lib/module/components/SearchBar.js +164 -0
- package/lib/module/components/SearchBar.js.map +1 -0
- package/lib/module/components/SegmentedControl.js +26 -0
- package/lib/module/components/SegmentedControl.js.map +1 -0
- package/lib/module/components/Slider.js +9 -0
- package/lib/module/components/Slider.js.map +1 -0
- package/lib/module/components/Snackbar.js +8 -0
- package/lib/module/components/Snackbar.js.map +1 -0
- package/lib/module/components/SurfaceEnvironmentContext.js +27 -0
- package/lib/module/components/SurfaceEnvironmentContext.js.map +1 -0
- package/lib/module/components/SurfaceGroup.js +33 -0
- package/lib/module/components/SurfaceGroup.js.map +1 -0
- package/lib/module/components/Switch.js +8 -0
- package/lib/module/components/Switch.js.map +1 -0
- package/lib/module/components/Toast.js +74 -0
- package/lib/module/components/Toast.js.map +1 -0
- package/lib/module/components/TopAppBar.js +68 -0
- package/lib/module/components/TopAppBar.js.map +1 -0
- package/lib/module/components/bottomSheetMotion.js +11 -0
- package/lib/module/components/bottomSheetMotion.js.map +1 -0
- package/lib/module/components/glassControlMaterial.js +19 -0
- package/lib/module/components/glassControlMaterial.js.map +1 -0
- package/lib/module/components/menuPosition.js +37 -0
- package/lib/module/components/menuPosition.js.map +1 -0
- package/lib/module/components/pages/FeedPage.js +12 -0
- package/lib/module/components/pages/FeedPage.js.map +1 -0
- package/lib/module/components/pages/PageBenchmarkContext.js +84 -0
- package/lib/module/components/pages/PageBenchmarkContext.js.map +1 -0
- package/lib/module/components/pages/SettingsPage.js +11 -0
- package/lib/module/components/pages/SettingsPage.js.map +1 -0
- package/lib/module/components/pages/SettingsSection.js +8 -0
- package/lib/module/components/pages/SettingsSection.js.map +1 -0
- package/lib/module/components/pages/StaticSettingsPage.js +10 -0
- package/lib/module/components/pages/StaticSettingsPage.js.map +1 -0
- package/lib/module/fallbackKnobGeometry.js +16 -0
- package/lib/module/fallbackKnobGeometry.js.map +1 -0
- package/lib/module/glassController.js +58 -0
- package/lib/module/glassController.js.map +1 -0
- package/lib/module/glassNativeEngine.js +11 -0
- package/lib/module/glassNativeEngine.js.map +1 -0
- package/lib/module/glassRuntime.js +22 -0
- package/lib/module/glassRuntime.js.map +1 -0
- package/lib/module/index.js +80 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/inputPresentation.js +14 -0
- package/lib/module/inputPresentation.js.map +1 -0
- package/lib/module/localGlassTelemetry.js +103 -0
- package/lib/module/localGlassTelemetry.js.map +1 -0
- package/lib/module/motion/MotionProvider.js +11 -0
- package/lib/module/motion/MotionProvider.js.map +1 -0
- package/lib/module/motion/easings.js +64 -0
- package/lib/module/motion/easings.js.map +1 -0
- package/lib/module/motion/folmeSpring.js +21 -0
- package/lib/module/motion/folmeSpring.js.map +1 -0
- package/lib/module/motion/folmeSpringByResponse.js +19 -0
- package/lib/module/motion/folmeSpringByResponse.js.map +1 -0
- package/lib/module/motion/index.js +6 -0
- package/lib/module/motion/index.js.map +1 -0
- package/lib/module/motion/presets.js +98 -0
- package/lib/module/motion/presets.js.map +1 -0
- package/lib/module/nativeGlassViews.js +27 -0
- package/lib/module/nativeGlassViews.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/performanceTelemetry.js +23 -0
- package/lib/module/performanceTelemetry.js.map +1 -0
- package/lib/module/pointerEventBridge.js +14 -0
- package/lib/module/pointerEventBridge.js.map +1 -0
- package/lib/module/pointerGeometry.js +9 -0
- package/lib/module/pointerGeometry.js.map +1 -0
- package/lib/module/pressVelocity.js +31 -0
- package/lib/module/pressVelocity.js.map +1 -0
- package/lib/module/primitives/Divider.js +29 -0
- package/lib/module/primitives/Divider.js.map +1 -0
- package/lib/module/primitives/Icon.js +19 -0
- package/lib/module/primitives/Icon.js.map +1 -0
- package/lib/module/primitives/PressIndication.js +22 -0
- package/lib/module/primitives/PressIndication.js.map +1 -0
- package/lib/module/primitives/Pressable.js +25 -0
- package/lib/module/primitives/Pressable.js.map +1 -0
- package/lib/module/primitives/PressableScale.js +28 -0
- package/lib/module/primitives/PressableScale.js.map +1 -0
- package/lib/module/primitives/Surface.js +83 -0
- package/lib/module/primitives/Surface.js.map +1 -0
- package/lib/module/primitives/Text.js +40 -0
- package/lib/module/primitives/Text.js.map +1 -0
- package/lib/module/primitives/index.js +8 -0
- package/lib/module/primitives/index.js.map +1 -0
- package/lib/module/renderer.js +22 -0
- package/lib/module/renderer.js.map +1 -0
- package/lib/module/sliderValue.js +25 -0
- package/lib/module/sliderValue.js.map +1 -0
- package/lib/module/surfaceRendererPolicy.js +27 -0
- package/lib/module/surfaceRendererPolicy.js.map +1 -0
- package/lib/module/theme/ThemeProvider.js +32 -0
- package/lib/module/theme/ThemeProvider.js.map +1 -0
- package/lib/module/theme/buildTheme.js +153 -0
- package/lib/module/theme/buildTheme.js.map +1 -0
- package/lib/module/theme/glassColors.js +14 -0
- package/lib/module/theme/glassColors.js.map +1 -0
- package/lib/module/theme/index.js +9 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/liquidGlass.js +21 -0
- package/lib/module/theme/liquidGlass.js.map +1 -0
- package/lib/module/theme/presentation.js +11 -0
- package/lib/module/theme/presentation.js.map +1 -0
- package/lib/module/theme/registry.js +13 -0
- package/lib/module/theme/registry.js.map +1 -0
- package/lib/module/theme/selectVariant.js +10 -0
- package/lib/module/theme/selectVariant.js.map +1 -0
- package/lib/module/theme/tokens.js +262 -0
- package/lib/module/theme/tokens.js.map +1 -0
- package/lib/module/theme/types.js +2 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/theme/wallpaper.js +83 -0
- package/lib/module/theme/wallpaper.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/useButtonGesture.js +132 -0
- package/lib/module/useButtonGesture.js.map +1 -0
- package/lib/module/useGlassKnobMotion.js +112 -0
- package/lib/module/useGlassKnobMotion.js.map +1 -0
- package/lib/module/useGlassPressMotion.js +143 -0
- package/lib/module/useGlassPressMotion.js.map +1 -0
- package/lib/types/GlassSurface.d.ts +216 -0
- package/lib/types/GlassTabBar.d.ts +35 -0
- package/lib/types/GlassTabLens.d.ts +11 -0
- package/lib/types/LiquidGlassProvider.d.ts +47 -0
- package/lib/types/LocalGlassMaterial.d.ts +21 -0
- package/lib/types/adaptiveLuminance.d.ts +2 -0
- package/lib/types/badgePalette.d.ts +9 -0
- package/lib/types/buttonGesturePolicy.d.ts +4 -0
- package/lib/types/components/AdaptiveLuminance.d.ts +23 -0
- package/lib/types/components/BottomSheet.d.ts +33 -0
- package/lib/types/components/Button.d.ts +16 -0
- package/lib/types/components/Card.d.ts +25 -0
- package/lib/types/components/Checkbox.d.ts +11 -0
- package/lib/types/components/ControlPressContext.d.ts +9 -0
- package/lib/types/components/Dialog.d.ts +12 -0
- package/lib/types/components/DialogAction.d.ts +4 -0
- package/lib/types/components/DialogContent.d.ts +12 -0
- package/lib/types/components/GlassButton.d.ts +38 -0
- package/lib/types/components/GlassFab.d.ts +15 -0
- package/lib/types/components/GlassMagnifier.d.ts +41 -0
- package/lib/types/components/GlassPlayground.d.ts +12 -0
- package/lib/types/components/GlassSlider.d.ts +48 -0
- package/lib/types/components/GlassSwitch.d.ts +46 -0
- package/lib/types/components/GlassTabBar.d.ts +44 -0
- package/lib/types/components/Input.d.ts +47 -0
- package/lib/types/components/ListRow.d.ts +17 -0
- package/lib/types/components/Menu.d.ts +41 -0
- package/lib/types/components/NavigationBar.d.ts +14 -0
- package/lib/types/components/NumberWheel.d.ts +11 -0
- package/lib/types/components/PageFeedList.d.ts +6 -0
- package/lib/types/components/PageScaffold.d.ts +64 -0
- package/lib/types/components/PreferenceGroup.d.ts +12 -0
- package/lib/types/components/ProgressIndicator.d.ts +9 -0
- package/lib/types/components/ProgressiveBlur.d.ts +12 -0
- package/lib/types/components/ReferenceSlider.d.ts +31 -0
- package/lib/types/components/ReferenceTabBar.d.ts +61 -0
- package/lib/types/components/SearchBar.d.ts +52 -0
- package/lib/types/components/SegmentedControl.d.ts +10 -0
- package/lib/types/components/Slider.d.ts +19 -0
- package/lib/types/components/Snackbar.d.ts +5 -0
- package/lib/types/components/SurfaceEnvironmentContext.d.ts +17 -0
- package/lib/types/components/SurfaceGroup.d.ts +17 -0
- package/lib/types/components/Switch.d.ts +12 -0
- package/lib/types/components/Toast.d.ts +14 -0
- package/lib/types/components/TopAppBar.d.ts +49 -0
- package/lib/types/components/bottomSheetMotion.d.ts +2 -0
- package/lib/types/components/glassControlMaterial.d.ts +3 -0
- package/lib/types/components/menuPosition.d.ts +22 -0
- package/lib/types/components/pages/FeedPage.d.ts +31 -0
- package/lib/types/components/pages/PageBenchmarkContext.d.ts +30 -0
- package/lib/types/components/pages/SettingsPage.d.ts +20 -0
- package/lib/types/components/pages/SettingsSection.d.ts +9 -0
- package/lib/types/components/pages/StaticSettingsPage.d.ts +18 -0
- package/lib/types/fallbackKnobGeometry.d.ts +7 -0
- package/lib/types/glassController.d.ts +20 -0
- package/lib/types/glassNativeEngine.d.ts +5 -0
- package/lib/types/glassRuntime.d.ts +7 -0
- package/lib/types/index.d.ts +124 -0
- package/lib/types/inputPresentation.d.ts +12 -0
- package/lib/types/localGlassTelemetry.d.ts +28 -0
- package/lib/types/motion/MotionProvider.d.ts +7 -0
- package/lib/types/motion/easings.d.ts +33 -0
- package/lib/types/motion/folmeSpring.d.ts +15 -0
- package/lib/types/motion/folmeSpringByResponse.d.ts +14 -0
- package/lib/types/motion/index.d.ts +7 -0
- package/lib/types/motion/presets.d.ts +103 -0
- package/lib/types/nativeGlassViews.d.ts +114 -0
- package/lib/types/performanceTelemetry.d.ts +65 -0
- package/lib/types/pointerEventBridge.d.ts +17 -0
- package/lib/types/pointerGeometry.d.ts +2 -0
- package/lib/types/pressVelocity.d.ts +11 -0
- package/lib/types/primitives/Divider.d.ts +19 -0
- package/lib/types/primitives/Icon.d.ts +29 -0
- package/lib/types/primitives/PressIndication.d.ts +26 -0
- package/lib/types/primitives/Pressable.d.ts +9 -0
- package/lib/types/primitives/PressableScale.d.ts +19 -0
- package/lib/types/primitives/Surface.d.ts +63 -0
- package/lib/types/primitives/Text.d.ts +35 -0
- package/lib/types/primitives/index.d.ts +14 -0
- package/lib/types/renderer.d.ts +32 -0
- package/lib/types/sliderValue.d.ts +2 -0
- package/lib/types/surfaceRendererPolicy.d.ts +14 -0
- package/lib/types/theme/ThemeProvider.d.ts +26 -0
- package/lib/types/theme/buildTheme.d.ts +6 -0
- package/lib/types/theme/glassColors.d.ts +13 -0
- package/lib/types/theme/index.d.ts +11 -0
- package/lib/types/theme/liquidGlass.d.ts +5 -0
- package/lib/types/theme/presentation.d.ts +3 -0
- package/lib/types/theme/registry.d.ts +7 -0
- package/lib/types/theme/selectVariant.d.ts +10 -0
- package/lib/types/theme/tokens.d.ts +18 -0
- package/lib/types/theme/types.d.ts +305 -0
- package/lib/types/theme/wallpaper.d.ts +32 -0
- package/lib/types/types.d.ts +127 -0
- package/lib/types/useButtonGesture.d.ts +30 -0
- package/lib/types/useGlassKnobMotion.d.ts +40 -0
- package/lib/types/useGlassPressMotion.d.ts +61 -0
- package/licenses/Apache-2.0-Kyant0-Shapes.txt +191 -0
- package/package.json +139 -4
- package/patches/liquid-glass-kit+1.0.0.patch +2015 -0
- package/patches/liquid-glass-kit-invalidation-coalescing.diff +249 -0
- package/patches/liquid-glass-kit-native-infra.diff +624 -0
- package/scripts/apply-legacy-patches.mjs +116 -0
- package/src/GlassSurface.tsx +1786 -0
- package/src/GlassTabBar.tsx +1304 -0
- package/src/GlassTabLens.tsx +92 -0
- package/src/LiquidGlassProvider.tsx +135 -0
- package/src/LocalGlassMaterial.tsx +262 -0
- package/src/adaptiveLuminance.ts +15 -0
- package/src/badgePalette.ts +54 -0
- package/src/buttonGesturePolicy.ts +15 -0
- package/src/components/AdaptiveLuminance.tsx +40 -0
- package/src/components/BottomSheet.tsx +291 -0
- package/src/components/Button.tsx +30 -0
- package/src/components/Card.tsx +343 -0
- package/src/components/Checkbox.tsx +141 -0
- package/src/components/ControlPressContext.ts +11 -0
- package/src/components/Dialog.tsx +129 -0
- package/src/components/DialogAction.tsx +109 -0
- package/src/components/DialogContent.tsx +52 -0
- package/src/components/GlassButton.tsx +225 -0
- package/src/components/GlassFab.tsx +98 -0
- package/src/components/GlassMagnifier.tsx +178 -0
- package/src/components/GlassPlayground.tsx +190 -0
- package/src/components/GlassSlider.tsx +448 -0
- package/src/components/GlassSwitch.tsx +391 -0
- package/src/components/GlassTabBar.tsx +522 -0
- package/src/components/Input.tsx +277 -0
- package/src/components/ListRow.tsx +124 -0
- package/src/components/Menu.tsx +322 -0
- package/src/components/NavigationBar.tsx +27 -0
- package/src/components/NumberWheel.tsx +344 -0
- package/src/components/PageFeedList.tsx +37 -0
- package/src/components/PageScaffold.tsx +266 -0
- package/src/components/PreferenceGroup.tsx +65 -0
- package/src/components/ProgressIndicator.tsx +63 -0
- package/src/components/ProgressiveBlur.tsx +56 -0
- package/src/components/ReferenceSlider.tsx +364 -0
- package/src/components/ReferenceTabBar.tsx +564 -0
- package/src/components/SearchBar.tsx +340 -0
- package/src/components/SegmentedControl.tsx +45 -0
- package/src/components/Slider.tsx +25 -0
- package/src/components/Snackbar.tsx +10 -0
- package/src/components/SurfaceEnvironmentContext.tsx +46 -0
- package/src/components/SurfaceGroup.tsx +60 -0
- package/src/components/Switch.tsx +18 -0
- package/src/components/Toast.tsx +110 -0
- package/src/components/TopAppBar.tsx +272 -0
- package/src/components/bottomSheetMotion.ts +10 -0
- package/src/components/glassControlMaterial.ts +20 -0
- package/src/components/menuPosition.ts +58 -0
- package/src/components/pages/FeedPage.tsx +96 -0
- package/src/components/pages/PageBenchmarkContext.tsx +105 -0
- package/src/components/pages/SettingsPage.tsx +55 -0
- package/src/components/pages/SettingsSection.tsx +20 -0
- package/src/components/pages/StaticSettingsPage.tsx +50 -0
- package/src/fallbackKnobGeometry.ts +15 -0
- package/src/glassController.ts +74 -0
- package/src/glassNativeEngine.ts +16 -0
- package/src/glassRuntime.ts +28 -0
- package/src/index.ts +199 -0
- package/src/inputPresentation.ts +32 -0
- package/src/localGlassTelemetry.ts +138 -0
- package/src/motion/MotionProvider.tsx +12 -0
- package/src/motion/easings.ts +71 -0
- package/src/motion/folmeSpring.ts +22 -0
- package/src/motion/folmeSpringByResponse.ts +19 -0
- package/src/motion/index.ts +47 -0
- package/src/motion/presets.ts +128 -0
- package/src/nativeGlassViews.ts +147 -0
- package/src/performanceTelemetry.ts +95 -0
- package/src/pointerEventBridge.ts +27 -0
- package/src/pointerGeometry.ts +8 -0
- package/src/pressVelocity.ts +36 -0
- package/src/primitives/Divider.tsx +42 -0
- package/src/primitives/Icon.tsx +44 -0
- package/src/primitives/PressIndication.tsx +43 -0
- package/src/primitives/Pressable.tsx +75 -0
- package/src/primitives/PressableScale.tsx +50 -0
- package/src/primitives/Surface.tsx +171 -0
- package/src/primitives/Text.tsx +80 -0
- package/src/primitives/index.ts +14 -0
- package/src/renderer.ts +70 -0
- package/src/sliderValue.ts +19 -0
- package/src/surfaceRendererPolicy.ts +32 -0
- package/src/theme/ThemeProvider.tsx +52 -0
- package/src/theme/buildTheme.ts +160 -0
- package/src/theme/glassColors.ts +13 -0
- package/src/theme/index.ts +34 -0
- package/src/theme/liquidGlass.ts +25 -0
- package/src/theme/presentation.ts +12 -0
- package/src/theme/registry.ts +16 -0
- package/src/theme/selectVariant.ts +12 -0
- package/src/theme/tokens.ts +309 -0
- package/src/theme/types.ts +345 -0
- package/src/theme/wallpaper.ts +94 -0
- package/src/types.ts +95 -0
- package/src/useButtonGesture.ts +134 -0
- package/src/useGlassKnobMotion.ts +155 -0
- package/src/useGlassPressMotion.ts +209 -0
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
package expo.modules.newhuliquidglass
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.graphics.Canvas
|
|
5
|
+
import android.graphics.Matrix
|
|
6
|
+
import android.view.MotionEvent
|
|
7
|
+
import android.view.View
|
|
8
|
+
import android.view.ViewGroup
|
|
9
|
+
import android.view.ViewTreeObserver
|
|
10
|
+
import com.newhu.liquidglass.backdrop.BackdropConsumerView
|
|
11
|
+
import com.newhu.liquidglass.backdrop.CORNER_RADIUS_CAPSULE
|
|
12
|
+
import com.newhu.liquidglass.backdrop.GlassViewController
|
|
13
|
+
import com.newhu.liquidglass.core.GlassOpticsModel
|
|
14
|
+
import com.newhu.liquidglass.telemetry.LiquidGlassTrace
|
|
15
|
+
import expo.modules.kotlin.AppContext
|
|
16
|
+
import expo.modules.kotlin.views.ExpoView
|
|
17
|
+
import com.newhu.liquidglass.core.SharedGlassPass
|
|
18
|
+
|
|
19
|
+
internal class ExpoGlassSurfaceCoreView(
|
|
20
|
+
context: Context,
|
|
21
|
+
appContext: AppContext,
|
|
22
|
+
) : ExpoView(context, appContext), BackdropConsumerView {
|
|
23
|
+
val glass = GlassViewController(this)
|
|
24
|
+
// INVISIBLE preserves geometry and the renderer/display-list allocation. It
|
|
25
|
+
// also makes isShown false, so dirty notifications and pre-draw sampling
|
|
26
|
+
// stop without replacing the page's foreground subtree on every tab press.
|
|
27
|
+
fun setRenderingEnabled(enabled: Boolean) {
|
|
28
|
+
val next = if (enabled) View.VISIBLE else View.INVISIBLE
|
|
29
|
+
if (visibility == next) return
|
|
30
|
+
dirtyWhileOffscreen = true
|
|
31
|
+
visibility = next
|
|
32
|
+
if (enabled) invalidate()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var providerId: String = "default"
|
|
36
|
+
set(value) {
|
|
37
|
+
if (field == value && glass.provider != null) return
|
|
38
|
+
field = value
|
|
39
|
+
if (isAttachedToWindow) CoreLiquidGlassRegistry.resolve(value, glass)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var syncContentTransform: Boolean = false
|
|
43
|
+
set(value) {
|
|
44
|
+
if (field == value) return
|
|
45
|
+
field = value
|
|
46
|
+
if (value) {
|
|
47
|
+
applySiblingContentTransform(translationX, translationY, scaleX, scaleY)
|
|
48
|
+
} else {
|
|
49
|
+
applySiblingContentTransform(0f, 0f, 1f, 1f)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private val preDrawMatrix = Matrix()
|
|
54
|
+
private val sourcePreDrawMatrix = Matrix()
|
|
55
|
+
private val preDrawPoints = floatArrayOf(0f, 0f, 1f, 0f, 0f, 1f, 0f, 0f)
|
|
56
|
+
private val sourcePreDrawPoint = floatArrayOf(0f, 0f)
|
|
57
|
+
private val viewportCheckMatrix = Matrix()
|
|
58
|
+
private val viewportCheckCorners = floatArrayOf(0f, 0f, 0f, 0f)
|
|
59
|
+
private var lastObservedRelX = Float.NaN
|
|
60
|
+
private var lastObservedRelY = Float.NaN
|
|
61
|
+
private var lastObservedAncestorScaleX = Float.NaN
|
|
62
|
+
private var lastObservedAncestorScaleY = Float.NaN
|
|
63
|
+
private var lastKnownOnscreen = true
|
|
64
|
+
private var preDrawValidatedOnscreen = false
|
|
65
|
+
private var dirtyWhileOffscreen = false
|
|
66
|
+
private var hasRecordedGlassDisplayList = false
|
|
67
|
+
private var preDrawObserver: ViewTreeObserver? = null
|
|
68
|
+
|
|
69
|
+
private fun effectiveOverhangPx(): Float {
|
|
70
|
+
val density = resources.displayMetrics.density
|
|
71
|
+
val outer = if (glass.referenceOuterShadowAlpha > 0f) {
|
|
72
|
+
glass.referenceOuterShadowRadiusDp * 3f +
|
|
73
|
+
kotlin.math.abs(glass.referenceOuterShadowOffsetYDp)
|
|
74
|
+
} else {
|
|
75
|
+
0f
|
|
76
|
+
}
|
|
77
|
+
// Small 6dp lookahead beyond optical overhang: preDrawListener wakes newly
|
|
78
|
+
// entering views synchronously before performDraw(), so far-offscreen rows cost 0.
|
|
79
|
+
return (outer + glass.highlightWidthDp + 4f + 6f) * density
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private fun isWithinWindowViewport(padPx: Float): Boolean {
|
|
83
|
+
val root = rootView ?: return true
|
|
84
|
+
val rootW = root.width
|
|
85
|
+
val rootH = root.height
|
|
86
|
+
if (rootW <= 0 || rootH <= 0 || width <= 0 || height <= 0) return true
|
|
87
|
+
val parentView = parent as? View ?: return true
|
|
88
|
+
viewportCheckMatrix.reset()
|
|
89
|
+
parentView.transformMatrixToGlobal(viewportCheckMatrix)
|
|
90
|
+
val originX = (left - parentView.scrollX).toFloat()
|
|
91
|
+
val originY = (top - parentView.scrollY).toFloat()
|
|
92
|
+
viewportCheckCorners[0] = originX
|
|
93
|
+
viewportCheckCorners[1] = originY
|
|
94
|
+
viewportCheckCorners[2] = originX + width.toFloat()
|
|
95
|
+
viewportCheckCorners[3] = originY + height.toFloat()
|
|
96
|
+
viewportCheckMatrix.mapPoints(viewportCheckCorners)
|
|
97
|
+
val extraPad = padPx + kotlin.math.max(
|
|
98
|
+
kotlin.math.abs(translationX),
|
|
99
|
+
kotlin.math.abs(translationY),
|
|
100
|
+
)
|
|
101
|
+
val minX = kotlin.math.min(viewportCheckCorners[0], viewportCheckCorners[2])
|
|
102
|
+
val maxX = kotlin.math.max(viewportCheckCorners[0], viewportCheckCorners[2])
|
|
103
|
+
val minY = kotlin.math.min(viewportCheckCorners[1], viewportCheckCorners[3])
|
|
104
|
+
val maxY = kotlin.math.max(viewportCheckCorners[1], viewportCheckCorners[3])
|
|
105
|
+
return maxX >= -extraPad && minX <= rootW + extraPad &&
|
|
106
|
+
maxY >= -extraPad && minY <= rootH + extraPad
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
override fun notifyBackdropDirty(): Boolean {
|
|
110
|
+
if (!isAttachedToWindow || !isShown || !lastKnownOnscreen) {
|
|
111
|
+
dirtyWhileOffscreen = true
|
|
112
|
+
return false
|
|
113
|
+
}
|
|
114
|
+
return true
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private val preDrawListener = ViewTreeObserver.OnPreDrawListener {
|
|
118
|
+
val backdrop = glass.provider ?: return@OnPreDrawListener true
|
|
119
|
+
if (!isAttachedToWindow || !backdrop.sourceView.isAttachedToWindow ||
|
|
120
|
+
width <= 0 || height <= 0 || !isShown ||
|
|
121
|
+
sharedPassHandled || PassSurfaceSuppression.isSuppressed(this)
|
|
122
|
+
) {
|
|
123
|
+
return@OnPreDrawListener true
|
|
124
|
+
}
|
|
125
|
+
val parentView = parent as? View ?: return@OnPreDrawListener true
|
|
126
|
+
preDrawMatrix.reset()
|
|
127
|
+
parentView.transformMatrixToGlobal(preDrawMatrix)
|
|
128
|
+
val originX = (left - parentView.scrollX).toFloat()
|
|
129
|
+
val originY = (top - parentView.scrollY).toFloat()
|
|
130
|
+
preDrawPoints[0] = originX
|
|
131
|
+
preDrawPoints[1] = originY
|
|
132
|
+
preDrawPoints[2] = originX + 1f
|
|
133
|
+
preDrawPoints[3] = originY
|
|
134
|
+
preDrawPoints[4] = originX
|
|
135
|
+
preDrawPoints[5] = originY + 1f
|
|
136
|
+
preDrawPoints[6] = originX + width.toFloat()
|
|
137
|
+
preDrawPoints[7] = originY + height.toFloat()
|
|
138
|
+
preDrawMatrix.mapPoints(preDrawPoints)
|
|
139
|
+
val root = rootView
|
|
140
|
+
val onscreen = if (root != null && root.width > 0 && root.height > 0) {
|
|
141
|
+
val pad = effectiveOverhangPx() + kotlin.math.max(
|
|
142
|
+
kotlin.math.abs(translationX),
|
|
143
|
+
kotlin.math.abs(translationY),
|
|
144
|
+
)
|
|
145
|
+
val minX = kotlin.math.min(preDrawPoints[0], preDrawPoints[6])
|
|
146
|
+
val maxX = kotlin.math.max(preDrawPoints[0], preDrawPoints[6])
|
|
147
|
+
val minY = kotlin.math.min(preDrawPoints[1], preDrawPoints[7])
|
|
148
|
+
val maxY = kotlin.math.max(preDrawPoints[1], preDrawPoints[7])
|
|
149
|
+
maxX >= -pad && minX <= root.width + pad &&
|
|
150
|
+
maxY >= -pad && minY <= root.height + pad
|
|
151
|
+
} else {
|
|
152
|
+
true
|
|
153
|
+
}
|
|
154
|
+
val wasOnscreen = lastKnownOnscreen
|
|
155
|
+
lastKnownOnscreen = onscreen
|
|
156
|
+
preDrawValidatedOnscreen = true
|
|
157
|
+
if (!onscreen) {
|
|
158
|
+
val justExited = wasOnscreen && hasRecordedGlassDisplayList
|
|
159
|
+
dirtyWhileOffscreen = true
|
|
160
|
+
if (justExited) invalidate()
|
|
161
|
+
return@OnPreDrawListener true
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
sourcePreDrawMatrix.reset()
|
|
165
|
+
backdrop.sourceView.transformMatrixToGlobal(sourcePreDrawMatrix)
|
|
166
|
+
sourcePreDrawPoint[0] = 0f
|
|
167
|
+
sourcePreDrawPoint[1] = 0f
|
|
168
|
+
sourcePreDrawMatrix.mapPoints(sourcePreDrawPoint)
|
|
169
|
+
val relX = preDrawPoints[0] - sourcePreDrawPoint[0]
|
|
170
|
+
val relY = preDrawPoints[1] - sourcePreDrawPoint[1]
|
|
171
|
+
val ancestorScaleX = kotlin.math.hypot(
|
|
172
|
+
(preDrawPoints[2] - preDrawPoints[0]).toDouble(),
|
|
173
|
+
(preDrawPoints[3] - preDrawPoints[1]).toDouble(),
|
|
174
|
+
).toFloat()
|
|
175
|
+
val ancestorScaleY = kotlin.math.hypot(
|
|
176
|
+
(preDrawPoints[4] - preDrawPoints[0]).toDouble(),
|
|
177
|
+
(preDrawPoints[5] - preDrawPoints[1]).toDouble(),
|
|
178
|
+
).toFloat()
|
|
179
|
+
|
|
180
|
+
val moved = lastObservedRelX.isNaN() ||
|
|
181
|
+
kotlin.math.abs(relX - lastObservedRelX) > 0.5f ||
|
|
182
|
+
kotlin.math.abs(relY - lastObservedRelY) > 0.5f ||
|
|
183
|
+
kotlin.math.abs(ancestorScaleX - lastObservedAncestorScaleX) > 0.002f ||
|
|
184
|
+
kotlin.math.abs(ancestorScaleY - lastObservedAncestorScaleY) > 0.002f
|
|
185
|
+
val resumedFromOffscreen = dirtyWhileOffscreen || !wasOnscreen
|
|
186
|
+
if (moved || resumedFromOffscreen) {
|
|
187
|
+
val hadPrevious = !lastObservedRelX.isNaN()
|
|
188
|
+
lastObservedRelX = relX
|
|
189
|
+
lastObservedRelY = relY
|
|
190
|
+
lastObservedAncestorScaleX = ancestorScaleX
|
|
191
|
+
lastObservedAncestorScaleY = ancestorScaleY
|
|
192
|
+
dirtyWhileOffscreen = false
|
|
193
|
+
if (hadPrevious || resumedFromOffscreen) invalidate()
|
|
194
|
+
}
|
|
195
|
+
true
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
init {
|
|
199
|
+
setWillNotDraw(false)
|
|
200
|
+
glass.onInteractionTransformUpdated = { tx, ty, sx, sy ->
|
|
201
|
+
if (syncContentTransform) applySiblingContentTransform(tx, ty, sx, sy)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
private fun applySiblingContentTransform(tx: Float, ty: Float, sx: Float, sy: Float) {
|
|
206
|
+
val group = parent as? ViewGroup ?: return
|
|
207
|
+
for (i in 0 until group.childCount) {
|
|
208
|
+
val child = group.getChildAt(i)
|
|
209
|
+
if (child !== this) {
|
|
210
|
+
child.translationX = tx
|
|
211
|
+
child.translationY = ty
|
|
212
|
+
child.scaleX = sx
|
|
213
|
+
child.scaleY = sy
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
override fun onAttachedToWindow() {
|
|
219
|
+
super.onAttachedToWindow()
|
|
220
|
+
CoreLiquidGlassRegistry.resolve(providerId, glass)
|
|
221
|
+
glass.onHostAttached()
|
|
222
|
+
val observer = viewTreeObserver
|
|
223
|
+
if (preDrawObserver == null && observer.isAlive) {
|
|
224
|
+
observer.addOnPreDrawListener(preDrawListener)
|
|
225
|
+
preDrawObserver = observer
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
override fun onDetachedFromWindow() {
|
|
230
|
+
val observer = preDrawObserver
|
|
231
|
+
if (observer != null && observer.isAlive) {
|
|
232
|
+
observer.removeOnPreDrawListener(preDrawListener)
|
|
233
|
+
} else if (viewTreeObserver.isAlive) {
|
|
234
|
+
viewTreeObserver.removeOnPreDrawListener(preDrawListener)
|
|
235
|
+
}
|
|
236
|
+
preDrawObserver = null
|
|
237
|
+
lastObservedRelX = Float.NaN
|
|
238
|
+
lastObservedRelY = Float.NaN
|
|
239
|
+
lastObservedAncestorScaleX = Float.NaN
|
|
240
|
+
lastObservedAncestorScaleY = Float.NaN
|
|
241
|
+
lastKnownOnscreen = true
|
|
242
|
+
preDrawValidatedOnscreen = false
|
|
243
|
+
dirtyWhileOffscreen = false
|
|
244
|
+
hasRecordedGlassDisplayList = false
|
|
245
|
+
applySiblingContentTransform(0f, 0f, 1f, 1f)
|
|
246
|
+
CoreLiquidGlassRegistry.cancelWaiting(glass)
|
|
247
|
+
glass.onHostDetached()
|
|
248
|
+
super.onDetachedFromWindow()
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
override fun onWindowVisibilityChanged(visibility: Int) {
|
|
252
|
+
super.onWindowVisibilityChanged(visibility)
|
|
253
|
+
if (visibility == View.VISIBLE && isAttachedToWindow) {
|
|
254
|
+
glass.onHostBecameVisible()
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
override fun dispatchTouchEvent(event: MotionEvent): Boolean {
|
|
259
|
+
glass.handleTouch(event)
|
|
260
|
+
return super.dispatchTouchEvent(event)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Set by the provider for the duration of one draw when this surface was
|
|
265
|
+
* already composited by the shared pass, so it must not paint itself again.
|
|
266
|
+
*/
|
|
267
|
+
var sharedPassHandled = false
|
|
268
|
+
|
|
269
|
+
/** Mirrors the React portal wrapper's ordering for the provider's batch. */
|
|
270
|
+
var sharedPassOrder: Int = 0
|
|
271
|
+
var sharedPassZIndex: Int = 1
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
private val sharedPassValuesBuffer = FloatArray(
|
|
275
|
+
com.newhu.liquidglass.core.SharedGlassPass.VALUE_COUNT,
|
|
276
|
+
)
|
|
277
|
+
private val sharedPassBounds = android.graphics.RectF()
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Geometry plus the reference parameters for the shared multi-shape pass. The
|
|
281
|
+
* values are the same numbers this surface would set as its own uniforms, so a
|
|
282
|
+
* shared pass draws what the per-surface renderer would have drawn.
|
|
283
|
+
*/
|
|
284
|
+
/** True only for surfaces the provider's multi-shape pass could ever composite. */
|
|
285
|
+
private fun canJoinSharedPass(): Boolean =
|
|
286
|
+
com.newhu.liquidglass.core.SharedGlassPass.ENABLED &&
|
|
287
|
+
glass.referenceInteractionProfile == 0 &&
|
|
288
|
+
glass.highlightAlpha <= 0.001f &&
|
|
289
|
+
glass.innerShadowStrength <= 0.001f &&
|
|
290
|
+
glass.referenceOuterShadowAlpha <= 0.001f &&
|
|
291
|
+
glass.shapeMaskText == null &&
|
|
292
|
+
glass.progressiveBlurIntensity <= 0.001f
|
|
293
|
+
|
|
294
|
+
fun sharedPassEntry(): com.newhu.liquidglass.core.SharedGlassEntry? {
|
|
295
|
+
if (!com.newhu.liquidglass.core.SharedGlassPass.ENABLED) return null
|
|
296
|
+
if (!isShown) return null
|
|
297
|
+
// The multi-shape shader currently composites only each lens body. It does
|
|
298
|
+
// not draw the reference highlight, inner/outer shadows, or interaction
|
|
299
|
+
// overlays. Keep any surface that needs those layers on its own renderer;
|
|
300
|
+
// otherwise a page with several glasses silently loses the very effects
|
|
301
|
+
// that define the component (especially the travelling tab/switch/slider
|
|
302
|
+
// lenses).
|
|
303
|
+
if (!canJoinSharedPass()) return null
|
|
304
|
+
if (width <= 0 || height <= 0) return null
|
|
305
|
+
glass.refreshSharedPassSnapshot()
|
|
306
|
+
if (!glass.sharedPassValues(sharedPassValuesBuffer)) return null
|
|
307
|
+
val location = IntArray(2)
|
|
308
|
+
getLocationInWindow(location)
|
|
309
|
+
sharedPassBounds.set(
|
|
310
|
+
location[0].toFloat(),
|
|
311
|
+
location[1].toFloat(),
|
|
312
|
+
(location[0] + width).toFloat(),
|
|
313
|
+
(location[1] + height).toFloat(),
|
|
314
|
+
)
|
|
315
|
+
return com.newhu.liquidglass.core.SharedGlassEntry(
|
|
316
|
+
bounds = android.graphics.RectF(sharedPassBounds),
|
|
317
|
+
values = sharedPassValuesBuffer.copyOf(),
|
|
318
|
+
)
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
|
|
322
|
+
super.onLayout(changed, left, top, right, bottom)
|
|
323
|
+
if (canJoinSharedPass()) glass.refreshSharedPassSnapshot()
|
|
324
|
+
if (changed) invalidate()
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
override fun onSizeChanged(width: Int, height: Int, oldWidth: Int, oldHeight: Int) {
|
|
328
|
+
super.onSizeChanged(width, height, oldWidth, oldHeight)
|
|
329
|
+
if (width != oldWidth || height != oldHeight) {
|
|
330
|
+
if (canJoinSharedPass()) glass.refreshSharedPassSnapshot()
|
|
331
|
+
glass.provider?.onConsumerGeometryChanged(this)
|
|
332
|
+
invalidate()
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
private fun branch(): String {
|
|
337
|
+
val loc = IntArray(2)
|
|
338
|
+
getLocationInWindow(loc)
|
|
339
|
+
return "at=" + loc[0] + "," + loc[1] + " " + width + "x" + height + " "
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
override fun onDraw(canvas: Canvas) {
|
|
343
|
+
// A pass that has painted owns those pixels for the rest of the frame.
|
|
344
|
+
if (sharedPassHandled || PassSurfaceSuppression.isSuppressed(this)) {
|
|
345
|
+
if (SharedGlassPassProbeLog.DEBUG_ENABLED) {
|
|
346
|
+
SharedGlassPassProbeLog.tick("skip", providerId, branch() + (if (sharedPassHandled) "handled" else "suppressed"))
|
|
347
|
+
}
|
|
348
|
+
hasRecordedGlassDisplayList = false
|
|
349
|
+
return
|
|
350
|
+
}
|
|
351
|
+
// Portal-hosted glass views can stay mounted while their settings/feed
|
|
352
|
+
// rows have scrolled fully beyond the visible window viewport. Skip
|
|
353
|
+
// off-screen draws completely so neither HWUI nor RenderThread allocates
|
|
354
|
+
// or shades scratch FBOs for rows outside view; preDrawListener wakes
|
|
355
|
+
// them as soon as they approach the viewport again.
|
|
356
|
+
val overhangPx = effectiveOverhangPx()
|
|
357
|
+
val onscreen = if (preDrawValidatedOnscreen) {
|
|
358
|
+
preDrawValidatedOnscreen = false
|
|
359
|
+
lastKnownOnscreen
|
|
360
|
+
} else {
|
|
361
|
+
isWithinWindowViewport(overhangPx)
|
|
362
|
+
}
|
|
363
|
+
if (width <= 0 || height <= 0 ||
|
|
364
|
+
!onscreen ||
|
|
365
|
+
canvas.quickReject(
|
|
366
|
+
-overhangPx, -overhangPx,
|
|
367
|
+
width.toFloat() + overhangPx, height.toFloat() + overhangPx,
|
|
368
|
+
)
|
|
369
|
+
) {
|
|
370
|
+
lastKnownOnscreen = false
|
|
371
|
+
dirtyWhileOffscreen = true
|
|
372
|
+
hasRecordedGlassDisplayList = false
|
|
373
|
+
return
|
|
374
|
+
}
|
|
375
|
+
lastKnownOnscreen = true
|
|
376
|
+
dirtyWhileOffscreen = false
|
|
377
|
+
if (canJoinSharedPass()) glass.refreshSharedPassSnapshot()
|
|
378
|
+
// Nothing has painted this surface's pixels yet. Ask the provider to run its pass
|
|
379
|
+
// and keep out of the way: without this the pass draws once, the surface then
|
|
380
|
+
// invalidates and redraws, and its own glass wins every frame after that.
|
|
381
|
+
val passProvider = glass.provider as? ExpoGlassProviderCoreView
|
|
382
|
+
if (passProvider != null && passProvider.passCovers(this)) {
|
|
383
|
+
if (SharedGlassPassProbeLog.DEBUG_ENABLED) {
|
|
384
|
+
SharedGlassPassProbeLog.tick("wait", providerId, branch() + "waiting for pass")
|
|
385
|
+
}
|
|
386
|
+
passProvider.invalidate()
|
|
387
|
+
hasRecordedGlassDisplayList = false
|
|
388
|
+
return
|
|
389
|
+
}
|
|
390
|
+
if (SharedGlassPassProbeLog.DEBUG_ENABLED) {
|
|
391
|
+
SharedGlassPassProbeLog.tick("draw", providerId, branch() + "own renderer")
|
|
392
|
+
}
|
|
393
|
+
val tracing = LiquidGlassTrace.isEnabled()
|
|
394
|
+
if (!tracing) {
|
|
395
|
+
super.onDraw(canvas)
|
|
396
|
+
glass.draw(canvas)
|
|
397
|
+
hasRecordedGlassDisplayList = true
|
|
398
|
+
return
|
|
399
|
+
}
|
|
400
|
+
LiquidGlassTrace.beginSection("Consumer.onDraw")
|
|
401
|
+
try {
|
|
402
|
+
val backdrop = glass.provider
|
|
403
|
+
LiquidGlassTrace.counter("consumerViewId", System.identityHashCode(this).toLong())
|
|
404
|
+
LiquidGlassTrace.counter("consumerTop", top.toLong())
|
|
405
|
+
LiquidGlassTrace.counter("consumerScrollSampleOriginY", backdrop?.recordedOriginYFor(this)?.toLong() ?: -1L)
|
|
406
|
+
LiquidGlassTrace.counter("consumerHasSourceRecording", if (backdrop?.hasRecording == true) 1L else 0L)
|
|
407
|
+
super.onDraw(canvas)
|
|
408
|
+
glass.draw(canvas)
|
|
409
|
+
hasRecordedGlassDisplayList = true
|
|
410
|
+
} finally {
|
|
411
|
+
LiquidGlassTrace.endSection()
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
fun setCornerRadius(radius: Float?) { glass.cornerRadiusDp = radius ?: CORNER_RADIUS_CAPSULE }
|
|
416
|
+
fun setShapeMaskText(value: String?) { glass.shapeMaskText = value?.take(64) }
|
|
417
|
+
fun setShapeMaskFontSize(value: Float?) { glass.shapeMaskFontSizeDp = value ?: 0f }
|
|
418
|
+
fun setShapeMaskFontWeight(value: Int?) { glass.shapeMaskFontWeight = value ?: 700 }
|
|
419
|
+
fun setProgressiveBlurIntensity(value: Float?) { glass.progressiveBlurIntensity = value ?: 0f }
|
|
420
|
+
fun setBlurRadius(radius: Float?) { glass.blurRadiusDp = radius ?: 20f }
|
|
421
|
+
fun setRefractionHeight(value: Float?) { glass.refractionHeightDp = value ?: 10f }
|
|
422
|
+
fun setRefractionAmount(value: Float?) { glass.refractionAmountDp = value ?: 12f }
|
|
423
|
+
fun setDepthEffect(value: Boolean?) { glass.referenceDepthEffect = value ?: false }
|
|
424
|
+
fun setBodyRefractionAmount(value: Float?) { glass.bodyRefractionAmountDp = value ?: 2.5f }
|
|
425
|
+
fun setInteractionProgress(value: Float?) { glass.interactionProgress = value ?: 0f }
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Touch forwarded from the JS touch source, as "phase,x,y,timeMillis".
|
|
429
|
+
*
|
|
430
|
+
* One string rather than four numeric props because the four values are only
|
|
431
|
+
* meaningful together: the bridge delivers props independently, and a phase that
|
|
432
|
+
* arrives before its coordinates would place the press at the previous point.
|
|
433
|
+
*/
|
|
434
|
+
private var lastPropValueEvent: String? = null
|
|
435
|
+
private var lastPropPointerEvent: String? = null
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Prop delivery channel for [forwardValue]. React re-renders replay unchanged
|
|
439
|
+
* string props whenever sibling props (like `interacting` or controlled
|
|
440
|
+
* UI state) commit, which would otherwise clobber active JSI drag packets.
|
|
441
|
+
*/
|
|
442
|
+
fun forwardValueProp(payload: String?) {
|
|
443
|
+
if (payload == lastPropValueEvent) return
|
|
444
|
+
lastPropValueEvent = payload
|
|
445
|
+
forwardValue(payload)
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/** Prop delivery channel for [forwardPointer]; ignores unchanged React replays. */
|
|
449
|
+
fun forwardPointerProp(payload: String?) {
|
|
450
|
+
if (payload == lastPropPointerEvent) return
|
|
451
|
+
lastPropPointerEvent = payload
|
|
452
|
+
forwardPointer(payload)
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Knob value channel, as "travel,trackLength,animate,velocity[,seq]".
|
|
457
|
+
*
|
|
458
|
+
* One string for the same reason as [forwardPointer]: the values are only
|
|
459
|
+
* meaningful together, and a travel arriving before the track length it is
|
|
460
|
+
* relative to would place the lens using the previous track.
|
|
461
|
+
*/
|
|
462
|
+
fun forwardValue(payload: String?) {
|
|
463
|
+
if (payload == null) return
|
|
464
|
+
val parts = payload.split(',')
|
|
465
|
+
if (parts.size !in 4..5) return
|
|
466
|
+
// React Native reports layout in dp; the motion driver works in pixels, like
|
|
467
|
+
// every other geometry value it receives. Mixing the two put a slider's track at
|
|
468
|
+
// 272px when the rail on screen was 1016px wide, so the knob's travel was a
|
|
469
|
+
// quarter of what the value implied and its offset never matched the rail fill.
|
|
470
|
+
val density = resources.displayMetrics.density
|
|
471
|
+
val travel = (parts[0].toFloatOrNull() ?: return) * density
|
|
472
|
+
val trackLength = (parts[1].toFloatOrNull() ?: return) * density
|
|
473
|
+
val mode = parts[2].toIntOrNull() ?: 0
|
|
474
|
+
val animate = mode >= 1
|
|
475
|
+
val keepPressed = mode == 2
|
|
476
|
+
// Velocity is already normalized to track fractions per second in JS;
|
|
477
|
+
// unlike travel and track length (dp), it is not a screen-space distance.
|
|
478
|
+
val velocity = parts[3].toFloatOrNull() ?: 0f
|
|
479
|
+
glass.forwardValue(travel, trackLength, animate, velocity, keepPressed, snap = mode == 3)
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
fun forwardPointer(payload: String?) {
|
|
483
|
+
if (payload == null) return
|
|
484
|
+
val parts = payload.split(',')
|
|
485
|
+
if (parts.size != 4) return
|
|
486
|
+
val phase = parts[0].toIntOrNull() ?: return
|
|
487
|
+
val x = parts[1].toFloatOrNull() ?: return
|
|
488
|
+
val y = parts[2].toFloatOrNull() ?: return
|
|
489
|
+
val time = parts[3].toLongOrNull() ?: return
|
|
490
|
+
// React Native's locationX/locationY are in dp, while the native motion
|
|
491
|
+
// driver and the surface geometry are both in physical pixels.
|
|
492
|
+
val density = resources.displayMetrics.density
|
|
493
|
+
glass.forwardPointer(phase, x * density, y * density, time)
|
|
494
|
+
}
|
|
495
|
+
fun setToggleFraction(value: Float?) { glass.referenceToggleFraction = value ?: 0f }
|
|
496
|
+
fun setToggleTrackColorOff(value: Int?) { glass.referenceToggleTrackColorOff = value }
|
|
497
|
+
fun setToggleTrackColorOn(value: Int?) { glass.referenceToggleTrackColorOn = value }
|
|
498
|
+
fun setToggleTrackWidth(value: Float?) { glass.referenceToggleTrackWidthDp = value ?: 0f }
|
|
499
|
+
fun setToggleTrackHeight(value: Float?) { glass.referenceToggleTrackHeightDp = value ?: 0f }
|
|
500
|
+
fun setToggleSolidBackdropColor(value: Int?) { glass.referenceToggleSolidBackdropColor = value }
|
|
501
|
+
fun setInteractionPointX(value: Float?) { glass.interactionPointX = value ?: 0f }
|
|
502
|
+
fun setInteractionPointY(value: Float?) { glass.interactionPointY = value ?: 0f }
|
|
503
|
+
fun setInteractionVelocityX(value: Float?) { glass.interactionVelocityXDpPerSecond = value ?: 0f }
|
|
504
|
+
fun setInteractionVelocityY(value: Float?) { glass.interactionVelocityYDpPerSecond = value ?: 0f }
|
|
505
|
+
fun setSaturation(value: Float?) { glass.saturation = value ?: 1.5f }
|
|
506
|
+
fun setTint(value: Int?) { glass.glassTintColor = value ?: 0 }
|
|
507
|
+
fun setSurfaceColor(value: Int?) { glass.glassSurfaceColor = value ?: 0 }
|
|
508
|
+
fun setHighlightColor(value: Int?) { glass.referenceHighlightColor = value ?: android.graphics.Color.WHITE }
|
|
509
|
+
fun setTintAlpha(value: Float?) { glass.tintAlpha = value ?: 1f }
|
|
510
|
+
fun setChromaticAberration(value: Float?) { glass.chromaticAberration = (value ?: 0f).coerceIn(0f, 1f) }
|
|
511
|
+
fun setNoiseAlpha(value: Float?) { glass.noiseAlpha = (value ?: 0.015f).coerceIn(0f, 1f) }
|
|
512
|
+
fun setHighlightAlpha(value: Float?) { glass.highlightAlpha = (value ?: 0.45f).coerceIn(0f, 1f) }
|
|
513
|
+
fun setSpecularStrength(value: Float?) { glass.specularStrength = (value ?: 1f).coerceIn(0f, 2f) }
|
|
514
|
+
fun setFresnelStrength(value: Float?) { glass.fresnelStrength = (value ?: 0.85f).coerceIn(0f, 2f) }
|
|
515
|
+
fun setInnerShadowStrength(value: Float?) { glass.innerShadowStrength = (value ?: 0.18f).coerceIn(0f, 1f) }
|
|
516
|
+
fun setShadowOpacity(value: Float?) { glass.referenceOuterShadowAlpha = (value ?: 0f).coerceIn(0f, 1f) }
|
|
517
|
+
fun setShadowRadius(value: Float?) { glass.referenceOuterShadowRadiusDp = (value ?: 0f).coerceAtLeast(0f) }
|
|
518
|
+
fun setShadowOffsetY(value: Float?) { glass.referenceOuterShadowOffsetYDp = value ?: 0f }
|
|
519
|
+
fun setHighlightWidth(value: Float?) { glass.highlightWidthDp = value ?: 2f }
|
|
520
|
+
fun setLightAngle(value: Float?) { glass.lightAngleDegrees = value ?: 245f }
|
|
521
|
+
fun setInteractive(value: Boolean?) { glass.isGlassInteractive = value ?: false }
|
|
522
|
+
fun setMotionX(value: Float?) { glass.motionX = value }
|
|
523
|
+
fun setMotionY(value: Float?) { glass.motionY = value }
|
|
524
|
+
fun setDisplacementOnlyDebug(value: Boolean?) { glass.displacementOnlyDebug = value ?: false }
|
|
525
|
+
fun setSdfDisplacementMapDebug(value: Boolean?) { glass.sdfDisplacementMapDebug = value ?: false }
|
|
526
|
+
fun setOpticsModel(value: String?) {
|
|
527
|
+
glass.opticsModel = when (value?.lowercase()) {
|
|
528
|
+
"sdfscalelens" -> GlassOpticsModel.SDF_SCALE_LENS
|
|
529
|
+
"referenceparity" -> GlassOpticsModel.REFERENCE_PARITY
|
|
530
|
+
else -> GlassOpticsModel.HEIGHT_FIELD
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
fun setHighlightStyle(value: String?) {
|
|
534
|
+
glass.referenceHighlightStyle = when (value?.lowercase()) {
|
|
535
|
+
"ambient" -> 1
|
|
536
|
+
"plain" -> 2
|
|
537
|
+
else -> 0
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
fun setInteractionProfile(value: String?) {
|
|
541
|
+
glass.referenceInteractionProfile = when (value?.lowercase()) {
|
|
542
|
+
"button" -> 4
|
|
543
|
+
"toggle" -> 1
|
|
544
|
+
"slider" -> 2
|
|
545
|
+
"tab" -> 3
|
|
546
|
+
else -> 0
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
fun setContentScaleX(value: Float?) { glass.referenceContentScaleX = value ?: 1f }
|
|
550
|
+
fun setContentScaleY(value: Float?) { glass.referenceContentScaleY = value ?: 1f }
|
|
551
|
+
fun setSampleOffsetX(value: Float?) { glass.referenceSampleOffsetXDp = value ?: 0f }
|
|
552
|
+
fun setSampleOffsetY(value: Float?) { glass.referenceSampleOffsetYDp = value ?: 0f }
|
|
553
|
+
fun setBrightness(value: Float?) { glass.brightness = value ?: 0f }
|
|
554
|
+
fun setContrast(value: Float?) { glass.contrast = value ?: 1f }
|
|
555
|
+
fun setHighlightFalloff(value: Float?) { glass.referenceHighlightFalloff = (value ?: 1f).coerceAtLeast(0f) }
|
|
556
|
+
fun setSdfContrast(value: Float?) { glass.sdfScaleLens = glass.sdfScaleLens.copy(contrast = value ?: 1.2f) }
|
|
557
|
+
fun setSdfBrightness(value: Float?) { glass.sdfScaleLens = glass.sdfScaleLens.copy(brightness = value ?: 1.05f) }
|
|
558
|
+
fun setSdfSaturation(value: Float?) { glass.sdfScaleLens = glass.sdfScaleLens.copy(saturation = value ?: 1.1f) }
|
|
559
|
+
fun setSdfOuterShadowAlpha(value: Float?) { glass.sdfScaleLens = glass.sdfScaleLens.copy(outerShadowAlpha = value ?: 0.25f) }
|
|
560
|
+
fun setSdfOuterShadowBlurRadius(value: Float?) { glass.sdfScaleLens = glass.sdfScaleLens.copy(outerShadowBlurRadiusDp = value ?: 8f) }
|
|
561
|
+
fun setSdfOuterShadowOffsetY(value: Float?) { glass.sdfScaleLens = glass.sdfScaleLens.copy(outerShadowOffsetYDp = value ?: 4f) }
|
|
562
|
+
fun setSdfInnerShadowAlpha(value: Float?) { glass.sdfScaleLens = glass.sdfScaleLens.copy(innerShadowAlpha = value ?: 0.15f) }
|
|
563
|
+
fun setSdfInnerShadowExtent(value: Float?) { glass.sdfScaleLens = glass.sdfScaleLens.copy(innerShadowExtentDp = value ?: 25f) }
|
|
564
|
+
fun setContinuous(value: Boolean?) { glass.continuousBackdrop = value ?: false }
|
|
565
|
+
fun setSharedSource(value: Boolean?) {
|
|
566
|
+
glass.sharedSourceSampling = value ?: false
|
|
567
|
+
}
|
|
568
|
+
fun setCaptureProbe(value: Boolean?) {
|
|
569
|
+
glass.sharedSceneCaptureProbe = value ?: false
|
|
570
|
+
}
|
|
571
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
package expo.modules.newhuliquidglass
|
|
2
|
+
|
|
3
|
+
import android.view.Choreographer
|
|
4
|
+
import android.view.View
|
|
5
|
+
import java.util.Collections
|
|
6
|
+
import java.util.WeakHashMap
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Which surfaces a shared pass has painted this frame.
|
|
10
|
+
*
|
|
11
|
+
* A process-wide boolean was tried and is wrong: it hides surfaces that no pass covers -
|
|
12
|
+
* the tab bar vanished while the search bar was being composited. The suppression has to
|
|
13
|
+
* name the views, and it has to outlive the provider that armed it, because the covered
|
|
14
|
+
* surfaces are drawn afterwards by the parent traversal. It is released at the start of
|
|
15
|
+
* the next frame, so a frame that runs no pass leaves every surface drawing normally.
|
|
16
|
+
*/
|
|
17
|
+
internal object PassSurfaceSuppression {
|
|
18
|
+
private val views = Collections.newSetFromMap(WeakHashMap<View, Boolean>())
|
|
19
|
+
|
|
20
|
+
@Volatile
|
|
21
|
+
private var armed = false
|
|
22
|
+
|
|
23
|
+
private var releasePending = false
|
|
24
|
+
|
|
25
|
+
fun arm(covered: Collection<View>) {
|
|
26
|
+
if (covered.isEmpty()) return
|
|
27
|
+
views.addAll(covered)
|
|
28
|
+
armed = true
|
|
29
|
+
if (releasePending) return
|
|
30
|
+
releasePending = true
|
|
31
|
+
Choreographer.getInstance().postFrameCallback {
|
|
32
|
+
armed = false
|
|
33
|
+
views.clear()
|
|
34
|
+
releasePending = false
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
fun isSuppressed(view: View): Boolean = armed && views.contains(view)
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package expo.modules.newhuliquidglass
|
|
2
|
+
|
|
3
|
+
/** Throttled diagnostics for the shared-pass investigation. */
|
|
4
|
+
internal object SharedGlassPassProbeLog {
|
|
5
|
+
const val DEBUG_ENABLED = false
|
|
6
|
+
private val counters = HashMap<String, Int>()
|
|
7
|
+
|
|
8
|
+
private val seen = HashSet<String>()
|
|
9
|
+
|
|
10
|
+
fun tick(key: String, id: String, reason: String) {
|
|
11
|
+
if (!DEBUG_ENABLED) return
|
|
12
|
+
if (!seen.add(key + reason)) return
|
|
13
|
+
android.util.Log.i("LiquidGlassSuppress", "$key id=$id $reason")
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
fun log(message: String) {
|
|
17
|
+
if (!DEBUG_ENABLED) return
|
|
18
|
+
val next = (counters["log"] ?: 0) + 1
|
|
19
|
+
counters["log"] = next
|
|
20
|
+
if (next % 60 != 1) return
|
|
21
|
+
android.util.Log.i("LiquidGlassSuppress", message)
|
|
22
|
+
}
|
|
23
|
+
}
|