Using Skia, Yoga, SurfaceView/TextureView to build a simple Flexbox-UI framework for Android.
steps:
- Compile skia https://skia.org/docs/user/build/ ,or unzip arm64-v8a.zip and x86-64.zip files in jniLibs.
- Using Skia GL context.
- Two threads: ui-thread & render-thread.
- Only support FlexboxLayout. Measure/Layout/Draw are triggered by Vsync.
- TouchEvents: dispatchTouchEvent/interceptTouchEvent/onTouchEvent.
- Animations support scale/rotate/translate,and will be performed before measure.
support easing functions: https://easings.net/en - Dirty-Render: markDirty if next draw is necessary.
- Supported Widgets:
View, ImageView, TextView, Icon, ProgressBar, SVGView, ShaderView, Lottie, VideoView, YUVVideoView, ScrollView, MovingArea, RecyclerView, Swiper, Loading, Switch, Radio, Picker, LyricView, InputView, FlexboxLayout, Page... - PlatformView:
render Android-Views such as WebView/EditText by SurfaceTexture/SkImage, just like Flutter.
render 3D View by Filament(other engines can also supported)/SurfaceTexture/SkImage.
render Video(ExoPlayer)/Camera by SurfaceTexture/SkImage.
... - Development:
C++ `` See ExamplePage.cpp. js Import v8 to evaluate javascript
See test.js in assets. Support debug in chrome. Kotlin Import kotlin
Compose-runtime
Support Live-Edit, save code then ui will refresh. See HYComposeExamplePage.kt in java. React Import react/react-reconciler
demo: https://github.com/tanpuer/skia-ui-react Vue Import @vue/runtime-core
demo: https://github.com/tanpuer/skia-ui-vue. Need import CSS-Selector(TODO). - Cross Platform
ios: https://github.com/tanpuer/HYSkiaUI-iOS - Performance Problems:
Skia: Shader Compilation jank, cache kSKSL