Jetpack Compose Number Picker

Overview

Jetpack Compose Number Picker

Android library providing a Number Picker for Jetpack Compose.

chargemap

Maven version

License MIT Android minimuml version

Showcase

Installation

In your module build.gradle :

dependencies {
  implementation "com.chargemap.compose:numberpicker:latestVersion"
}

Usage

Simple NumberPicker

var pickerValue by remember { mutableStateOf(0) }

NumberPicker(
    value = pickerValue,
    range = 0..10,
    onValueChange = {
        pickerValue = it
    }
)

24 hours HoursNumberPicker

var pickerValue by remember { mutableStateOf<Hours>(FullHours(12, 43)) }

HoursNumberPicker(
    dividersColor = MaterialTheme.colors.primary,
    value = pickerValue,
    onValueChange = {
        pickerValue = it
    },
    hoursDivider = {
        Text(
            modifier = Modifier.size(24.dp),
            textAlign = TextAlign.Center,
            text = ":"
        )
    }
)

AM/PM HoursNumberPicker

var pickerValue by remember { mutableStateOf<Hours>(AMPMHours(9, 12, AMPMHours.DayTime.PM )) }

HoursNumberPicker(
    dividersColor = MaterialTheme.colors.primary,
    value = pickerValue,
    onValueChange = {
        pickerValue = it
    },
    hoursDivider = {
        Text(
            modifier = Modifier.padding(horizontal = 8.dp),
            textAlign = TextAlign.Center,
            text = "hours"
        )
    },
    minutesDivider = {
        Text(
            modifier = Modifier.padding(horizontal = 8.dp),
            textAlign = TextAlign.Center,
            text = "minutes"
        )
    }
)

Contributors

raphaël Raphaël Bertin
Comments
  • License ?

    License ?

    opened by noe 1
  • 0.0.13 leadingZero parameter added

    0.0.13 leadingZero parameter added

    0.0.13, leadingZero boolean parameter added. When true, numbers less than 10 (and greater than -10) will display an extra leading 0, useful for displaying time formats accurately (e.g. leadingZero = true, 01:05 PM / leadingZero = false, 1:5 PM)

    currently accessible through: https://jitpack.io/#cjrcodes/Compose-NumberPicker/0.0.13

    build.gradle: app: implementation "com.github.cjrcodes:Compose-NumberPicker:0.0.13"

    build.gradle: maven { url 'https://jitpack.io' }

    opened by cjrcodes 1
  • Add ListItemPicker and examples

    Add ListItemPicker and examples

    Added a ListItemPicker which is almost identical to NumberPicker, but works on a List of a generic type. I wanted to make this available but not require an immediate refactoring of NumberPicker in case you might use parts but not accept the pull request. I've included 3 examples in the sample app, DoublesPicker, FruitPicker, and IntRangePicker. Thanks.

    opened by pandasys 1
  • Add the apache license to the repository to match the maven license.

    Add the apache license to the repository to match the maven license.

    • https://www.apache.org/licenses/LICENSE-2.0.txt
    • https://search.maven.org/artifact/io.github.chargemap.android/compose-numberpicker

    Will close issue #13

    opened by plusmobileapps 0
  • Create a license

    Create a license

    There is currently no license on this project so it's unknown on the legality of using this code in other projects. Please add one so others can know what is possible to do with this code.

    opened by plusmobileapps 1
  • Suggestion: Accessibility Improvements

    Suggestion: Accessibility Improvements

    Hello!

    Consider making this component accessible meaning that it could be used with e.g. TalkBack and keyboards/Dpads. The picker doesn't seem to work on either currently.

    opened by arttujo 0
  • Slotting suggestion

    Slotting suggestion

    Hi,

    In order to solve all style implementation you should use the slot Api pattern for your component :

    @Composable
    fun <T> ListItemPicker(
        modifier: Modifier = Modifier,
        pickerState = rememberPickerState()
        item: @Composable (T) -> Unit
    )
    

    https://chris.banes.dev/slotting-in-with-compose-ui/

    opened by CedrickFlocon 0
  • Suggestion: Multiplatform NumberPicker

    Suggestion: Multiplatform NumberPicker

    Hello!

    I see that you don't use any platform specific features, could you please add multiplatform support.

    similar suggestion: https://github.com/ChargeMap/Compose-NumberPicker/issues/4

    opened by DoTheMonkeyBusiness 0
  • "Repeat" property

    "Repeat" Boolean property that if true, will loop back to the bottom of the picker at the top of the picker and vice versa if the picker is at the bottom, similar to a never-ending carousel. (Once the beginning/end is reached, the end/beginning of the list will be the next value in display, instead of having to scroll all the way back to the desired point of the list.)

    opened by cjrcodes 0
