Skip to content

Commit abbdb58

Browse files
committed
Initial commit
0 parents  commit abbdb58

File tree

68 files changed

+3412
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3412
-0
lines changed

.github/dependabot.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "gradle"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"

.github/workflows/build.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Android CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: set up JDK 11
16+
uses: actions/setup-java@v3
17+
with:
18+
java-version: '11'
19+
distribution: 'adopt'
20+
cache: gradle
21+
22+
- name: Grant execute permission for gradlew
23+
run: chmod +x gradlew
24+
- name: Run tests
25+
run: ./gradlew check

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties
16+
/.idea/

README.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Sheets
2+
3+
Another BottomSheet in Jetpack Compose.
4+
5+
<a href="images/screenshot_simple.png"><img src="images/screenshot_simple.png" width="32%"/></a>
6+
<a href="images/screenshot_list.png"><img src="images/screenshot_list.png" width="32%"/></a>
7+
<a href="images/screenshot_intent-picker.png"><img src="images/screenshot_intent-picker.png" width="32%"/></a>
8+
9+
**Features**:
10+
11+
12+
- Independent. Unlike [`ModalBottomSheetLayout`](https://developer.android.com/reference/kotlin/androidx/compose/material/package-summary#ModalBottomSheetLayout(kotlin.Function1,androidx.compose.ui.Modifier,androidx.compose.material.ModalBottomSheetState,androidx.compose.ui.graphics.Shape,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,kotlin.Function0)) , this bottom sheet will be displayed in a dialog window, which means we can easily create and display multiple sheets in the same composable:
13+
14+
```kotlin
15+
@Composable
16+
fun MyComposable() {
17+
val scope = rememberCoroutineScope()
18+
19+
val sheet1 = rememberBottomSheetState()
20+
val sheet2 = rememberBottomSheetState()
21+
22+
Column {
23+
Button(onClick = { scope.launch { sheet1.expand() } }) {
24+
Text("Sheet 1")
25+
}
26+
27+
Button(onClick = { scope.launch { sheet2.expand() } }) {
28+
Text("Sheet 2")
29+
}
30+
}
31+
32+
BottomSheet(state = sheet1) { ... }
33+
BottomSheet(state = sheet2) { ... }
34+
}
35+
```
36+
37+
38+
- Peek state support:
39+
40+
```kotlin
41+
val state = rememberBottomSheetState()
42+
43+
BottomSheet(
44+
state = state,
45+
/*
46+
* PeekHeight.px(Int) and PeekHeight.fraction(Float) are supported as well.
47+
*/
48+
peekHeight = PeekHeight.dp(300),
49+
) {
50+
...
51+
}
52+
53+
state.peek()
54+
```
55+
56+
57+
- Customizable animation spec:
58+
59+
```kotlin
60+
val state = rememberBottomSheetState()
61+
62+
state.expand(animationSpec = spring())
63+
```
64+
65+
# Quick start
66+
67+
Add the dependency [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.dokar3/sheets/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.dokar3/sheets):
68+
69+
```groovy
70+
implementation "io.github.dokar3.sheets:sheets:latest_version"
71+
```
72+
73+
**Basic**
74+
75+
```kotlin
76+
val scope = rememberCoroutineScope()
77+
val state = rememberBottomSheetState()
78+
79+
Button(onClick = { scope.launch { state.expand() } }) {
80+
Text("Show bottom sheet")
81+
}
82+
83+
BottomSheet(state = state) {
84+
Text("Sheet content")
85+
}
86+
```
87+
88+
**Skip peek state**
89+
90+
To skip peek state, set `peekHeight` to a value at least equal to the content height, eg. `PeekHeight.px(Int.MAX_VALUE)`, `PeekHeight.fraction(1f)`:
91+
92+
```kotlin
93+
BottomSheet(
94+
state = state,
95+
peekHeight = PeekHeight.fraction(1f),
96+
) {
97+
...
98+
}
99+
```
100+
101+
**Embedded sheet**
102+
103+
To embed the sheet in the current layout hierarchy, use the `BottomSheetLayout()`:
104+
105+
```kotlin
106+
Box {
107+
OtherContent()
108+
109+
val state = rememberBottomSheetState()
110+
if (state.visible) {
111+
BottomSheetLayout(state = state) {
112+
...
113+
}
114+
}
115+
}
116+
```
117+
118+
# License
119+
120+
```
121+
Copyright 2022 dokar3
122+
123+
Licensed under the Apache License, Version 2.0 (the "License");
124+
you may not use this file except in compliance with the License.
125+
You may obtain a copy of the License at
126+
127+
http://www.apache.org/licenses/LICENSE-2.0
128+
129+
Unless required by applicable law or agreed to in writing, software
130+
distributed under the License is distributed on an "AS IS" BASIS,
131+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132+
See the License for the specific language governing permissions and
133+
limitations under the License.
134+
```

build.gradle

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
buildscript {
3+
ext {
4+
compose_version = '1.2.0-beta02'
5+
kotlin_version = '1.6.21'
6+
}
7+
repositories {
8+
google()
9+
mavenCentral()
10+
}
11+
dependencies {
12+
classpath 'com.android.tools.build:gradle:7.2.1'
13+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14+
15+
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.19.0'
16+
17+
// NOTE: Do not place your application dependencies here; they belong
18+
// in the individual module build.gradle files
19+
}
20+
}
21+
22+
task clean(type: Delete) {
23+
delete rootProject.buildDir
24+
}

gradle.properties

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Project-wide Gradle settings.
2+
# IDE (e.g. Android Studio) users:
3+
# Gradle settings configured through the IDE *will override*
4+
# any settings specified in this file.
5+
# For more details on how to configure your build environment visit
6+
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Specifies the JVM arguments used for the daemon process.
8+
# The setting is particularly useful for tweaking memory settings.
9+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10+
# When configured, Gradle will run in incubating parallel mode.
11+
# This option should only be used with decoupled projects. More details, visit
12+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13+
# org.gradle.parallel=true
14+
# AndroidX package structure to make it clearer which packages are bundled with the
15+
# Android operating system, and which are packaged with your app"s APK
16+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
17+
android.useAndroidX=true
18+
# Automatically convert third-party libraries to use AndroidX
19+
android.enableJetifier=false
20+
# Kotlin code style for this project: "official" or "obsolete":
21+
kotlin.code.style=official
22+
23+
VERSION_NAME=0.1.0
24+
GROUP=io.github.dokar3
25+
26+
POM_NAME=sheets
27+
POM_DESCRIPTION=Another BottomSheet in Jetpack Compose
28+
POM_INCEPTION_YEAR=2022
29+
POM_URL=https://github.com/dokar3/sheets
30+
31+
POM_LICENSE_NAME=The Apache Software License, Version 2.0
32+
POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
33+
POM_LICENSE_DIST=repo
34+
35+
POM_SCM_URL=https://github.com/dokar3/sheets
36+
POM_SCM_CONNECTION=scm:git:git://github.com/dokar3/sheets.git
37+
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/dokar3/sheets.git
38+
39+
POM_DEVELOPER_ID=dokar3
40+
POM_DEVELOPER_NAME=Dokar
41+
POM_DEVELOPER_URL=https://github.com/dokar3/

gradle/wrapper/gradle-wrapper.jar

57.8 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Jan 28 20:07:14 CST 2022
2+
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
4+
distributionPath=wrapper/dists
5+
zipStorePath=wrapper/dists
6+
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)