From 5d3bdb48f65c8f066cc92ea655cc6defdc6fc96c Mon Sep 17 00:00:00 2001 From: Jenly Date: Tue, 3 Sep 2024 23:16:43 +0800 Subject: [PATCH] docs --- .editorconfig | 11 +++ .github/workflows/{gradle.yml => build.yml} | 4 +- .github/workflows/docs.yml | 56 ++++++++++++++ CHANGELOG.md | 14 ++++ README.md | 16 ++-- build.gradle | 3 +- build_docs.sh | 23 ++++++ drawboard/build.gradle | 4 +- mkdocs.yml | 86 +++++++++++++++++++++ 9 files changed, 204 insertions(+), 13 deletions(-) create mode 100644 .editorconfig rename .github/workflows/{gradle.yml => build.yml} (87%) create mode 100644 .github/workflows/docs.yml create mode 100644 CHANGELOG.md create mode 100755 build_docs.sh create mode 100644 mkdocs.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9d4adec --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +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/gradle.yml b/.github/workflows/build.yml similarity index 87% rename from .github/workflows/gradle.yml rename to .github/workflows/build.yml index b48f6b0..362568d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Android CI +name: build on: push: @@ -17,4 +17,4 @@ jobs: with: java-version: 11 - name: Build with Gradle - run: ./gradlew build \ No newline at end of file + run: ./gradlew build diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..e5c3e31 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,56 @@ +name: docs + +on: + push: + branches: + - master + +env: + JAVA_VERSION: 11 + 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/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1046b1c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +## 版本日志 + +#### v1.1.0:2024-3-18 +* 新增支持绘制马赛克 +* 绘制直线时,支持带箭头 +* 绘制图片或文字时,支持选中再次移动(限最近一次操作) +* 对外提供更多绘制相关配置 +* 更新Gradle至v7.5 + +#### v1.0.1:2022-2-17 +* 对外提供更多Paint相关配置 + +#### v1.0.0:2021-11-30 +* DrawBoard初始版本 diff --git a/README.md b/README.md index 840ea80..4dc4748 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ DrawMode.ERASER DrawMode.MOSAIC ``` -> 如果以上操作不完全满足你的需求,`DrawBoard`对外还提供了很多可定制化的配置(例如:自实现一个 [**Draw**](drawboard/src/main/java/com/king/drawboard/draw/Draw.java))。 +> 如果以上操作不完全满足你的需求,`DrawBoard`对外还提供了很多可定制化的配置(例如:自实现一个 [`Draw`](drawboard/src/main/java/com/king/drawboard/draw/Draw.java))。 ```kotlin /** @@ -182,9 +182,11 @@ drawBoardView.getResultBitmap() ``` -更多使用详情,请查看[Demo](app)中的源码使用示例或直接查看[API帮助文档](https://jitpack.io/com/github/jenly1314/DrawBoard/latest/javadoc/) +更多使用详情,请查看[app](app)中的源码使用示例或直接查看[API帮助文档](https://jenly1314.github.io/DrawBoard/api/) -## 版本记录 + + +## 版本日志 #### v1.1.0:2024-3-18 * 新增支持绘制马赛克 @@ -193,11 +195,7 @@ drawBoardView.getResultBitmap() * 对外提供更多绘制相关配置 * 更新Gradle至v7.5 -#### v1.0.1:2022-2-17 -* 对外提供更多Paint相关配置 - -#### v1.0.0:2021-11-30 -* DrawBoard初始版本 +#### [查看更多版本日志](CHANGELOG.md) ## 赞赏 如果你喜欢DrawBoard,或感觉DrawBoard帮助到了你,可以点右上角“Star”支持一下,你的支持就是我的动力,谢谢 :smiley: @@ -223,4 +221,4 @@ drawBoardView.getResultBitmap() - + diff --git a/build.gradle b/build.gradle index 4695274..1c0eee9 100644 --- a/build.gradle +++ b/build.gradle @@ -5,5 +5,6 @@ plugins { id 'com.android.application' version '7.4.2' apply false id 'com.android.library' version '7.4.2' apply false id 'org.jetbrains.kotlin.android' version '1.8.0' apply false + id 'org.jetbrains.dokka' version '1.9.20' apply false id 'com.vanniktech.maven.publish' version '0.22.0' apply false -} \ No newline at end of file +} diff --git a/build_docs.sh b/build_docs.sh new file mode 100755 index 0000000..df80324 --- /dev/null +++ b/build_docs.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -ex + +# Generate the API docs +./gradlew dokkaHtml + +mkdir -p docs/api +mv drawboard/build/dokka/html/* docs/api + +# Copy in special files that GitHub wants in the project root. +GITHUB_URL=https://github.com/jenly1314/DrawBoard/ +echo $GITHUB_URL +sed "//q" README.md > docs/index.md +sed -i "s|app/src/main/ic_launcher-playstore.png|ic_logo.png|g" docs/index.md +sed -i "s|](app|](${GITHUB_URL}blob/master/app|g" docs/index.md +cat CHANGELOG.md | grep -v '## 版本日志' > docs/changelog.md + +cp GIF.gif docs/GIF.gif +cp app/src/main/ic_launcher-playstore.png docs/ic_logo.png + +# Build the site locally +mkdocs build diff --git a/drawboard/build.gradle b/drawboard/build.gradle index ac57969..0349617 100644 --- a/drawboard/build.gradle +++ b/drawboard/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' } @@ -37,4 +39,4 @@ dependencies { androidTestImplementation "androidx.test.ext:junit:$versions.androidExtJunit" androidTestImplementation "androidx.test.espresso:espresso-core:$versions.espressoCore" implementation "androidx.annotation:annotation:$versions.annotation" -} \ No newline at end of file +} diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..5711abd --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,86 @@ +# Project information +site_name: DrawBoard +site_url: https://jenly1314.github.io/DrawBoard/ +site_description: "DrawBoard for Android" +site_author: Jenly +remote_branch: gh-pages +edit_uri: "" + +# Repository +repo_name: DrawBoard +repo_url: https://github.com/jenly1314/DrawBoard + +# 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 +