Skip to content

Commit 102c9f5

Browse files
committed
Implement colorPickerDialog extension for creating ColorPickerDialog
1 parent c715ab6 commit 102c9f5

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Designed and developed by 2017 skydoves (Jaewoong Eum)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.skydoves.colorpickerview.kotlin
18+
19+
import android.content.Context
20+
import com.skydoves.colorpickerview.ColorPickerDialog
21+
22+
@DslMarker
23+
internal annotation class ColorPickerDsl
24+
25+
/**
26+
* Creates a lambda scope for implementing [ColorPickerDialog] using its [ColorPickerDialog.Builder].
27+
*
28+
* @param block lambda scope for receiving [ColorPickerDialog.Builder].
29+
* @return new instance of [ColorPickerDialog].
30+
*/
31+
@ColorPickerDsl
32+
@JvmSynthetic
33+
fun Context.colorPickerDialog(block: ColorPickerDialog.Builder.() -> Unit) =
34+
ColorPickerDialog.Builder(this).apply(block)

spotless.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@ spotless {
2222
googleJavaFormat()
2323
endWithNewline()
2424
}
25+
kotlin {
26+
target "**/*.kt"
27+
ktlint("$versions.ktlintGradle").userData(['indent_size': '2', 'continuation_indent_size': '2'])
28+
licenseHeaderFile "$rootDir/spotless.license.java"
29+
trimTrailingWhitespace()
30+
endWithNewline()
31+
}
2532
}

0 commit comments

Comments
 (0)