Code Monkey home page Code Monkey logo

android-betterpickers's Introduction

/!\ This Project is no longer maintained /!\ 

Maven Central API Android Arsenal

Built With Cloudbees

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

Gradle

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

Maven

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

Usage

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

Calendar Date Picker

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        CalendarDatePickerDialogFragment cdp = new CalendarDatePickerDialogFragment()
                .setOnDateSetListener(SampleCalendarDateBasicUsage.this)
                .setFirstDayOfWeek(Calendar.SUNDAY)
                .setPreselectedDate(towDaysAgo.getYear(), towDaysAgo.getMonthOfYear() - 1, towDaysAgo.getDayOfMonth())
                .setDateRange(minDate, null)
                .setDoneText("Yay")
                .setCancelText("Nop")
                .setThemeDark(true);
        cdp.show(getSupportFragmentManager(), FRAG_TAG_DATE_PICKER);
    }
});

Radial Time Picker

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        RadialTimePickerDialogFragment rtpd = new RadialTimePickerDialogFragment()
                .setOnTimeSetListener(SampleRadialTimeBasicUsage.this)
                .setStartTime(10, 10)
                .setDoneText("Yay")
                .setCancelText("Nop")
                .setThemeDark(true);
        rtpd.show(getSupportFragmentManager(), FRAG_TAG_TIME_PICKER);
    }
});

Recurrence Picker

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        FragmentManager fm = getSupportFragmentManager();
        Bundle bundle = new Bundle();
        Time time = new Time();
        time.setToNow();
        bundle.putLong(RecurrencePickerDialogFragment.BUNDLE_START_TIME_MILLIS, time.toMillis(false));
        bundle.putString(RecurrencePickerDialogFragment.BUNDLE_TIME_ZONE, time.timezone);
        bundle.putString(RecurrencePickerDialogFragment.BUNDLE_RRULE, mRrule);
        bundle.putBoolean(RecurrencePickerDialogFragment.BUNDLE_HIDE_SWITCH_BUTTON, true);

        RecurrencePickerDialogFragment rpd = new RecurrencePickerDialogFragment();
        rpd.setArguments(bundle);
        rpd.setOnRecurrenceSetListener(SampleRecurrenceBasicUsage.this);
        rpd.show(fm, FRAG_TAG_RECUR_PICKER);
    }
});

Timezone Picker

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        FragmentManager fm = getSupportFragmentManager();
        Bundle bundle = new Bundle();
        Time time = new Time();
        time.setToNow();
        bundle.putLong(TimeZonePickerDialogFragment.BUNDLE_START_TIME_MILLIS, time.toMillis(false));
        bundle.putString(TimeZonePickerDialogFragment.BUNDLE_TIME_ZONE, time.timezone);
        bundle.putString(RecurrencePickerDialogFragment.BUNDLE_RRULE, mRrule);

        TimeZonePickerDialogFragment tzpd = new TimeZonePickerDialogFragment();
        tzpd.setArguments(bundle);
        tzpd.setOnTimeZoneSetListener(SampleTimeZoneBasicUsage.this);
        tzpd.show(fm, FRAG_TAG_TIME_ZONE_PICKER);
    }
});

Date Picker

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        DatePickerBuilder dpb = new DatePickerBuilder()
                .setFragmentManager(getSupportFragmentManager())
                .setStyleResId(R.style.BetterPickersDialogFragment)
                .setYearOptional(true);
        dpb.show();
    }
});

Expiration Picker

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        ExpirationPickerBuilder epb = new ExpirationPickerBuilder()
                  .setFragmentManager(getSupportFragmentManager())
                  .setStyleResId(R.style.BetterPickersDialogFragment)
                  .setMinYear(2000);
        epb.show();
    }
});

HMS Picker

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        HmsPickerBuilder hpb = new HmsPickerBuilder()
                .setFragmentManager(getSupportFragmentManager())
                .setStyleResId(R.style.BetterPickersDialogFragment);
        hpb.show();
    }
});

Number Picker

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        NumberPickerBuilder npb = new NumberPickerBuilder()
                .setFragmentManager(getSupportFragmentManager())
                .setStyleResId(R.style.BetterPickersDialogFragment)
                .setLabelText("LBS.");
        npb.show();
}
});

Time Picker

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        TimePickerBuilder tpb = new TimePickerBuilder()
                .setFragmentManager(getSupportFragmentManager())
                .setStyleResId(R.style.BetterPickersDialogFragment);
        tpb.show();
    }
});

