Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hotchemi/stringpicker
StringPicker is a library to provides a custom view and dialog fragment to pick string value.
https://github.com/hotchemi/stringpicker
Last synced: 2 months ago
JSON representation
StringPicker is a library to provides a custom view and dialog fragment to pick string value.
- Host: GitHub
- URL: https://github.com/hotchemi/stringpicker
- Owner: hotchemi
- Created: 2014-02-15T15:43:41.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-09T16:18:56.000Z (over 10 years ago)
- Last Synced: 2024-10-14T12:43:26.006Z (3 months ago)
- Language: Java
- Homepage: http://hotchemi.github.io/StringPicker
- Size: 1.26 MB
- Stars: 50
- Watchers: 7
- Forks: 18
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
StringPicker
============StringPicker is a library to provides a custom view and dialog fragment to pick string value.
![screen shot](http://gifzo.net/5dMGZEDfpZ.gif)
on 2.x device.
![screen shot](http://gifzo.net/eCnHCAoINu.gif)
## Download
Download from maven central.
```groovy
dependencies {
compile 'com.github.hotchemi:stringpicker:0.0.2'
}
```## ChangeLog
- 2014/02/28 v0.0.1 release.
- 2014/03/01 v0.0.2 release.## Sample
Please try to move the [sample module](https://github.com/hotchemi/StringPicker/tree/master/sample/).
## How to use
### StringPicker
Custom view.
```xml
```
```java
StringPicker stringPicker = (StringPicker) view.findViewById(R.id.string_picker);
// set string array
String[] values = new String[] {"a","b","c","d","e","f"};
stringPicker.setValues(values);
// or set list
List list = values.toArray(new String[values.size()]);
stringPicker.setValues(list);// get value
stringPicker.getCurrentValue()
```### StringPickerDialog
implements in your activity.
```java
StringPickerDialog dialog = new StringPickerDialog();
Bundle bundle = new Bundle();
String[] values = new String[] {"a","b","c","d","e","f"};
bundle.putStringArray(getString(R.string.string_picker_dialog_values), values);
dialog.setArguments(bundle);
dialog.show(getSupportFragmentManager(), TAG);
```callback.
```java
@Override
public void onClick(String value) {
mTextView.setText(value);
}
```### Custom dialog
If you want to use your own dialog labels, override string xml resources on your application.
```xml
STRING_PICKER_DIALOG_VALUES
StringPickerDialog
OK
Cancel```
## Requirements
Supports Android 2.2 or greater.
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request## License
```
Copyright 2014 Shintaro KatafuchiLicensed 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.
```