Coder Social home page Coder Social logo

android-wear-color-picker's Introduction

Android Arsenal

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.

Demo

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:

// 1. Setup the pick launcher
val colorPickLauncher = registerForActivityResult(ColorPickActivity.Contract()) { pickedColorResult ->
    if (pickedColorResult == null) {
        // The user closed the picker without picking anything
    } else {
        // Get the picked color. The result is an Int in the form 0xAARRGGBB.
        pickedColor = pickedColorResult.pickedColor
    }
}

// ...

// 2. Launch the picker. The picked color parameter is optional - if specified, the picker will start already positioned on that color.
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 ([email protected])

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.

android-wear-color-picker's People

Contributors

bod avatar mu-lambda avatar tpmkranz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

android-wear-color-picker's Issues

Compatibility with Android Wear 5.1.1

Since the update to Android 5.1.1 this color picker is not working anymore. No crashes. When color is picked it does not make changes as it did before 5.1.1

Data binding class paths

When trying to use this in a java project I get e.g.

java.lang.ClassCastException: com.mine.app.databinding.AwcpColorPickBindingImpl cannot be cast to org.jraf.android.androidwearcolorpicker.databinding.AwcpColorPickBinding

How do I deal with that please?

Ability to pick a specific color

I would like to update to version 3.0.0 but I do specifically use the ability to specify colors. Without that ability I will need to stick with the previous version.

image000000

Release on mavenCentral

Hi,

First thank you so much for this great library.
Are there any plans to release this library to the mavenCentral repository. Due to the jcenter shutdown ?

Best regards
Thomas

androidx update

Will you be migrating to use androidx instead of the deprecated classes?
ColorPickActivity.kt:
android.support.v7.widget.LinearSnapHelper = androidx.recyclerview.widget.LinearSnapHelper
android.support.v7.widget.RecyclerView = androidx.recyclerview.widget.RecyclerView
android.support.wear.widget.CurvingLayoutCallback = androidx.wear.widget.CurvingLayoutCallback
android.support.wear.widget.WearableLinearLayoutManager = androidx.wear.widget.WearableLinearLayoutManager

ColorAdapter.kt:
android.support.v7.widget.RecyclerView = androidx.recyclerview.widget.RecyclerView

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.