Wear OS Color Picker
A color picker activity optimized for Wear OS (formerly known as Android Wear). Handy for watch face settings.
The UI presents a wheel of colors with different hues and lightness.
How to use
Adding the library to your project
The artifact is available on Maven Central.
dependencies {
implementation("org.jraf:android-wear-color-picker:3.0.0")
}
Note: the artifact was hosted on JCenter in the past, but is now on Maven Central since v2.2.4
Use the library
The picker uses the ActivityResultContract API to be launched and to return the picked color:
val colorPickLauncher = registerForActivityResult(ColorPickActivity.Contract()) { pickedColorResult ->
if (pickedColorResult == null) {
} else {
pickedColor = pickedColorResult.pickedColor
}
}
colorPickLauncher.launch(ColorPickActivity.Contract.PickRequest(pickedColor))
You can also have a look at the sample.
That's it!
License
Copyright (C) 2015-present Benoit 'BoD' Lubek (BoD@JRAF.org)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.