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,the interpolator will be executed in Layout then update SkRect.
- Supported Widgets:
View: rect, cornerRadius.
ImageView: support png/gif, scaleType,cornerRadius, blur.
TextView: use SkParagraph, use AlimamaFangYuanTiVF-Thin.ttf by default.
Icon: use the iconfont.woff by default.
ProgressBar: circle and linear style,also can be dragged.
SVGView: svg file.
ShaderView: render simple fragment-shader.
Lottie: render lottie.json.
VideoView: render local video by MediaCodec/HardwareBuffer/SkImage.
YUVVideoView: render video by MediaCodec/SkRuntimeEffect.
LyricView: parse .lrc/.srt files, use RecyclerView to render lyric.
MovingArea: intercept TouchEvents by default and can move.
InputView: binding to Java EditText and render it's text.
Swiper: just like ViewPager.
Other CustomsViews: Loading, Switch, Radio, Picker...
PlatformView: render Android-Views such as WebView/EditText by SurfaceTexture/SkImage, just like Flutter.
render CameraView by ImageReader/ByteBuffer/SkRuntimeEffect.
render 3D View by Filament(other engines can also supported)/SurfaceTexture/SkImage.
... - scrollView: scroll, fling,for more optimizations.
- RecyclerView: adapter,ViewHolder,for more optimizations.
- Page: act as the same role as Activity.
- C++: See CppTest.cpp.
- js: See test.js in assets. Import v8 to evaluate javascript.
- kotlin: See JetpackComposeTest.kt in java. Import kotlin and Compose-runtime to run.
- Dirty-Render: markDirty after "draw" if necessary.