Theming

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

Calendar Date Picker / Radial Time Picker

  1. Use attributes that allow you to customize pickers

    bpHeaderBackgroundColor :: bpHeaderUnselectedTextColor :: bpHeaderSelectedTextColor :: bpBodyBackgroundColor :: bpBodySelectedTextColor :: bpBodyUnselectedTextColor :: bpButtonsBackgroundColor :: bpButtonsTextColor :: -- Calendar Date Picker bpPreHeaderBackgroundColor :: bpDisabledDayTextColor :: -- Radial Time Picker bpRadialBackgroundColor :: bpRadialTextColor :: bpRadialPointerColor :: bpAmPmCircleColor ::

  2. Create your own custom theme in styles.xml:

```xml
<style name="MyCustomBetterPickersDialogs" parent="BetterPickersRadialTimePickerDialog.PrimaryColor">
    <item name="bpPreHeaderBackgroundColor">@color/holo_red_dark</item>
    <item name="bpHeaderBackgroundColor">@color/holo_red_light</item>
    <item name="bpHeaderSelectedTextColor">@color/holo_orange_dark</item>
    <item name="bpHeaderUnselectedTextColor">@android:color/white</item>

    <item name="bpBodyBackgroundColor">@color/holo_blue_dark</item>
    <item name="bpBodySelectedTextColor">@color/holo_orange_dark</item>
    <item name="bpBodyUnselectedTextColor">@android:color/white</item>

    <item name="bpRadialBackgroundColor">@color/holo_orange_dark</item>
    <item name="bpRadialTextColor">@color/holo_purple</item>
    <item name="bpRadialPointerColor">@android:color/black</item>

    <item name="bpButtonsBackgroundColor">@color/holo_green_dark</item>
    <item name="bpButtonsTextColor">@color/holo_orange_dark</item>
</style>
```
  1. Instantiate your DialogFragment using your custom theme:
RadialTimePickerDialogFragment rtpd = new RadialTimePickerDialogFragment()
       .setOnTimeSetListener(SampleRadialTimeThemeCustom.this)
       .setThemeCustom(R.style.MyCustomBetterPickersDialogs);
rtpd.show(getSupportFragmentManager(), FRAG_TAG_TIME_PICKER);
  1. Result

Date Picker / Expiration Picker / HMS Picker / Number Picker / Time Picker

  1. 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

  2. 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.

Applications using BetterPickers

Please send a pull request if you would like to be added here.

Icon Application
Trello
Navig'Tours
Sleep Well
Dayon Alarm
Driving Timer
TVShow Time

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

abrugues avatar austriandudes avatar bbbenja avatar cedricgatay avatar ctknight avatar ddrboxman avatar derekbrameyer avatar devnied avatar emce avatar fchauveau avatar gitter-badger avatar johnjohndoe avatar jorispotier avatar joticajulian avatar jozefceluch avatar leoforney avatar mcginty avatar mtrakal avatar nkarasch avatar novalu avatar paxxux avatar renanferrari avatar rlucas1 avatar spectrl avatar tyderion avatar tylermccraw avatar vanniktech avatar viniciusam avatar yuki24 avatar zaplitny 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  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  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  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

android-betterpickers's Issues

remove com.viewpagerindicator from library pom

Hello,

i just found this library and it looks cool.

but i can't find a reason why it would need this in the library pom.xml

<dependency>
  <groupId>com.viewpagerindicator</groupId>
  <artifactId>library</artifactId>
  <version>2.4.1</version>
  <type>apklib</type>
</dependency>

in its pom. it does not seem to use any of the features of the viewpagerindicator library.

could you push an update that does not require this extra library?

Thanks in advance! :)

