philliphsu / bottomsheetpickers Goto Github PK
View Code? Open in Web Editor NEWThird-party date and time pickers for Android.
License: Apache License 2.0
Third-party date and time pickers for Android.
License: Apache License 2.0
In my application it is possible to change the background and primary color. I can't use / set a accent color due that. Could you please add a option to add a method to theme the grid dialog programmatically?
https://code.google.com/p/android/issues/detail?id=183120
BottomSheetPickers has dependencies on the appcompat-v7
, gridlayout-v7
, and design
libraries. All resources in the library have been marked as private, which unfortunately marks the public resources in the other libraries private as well. You will get a Lint warning in Android Studio if you are using any of these attributes:
?colorPrimary
?colorPrimaryDark
?colorAccent
?selectableItemBackground
How i can set my own style?
dialog.setStyle(DialogFragment.STYLE_NORMAL, R.style.MyOwnStyle); - not working.
I want to have something like 00, 15, 30, 45 instead of the 5 minute increments. Is this possible?
Thanks,
Just noticed this in my firebase Crash Reporting.
com.philliphsu.bottomsheetpickers.date.BottomSheetDatePickerDialog.updateDisplay (BottomSheetDatePickerDialog.java:444)
com.philliphsu.bottomsheetpickers.date.BottomSheetDatePickerDialog.onCreateView (BottomSheetDatePickerDialog.java:291)
Unfortunately, I can't reproduce it for myself, now, to give you more information about inputs and extra.
But I hope it will be helpful to you.
Thanks.
Hi Phillip,
Any chance if you implementing a customisable button for the bottom-left of the Number Pad? I'd love to use it as a All-Day button in the calendar app I'm building, so ideally I'd prefer it if text or a icon can be placed there.
Would submit a pull request for it but am unsure of if/how you'd want it implemented.
Hi, I need to set minDate and maxDate, but getting error java.lang.IllegalArgumentException: Year end must be larger than year start
Here is my implementation:
Calendar now = Calendar.getInstance();
DatePickerDialog.Builder dialog = new DatePickerDialog.Builder(CalculatorActivity.this,
now.get(Calendar.YEAR), now.get(Calendar.MONTH), Calendar.DAY_OF_MONTH);
dialog.setMaxDate(now);
dialog.setMinDate(minDate);
Log.e("Max", now.getTime().toString());
Log.e("Min", minDate.getTime().toString());
DatePickerDialog dp = dialog.build();
dp.show(getSupportFragmentManager(), "end");
As logcat show:
E/Max: Thu May 04 04:08:35 GMT+00:00 2017
E/Min: Wed Feb 01 04:08:33 GMT+00:00 2017
So, how can I achieve this without error?
Edit:
In DatePickerDialog.java in your library, I think this line (line 605) need to change to endYear < startYear
instead of below
public void setYearRange(int startYear, int endYear) {
if (endYear <= startYear) {
throw new IllegalArgumentException("Year end must be larger than year start");
}
mMinYear = startYear;
mMaxYear = endYear;
if (mDayPickerView != null) {
mDayPickerView.onChange();
}
}
Returns 24 hour time for 12 hour time. Hours in chosen in 12 hour format are always in 24 hours format (ie. Even i choose 1:30 am it returns 13:30)
Can you update your support library? If not it will trigger warning below:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.3.1, 25.1.0. Examples include com.android.support:animated-vector-drawable:25.3.1 and com.android.support:gridlayout-v7:25.1.0 less... (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)
My build.gradle:
dependencies {
compile('com.philliphsu:bottomsheetpickers:2.3.2') {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'design'
}
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:design:25.3.1' // here is the warning
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'me.angrybyte.picker:picker:1.2.0'
compile 'com.github.bluejamesbond:textjustify-android:2.1.6'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'org.greenrobot:greendao:3.2.0'
testCompile 'junit:junit:4.12'
}
Feature Request:
The ability to select individual elements ex. day, month, year
without including the selection or display of other elements.
Pick and choose combinations of elements to select and in which order ex. month-year, day-month.
dialog.isCancelable = true
But I can't cancel dialog only choose a day, back button or pressing out of the dialog not working.
P.S. thanks for this pretty picker!
Hello! Thanks for the library, but some minor problems
When the 12-hour format everything works, when setting the 24 hour clock, you receive this error in the console
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.drawable.Drawable.setTint(int)' on a null object reference at com.philliphsu.bottomsheetpickers.time.grid.GridTimePickerDialog.updateAmPmDisplay(GridTimePickerDialog.java:431) at com.philliphsu.bottomsheetpickers.time.grid.GridTimePickerDialog.onCreateView(GridTimePickerDialog.java:403)
Please add minimum time picker in GridTimePickerDialog
GridTimePickerDialog time = GridTimePickerDialog.newInstance(
new BottomSheetTimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(ViewGroup viewGroup, int hourOfDay, int minute) {
mBookingDateTime.set(Calendar.HOUR_OF_DAY, hourOfDay);
mBookingDateTime.set(Calendar.MINUTE, minute);
mTextTime.setText(DateFormat.format("hh:mm", mBookingDateTime.getTime()));
mTextAmPm.setText(DateFormat.format("a", mBookingDateTime.getTime()));
}
},
mBookingDateTime.get(Calendar.HOUR_OF_DAY),
mBookingDateTime.get(Calendar.MINUTE),
false); //DateFormat.is24HourFormat(mContext)
time.setCancelable(true);
time.show(getChildFragmentManager(), TAG);
Error:
E/AndroidRuntime: FATAL EXCEPTION: main
android.content.res.Resources$NotFoundException: File res/drawable/ic_minus_circle_24dp.xml from drawable resource ID #0x7f020090. If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.
at android.content.res.Resources.loadDrawable(Resources.java:2103)
at android.content.res.Resources.getDrawable(Resources.java:702)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
at com.philliphsu.bottomsheetpickers.Utils.getTintedDrawable(Utils.java:255)
at com.philliphsu.bottomsheetpickers.time.grid.MinutesGrid.setTheme(MinutesGrid.java:99)
at com.philliphsu.bottomsheetpickers.time.grid.GridPickerLayout.setTheme(GridPickerLayout.java:116)
at com.philliphsu.bottomsheetpickers.time.grid.GridTimePickerDialog.onCreateView(GridTimePickerDialog.java:331)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2087)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1113)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1295)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1682)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:541)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:925)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:853)
at android.content.res.Resources.loadDrawable(Resources.java:2099)
at android.content.res.Resources.getDrawable(Resources.java:702)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
at com.philliphsu.bottomsheetpickers.Utils.getTintedDrawable(Utils.java:255)
at com.philliphsu.bottomsheetpickers.time.grid.MinutesGrid.setTheme(MinutesGrid.java:99)
at com.philliphsu.bottomsheetpickers.time.grid.GridPickerLayout.setTheme(GridPickerLayout.java:116)
at com.philliphsu.bottomsheetpickers.time.grid.GridTimePickerDialog.onCreateView(GridTimePickerDialog.java:331)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2087)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1113)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1295)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1682)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:541)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
Is it possible to create a picker with custom data, meaning something different from Date or Time?
Have a problem with android 7. When I select a date and press "OK" app is crash.
java.lang.ClassCastException: android.graphics.drawable.VectorDrawable cannot be cast to android.support.graphics.drawable.VectorDrawableCompat
at com.philliphsu.bottomsheetpickers.time.grid.GridTimePickerDialog.updateAmPmDisplay(GridTimePickerDialog.java:420)
at com.philliphsu.bottomsheetpickers.time.grid.GridTimePickerDialog.onCreateView(GridTimePickerDialog.java:395)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2189)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:757)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2355)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2146)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2098)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2008)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
On other APIs it work fine. Have some idea how to fix it ?
P.S. Sorry for my bad language :)
The number pad dialog is overlapping the navigation bar in the half (on Galaxy Tab S4 and Galaxy Tab A). Is there a way to fix that?
Also, on smartphones the status bar is darken much more than on tablets (tested on Huaweis and OnePlus smartphones and Samsung tablets). Is there a way to generalize that?
Man it is terrible not possible to set time in NumberPadTimePickerDialog 👎
Like the date picker, would like to pre-fill the time picker with time values.
Can be used to edit an already entered time from some text field.
How to pick older date? it just unable to pick.
This library looks awesome!
Would you provide a hh:mm:ss picker so we can use it for users to pick an interval time?
Hello,
I think this isn't a library problem, but I'm having problem with this for days. I'm trying to get specific days in a week when a user selects a date in onDateSet method, but I constantly get wrong values
`Calendar kal = Calendar.getInstance();
kal.set(Calendar.YEAR, year);
kal.set(Calendar.MONTH, monthOfYear);
kal.set(Calendar.DAY_OF_MONTH, dayOfMonth);
DateFormat sday = new SimpleDateFormat("dd");
DateFormat smonth = new SimpleDateFormat("MM");
DateFormat syear = new SimpleDateFormat("yyyy");
kal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
String mMonth = smonth.format(kal.getTime());
String mDay = sday.format(kal.getTime());
String mYear = syear.format(kal.getTime());
Toast.makeText(getContext(), "Ponediljak: " + mMonth + " " + mDay + " " + mYear, Toast.LENGTH_SHORT).show();`
Toast shows the date of monday of the current week, not the selected one. What am I doing wrong? Can you be kind and help me? Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.