jCenter will close in May. In 0.2.4 moved to mavenCentral from jcenter.
Please note that the groupID has changed
Download from mavenCentral.
latest version:
repositories {
jcenter()
}
dependencies {
implementation 'net.mm2d.color-chooser:color-chooser:<version>'
}
Versions below 0.2.4 were distributed with jCenter. However, jCenter will close and old versions are not migrated to mavenCentral. If you need an older version, please use the Github Pages repository.
repositories {
maven { url = URI("https://ohmae.github.com/maven") }
}
dependencies {
implementation 'net.mm2d:color-chooser:<version>'
}
Register the listener to receive the result. Write the following process in onViewCreated of Fragment or onCreate of Activity.
ColorChooserDialog.registerListener(REQUEST_KEY, this) {
// it is selected color as @ColorInt
}
To show dialog. On FragmentActivity
or Fragment
ColorChooserDialog.show(
this, // Fragment or FragmentActivity
REQUEST_KEY, // request key for receive result
initialColor, // initial color, optional, default #FFFFFF
true, // need for alpha, optional, default false
TAB_RGB // initial tab, TAB_PALETTE/TAB_HSV/TAB_RGB, optional, default TAB_PALETTE
)
The style of implementing a callback interface in Activity and Fragment has been deprecated.
Please see Sample code for detail.
- Kotlin
- Android Jetpack
- androidx.appcompat:appcompat
- androidx.constraintlayout:constraintlayout
- androidx.core:core-ktx
- com.google.android.material:material
- Kotlin
- Android Jetpack
- androidx.appcompat:appcompat
- androidx.constraintlayout:constraintlayout
- androidx.navigation:navigation-fragment-ktx
- androidx.navigation:navigation-ui-ktx
- com.google.android.material:material
- LeakCanary
大前 良介 (OHMAE Ryosuke) http://www.mm2d.net/