Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/StephaneBg/SimpleNumberPicker
A customisable decimal and hexadecimal material picker view for Android.
https://github.com/StephaneBg/SimpleNumberPicker
android android-library picker picker-library
Last synced: 3 months ago
JSON representation
A customisable decimal and hexadecimal material picker view for Android.
- Host: GitHub
- URL: https://github.com/StephaneBg/SimpleNumberPicker
- Owner: StephaneBg
- License: apache-2.0
- Created: 2017-03-08T11:50:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-03T19:48:02.000Z (about 5 years ago)
- Last Synced: 2024-06-16T03:32:19.158Z (5 months ago)
- Topics: android, android-library, picker, picker-library
- Language: Kotlin
- Homepage:
- Size: 269 KB
- Stars: 179
- Watchers: 5
- Forks: 24
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-android-ui - SimpleNumberPicker - 十进制和十六进制选择器视图 (选择器(Picker))
README
[ ![Download](https://api.bintray.com/packages/stephanebg/SimpleNumberPicker/SimpleNumberPicker/images/download.svg) ](https://bintray.com/stephanebg/SimpleNumberPicker/SimpleNumberPicker/_latestVersion)
# SimpleNumberPicker
A customisable decimal and hexadecimal material picker view for Android.
## Add the dependency
```
dependencies {
implementation 'com.sbgapps:simplenumberpicker:2.1.0'
}
```## Usage
### DecimalPickerDialog
To display a decimal picker `DialogFragment`:
``` java
DecimalPickerDialog.Builder()
.setReference(REF_DEC_DIALOG) // Optional
.setNatural(false) // Optional - false is default
.setRelative(true) // Optional - true is default
.setTheme(R.style.DecimalPickerTheme) // Optional
.create()
.show(getSupportFragmentManager(), TAG_DEC_DIALOG)
```### HexaPickerDialog
To display a hexadecimal picker `DialogFragment`:
``` java
HexaPickerDialog.Builder()
.setReference(REF_HEX_DIALOG) // Optional
.setMinLength(2) // Optional - Default is none
.setMaxLength(8) // Optional - Default is none
.setTheme(R.style.HexaPickerTheme) // Optional
.create()
.show(getSupportFragmentManager(), TAG_HEX_DIALOG)
```## Handler
Your parent `Activity` or parent `Fragment` must implement `DecimalPickerHandler` or `HexaPickerHandler`.## Styling
1. You can use your own themes if you'd like to change certain attributes. SimpleNumberPicker currently allows for customization of the following attributes:
snpKeyColor :: color of the keys
snpNumberColor :: color of the entered number
snpBackspaceColor :: color of the backspace button
snpDialogBackground :: color of the dialog background2. Create your own custom style in `styles.xml`:
```xml
<item name="snpKeyColor">@android:color/white</item>
<item name="snpNumberColor">@android:color/white</item>
<item name="snpBackspaceColor">@android:color/white</item>
<item name="colorAccent">@android:color/white</item>
<item name="snpDialogBackground">@color/color_primary</item>
```See sample for more details.
## Contribution
### Pull requests are welcome!
Feel free to contribute to SimpleNumberPicker.
If you've fixed a bug or have a feature you've added, just create a pull request. If you've found a bug, want a new feature, or have other questions, file an issue. I will try to answer as soon as possible.
### Applications using SimpleNumberPicker
Please send a pull request if you would like to be added here.
## License
Copyright 2018 Stéphane BaigetLicensed 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 athttp://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.