GithubHelp home page GithubHelp logo

usherbaby / android-betterpickers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from code-troopers/android-betterpickers

0.0 2.0 0.0 14.78 MB

Android library for better Picker DialogFragments

Java 100.00%

android-betterpickers's Introduction

Maven Central API Android Arsenal Join the chat at https://gitter.im/derekbrameyer/android-betterpickers

Built With Cloudbees

BetterPickers Feature Graphic

DialogFragments modeled after the AOSP Clock and Calendar apps to improve UX for picking time, date, numbers, and other things.

Try out the sample application on Google Play.

BetterPickers Samples on Google Play

Including in Your Project

Android-BetterPickers is presented as an Android library project. A standalone JAR is not possible due to the theming capabilities offered by the DialogFragments.

You can include this project by referencing it as a library project.

Gradle

If you are a Gradle user you can also easily include the library:

compile 'com.code-troopers.betterpickers:library:2.0.0'

Maven

If you are a Maven user you can easily include the library by specifying it as a dependency:

<dependency>
  <groupId>com.code-troopers.betterpickers</groupId>
  <artifactId>library</artifactId>
  <version>2.0.0</version>
  <type>aar</type>
</dependency>

Usage

For a working implementation of this project see the sample/ folder.

  1. Implement the appropriate Handler callbacks:
public class MyActivity extends Activity implements 
  DatePickerDialogFragment.DatePickerDialogHandler {

  @Override
  public void onCreate(Bundle savedInstanceState) {
    // ...
  }
  
  @Override
  public void onDialogDateSet(int year, int monthOfYear, int dayOfMonth) {
    // Do something with your date!
  }
}
  1. Use one of the Builder classes to create a PickerDialog with a theme:
DatePickerBuilder dpb = new DatePickerBuilder()
    .setFragmentManager(getSupportFragmentManager())
    .setStyleResId(R.style.BetterPickersDialogFragment);
dpb.show();

Theming

For a demonstration of theming, see the sample/ folder.

You can use your own themes if you'd like to change certain attributes. BetterPickers currently allows for customization of the following attributes:

    bpDialogBackground       :: the drawable (preferably a 9-patch) used as a window background for the DialogFragment
    bpTextColor              :: the color (optionally state list) for all text in the DialogFragment
    bpDeleteIcon             :: the drawable (optionally state list) for the delete button
    bpCheckIcon              :: the drawable (optionally state list) for the check button in the DateDialogPicker
    bpKeyBackground          :: the drawable (optionally state list) for the keyboard buttons
    bpButtonBackground       :: the drawable (optionally state list) for the Set, Cancel, and Delete buttons
    bpDividerColor           :: the color used for the DialogFragment dividers
    bpKeyboardIndicatorColor :: the color used for the ViewPagerIndicator on the DateDialogPicker
  1. Create your own custom theme in styles.xml:
<style name="MyCustomBetterPickerTheme">
    <item name="bpDialogBackground">@drawable/custom_dialog_background</item>
    <item name="bpTextColor">@color/custom_text_color</item>
    <item name="bpDeleteIcon">@drawable/ic_backspace_custom</item>
    <item name="bpCheckIcon">@drawable/ic_check_custom</item>
    <item name="bpKeyBackground">@drawable/key_background_custom</item>
    <item name="bpButtonBackground">@drawable/button_background_custom</item>
    <item name="bpDividerColor">@color/custom_divider_color</item>
    <item name="bpKeyboardIndicatorColor">@color/custom_keyboard_indicator_color</item>
</style>
  1. Instantiate your DialogFragment using your custom theme:
DatePickerBuilder dpb = new DatePickerBuilder()
    .setFragmentManager(getSupportFragmentManager())
    .setStyleResId(R.style.MyCustomBetterPickerTheme);
dpb.show();

Actionbarsherlock compatibility

If you use actionbarsherlock which is not compatible with appcompat-v7 you can use the latest version of the library on the 1.x.x branch.

You can view the readme here

ChangeLog

Change log file is available here

Contribution

Pull requests are welcome!

Feel free to contribute to BetterPickers.

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. We will try to answer as soon as possible.

Credits

Thanks to Derek Brameyer for the initial version.

Thanks to JakeWharton for his work on ViewPagerIndicator.

Thanks to OAK and WillowTree Apps for Maven assistance and possible future improvements.

Thanks to all contributors !

License

Copyright 2013 Derek Brameyer, Code-Troopers

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-betterpickers's People

Contributors

derekbrameyer avatar fchauveau avatar cedricgatay avatar bbbenja avatar nkarasch avatar yuki24 avatar abrugues avatar ddrboxman avatar renanferrari avatar a-thomas avatar abeatte avatar ch4vi avatar takhion avatar mcginty avatar emce avatar gitter-badger avatar johnjohndoe avatar novalu avatar

Watchers

James Cloos avatar TaTa avatar

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.