Owner
Chargemap
Chargemap
Split Food Bill is an android application where user can split the expenses based on the number of people joined the trip. This application is developed using Android's Jetpack Compose

SplitFoodBill-Compose Split Food Bill is an android application where user can split the expenses based on the number of people joined the trip. This

Shivaprasad Bhat 1 Jan 17, 2022
🌈 Palette - A color picker library made in Jetpack Compose

?? Palette A color picker library made in Jetpack Compose. Including in your project Gradle Add it in your root build.gradle at the end of repositorie

Shivam Dhuria 56 Dec 11, 2022
Fast android task that finished in only 3 hours, it gets the information from national number without database. I just wanna refine my skills in android basics so I try to make this simple project.

RaqmQawmy it is a fast android task that finished in only 3 hours, it gets the information from national number without database. I just wanna refine

Mahmoud Abdelazim 3 May 15, 2022
Jetpack Compose Boids | Flocking Insect 🐜. bird or Fish simulation using Jetpack Compose Desktop 🚀, using Canvas API 🎨

?? ?? ?? Compose flocking Ants(boids) ?? ?? ?? Jetpack compose Boids | Flocking Insect. bird or Fish simulation using Jetpack Compose Desktop ?? , usi

Chetan Gupta 38 Sep 25, 2022
A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Why Not Compose! A collection of animations, compositions, UIs using Jetpack Compose. You can say Jetpack Compose cookbook or play-ground if you want!

Md. Mahmudul Hasan Shohag 186 Jan 1, 2023
Learn Jetpack Compose for Android by Examples. Learn how to use Jetpack Compose for Android App Development. Android’s modern toolkit for building native UI.

Learn Jetpack Compose for Android by Examples. Learn how to use Jetpack Compose for Android App Development. Android’s modern toolkit for building native UI.

MindOrks 382 Jan 5, 2023
This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Compose.

JetBMICalculator This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Co

BHAVNA THACKER 3 Dec 31, 2022
Jetpack-Compose-Demo - Instagram Profile UI using Jetpack Compose

Jetpack-Compose-Demo Instagram Profile UI using Jetpack Compose

omar 1 Aug 11, 2022
Jetpack-compose-animations-examples - Cool animations implemented with Jetpack compose

Jetpack-compose-animations-examples This repository consists of 4 animations: St

Canopas Software 180 Jan 2, 2023
Compose-navigation - Set of utils to help with integrating Jetpack Compose and Jetpack's Navigation

Jetpack Compose Navigation Set of utils to help with integrating Jetpack Compose

Adam Kobus 5 Apr 5, 2022
Jetpack-compose-uis - A collection of some UIs using Jetpack Compose. built using Katalog

Jetpack Compose UIs This is a collection of some UIs using Jetpack Compose. It i

Mori Atsushi 3 Dec 15, 2022
A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose

Authentication A simple authentication application using Jetpack compose to illustrate signin and sign up using Mvvm, Kotlin and jetpack compose Scree

Felix Kariuki 5 Dec 29, 2022
An application that i developed with a aim of learning Jetpack compose and many other jetpack libraries

An application that i developed with a aim of learning Jetpack compose and many other jetpack libraries, The application make use of jikan Api which displays a list of animations,there more details and even trailers of the animations.

Odhiambo Brandy 10 Nov 23, 2022
A Kotlin library to use Jetpack Compose in Android and iOS. Allow to write UI for both in Kotin. Still experimental as many compose features are not yet available.

Multiplatform Compose A Kotlin library to use Jetpack Compose in Android and iOS. Allow to write UI for both in Kotin. Still experimental as many comp

Clément Beffa 548 Jan 7, 2023
K5-compose is a sketchy port of p5.js for Jetpack Compose

k5-compose k5-compose is a sketchy port of P5.js for Jetpack Compose Desktop. This library provides you a playground to play with your sketches so you

Nikhil Chaudhari 176 Nov 22, 2022
Jetpack Compose based project, used to stress-testing compose features / integrations and explore non-trivial functionality

Project containing Jetpack Compose samples For pagination & network images it uses CATAAS. Known issues Navigation-Compose Issue with fast tapping on

Denis Rudenko 59 Dec 14, 2022
Pokedex Compose is an independent re-write of a demo application by the name of Pokedex, but written in jetpack compose.

Pokedex Compose Pokedex Compose is an independent re-write of a similar project by the name of Pokedex. I am recreating the UI but I am doing it using

Jose Patino 4 May 1, 2022
Compose-Instagram-Profile-UI - Instagram profile screen UI using android jetpack compose

Compose-Intsgram-Profile-UI Instagram profile screen UI using android jetpack co

TILLERN 1 Mar 8, 2022