Noob question...but how to use? (doesn't import)

I tried following the directions, which congrats, are simple enough, but for some reason this doesn't import right. I added it to my workspace in Eclipse by doing the usual (File->Import->Existing Code...) just like I did for actionbarsherlock. It showed 1059 errors. I tried changing the target API to 4.0. as instructions said, this dropped it down to 1015 errors, but still doesn't work. I lastly tried adding actionbarsherlock library to this as a library, and that dropped it down to 644 errors but still can't get it to work. FWIW, I'm using Kepler and not android studio. I've imported projects before so not sure why this isn't working. :(

Do I need to also get NineOldAndroids?

Help?

Edit: It seems like I fixed it...required to add external Jar nineoldandroids, an adding actionbarsherlock as a required library to this library

Take theme from context

Could you add an option to simply supply a context and use the context's theme to style the picker (so basically what normal dialogs do)? I have a light and a dark theme in my app and currently have to use reflection to set either the one or the other.

Change Default Android theme in pickers

Could you add an easy to setup option to change the default picker theme.

Currently I have a project that is using Holo Dark Android theme and the picker is look like below,

device-2013-12-02-182227

I guess its taking Holo Dark theme from the context
I would like it to look like the following

device-2013-12-02-172140

improve public api

For example, .setPlusMinusVisibility or .setDecimalVisibilty.

Just change it to .setPlusMinusVisible(boolean isVisible) or .setDecimalVisible(boolean isVisible).

Nullpointer when styling dialog

I get the following stacktrace when trying to custom style my dialog:

java.lang.NullPointerException
        at android.widget.TextView.setTextColor(TextView.java:2641)
        at com.doomonafireball.betterpickers.datepicker.DateView.restyleViews(DateView.java:74)
        at com.doomonafireball.betterpickers.datepicker.DateView.setTheme(DateView.java:69)
        at com.doomonafireball.betterpickers.datepicker.DatePicker.restyleViews(DatePicker.java:189)
        at com.doomonafireball.betterpickers.datepicker.DatePicker.setTheme(DatePicker.java:140)
        at com.doomonafireball.betterpickers.datepicker.DatePickerDialogFragment.onCreateView(DatePickerDialogFragment.java:170)
        at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
        at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
        at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
        at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440)
        at android.os.Handler.handleCallback(Handler.java:733)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5017)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)

I have the following code snippet creating a DatePicker

DatePickerBuilder dpb = new DatePickerBuilder()
            .setFragmentManager(getSupportFragmentManager())
            .addDatePickerDialogHandler(new DatePickerDialogFragment.DatePickerDialogHandler() {
                @Override
                public void onDialogDateSet(int reference, int year, int monthOfYear, int dayOfMonth) {
                    // Do stuff
                }
            })
            .setStyleResId(R.style.CustomBetterPickerTheme);
    dpb.show();

The following is the style:

<style name="CustomBetterPickerTheme">
    <item name="bpTextColor">@color/my_orange</item>
</style>

NullPointerException when using NumberPickerDialogFragment [version 1.5.2]

As in the title - while using NumberPickerDialogFragment i get NPE. I debuged it and it seems that after inflating view (in onCreateView method) mSet and mCancel fields (R.id.set_button nad R.id.cancel_button) are null. Quite strange...
I get NPE when invoking mCancel.setOnClickListener.

Please see below stacktrace:
java.lang.NullPointerException
at com.doomonafireball.betterpickers.numberpicker.NumberPickerDialogFragment.onCreateView(NumberPickerDialogFragment.java:146)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)

java.lang.NullPointerException at NumberPicker.java:579

I can't reproduce the bug.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxxx/com.xxxx.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by: java.lang.NullPointerException
at android.os.Parcel.readIntArray(Parcel.java:784)
at com.doomonafireball.betterpickers.numberpicker.NumberPicker$SavedState.(NumberPicker.java:564)
at com.doomonafireball.betterpickers.numberpicker.NumberPicker$SavedState.(NumberPicker.java:561)
at com.doomonafireball.betterpickers.numberpicker.a.a(NumberPicker.java:579)
at com.doomonafireball.betterpickers.numberpicker.a.createFromParcel(NumberPicker.java:1)
at android.os.Parcel.readParcelable(Parcel.java:2103)
at android.os.Parcel.readValue(Parcel.java:1965)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:2255)
at android.os.Parcel.readSparseArray(Parcel.java:1687)
at android.os.Parcel.readValue(Parcel.java:2022)
at android.os.Parcel.readMapInternal(Parcel.java:2226)
at android.os.Bundle.unparcel(Bundle.java:223)
at android.os.Bundle.getSparseParcelableArray(Bundle.java:1232)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:861)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
at android.support.v4.app.FragmentManagerImpl.dispatchCreate(FragmentManager.java:1879)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1490)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:893)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
at android.support.v4.app.FragmentManagerImpl.dispatchCreate(FragmentManager.java:1879)
at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:215)
at com.yyyyy.MainActivity.onCreate(MainActivity.java:79)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(NativeStart.java)

Support library dependency not resolvable via Maven Central

When compiling from master:

Could not resolve dependencies for project com.doomonafireball.betterpickers:library:apklib:1.4.3-SNAPSHOT: Failure to find com.google.android:support-v4:jar:18

