Skip to content

Commit e44d2b0

Browse files
Initial commit
1 parent 1209e63 commit e44d2b0

Some content is hidden

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

64 files changed

+3179
-36
lines changed

.gitignore

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Built application files
22
*.apk
3-
*.aar
43
*.ap_
5-
*.aab
64

75
# Files for the ART/Dalvik VM
86
*.dex
@@ -14,13 +12,16 @@
1412
bin/
1513
gen/
1614
out/
17-
# Uncomment the following line in case you need and you don't have the release build type files in your app
18-
# release/
1915

2016
# Gradle files
17+
/.idea
2118
.gradle/
2219
build/
2320

21+
# DS_Store
22+
*.DS_Store
23+
**/DS_Store
24+
2425
# Local configuration file (sdk path, etc)
2526
local.properties
2627

@@ -36,50 +37,24 @@ proguard/
3637
# Android Studio captures folder
3738
captures/
3839

39-
# IntelliJ
40+
# Intellij
4041
*.iml
4142
.idea/workspace.xml
4243
.idea/tasks.xml
4344
.idea/gradle.xml
44-
.idea/assetWizardSettings.xml
4545
.idea/dictionaries
4646
.idea/libraries
47-
# Android Studio 3 in .gitignore file.
48-
.idea/caches
49-
.idea/modules.xml
50-
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
51-
.idea/navEditor.xml
5247

5348
# Keystore files
54-
# Uncomment the following lines if you do not want to check your keystore files in.
55-
#*.jks
56-
#*.keystore
49+
*.jks
5750

5851
# External native build folder generated in Android Studio 2.2 and later
5952
.externalNativeBuild
60-
.cxx/
6153

6254
# Google Services (e.g. APIs or Firebase)
63-
# google-services.json
55+
google-services.json
6456

6557
# Freeline
6658
freeline.py
6759
freeline/
68-
freeline_project_description.json
69-
70-
# fastlane
71-
fastlane/report.xml
72-
fastlane/Preview.html
73-
fastlane/screenshots
74-
fastlane/test_output
75-
fastlane/readme.md
76-
77-
# Version control
78-
vcs.xml
79-
80-
# lint
81-
lint/intermediates/
82-
lint/generated/
83-
lint/outputs/
84-
lint/tmp/
85-
# lint/reports/
60+
freeline_project_description.json

README.md

