From 1c0b13ca057f3c4065703c087896a04601ffa3c0 Mon Sep 17 00:00:00 2001
From: Arthur <16458204+ArthurKun21@users.noreply.github.com>
Date: Fri, 22 Aug 2025 09:56:22 +0800
Subject: [PATCH 01/10] docs: remove Chinese language link from README
---
README.md | 4 +-
README_CN.md | 132 ---------------------------------------------------
2 files changed, 1 insertion(+), 135 deletions(-)
delete mode 100644 README_CN.md
diff --git a/README.md b/README.md
index 56db4e4..8d4c995 100644
--- a/README.md
+++ b/README.md
@@ -5,8 +5,6 @@
Global Floating Window Framework based on Jetpack Compose
-[简体中文](README_CN.md)
-
## Preview

@@ -131,4 +129,4 @@ fun MyScreen(
## License
-Apache 2.0 License
\ No newline at end of file
+Apache 2.0 License
diff --git a/README_CN.md b/README_CN.md
deleted file mode 100644
index eeec8fa..0000000
--- a/README_CN.md
+++ /dev/null
@@ -1,132 +0,0 @@
-# compose-floating-window
-
-[](https://jitpack.io/#User/Repo)
-[](https://opensource.org/licenses/Apache-2.0)
-
-基于Jetpack Compose的全局悬浮窗框架
-
-## 效果预览
-
-
-
-## 特性
-
-- 使用Compose代码描述悬浮窗界面
-- ViewModel支持
-- 可拖拽悬浮窗支持
-- 基于Application Context的对话框组件
-
-## 基本使用
-
-### 导入依赖
-
-- 如果Gradle版本小于7.0,在应用的`build.gradle`中,添加Jitpack仓库
-
-```groovy
-repositories {
- maven { url 'https://jitpack.io' }
-}
-```
-
-- 如果Gradle版本大于等于7.0,在 settings.gradle 文件中加入
-```groovy
-dependencyResolutionManagement {
- repositories {
- maven { url 'https://jitpack.io' }
- }
-}
-```
-
-- 添加ComposeFloatingWindow依赖
-```groovy
-dependencies {
- implementation "com.github.only52607:ComposeFloatingWindow:1.0"
-}
-```
-
-### 增加悬浮窗权限
-
-在`AndroidManifest.xml`中添加
-```xml
-
-```
-
-### 创建悬浮窗并显示
-
-```kotlin
-val floatingWindow = ComposeFloatingWindow(applicationContext)
-floatingWindow.setContent {
- FloatingActionButton(
- modifier = Modifier.dragFloatingWindow(),
- onClick = {
- Log.i("")
- }) {
- Icon(Icons.Filled.Call, "Call")
- }
-}
-floatingWindow.show()
-```
-
-> 查看[示例程序](https://github.com/only52607/compose-floating-window/tree/master/app),了解详细用法。
-
-## 高级用法
-
-### 创建可拖拽的悬浮窗
-
-在需要拖拽的组件上使用`Modifier.dragFloatingWindow()`修饰符,示例:
-
-```kotlin
-FloatingActionButton(
- modifier = Modifier.dragFloatingWindow()
-) {
- Icon(Icons.Filled.Call, "Call")
-}
-```
-
-### 获取当前ComposeFloatingWindow实例
-
-使用`LocalComposeFloatingWindow`获取,示例:
-
-```kotlin
-val floatingWindow = LocalComposeFloatingWindow.current
-```
-
-### 显示对话框
-
-当悬浮窗的Context为Application时,在悬浮窗的Compose界面中使用`AlertDialog`和`Dialog`会出现token is null异常,这时可使用`SystemAlertDialog`或`SystemDialog`组件,用法与自带的`AlertDialog`和`Dialog`一致。
-
-示例:
-```kotlin
-SystemAlertDialog(
- onDismissRequest = { showDialog = false },
- confirmButton = {
- TextButton(onClick = { showDialog = false }) {
- Text(text = "OK")
- }
- },
- text = {
- Text(text = "This is a system dialog")
- }
-)
-```
-
-### 使用ViewModel
-
-通过调用 viewModel() 函数,从任何可组合项访问 ViewModel。
-
-```kotlin
-class MyViewModel : ViewModel() { /*...*/ }
-
-@Composable
-fun MyScreen(
- viewModel: MyViewModel = viewModel()
-) {
- // use viewModel here
-}
-```
-
-> 详情请参照[Android文档](https://developer.android.com/jetpack/compose/libraries#viewmodel)
-
-## License
-
-Apache 2.0 License
\ No newline at end of file
From a8a0f5172f48ed5b3a396811c9591e074b7b6900 Mon Sep 17 00:00:00 2001
From: Arthur <16458204+ArthurKun21@users.noreply.github.com>
Date: Fri, 22 Aug 2025 09:57:39 +0800
Subject: [PATCH 02/10] docs: update release link in README
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 8d4c995..ad56de4 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# compose-floating-window
-[](https://jitpack.io/#User/Repo)
+[](https://jitpack.io/#ArthurKun21/compose-overlay-window)
[](https://opensource.org/licenses/Apache-2.0)
Global Floating Window Framework based on Jetpack Compose
From 859096fb961b46490559a55d3d972870d7e9c4a6 Mon Sep 17 00:00:00 2001
From: Arthur <16458204+ArthurKun21@users.noreply.github.com>
Date: Fri, 22 Aug 2025 09:58:28 +0800
Subject: [PATCH 03/10] docs: update the dependency versions in the
documentation
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index ad56de4..cc3f4d6 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@ dependencyResolutionManagement {
- Add `compose-floating-window` Dependency
```groovy
dependencies {
- implementation "com.github.only52607:compose-floating-window:1.0"
+ implementation "com.github.ArthurKun21:compose-floating-window:1.0"
}
```
From d6b28f80a26aedc551379b492f4d1fe60ffb108c Mon Sep 17 00:00:00 2001
From: Arthur <16458204+ArthurKun21@users.noreply.github.com>
Date: Fri, 22 Aug 2025 09:59:05 +0800
Subject: [PATCH 04/10] docs: improve formatting and links in README
---
README.md | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index cc3f4d6..bed05a8 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,7 @@ repositories {
```
- If the Gradle version is greater than or equal to 7.0, add it in the settings.gradle file.
+
```groovy
dependencyResolutionManagement {
repositories {
@@ -38,6 +39,7 @@ dependencyResolutionManagement {
```
- Add `compose-floating-window` Dependency
+
```groovy
dependencies {
implementation "com.github.ArthurKun21:compose-floating-window:1.0"
@@ -47,6 +49,7 @@ dependencies {
### Grant Floating Window Permission
Add to `AndroidManifest.xml`
+
```xml
```
@@ -96,6 +99,7 @@ val floatingWindow = LocalComposeFloatingWindow.current
When the Context of the floating window is set to Application, using AlertDialog and Dialog in the Compose interface of the floating window may result in a 'token is null' exception. In such cases, you can use the SystemAlertDialog or SystemDialog components, which can be used in the same way as the built-in AlertDialog and Dialog components.
Example:
+
```kotlin
SystemAlertDialog(
onDismissRequest = { showDialog = false },
@@ -125,7 +129,7 @@ fun MyScreen(
}
```
-> See https://developer.android.com/jetpack/compose/libraries#viewmodel
+> See [https://developer.android.com/jetpack/compose/libraries#viewmodel](https://developer.android.com/jetpack/compose/libraries#viewmodel)
## License
From c90ec915ebfb9f3b8dd081a964998e25c6aa9560 Mon Sep 17 00:00:00 2001
From: Arthur <16458204+ArthurKun21@users.noreply.github.com>
Date: Fri, 22 Aug 2025 09:59:34 +0800
Subject: [PATCH 05/10] docs: update sample app link in README
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index bed05a8..c735e9d 100644
--- a/README.md
+++ b/README.md
@@ -70,7 +70,7 @@ floatingWindow.setContent {
floatingWindow.show()
```
-> See [Sample App](https://github.com/only52607/compose-floating-window/tree/master/app).
+> See [Sample App](./samples/).
## Advanced Usage
From aae22d29f75e3f756c4925164453fb867b13d641 Mon Sep 17 00:00:00 2001
From: Arthur <16458204+ArthurKun21@users.noreply.github.com>
Date: Fri, 22 Aug 2025 10:00:32 +0800
Subject: [PATCH 06/10] docs: update dependency version placeholder in README
---
README.md | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index c735e9d..59507be 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,13 @@ dependencyResolutionManagement {
```groovy
dependencies {
- implementation "com.github.ArthurKun21:compose-floating-window:1.0"
+ implementation "com.github.ArthurKun21:compose-floating-window:"
+}
+```
+
+```kts
+dependencies {
+ implementation("com.github.ArthurKun21:compose-floating-window:")
}
```
From f10e09055f89da012638bc1f57b85b4cd84034ec Mon Sep 17 00:00:00 2001
From: Arthur <16458204+ArthurKun21@users.noreply.github.com>
Date: Fri, 22 Aug 2025 10:06:15 +0800
Subject: [PATCH 07/10] docs: add EditorConfig settings for Markdown files
---
.editorconfig | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.editorconfig b/.editorconfig
index b00acaa..913b1a0 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -11,6 +11,10 @@ trim_trailing_whitespace = true
indent_size = 2
indent_style = space
+[*.md]
+indent_size = 4
+indent_style = space
+
# noinspection EditorConfigKeyCorrectness
[*.{kt,kts}]
max_line_length = 120
From d66f88a79f9ea0154b86eb0d89f5119d6c531fe7 Mon Sep 17 00:00:00 2001
From: Arthur <16458204+ArthurKun21@users.noreply.github.com>
Date: Fri, 22 Aug 2025 10:06:58 +0800
Subject: [PATCH 08/10] docs: remove outdated usage instructions from README
---
README.md | 121 ------------------------------------------------------
1 file changed, 121 deletions(-)
diff --git a/README.md b/README.md
index 59507be..ccac0f7 100644
--- a/README.md
+++ b/README.md
@@ -16,127 +16,6 @@ Global Floating Window Framework based on Jetpack Compose
- Support for draggable floating windows.
- Dialog components based on the Application Context.
-## Basic Usage
-
-### Import Dependencies
-
-- If the Gradle version is less than 7.0, add the Jitpack repository in the `build.gradle` of your app.
-
-```groovy
-repositories {
- maven { url 'https://jitpack.io' }
-}
-```
-
-- If the Gradle version is greater than or equal to 7.0, add it in the settings.gradle file.
-
-```groovy
-dependencyResolutionManagement {
- repositories {
- maven { url 'https://jitpack.io' }
- }
-}
-```
-
-- Add `compose-floating-window` Dependency
-
-```groovy
-dependencies {
- implementation "com.github.ArthurKun21:compose-floating-window:"
-}
-```
-
-```kts
-dependencies {
- implementation("com.github.ArthurKun21:compose-floating-window:")
-}
-```
-
-### Grant Floating Window Permission
-
-Add to `AndroidManifest.xml`
-
-```xml
-
-```
-
-### Create Floating Window and Show
-
-```kotlin
-val floatingWindow = ComposeFloatingWindow(applicationContext)
-floatingWindow.setContent {
- FloatingActionButton(
- modifier = Modifier.dragFloatingWindow(),
- onClick = {
- Log.i("")
- }) {
- Icon(Icons.Filled.Call, "Call")
- }
-}
-floatingWindow.show()
-```
-
-> See [Sample App](./samples/).
-
-## Advanced Usage
-
-### Make Floating Window Draggable
-
-Use the `Modifier.dragFloatingWindow()` modifier on the component you want to make draggable. Example:
-
-```kotlin
-FloatingActionButton(
- modifier = Modifier.dragFloatingWindow()
-) {
- Icon(Icons.Filled.Call, "Call")
-}
-```
-
-### Get the current instance of `ComposeFloatingWindow`
-
-Using LocalComposeFloatingWindow to retrieve, here's an example:
-
-```kotlin
-val floatingWindow = LocalComposeFloatingWindow.current
-```
-
-### Show Dialog
-
-When the Context of the floating window is set to Application, using AlertDialog and Dialog in the Compose interface of the floating window may result in a 'token is null' exception. In such cases, you can use the SystemAlertDialog or SystemDialog components, which can be used in the same way as the built-in AlertDialog and Dialog components.
-
-Example:
-
-```kotlin
-SystemAlertDialog(
- onDismissRequest = { showDialog = false },
- confirmButton = {
- TextButton(onClick = { showDialog = false }) {
- Text(text = "OK")
- }
- },
- text = {
- Text(text = "This is a system dialog")
- }
-)
-```
-
-### ViewModel
-
-You can access the ViewModel from any Composable by calling the viewModel() function.
-
-```kotlin
-class MyViewModel : ViewModel() { /*...*/ }
-
-@Composable
-fun MyScreen(
- viewModel: MyViewModel = viewModel()
-) {
- // use viewModel here
-}
-```
-
-> See [https://developer.android.com/jetpack/compose/libraries#viewmodel](https://developer.android.com/jetpack/compose/libraries#viewmodel)
-
## License
Apache 2.0 License
From fc0ac8caec37af58d81fc1453a5039a82285e9b0 Mon Sep 17 00:00:00 2001
From: Arthur <16458204+ArthurKun21@users.noreply.github.com>
Date: Fri, 22 Aug 2025 10:22:40 +0800
Subject: [PATCH 09/10] feat: initial docs
---
.github/workflows/docs.yml | 47 +++++++++++++++++++++
.github/workflows/requirements.txt | 9 ++++
README.md | 2 +-
docs/.nav.yml | 2 +
{preview => docs/assets}/example.gif | Bin
docs/index.md | 37 +++++++++++++++++
mkdocs.yaml | 59 +++++++++++++++++++++++++++
7 files changed, 155 insertions(+), 1 deletion(-)
create mode 100644 .github/workflows/docs.yml
create mode 100644 .github/workflows/requirements.txt
create mode 100644 docs/.nav.yml
rename {preview => docs/assets}/example.gif (100%)
create mode 100644 docs/index.md
create mode 100644 mkdocs.yaml
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 0000000..17c196d
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,47 @@
+name: Publish Docs
+on:
+ push:
+ branches:
+ - master
+ - docs/**
+ paths:
+ - 'docs/**'
+ - mkdocs.yml
+ - '.github/workflows/docs.yml'
+ # Manual triggers
+ workflow_dispatch:
+
+permissions:
+ contents: write
+
+concurrency:
+ group: ${{ github.ref }}
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
+
+jobs:
+ publish-docs:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v5
+ with:
+ fetch-depth: 0
+
+ - name: Configure Git Credentials
+ run: |
+ git config user.name github-actions[bot]
+ git config user.email 41898282+github-actions[bot]@users.noreply.github.com
+ - uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+ - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
+
+ - uses: actions/cache@v4
+ with:
+ key: mkdocs-material-${{ env.cache_id }}
+ path: ~/.cache
+ restore-keys: |
+ mkdocs-material-
+ - run: pip install -r .github/workflows/requirements.txt
+
+ - run: mkdocs gh-deploy --force
+
diff --git a/.github/workflows/requirements.txt b/.github/workflows/requirements.txt
new file mode 100644
index 0000000..43ae21a
--- /dev/null
+++ b/.github/workflows/requirements.txt
@@ -0,0 +1,9 @@
+mkdocs-material
+mkdocs-git-revision-date-localized-plugin
+mkdocs-awesome-nav
+pymdown-extensions
+
+# Imaging dependencies for mkdocs-material social plugin
+# https://squidfunk.github.io/mkdocs-material/plugins/requirements/image-processing/
+cairosvg==2.8.2
+pillow==11.3.0
\ No newline at end of file
diff --git a/README.md b/README.md
index ccac0f7..d127945 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Global Floating Window Framework based on Jetpack Compose
## Preview
-
+
## Features
diff --git a/docs/.nav.yml b/docs/.nav.yml
new file mode 100644
index 0000000..d921fbc
--- /dev/null
+++ b/docs/.nav.yml
@@ -0,0 +1,2 @@
+nav:
+ - Overview: index.md
\ No newline at end of file
diff --git a/preview/example.gif b/docs/assets/example.gif
similarity index 100%
rename from preview/example.gif
rename to docs/assets/example.gif
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 0000000..d6b54c9
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,37 @@
+# Compose Floating Window
+
+Compose Floating Window is a global floating window framework based on Jetpack Compose.
+
+
+
+## Download
+
+[](https://jitpack.io/#ArthurKun21/compose-overlay-window)
+
+``` kotlin
+dependencyResolutionManagement {
+ repositories {
+ maven { url 'https://jitpack.io' }
+ }
+}
+
+dependencies {
+ implementation("com.github.ArthurKun21:compose-floating-window:")
+}
+```
+
+## Permissions
+
+Add to `AndroidManifest.xml`
+
+```xml
+
+```
+
+## Acknowledgements
+
+The initial implementation of this library is based on [https://github.com/only52607/compose-floating-window](https://github.com/only52607/compose-floating-window)
+
+## License
+
+[](https://opensource.org/licenses/Apache-2.0)
\ No newline at end of file
diff --git a/mkdocs.yaml b/mkdocs.yaml
new file mode 100644
index 0000000..b005869
--- /dev/null
+++ b/mkdocs.yaml
@@ -0,0 +1,59 @@
+site_name: Compose Floating Window
+site_url: https://arthurkun21.github.io/compose-overlay-window
+site_description: Global Floating Window Framework based on Jetpack Compose
+repo_name: Compose Floating Window
+repo_url: https://github.com/ArthurKun21/compose-overlay-window
+use_directory_urls: true
+theme:
+ name: material
+ palette:
+ # Palette toggle for light mode
+ - scheme: default
+ primary: red
+ toggle:
+ icon: material/brightness-7
+ name: Switch to dark mode
+
+ # Palette toggle for dark mode
+ - scheme: slate
+ primary: red
+ toggle:
+ icon: material/brightness-4
+ name: Switch to light mode
+
+ features:
+ - navigation.tabs
+ - navigation.tabs.sticky
+ - navigation.top
+ - navigation.footer
+ - navigation.sections
+ - navigation.expand
+ - navigation.path
+ - toc.follow
+ - toc.integrate
+ - search.suggest
+ - search.share
+ - search.highlight
+ - content.tabs.link
+ - content.code.copy
+plugins:
+ - search
+ - awesome-nav
+ - tags
+ - git-revision-date-localized:
+ type: date
+ enable_creation_date: true
+ - social
+ - meta
+markdown_extensions:
+ - admonition
+ - def_list
+ - toc:
+ permalink: true
+ - footnotes
+ - tables
+ - pymdownx.details
+ - pymdownx.superfences
+ - pymdownx.betterem
+ - pymdownx.tasklist:
+ custom_checkbox: true
From 5ea0a719706a857482456633e7b90dba468e1560 Mon Sep 17 00:00:00 2001
From: Arthur <16458204+ArthurKun21@users.noreply.github.com>
Date: Fri, 22 Aug 2025 10:26:33 +0800
Subject: [PATCH 10/10] ci: update paths-ignore to include docs and mkdocs.yaml
in workflows
---
.github/workflows/build.yml | 2 ++
.github/workflows/lint.yml | 2 ++
2 files changed, 4 insertions(+)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d234a14..c25bfa0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -10,6 +10,8 @@ on:
- '.gitignore'
- 'renovate.json'
- 'FUNDING.yml'
+ - 'docs/**'
+ - 'mkdocs.yaml'
workflow_dispatch:
env:
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 1960a9d..cb09e17 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -11,6 +11,8 @@ on:
- '.github/**'
- '!.github/workflows/**'
- 'renovate.json'
+ - 'docs/**'
+ - 'mkdocs.yaml'
env:
JAVA_VERSION: 17