The last version of support-v4 on Maven Central is "r7". It would be nice if betterpickers would depend only on artifacts that can be resolved via Maven Central. (This is also a requirement for uploading it to Maven Central afaik.)

Implementing in base adapter list item?

How could this be used as a click event from a view in every item? I want to use in place of edittext widget but can't figure it how it should be done. Any idea's?

Fonts are not in library

The library project is missing the asset folder. They are in the sample project instead.

Gives rise to nice errors like this :)

E/AndroidRuntime(25996): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.doomonafireball.betterpickers.timepicker.TimerView
E/AndroidRuntime(25996): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
E/AndroidRuntime(25996): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
E/AndroidRuntime(25996): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
E/AndroidRuntime(25996): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
E/AndroidRuntime(25996): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
E/AndroidRuntime(25996): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
E/AndroidRuntime(25996): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
E/AndroidRuntime(25996): at com.doomonafireball.betterpickers.timepicker.TimePicker.(TimePicker.java:70)
E/AndroidRuntime(25996): ... 24 more
E/AndroidRuntime(25996): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime(25996): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime(25996): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
E/AndroidRuntime(25996): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
E/AndroidRuntime(25996): ... 31 more
E/AndroidRuntime(25996): Caused by: java.lang.RuntimeException: native typeface cannot be made
E/AndroidRuntime(25996): at android.graphics.Typeface.(Typeface.java:175)
E/AndroidRuntime(25996): at android.graphics.Typeface.createFromAsset(Typeface.java:149)
E/AndroidRuntime(25996): at com.doomonafireball.betterpickers.timepicker.TimerView.(TimerView.java:31)
E/AndroidRuntime(25996): ... 34 more

add javadocs

Javadoc is missing for every public method, this is really bad.

Font issue in TimePicker

Not sure what was fixed in the 1.4
(Fix for Android 4.3 font rendering)

but still having issues on Android 4.4.2

screenshot_2014-01-09-16-13-17

Orientation issue that you haven't handled.

Hi here is one serious issue in your app.

It is easily reproducible from ur sample app.
1.Click the set button. The date picker dialog appears.
2. Change the orientation.
3.Tap any date and "done".

When all the above three steps over, you cannot see the date as be set.

please guide me to handle this issue soon..

Provide customization option for a title/header of the DatePicker's ViewPagerIndicator

Would it be possible to add an option where the ViewPagerIndicator shows a title or label for the current tab. For someone who has played with the pickers it might be obvious, but to a new user accustomed to the stock Android Date/Time pickers the swiping functionality (i.e. to switch from day, month, year, etc) won't be as discoverable. By indicating the title (at least for the current tab) it will be more obvious to the user that they can swipe to switch between day/month/year (DatePicker) or hour/minutes (TimePicker).

Setting up a Gradle build

It would be great if this project had a gradle build and published .aar packages, since that is where Android develoment is headed now. I believe this issue depends on JakeWharton/ViewPagerIndicator#229 (or the duplicate issue 241) being merged, since you depend on that library.

NullPointerException in RadialTimePickerDialog fragment

The Fragment crashes when embedded in a frame instead of being used as Dialog (not, Android specs allows this usage).

Instanciating...

DialogFragment newFragment = RadialTimePickerDialog.newInstance(new OnTimeSetListener() {...}

...and then launching it (first branch in case of landscape orientation):

if (hasDialogFrame) {
       FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
       ft.add(R.id.main_dialogs, fragment, fragment.getTag())
         .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
          .commit();
} else {
      ...
}

Return an NPE in RadialTimePickerDialog.java:

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

Because the Dialog is never created (DialogFragment.java):

@Override
public LayoutInflater getLayoutInflater(Bundle savedInstanceState) {
    if (!mShowsDialog) {
        return super.getLayoutInflater(savedInstanceState);
    }

Can you confirm the issue? A solution would be to remove the request in the onCreateView (that is the only method gets called in this case by the Android framework...
Thanks!

Implementing in base adapter list item?

How could this be used as a click event from a view in every item? I want to use in place of edittext widget but can't figure it how it should be done. Any idea's?

Wrong dependencies everywhere..

I don't know what the hack is going on but it's not possible to import your projects (sample + lib) into Eclipse. I mean - it's possible to import them, but they have tons of wrong dependencies.

Am I doing something wrong?

Importing the project as usual and adding it as a lib to another project.. I'd love to use your lib - it looks fabulous - but it really sucks that it can't be included as a normal lib.

Required SDK level

There appears to be no mention of the required SDK level in order for this project to work. When first importing, as I've got the 2.2 SDK downloaded for testing, I assume the project defaulted to that as the SDK, however I needed to change it to a higher SDK level in order to compile.

Perhaps an entry stating the minimum required SDK level would be useful on the main page of this git?

Cheers for the lovely library, very snazzy :)

HMSPicker InflationException

Hello,

I've tried to use hmsPicker in a android.support.v4.app.FragmentActivity and I used the same code as in your sample app.

btnDuration.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                HmsPickerBuilder hpb = new HmsPickerBuilder()
                        .setFragmentManager(getSupportFragmentManager())
                        .setStyleResId(R.style.BetterPickersDialogFragment_Light);
                hpb.show();
            }
        });

