From 9a4974320a9a0220b50c26a31d77bd41f85641b9 Mon Sep 17 00:00:00 2001 From: Jenly Date: Sun, 18 Aug 2024 22:56:46 +0800 Subject: [PATCH] docs --- .editorconfig | 12 +++ .github/workflows/docs.yml | 56 ++++++++++++++ change_log.md => CHANGELOG.md | 8 +- README.md | 46 ++++++------ build.gradle | 5 +- build_docs.sh | 24 ++++++ mkdocs.yml | 86 ++++++++++++++++++++++ mlkit-barcode-scanning/build.gradle | 2 + mlkit-common/build.gradle | 2 + mlkit-face-detection/build.gradle | 2 + mlkit-face-mesh-detection/build.gradle | 2 + mlkit-image-labeling/build.gradle | 2 + mlkit-object-detection/build.gradle | 2 + mlkit-pose-detection-accurate/build.gradle | 2 + mlkit-pose-detection/build.gradle | 2 + mlkit-segmentation-selfie/build.gradle | 2 + mlkit-text-recognition/build.gradle | 2 + 17 files changed, 230 insertions(+), 27 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/workflows/docs.yml rename change_log.md => CHANGELOG.md (84%) create mode 100755 build_docs.sh create mode 100644 mkdocs.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a15f8f8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +ij_continuation_indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{kt, kts}] +ij_kotlin_imports_layout = * \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..2bbfc7b --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,56 @@ +name: docs + +on: + push: + branches: + - master + +env: + JAVA_VERSION: 17 + PYTHON_VERSION: 3.x + GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false" + +permissions: + contents: write + id-token: write + pages: write + +jobs: + docs: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Configure JDK + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: ${{ env.JAVA_VERSION }} + + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install MkDocs Material + run: pip install mkdocs-material + + - name: Generate Docs + run: ./build_docs.sh + + - name: Upload to GitHub Pages + uses: actions/upload-pages-artifact@v3 + with: + path: site + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/change_log.md b/CHANGELOG.md similarity index 84% rename from change_log.md rename to CHANGELOG.md index 1b7a298..d1916e5 100644 --- a/change_log.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 版本记录 +## 版本日志 #### v2.2.1:2024-8-8 * 优化细节 @@ -18,8 +18,8 @@ * 更新ViewfinderView至v1.1.0 #### v2.0.0:2023-8-13 -* 移除相机核心库(**mlkit-camera-core**),改为依赖[CameraScan](https://github.com/jenly1314/CameraScan) -* 移除**mlkit-barcode-scanning** 中的 **ViewfinderView**,改为依赖[ViewfinderView](https://github.com/jenly1314/ViewfinderView) +* 移除相机核心库(mlkit-camera-core),改为依赖[CameraScan](https://github.com/jenly1314/CameraScan) +* 移除mlkit-barcode-scanning中的 **ViewfinderView** ,改为依赖[ViewfinderView](https://github.com/jenly1314/ViewfinderView) * 优化扫描分析过程的性能体验 * 更新MLKit相关依赖库版本 @@ -62,4 +62,4 @@ * 优化细节 #### v1.0.0:2021-4-7 -* MLKit初始版本 \ No newline at end of file +* MLKit初始版本 diff --git a/README.md b/README.md index 109ab9d..f9bca3b 100644 --- a/README.md +++ b/README.md @@ -103,39 +103,39 @@ Camera:为各个子库提供相机预览分析的核心库 2. 在Module的 **build.gradle** 里面添加引入依赖项 ```gradle - - //公共库 (*必须) + + //公共库 (*必须) implementation 'com.github.jenly1314.MLKit:mlkit-common:2.2.1' - + //-------------------------- - + //条码识别 (可选) implementation 'com.github.jenly1314.MLKit:mlkit-barcode-scanning:2.2.1' - + //人脸检测 (可选) implementation 'com.github.jenly1314.MLKit:mlkit-face-detection:2.2.1' - + //人脸网格检测 (可选) implementation 'com.github.jenly1314.MLKit:mlkit-face-mesh-detection:2.2.1' - + //图像标签 (可选) implementation 'com.github.jenly1314.MLKit:mlkit-image-labeling:2.2.1' - + //对象检测 (可选) implementation 'com.github.jenly1314.MLKit:mlkit-object-detection:2.2.1' - + //姿势检测 (可选) implementation 'com.github.jenly1314.MLKit:mlkit-pose-detection:2.2.1' - + //姿势检测精确版 (可选) implementation 'com.github.jenly1314.MLKit:mlkit-pose-detection-accurate:2.2.1' - + //自拍分割 (可选) implementation 'com.github.jenly1314.MLKit:mlkit-segmentation-selfie:2.2.1' - + //文字识别 (可选) implementation 'com.github.jenly1314.MLKit:mlkit-text-recognition:2.2.1' - + ``` ### 温馨提示 @@ -146,7 +146,7 @@ Camera:为各个子库提供相机预览分析的核心库 > 使用 **v2.0.x** 以上版本时,要求 **compileSdkVersion >= 33** -> 如果 **compileSdkVersion < 33** 请使用 [**v1.x版本**](https://github.com/jenly1314/MLKit/tree/1.x/) +> 如果 **compileSdkVersion < 33** 请使用 [**v1.x版本**](https://github.com/jenly1314/MLKit/tree/1.x/) ## 使用 @@ -196,7 +196,7 @@ Camera:为各个子库提供相机预览分析的核心库 * 2D格式:Aztec, Data Matrix, PDF417, QR Code ```kotlin -BarcodeDecoder.process(bitmap).addOnSuccessListener(this) { +BarcodeDecoder.process(bitmap).addOnSuccessListener(this) { if (it.isNotEmpty()) { // TODO 成功;此处可获取识别的结果 } else { @@ -288,7 +288,7 @@ BarcodeDecoder.process(bitmap).addOnSuccessListener(this) { android:value="barcode,face,ocr" /> ``` -更多使用详情,请查看[app](app)中的源码使用示例或直接查看 [API帮助文档](https://jitpack.io/com/github/jenly1314/MLKit/latest/javadoc/) +更多使用详情,请查看[app](app)中的源码使用示例或直接查看 [API帮助文档](https://jenly1314.github.io/MLKit/api/) ### 其他 @@ -298,9 +298,9 @@ BarcodeDecoder.process(bitmap).addOnSuccessListener(this) { ```gradle defaultConfig { - + //... - + ndk { //设置支持的 SO 库架构(开发者可以根据需要,选择一个或多个平台的 so) abiFilters 'armeabi-v7a' // , 'arm64-v8a', 'x86', 'x86_64' @@ -326,7 +326,9 @@ compileOptions { #### [CameraScan](https://github.com/jenly1314/CameraScan) 一个简化扫描识别流程的通用基础库。 #### [ViewfinderView](https://github.com/jenly1314/ViewfinderView) ViewfinderView一个取景视图:主要用于渲染扫描相关的动画效果。 -## 版本记录 + + +## 版本日志 #### v2.2.1:2024-8-8 * 优化细节 @@ -346,8 +348,8 @@ compileOptions { * 更新ViewfinderView至v1.1.0 #### v2.0.0:2023-8-13 -* 移除相机核心库(**mlkit-camera-core**),改为依赖[CameraScan](https://github.com/jenly1314/CameraScan) -* 移除**mlkit-barcode-scanning** 中的 **ViewfinderView**,改为依赖[ViewfinderView](https://github.com/jenly1314/ViewfinderView) +* 移除相机核心库(mlkit-camera-core),改为依赖[CameraScan](https://github.com/jenly1314/CameraScan) +* 移除mlkit-barcode-scanning中的 **ViewfinderView** ,改为依赖[ViewfinderView](https://github.com/jenly1314/ViewfinderView) * 优化扫描分析过程的性能体验 * 更新MLKit相关依赖库版本 @@ -357,7 +359,7 @@ compileOptions { * 更新MLKit相关依赖库版本 * 更新CameraX至v1.2.2 -#### [查看更多版本记录](change_log.md) +#### [查看更多版本日志](CHANGELOG.md) ## 赞赏 diff --git a/build.gradle b/build.gradle index 1dcdd6d..1ec2efd 100644 --- a/build.gradle +++ b/build.gradle @@ -6,5 +6,8 @@ plugins { id 'com.android.application' version '8.1.2' apply false id 'com.android.library' version '8.1.2' apply false id 'org.jetbrains.kotlin.android' version '1.8.10' apply false + id 'org.jetbrains.dokka' version '1.9.20' id 'com.vanniktech.maven.publish' version '0.25.3' apply false -} \ No newline at end of file +} + + diff --git a/build_docs.sh b/build_docs.sh new file mode 100755 index 0000000..30404ef --- /dev/null +++ b/build_docs.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -ex + +# Generate the API docs +./gradlew dokkaHtmlMultiModule + +mkdir -p docs/api +mv build/dokka/htmlMultiModule/* docs/api + +# Copy in special files that GitHub wants in the project root. +GITHUB_URL=https://github.com/jenly1314/MLKit/ +echo $GITHUB_URL +sed "//q" README.md > docs/index.md +sed -i "s|app/src/main/ic_launcher-web.png|ic_logo.png|g" docs/index.md +sed -i "s|](app|](${GITHUB_URL}blob/master/app|g" docs/index.md +sed -i "s|](mlkit|](${GITHUB_URL}blob/master/mlkit|g" docs/index.md +cat CHANGELOG.md | grep -v '## 版本日志' > docs/changelog.md + +cp GIF.gif docs/GIF.gif +cp app/src/main/ic_launcher-web.png docs/ic_logo.png + +# Build the site locally +mkdocs build diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..b781dad --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,86 @@ +# Project information +site_name: MLKit +site_url: https://jenly1314.github.io/MLKit/ +site_description: "MLKit for Android" +site_author: Jenly +remote_branch: gh-pages +edit_uri: "" + +# Repository +repo_name: MLKit +repo_url: https://github.com/jenly1314/MLKit + +# Copyright +copyright: 'Copyright © 2016 - 2024 Jenly' + +# Configuration +theme: + name: 'material' + favicon: https://jenly1314.github.io/favicon.png + logo: https://jenly1314.github.io/medias/logo.png + icon: + repo: fontawesome/brands/github + language: zh + palette: + - media: "(prefers-color-scheme: light)" + scheme: default + primary: teal + accent: blue + toggle: + icon: octicons/sun-24 + name: "切换到深色模式" + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: teal + accent: blue + toggle: + icon: octicons/moon-24 + name: "切换到浅色模式" + features: + - navigation.instant + - navigation.instant.progress + - navigation.tabs + - content.code.copy + +extra: + social: + - icon: material/home-circle + link: https://jenly1314.github.io/ + - icon: simple/github + link: https://github.com/jenly1314/ + - icon: simple/gitee + link: https://gitee.com/jenly1314/ + - icon: fontawesome/solid/paper-plane + link: mailto:jenly1314@gmail.com + +markdown_extensions: + - smarty + - footnotes + - meta + - toc: + permalink: true + - attr_list + - pymdownx.betterem: + smart_enable: all + - pymdownx.caret + - pymdownx.emoji: + emoji_index: !!python/name:materialx.emoji.twemoji + emoji_generator: !!python/name:materialx.emoji.to_svg + - pymdownx.inlinehilite + - pymdownx.magiclink + - pymdownx.smartsymbols + - pymdownx.superfences + - pymdownx.tilde + - pymdownx.tabbed: + alternate_style: true + - tables + +# Plugins +plugins: + - search + +nav: + - '概览': index.md + - 'API文档': api/index.html + - '版本日志': changelog.md + diff --git a/mlkit-barcode-scanning/build.gradle b/mlkit-barcode-scanning/build.gradle index 713967b..ab99bb4 100644 --- a/mlkit-barcode-scanning/build.gradle +++ b/mlkit-barcode-scanning/build.gradle @@ -1,5 +1,7 @@ plugins { id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/mlkit-common/build.gradle b/mlkit-common/build.gradle index 806c4d6..f8ee76f 100644 --- a/mlkit-common/build.gradle +++ b/mlkit-common/build.gradle @@ -1,5 +1,7 @@ plugins { id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/mlkit-face-detection/build.gradle b/mlkit-face-detection/build.gradle index 00fd6cd..b2c54a7 100644 --- a/mlkit-face-detection/build.gradle +++ b/mlkit-face-detection/build.gradle @@ -1,5 +1,7 @@ plugins { id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/mlkit-face-mesh-detection/build.gradle b/mlkit-face-mesh-detection/build.gradle index 91ba0d7..d880e23 100644 --- a/mlkit-face-mesh-detection/build.gradle +++ b/mlkit-face-mesh-detection/build.gradle @@ -1,5 +1,7 @@ plugins { id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/mlkit-image-labeling/build.gradle b/mlkit-image-labeling/build.gradle index e9e8a9a..649e87d 100644 --- a/mlkit-image-labeling/build.gradle +++ b/mlkit-image-labeling/build.gradle @@ -1,5 +1,7 @@ plugins { id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/mlkit-object-detection/build.gradle b/mlkit-object-detection/build.gradle index a99d6ff..8f1c020 100644 --- a/mlkit-object-detection/build.gradle +++ b/mlkit-object-detection/build.gradle @@ -1,5 +1,7 @@ plugins { id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/mlkit-pose-detection-accurate/build.gradle b/mlkit-pose-detection-accurate/build.gradle index 03baacd..bd7de81 100644 --- a/mlkit-pose-detection-accurate/build.gradle +++ b/mlkit-pose-detection-accurate/build.gradle @@ -1,5 +1,7 @@ plugins { id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/mlkit-pose-detection/build.gradle b/mlkit-pose-detection/build.gradle index 62031fb..a47f880 100644 --- a/mlkit-pose-detection/build.gradle +++ b/mlkit-pose-detection/build.gradle @@ -1,5 +1,7 @@ plugins { id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/mlkit-segmentation-selfie/build.gradle b/mlkit-segmentation-selfie/build.gradle index dd84f2a..ed4070b 100644 --- a/mlkit-segmentation-selfie/build.gradle +++ b/mlkit-segmentation-selfie/build.gradle @@ -1,5 +1,7 @@ plugins { id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/mlkit-text-recognition/build.gradle b/mlkit-text-recognition/build.gradle index 11dff91..dc00886 100644 --- a/mlkit-text-recognition/build.gradle +++ b/mlkit-text-recognition/build.gradle @@ -1,5 +1,7 @@ plugins { id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' }