Lines changed: 198 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,198 @@
1-
# Orchestra
2-
🎺 Compatible libraries by Balloon, ColorPickerView, PowerSpinner for use in Jetpack Compose.
1+
2+
<h1 align="center">Orchestra</h1></br>
3+
4+
<p align="center">
5+
<a href="https://opensource.org/licenses/Apache-2.0"><img alt="License" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"/></a>
6+
<a href="https://android-arsenal.com/api?level=21"><img alt="API" src="https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat"/></a>
7+
<a href="https://github.com/skydoves"><img alt="Profile" src="https://skydoves.github.io/badges/skydoves.svg"/></a>
8+
</p>
9+
10+
<p align="center">
11+
🎺 Jetpack Compose compatible libraries using Balloon, ColorPickerView, PowerSpinner.
12+
</p>
13+
<p align="center">
14+
<img src="https://user-images.githubusercontent.com/24237865/61194943-f9d70380-a6ff-11e9-807f-ba1ca8126f8a.gif" width="32%"/>
15+
<img src="https://user-images.githubusercontent.com/24237865/95007367-d58b7d80-0649-11eb-857b-9e0187be70d1.gif" width="30.4%"/>
16+
<img src="https://user-images.githubusercontent.com/24237865/71962685-534a6600-323d-11ea-9e1e-df1f68cb2181.gif" width="32%"/>
17+
</p>
18+
19+
<img src="https://user-images.githubusercontent.com/24237865/95007576-3caa3180-064c-11eb-815b-b995f45bb18a.gif" align="right" width="32%"/>
20+
21+
## Balloon
22+
And add a dependency code to your **module**'s `build.gradle` file.
23+
```gradle
24+
dependencies {
25+
implementation "com.github.skydoves:orchestra-balloon:1.0.0"
26+
}
27+
```
28+
29+
### Usage
30+
`BalloonAnchor` composable can be used in `ConstraintLayout` and it receives a constraint reference. In the below, `BalloonAnchor` references `image` composable. When clicked the `image` composable, balloon popup will be shown.
31+
```kotlin
32+
ConstraintLayout {
33+
val (image, title, content, message) = createRefs()
34+
35+
// image, title, content, message //
36+
37+
BalloonAnchor(
38+
reference = image,
39+
modifier = Modifier.aspectRatio(0.8f),
40+
balloon = BalloonUtils.getTitleBalloon(
41+
context = context,
42+
title = poster.name,
43+
lifecycle = lifecycleOwner
44+
),
45+
onAnchorClick = { balloon, anchor -> balloon.show(anchor) },
46+
onClickIndication = RippleIndication(color = purple500)
47+
)
48+
```
49+
Or we can create a `BalloonAnchor` composable using [Balloon.Factory](https://github.com/skydoves/balloon#lazy-initialization).
50+
```kotlin
51+
BalloonAnchor(
52+
reference = image,
53+
modifier = Modifier.aspectRatio(0.8f),
54+
factory = MyBalloonFactory::class,
55+
onAnchorClick = { balloon, anchor -> balloon.show(anchor) },
56+
onBalloonClick = { },
57+
onBalloonDismiss = { },
58+
onBalloonInitialized = { content -> },
59+
onBalloonOutsideTouch = { content, event -> },
60+
onClickIndication = RippleIndication(color = purple500)
61+
)
62+
```
63+
64+
<img src="https://user-images.githubusercontent.com/24237865/95007577-416ee580-064c-11eb-92b7-ad30c5b36da0.gif" align="right" width="32%"/>
65+
66+
## ColorPicker
67+
And add a dependency code to your **module**'s `build.gradle` file.
68+
```gradle
69+
dependencies {
70+
implementation "com.github.skydoves:orchestra-colorpicker:1.0.0"
71+
}
72+
```
73+
74+
### Usage
75+
`ColorPicker` composable implements a color picker with `AlphaSlideBar` and `BrightnessSlideBar`. We can create an alpha sidebar and brightness sidebar for changing saturation and lightness by tapping on the desired color. They should be used in `children` inner composable in `ColorPicker`, and they receive a `colorPickerView` as a parameter.
76+
```kotlin
77+
val (selectedColor, setSelectedColor) = remember { mutableStateOf(ColorEnvelope(0)) }
78+
ColorPicker(
79+
modifier = modifier.constrainAs(colorPicker) {
80+
centerHorizontallyTo(parent)
81+
}.fillMaxWidth().height(400.dp),
82+
onColorListener = { envelope, _ ->
83+
setSelectedColor(envelope)
84+
},
85+
initialColor = purple500,
86+
children = { colorPickerView ->
87+
Column(modifier = Modifier.padding(top = 32.dp)) {
88+
Box(modifier = Modifier.padding(vertical = 6.dp)) {
89+
AlphaSlideBar(
90+
modifier = Modifier.fillMaxWidth().height(30.dp)
91+
.clip(RoundedCornerShape(4.dp)),
92+
colorPickerView = colorPickerView
93+
)
94+
}
95+
Box(modifier = Modifier.padding(vertical = 6.dp)) {
96+
BrightnessSlideBar(
97+
modifier = Modifier.fillMaxWidth().height(30.dp)
98+
.clip(RoundedCornerShape(4.dp)),
99+
colorPickerView = colorPickerView
100+
)
101+
}
102+
}
103+
}
104+
)
105+
```
106+
### AlphaTileBox
107+
In a normal View, it can not represent ARGB colors accurately. Because a color will be mixed with the parent's background-color. For resolving it we can use `AlphaTileBox` composable. `AlphaTileBox` composable reflects ARGB colors.
108+
```kotlin
109+
AlphaTileBox(
110+
modifier = modifier.constrainAs(square) {
111+
bottom.linkTo(parent.bottom)
112+
centerHorizontallyTo(parent)
113+
}.size(64.dp).clip(RoundedCornerShape(4.dp))
114+
) {
115+
it.setBackgroundColor(selectedColor.color)
116+
}
117+
```
118+
119+
<img src="https://user-images.githubusercontent.com/24237865/95007578-42a01280-064c-11eb-9081-e5567274c9ba.gif" align="right" width="32%"/>
120+
121+
## Spinner
122+
And add a dependency code to your **module**'s `build.gradle` file.
123+
```gradle
124+
dependencies {
125+
implementation "com.github.skydoves:orchestra-spinner:1.0.0"
126+
}
127+
```
128+
129+
### Usage
130+
`Spinner` composable implements a lightweight dropdown popup spinner. Here is an example for creating a spinner using a sting array resource. We should use the String generic type for creating a spinner when we us a string array resource.
131+
132+
```kotlin
133+
val (selectedItem0, setSelectedItem0) = remember { mutableStateOf("Choose a question") }
134+
Spinner<String>(
135+
text = selectedItem0,
136+
modifier = Modifier.fillMaxWidth().padding(16.dp)
137+
.background(blue200)
138+
.align(Alignment.CenterHorizontally),
139+
itemListRes = R.array.list_spinner,
140+
color = Color.White,
141+
style = MaterialTheme.typography.body2,
142+
textAlign = TextAlign.Center,
143+
showDivider = true,
144+
dividerColor = white87,
145+
overflow = TextOverflow.Ellipsis,
146+
maxLines = 1,
147+
spinnerPadding = 16.dp,
148+
spinnerBackgroundColor = MaterialTheme.colors.onBackground,
149+
onSpinnerItemSelected = { index, item ->
150+
setSelectedItem0(item)
151+
}
152+
)
153+
```
154+
Here is an another example using a List for creating a spinner. In this case, we don't need to decide a generic type of Spinner.
155+
156+
```kotlin
157+
val coffeeList = remember { listOf("Americano", "Cold Brew", "Espresso", "Latte") }
158+
val (selectedItem1, setSelectedItem1) = remember { mutableStateOf("Choose your coffee") }
159+
Spinner(
160+
text = selectedItem1,
161+
modifier = Modifier.fillMaxWidth().padding(16.dp)
162+
.background(amber700)
163+
.align(Alignment.CenterHorizontally),
164+
itemList = coffeeList,
165+
color = Color.White,
166+
style = MaterialTheme.typography.body2,
167+
textAlign = TextAlign.Center,
168+
dividerColor = white87,
169+
overflow = TextOverflow.Ellipsis,
170+
maxLines = 1,
171+
spinnerPadding = 16.dp,
172+
spinnerBackgroundColor = MaterialTheme.colors.onBackground,
173+
onSpinnerItemSelected = { index, item ->
174+
setSelectedItem1(item)
175+
}
176+
)
177+
```
178+
179+
## Find this repository useful? :heart:
180+
Support it by joining __[stargazers](https://github.com/skydoves/Orchestra/stargazers)__ for this repository. :star: <br>
181+
And __[follow](https://github.com/skydoves)__ me for my next creations! 🤩
182+
183+
# License
184+
```xml
185+
Designed and developed by 2020 skydoves (Jaewoong Eum)
186+
187+
Licensed under the Apache License, Version 2.0 (the "License");
188+
you may not use this file except in compliance with the License.
189+
You may obtain a copy of the License at
190+
191+
http://www.apache.org/licenses/LICENSE-2.0
192+
193+
Unless required by applicable law or agreed to in writing, software
194+
distributed under the License is distributed on an "AS IS" BASIS,
195+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
196+
See the License for the specific language governing permissions and
197+
limitations under the License.
198+
```

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'kotlin-android'
4+
id 'kotlin-android-extensions'
5+
}
6+
apply from: '../dependencies.gradle'
7+
8+
android {
9+
compileSdkVersion versions.compileSdk
10+
defaultConfig {
11+
applicationId "com.skydoves.compose.orchestra"
12+
minSdkVersion versions.minSdk
13+
targetSdkVersion versions.compileSdk
14+
versionCode versions.versionCode
15+
versionName versions.versionName
16+
}
17+
compileOptions {
18+
sourceCompatibility JavaVersion.VERSION_1_8
19+
targetCompatibility JavaVersion.VERSION_1_8
20+
}
21+
composeOptions {
22+
kotlinCompilerVersion versions.kotlin
23+
kotlinCompilerExtensionVersion versions.composeVersion
24+
}
25+
kotlinOptions {
26+
jvmTarget = '1.8'
27+
freeCompilerArgs += [
28+
"-Xallow-jvm-ir-dependencies",
29+
"-Xskip-prerelease-check",
30+
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi"]
31+
useIR = true
32+
}
33+
buildFeatures {
34+
compose true
35+
}
36+
androidExtensions {
37+
experimental = true
38+
}
39+
}
40+
41+
dependencies {
42+
// material
43+
implementation "com.google.android.material:material:$versions.materialVersion"
44+
45+
// androidx jetpack
46+
implementation "androidx.core:core-ktx:$versions.coreKtxVersion"
47+
48+
// compose
49+
implementation "androidx.compose.ui:ui:$versions.composeVersion"
50+
implementation "androidx.compose.material:material:$versions.composeVersion"
51+
implementation "androidx.compose.material:material-icons-extended:$versions.composeVersion"
52+
implementation "androidx.compose.foundation:foundation:$versions.composeVersion"
53+
implementation "androidx.compose.foundation:foundation-layout:$versions.composeVersion"
54+
implementation "androidx.compose.animation:animation:$versions.composeVersion"
55+
implementation "androidx.compose.runtime:runtime:$versions.composeVersion"
56+
implementation "androidx.compose.runtime:runtime-livedata:$versions.composeVersion"
57+
implementation "androidx.ui:ui-tooling:$versions.composeVersion"
58+
59+
// compose orchestras
60+
implementation project(":balloon")
61+
implementation project(":colorpicker")
62+
implementation project(":spinner")
63+
64+
// compose image loading
65+
implementation "com.github.skydoves:landscapist-glide:$versions.landscapistVersion"
66+
}
67+
68+
apply from: '../spotless.gradle'

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

0 commit comments

Comments
 (0)