However, it produce an error as below when clicked, is this normal? I've tested against 4.3 and 4.4. Could you please take a look at it? Thanks!

02-03 00:32:52.934: E/AndroidRuntime(4690): android.view.InflateException: Binary XML file line #7: Error inflating class com.doomonafireball.betterpickers.hmspicker.HmsPicker
02-03 00:32:52.934: E/AndroidRuntime(4690): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
02-03 00:32:52.934: E/AndroidRuntime(4690): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
02-03 00:32:52.934: E/AndroidRuntime(4690): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
02-03 00:32:52.934: E/AndroidRuntime(4690): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
02-03 00:32:52.934: E/AndroidRuntime(4690): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
02-03 00:32:52.934: E/AndroidRuntime(4690): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
02-03 00:32:52.934: E/AndroidRuntime(4690): at com.doomonafireball.betterpickers.hmspicker.HmsPickerDialogFragment.onCreateView(HmsPickerDialogFragment.java:96)

displaying the TimePicker result on 2 buttons

Hi Derek,
you have a lovely libray, I'm trying it now to use it in my next application but I just have a small question !!!

when I have more then one button in my xml layout,in fact I need to put 2 buttons (2 Time pickers for picking departure and arrival times ).

it's working with one button but not with two or more !!!!
this is my code and I hope that you helps me please

@OverRide
public void onDialogTimeSet(int reference, int hourOfDay, int minute) {
// TODO Auto-generated method stub

    Toast.makeText(getSherlockActivity(), ""+reference, Toast.LENGTH_SHORT).show();
     ti_depart.setText("" + hourOfDay + ":" + minute);
     //ti_arrive.setText("" + hourOfDay + ":" + minute);
    }

How can specify the time for every button ????
Thanks a lot and keep up the great work!!

Allow for more than 9 hours in the HMS picker

Currently, the HMS picker does not allow for more than 9 hours to be entered. It'd be nice if it did. Perhaps it could just be in a HorizontalScrollView for when the digits overflow?

Having trouble using BetterPickers with HoloEveryWhere

Hi there!

I've been having trouble using BetterPickers with HoloEveryWhere. It might just be an issue from my side with setting up both BetterPickers and HoloEveryWhere libraries (I'm new to all this). I'll drop the code I have and the issue I'm getting. Any help would be greatly appreciated! So here's the code:

package com.example.myfirstapp;

import org.holoeverywhere.widget.Button;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.doomonafireball.betterpickers.timepicker.TimePickerBuilder;
import com.doomonafireball.betterpickers.timepicker.TimePickerDialogFragment;

public class MainActivity extends org.holoeverywhere.app.Activity implements TimePickerDialogFragment.TimePickerDialogHandler{
    private Button theTime;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        theTime = (Button) findViewById(R.id.the_button);

        theTime.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                TimePickerBuilder tpb = new TimePickerBuilder()
                        .setFragmentManager(getSupportFragmentManager())
                        .setStyleResId(R.style.BetterPickersDialogFragment);
                tpb.show();
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getSupportMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        Intent showSettings = new Intent(this, SettingsActivity.class);
        startActivity(showSettings);
        return true;
    }

    @Override
    public void onDialogTimeSet(int reference, int hourOfDay, int minute) {
        theTime.setText("" + hourOfDay + ":" + minute);
    }


}

And here's the errors I'm getting:

