From fda677d05e8fc6186ffbbe6055e33fc85180bde1 Mon Sep 17 00:00:00 2001 From: Jenly Date: Mon, 19 Aug 2024 00:41:32 +0800 Subject: [PATCH] docs --- .editorconfig | 11 ++++ .github/workflows/docs.yml | 56 ++++++++++++++++ CHANGELOG.md | 29 +++++++++ README.md | 32 ++++----- build.gradle | 1 + build_docs.sh | 25 +++++++ mkdocs.yml | 86 +++++++++++++++++++++++++ refresh-indicator-classic/build.gradle | 1 + refresh-indicator-lottie/build.gradle | 1 + refresh-indicator-progress/build.gradle | 1 + refresh/build.gradle | 1 + 11 files changed, 228 insertions(+), 16 deletions(-) create mode 100644 .editorconfig 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/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/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3eb57ad --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,29 @@ +## 版本日志 + +#### v1.3.0 :2024-7-20 +* 更新compose至v1.6.0 (v1.5.0 -> v1.6.0) ([#13](https://github.com/jenly1314/UltraSwipeRefresh/issues/13)) +* 新增参数`alwaysScrollable`:是否始终可以滚动 +* 优化一些细节 + +#### v1.2.0 :2024-7-1 +* 新增参数`contentContainer`:内容的父容器,便于统一管理 +* 修复了一些已知问题 + +#### v1.1.3 :2024-6-2 +* 修复BUG:禁用下拉刷新或上拉加载时,上下滑动的边界值判定问题。([#8](https://github.com/jenly1314/UltraSwipeRefresh/issues/8)) +* 优化一些细节 + +#### v1.1.2 :2024-5-22 +* 修复BUG:部分机型在某些特定场景下,出现“无法再次触发下拉刷新”的问题。([#7](https://github.com/jenly1314/UltraSwipeRefresh/issues/7)) + +#### v1.1.1 :2024-4-20 +* 修复BUG:刷新状态变化太快时,导致”完成时的定格提示动画”不执行的问题。([#4](https://github.com/jenly1314/UltraSwipeRefresh/issues/4)) +* 优化一些细节 + +#### v1.1.0 :2023-12-17 +* 新增`UltraSwipeRefreshTheme`:用于统一管理全局默认配置 +* 新增参数`finishDelayMillis`:完成时延时时间(可用于定格展示提示内容) +* 新增参数`vibrateEnabled`:是否启用振动(当滑动偏移量满足触发刷新或触发加载更多时,会有振动效果) + +#### v1.0.0 :2023-12-3 +* UltraSwipeRefresh初始版本 diff --git a/README.md b/README.md index 833a734..aff126f 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ ```gradle // 极致体验的Compose刷新组件 (*必须) implementation 'com.github.jenly1314.UltraSwipeRefresh:refresh:1.3.0' - + // 经典样式的指示器 (可选) implementation 'com.github.jenly1314.UltraSwipeRefresh:refresh-indicator-classic:1.3.0' // Lottie动画指示器 (可选) @@ -94,7 +94,7 @@ fun UltraSwipeRefreshSample() { val state = rememberUltraSwipeRefreshState() var itemCount by remember { mutableIntStateOf(20) } val coroutineScope = rememberCoroutineScope() - + UltraSwipeRefresh( state = state, onRefresh = { @@ -159,7 +159,7 @@ UltraSwipeRefreshTheme:主要用于统一管理全局默认配置。 ```kotlin // 全局设置默认的滑动模式 (建议在Application的onCreate中进行配置) UltraSwipeRefreshTheme.config = UltraSwipeRefreshTheme.config.copy( - headerScrollMode = NestedScrollMode.Translate, + headerScrollMode = NestedScrollMode.Translate, footerScrollMode = NestedScrollMode.Translate, ) ``` @@ -169,19 +169,19 @@ UltraSwipeRefreshTheme.config = UltraSwipeRefreshTheme.config.copy( 这里罗列一下目前 **UltraSwipeRefresh** 所提供的一些Header和Footer指示器样式,方便快速查找与参考。 -| 默认官方样式 | 经典样式 | +| 默认官方样式 | 经典样式 | |:--------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------| -| SwipeRefreshHeader | ClassicRefreshHeader | -| ![Image](art/SwipeRefreshIndicatorSample.gif) | ![Image](art/ClassicRefreshIndicatorSample.gif) | -| SwipeRefreshFooter | ClassicRefreshFooter | -| [对应的代码示例](app/src/main/java/com/king/ultraswiperefresh/app/sample/SwipeRefreshIndicatorSample.kt) | [对应的代码示例](app/src/main/java/com/king/ultraswiperefresh/app/sample/ClassicRefreshIndicatorSample.kt) | +| SwipeRefreshHeader | ClassicRefreshHeader | +| ![Image](art/SwipeRefreshIndicatorSample.gif) | ![Image](art/ClassicRefreshIndicatorSample.gif) | +| SwipeRefreshFooter | ClassicRefreshFooter | +| [对应的代码示例](app/src/main/java/com/king/ultraswiperefresh/app/sample/SwipeRefreshIndicatorSample.kt) | [对应的代码示例](app/src/main/java/com/king/ultraswiperefresh/app/sample/ClassicRefreshIndicatorSample.kt) | -| 进度条样式 | Lottie动画样式 | +| 进度条样式 | Lottie动画样式 | |:-----------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------| -| ProgressRefreshHeader | LottieRefreshHeader | -| ![Image](art/ProgressRefreshIndicatorSample.gif) | ![Image](art/LottieRefreshIndicatorSample.gif) | -| ProgressRefreshFooter | LottieRefreshFooter | -| [对应的代码示例](app/src/main/java/com/king/ultraswiperefresh/app/sample/ProgressRefreshIndicatorSample.kt) | [对应的代码示例](app/src/main/java/com/king/ultraswiperefresh/app/sample/LottieRefreshIndicatorSample.kt) | +| ProgressRefreshHeader | LottieRefreshHeader | +| ![Image](art/ProgressRefreshIndicatorSample.gif) | ![Image](art/LottieRefreshIndicatorSample.gif) | +| ProgressRefreshFooter | LottieRefreshFooter | +| [对应的代码示例](app/src/main/java/com/king/ultraswiperefresh/app/sample/ProgressRefreshIndicatorSample.kt) | [对应的代码示例](app/src/main/java/com/king/ultraswiperefresh/app/sample/LottieRefreshIndicatorSample.kt) | > 如果以上的指示器效果都不满足你的需求,你可以自定义去实现Header和Footer的指示器,也可以直接使用Lottie动画样式的指示器来可快速接入任何Lottie动画。 @@ -193,7 +193,9 @@ UltraSwipeRefreshTheme.config = UltraSwipeRefreshTheme.config.copy( #### [CodeTextField](https://github.com/jenly1314/CodeTextField)一个使用 Compose 实现的验证码输入框。 #### [compose-component](https://github.com/jenly1314/compose-component) 一个Jetpack Compose的组件库;主要提供了一些小组件,便于快速使用。 -## 版本记录 + + +## 版本日志 #### v1.3.0 :2024-7-20 * 更新compose至v1.6.0 (v1.5.0 -> v1.6.0) ([#13](https://github.com/jenly1314/UltraSwipeRefresh/issues/13)) @@ -216,13 +218,11 @@ UltraSwipeRefreshTheme.config = UltraSwipeRefreshTheme.config.copy( * 优化一些细节 #### v1.1.0 :2023-12-17 - * 新增`UltraSwipeRefreshTheme`:用于统一管理全局默认配置 * 新增参数`finishDelayMillis`:完成时延时时间(可用于定格展示提示内容) * 新增参数`vibrateEnabled`:是否启用振动(当滑动偏移量满足触发刷新或触发加载更多时,会有振动效果) #### v1.0.0 :2023-12-3 - * UltraSwipeRefresh初始版本 ## 赞赏 diff --git a/build.gradle b/build.gradle index 4db4e87..026d16b 100644 --- a/build.gradle +++ b/build.gradle @@ -7,5 +7,6 @@ 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.9.0' 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..601ce24 --- /dev/null +++ b/build_docs.sh @@ -0,0 +1,25 @@ +#!/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/UltraSwipeRefresh/ +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|](art|](${GITHUB_URL}blob/master/art|g" docs/index.md +sed -i "s|](refresh|](${GITHUB_URL}blob/master/refresh|g" docs/index.md +cat CHANGELOG.md | grep -v '## 版本日志' > docs/changelog.md + +cp -r art docs/art +# 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..5d921a8 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,86 @@ +# Project information +site_name: UltraSwipeRefresh +site_url: https://jenly1314.github.io/UltraSwipeRefresh/ +site_description: "UltraSwipeRefresh for Android" +site_author: Jenly +remote_branch: gh-pages +edit_uri: "" + +# Repository +repo_name: UltraSwipeRefresh +repo_url: https://github.com/jenly1314/UltraSwipeRefresh + +# 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/refresh-indicator-classic/build.gradle b/refresh-indicator-classic/build.gradle index 5709e18..8571be7 100644 --- a/refresh-indicator-classic/build.gradle +++ b/refresh-indicator-classic/build.gradle @@ -1,6 +1,7 @@ plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/refresh-indicator-lottie/build.gradle b/refresh-indicator-lottie/build.gradle index f8d8abc..ee6e0d9 100644 --- a/refresh-indicator-lottie/build.gradle +++ b/refresh-indicator-lottie/build.gradle @@ -1,6 +1,7 @@ plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/refresh-indicator-progress/build.gradle b/refresh-indicator-progress/build.gradle index ffe8e54..18e2110 100644 --- a/refresh-indicator-progress/build.gradle +++ b/refresh-indicator-progress/build.gradle @@ -1,6 +1,7 @@ plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' } diff --git a/refresh/build.gradle b/refresh/build.gradle index 98696ff..265fb5a 100644 --- a/refresh/build.gradle +++ b/refresh/build.gradle @@ -1,6 +1,7 @@ plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' + id 'org.jetbrains.dokka' id 'com.vanniktech.maven.publish' }