Skip to content

Commit 79af22f

Browse files
authored
chore: update dependencies and project configuration (#124)
1 parent 39241eb commit 79af22f

26 files changed

+331
-368
lines changed

.devcontainer/Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM mcr.microsoft.com/devcontainers/java:17-bookworm
2+
3+
# Always start as root for provisioning
4+
USER root
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
7+
# ---- System dependencies ----
8+
# Remove yarn repository to avoid GPG key errors
9+
RUN rm -f /etc/apt/sources.list.d/yarn.list \
10+
&& rm -rf /var/lib/apt/lists/* \
11+
&& apt-get update \
12+
&& apt-get install -y --no-install-recommends \
13+
curl \
14+
unzip \
15+
zip \
16+
libglu1-mesa \
17+
&& apt-get clean \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
# ---- Android SDK env ----
21+
ENV ANDROID_SDK_ROOT=/usr/local/android-sdk
22+
ENV ANDROID_HOME=${ANDROID_SDK_ROOT}
23+
ENV PATH=${PATH}:${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin:${ANDROID_SDK_ROOT}/platform-tools
24+
25+
# ---- Android command line tools ----
26+
RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools \
27+
&& curl -fsSL https://dl.google.com/android/repository/commandlinetools-linux-14742923_latest.zip -o /tmp/cmdline-tools.zip \
28+
&& unzip /tmp/cmdline-tools.zip -d ${ANDROID_SDK_ROOT}/cmdline-tools \
29+
&& mv ${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest \
30+
&& rm /tmp/cmdline-tools.zip
31+
32+
# ---- SDK packages ----
33+
RUN yes | sdkmanager --licenses \
34+
&& sdkmanager --update \
35+
&& sdkmanager \
36+
"platform-tools" \
37+
"platforms;android-36" \
38+
"build-tools;36.0.0"
39+
40+
# ---- Permissions (CRITICAL) ----
41+
RUN chown -R vscode:vscode ${ANDROID_SDK_ROOT}
42+
43+
# Drop privileges
44+
USER vscode

.devcontainer/devcontainer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "Java + Android",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"features": {
7+
"ghcr.io/devcontainers/features/java:1": {
8+
"version": "17",
9+
"installGradle": true
10+
}
11+
},
12+
"customizations": {
13+
"vscode": {
14+
"extensions": [
15+
"GitHub.copilot",
16+
"oderwat.indent-rainbow",
17+
"redhat.vscode-yaml"
18+
]
19+
}
20+
},
21+
"remoteUser": "vscode"
22+
}

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- '.gitignore'
1111
- 'renovate.json'
1212
- 'FUNDING.yml'
13+
- '.devcontainer/**'
1314
workflow_dispatch:
1415

1516
env:

.github/workflows/lint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- '.github/**'
1212
- '!.github/workflows/**'
1313
- 'renovate.json'
14+
- '.devcontainer/**'
1415

1516
env:
1617
JAVA_VERSION: 17

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
.gradle
33
/local.properties
44
.DS_Store
5-
/build
5+
build
6+
.kotlin
67
/captures
78
.externalNativeBuild
89
.cxx
@@ -11,5 +12,3 @@ local.properties
1112
# Ignore all files in the .idea directory except for name
1213
.idea/*
1314
!.idea/.name
14-
15-
.kotlin/*

README.md

Lines changed: 25 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# compose-floating-window
22

3-
[![Release](https://jitpack.io/v/only52607/compose-floating-window.svg)](https://jitpack.io/#User/Repo)
3+
[![Release](https://jitpack.io/v/ArthurKun21/compose-overlay-window.svg)](https://jitpack.io/#ArthurKun21/compose-overlay-window)
44
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
55

66
Global Floating Window Framework based on Jetpack Compose
77

8-
[简体中文](README_CN.md)
9-
108
## Preview
119

1210
![Preview](/preview/example.gif)
@@ -22,38 +20,35 @@ Global Floating Window Framework based on Jetpack Compose
2220

2321
### Import Dependencies
2422

25-
- If the Gradle version is less than 7.0, add the Jitpack repository in the `build.gradle` of your app.
23+
- Add on settings.gradle.kts
2624

27-
```groovy
28-
repositories {
29-
maven { url 'https://jitpack.io' }
30-
}
31-
```
32-
33-
- If the Gradle version is greater than or equal to 7.0, add it in the settings.gradle file.
34-
```groovy
25+
```kotlin
3526
dependencyResolutionManagement {
3627
repositories {
37-
maven { url 'https://jitpack.io' }
28+
maven { url = uri("https://jitpack.io") }
3829
}
3930
}
4031
```
4132

4233
- Add `compose-floating-window` Dependency
43-
```groovy
34+
35+
```kotlin
4436
dependencies {
45-
implementation "com.github.only52607:compose-floating-window:1.0"
37+
implementation("com.github.ArthurKun21:compose-overlay-window:<tag>")
4638
}
4739
```
4840

4941
### Grant Floating Window Permission
5042

5143
Add to `AndroidManifest.xml`
44+
5245
```xml
5346
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
5447
```
5548

56-
### Create Floating Window and Show
49+
### Activity
50+
51+
When you want to show the floating window while on the Activity, you can use the following code:
5752

5853
```kotlin
5954
val floatingWindow = ComposeFloatingWindow(applicationContext)
@@ -69,65 +64,27 @@ floatingWindow.setContent {
6964
floatingWindow.show()
7065
```
7166

72-
> See [Sample App](https://github.com/only52607/compose-floating-window/tree/master/app).
73-
74-
## Advanced Usage
75-
76-
### Make Floating Window Draggable
77-
78-
Use the `Modifier.dragFloatingWindow()` modifier on the component you want to make draggable. Example:
79-
80-
```kotlin
81-
FloatingActionButton(
82-
modifier = Modifier.dragFloatingWindow()
83-
) {
84-
Icon(Icons.Filled.Call, "Call")
85-
}
86-
```
87-
88-
### Get the current instance of `ComposeFloatingWindow`
67+
### Service
8968

90-
Using LocalComposeFloatingWindow to retrieve, here's an example:
69+
When you want to show the floating window while on the Service, you can use the following code:
9170

9271
```kotlin
93-
val floatingWindow = LocalComposeFloatingWindow.current
94-
```
95-
96-
### Show Dialog
97-
98-
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.
99-
100-
Example:
101-
```kotlin
102-
SystemAlertDialog(
103-
onDismissRequest = { showDialog = false },
104-
confirmButton = {
105-
TextButton(onClick = { showDialog = false }) {
106-
Text(text = "OK")
107-
}
108-
},
109-
text = {
110-
Text(text = "This is a system dialog")
72+
val floatingWindow = ComposeServiceFloatingWindow(applicationContext)
73+
floatingWindow.setContent {
74+
FloatingActionButton(
75+
modifier = Modifier.dragFloatingWindow(),
76+
onClick = {
77+
Log.i("")
78+
}) {
79+
Icon(Icons.Filled.Call, "Call")
11180
}
112-
)
113-
```
114-
115-
### ViewModel
116-
117-
You can access the ViewModel from any Composable by calling the viewModel() function.
118-
119-
```kotlin
120-
class MyViewModel : ViewModel() { /*...*/ }
121-
122-
@Composable
123-
fun MyScreen(
124-
viewModel: MyViewModel = viewModel()
125-
) {
126-
// use viewModel here
12781
}
82+
floatingWindow.show()
12883
```
12984

130-
> See https://developer.android.com/jetpack/compose/libraries#viewmodel
85+
## Advanced Usage
86+
87+
> See [Sample Apps](samples).
13188
13289
## License
13390

README_CN.md

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)