06-16 15:24:24.048: E/AndroidRuntime(25989): FATAL EXCEPTION: main
06-16 15:24:24.048: E/AndroidRuntime(25989): android.view.InflateException: Binary XML file line #7: Error inflating class com.doomonafireball.betterpickers.timepicker.TimePicker
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:376)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:584)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:438)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:725)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:532)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:482)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:477)
06-16 15:24:24.048: E/AndroidRuntime(25989): at com.doomonafireball.betterpickers.timepicker.TimePickerDialogFragment.onCreateView(TimePickerDialogFragment.java:87)
06-16 15:24:24.048: E/AndroidRuntime(25989): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
06-16 15:24:24.048: E/AndroidRuntime(25989): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
06-16 15:24:24.048: E/AndroidRuntime(25989): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
06-16 15:24:24.048: E/AndroidRuntime(25989): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
06-16 15:24:24.048: E/AndroidRuntime(25989): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
06-16 15:24:24.048: E/AndroidRuntime(25989): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
06-16 15:24:24.048: E/AndroidRuntime(25989): at android.os.Handler.handleCallback(Handler.java:725)
06-16 15:24:24.048: E/AndroidRuntime(25989): at android.os.Handler.dispatchMessage(Handler.java:92)
06-16 15:24:24.048: E/AndroidRuntime(25989): at android.os.Looper.loop(Looper.java:137)
06-16 15:24:24.048: E/AndroidRuntime(25989): at android.app.ActivityThread.main(ActivityThread.java:5193)
06-16 15:24:24.048: E/AndroidRuntime(25989): at java.lang.reflect.Method.invokeNative(Native Method)
06-16 15:24:24.048: E/AndroidRuntime(25989): at java.lang.reflect.Method.invoke(Method.java:511)
06-16 15:24:24.048: E/AndroidRuntime(25989): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
06-16 15:24:24.048: E/AndroidRuntime(25989): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
06-16 15:24:24.048: E/AndroidRuntime(25989): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:101)
06-16 15:24:24.048: E/AndroidRuntime(25989): at dalvik.system.NativeStart.main(Native Method)
06-16 15:24:24.048: E/AndroidRuntime(25989): Caused by: java.lang.reflect.InvocationTargetException
06-16 15:24:24.048: E/AndroidRuntime(25989): at java.lang.reflect.Constructor.constructNative(Native Method)
06-16 15:24:24.048: E/AndroidRuntime(25989): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:352)
06-16 15:24:24.048: E/AndroidRuntime(25989): ... 23 more
06-16 15:24:24.048: E/AndroidRuntime(25989): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:376)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:588)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:438)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:725)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.parseInclude(LayoutInflater.java:641)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.rInflate(LayoutInflater.java:715)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:532)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:482)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:477)
06-16 15:24:24.048: E/AndroidRuntime(25989): at com.doomonafireball.betterpickers.timepicker.TimePicker.(TimePicker.java:70)
06-16 15:24:24.048: E/AndroidRuntime(25989): ... 26 more
06-16 15:24:24.048: E/AndroidRuntime(25989): Caused by: java.lang.reflect.InvocationTargetException
06-16 15:24:24.048: E/AndroidRuntime(25989): at java.lang.reflect.Constructor.constructNative(Native Method)
06-16 15:24:24.048: E/AndroidRuntime(25989): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:352)
06-16 15:24:24.048: E/AndroidRuntime(25989): ... 35 more
06-16 15:24:24.048: E/AndroidRuntime(25989): Caused by: java.lang.IllegalStateException: Could not find font in raw resources: roboto_light
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.FontLoader$RawLazyFont.loadTypeface(FontLoader.java:187)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.FontLoader$Font.getTypeface(FontLoader.java:52)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.FontLoader$FontCollector.getTypeface(FontLoader.java:81)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.FontLoader.applyInternal(FontLoader.java:296)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.FontLoader.apply(FontLoader.java:273)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.FontLoader.applyDefaultFont(FontLoader.java:278)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.widget.TextView.setFontStyle(TextView.java:109)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.widget.Button.setFontStyle(Button.java:38)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.widget.TextView.setTextAppearance(TextView.java:151)
06-16 15:24:24.048: E/AndroidRuntime(25989): at org.holoeverywhere.
06-16 15:24:26.056: I/Process(25989): Sending signal. PID: 25989 SIG: 9

Add v13 version

Could you add a v13 version similar to the support library that uses native fragments?

Looking for a hint to add icon / title to number picker

Hi Derek,
I am planning on using your number picker, but I would like to present it with a title and possibly an icon (a bit like AlertDialog).

I am happy to implement it myself and share the code, but I would appreciate if you had any pointers on the best option to implement this.

First thing that came to my mind would be to modify the number_picker_dialog layout, and add some "customisation" methods in the NumberPickerDialogFragment and NumberPickerBuilder classes.

How does it sound ?

Many thanks for your advice.

JM

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.