What module does this apply to?
New Module: datetime
Description what you'd like to happen:
As Android does not provide a comfortable and modern version of a combinded date-time-picker dialog, I started looking for a solution, without success.
As I'm using this library, I thought it'd be great if this library would offer a simple solution.
Therefore, I started implementing it in my fork, but came across an issue with theming (Material Design TabLayout won't inflate), and though searching for it on google, I couldn't find a solution.
Furthermore, there should be the possibility to only select either the date or the time dialog.
The stacktrace (shortened):
android.view.InflateException: Binary XML file line #7: Binary XML file line #7: Error inflating class com.google.android.material.tabs.TabLayout
Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.google.android.material.tabs.TabLayout
Caused by: java.lang.reflect.InvocationTargetException
at com.afollestad.materialdialogs.utils.ViewExtKt.inflate(ViewExt.kt:47)
at com.afollestad.materialdialogs.utils.ViewExtKt.inflate$default(ViewExt.kt:46)
at com.afollestad.materialdialogs.internal.main.DialogContentLayout.addCustomView(DialogContentLayout.kt:122)
at com.afollestad.materialdialogs.customview.DialogCustomViewExtKt.customView(DialogCustomViewExt.kt:54)
at com.afollestad.materialdialogs.customview.DialogCustomViewExtKt.customView$default(DialogCustomViewExt.kt:50)
at com.afollestad.materialdialogs.datetime.DialogDateTimePickerExtKt.dateTimePicker(DialogDateTimePickerExt.kt:41)
at com.afollestad.materialdialogs.datetime.DialogDateTimePickerExtKt.dateTimePicker$default(DialogDateTimePickerExt.kt:35)
at com.afollestad.materialdialogssample.MainActivity.showDateTimePicker(MainActivity.kt:792)
at com.afollestad.materialdialogssample.MainActivity.access$showDateTimePicker(MainActivity.kt:54)
at com.afollestad.materialdialogssample.MainActivity$onCreate$55.onClick(MainActivity.kt:683)
at android.view.View.performClick(View.java:6597)
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
at com.google.android.material.internal.ThemeEnforcement.checkTheme(ThemeEnforcement.java:221)
at com.google.android.material.internal.ThemeEnforcement.checkAppCompatTheme(ThemeEnforcement.java:196)
at com.google.android.material.tabs.TabLayout.(TabLayout.java:417)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)聽
at com.afollestad.materialdialogs.utils.ViewExtKt.inflate(ViewExt.kt:47)聽
at com.afollestad.materialdialogs.utils.ViewExtKt.inflate$default(ViewExt.kt:46)聽
at com.afollestad.materialdialogs.internal.main.DialogContentLayout.addCustomView(DialogContentLayout.kt:122)聽
at com.afollestad.materialdialogs.customview.DialogCustomViewExtKt.customView(DialogCustomViewExt.kt:54)聽
at com.afollestad.materialdialogs.customview.DialogCustomViewExtKt.customView$default(DialogCustomViewExt.kt:50)聽
at com.afollestad.materialdialogs.datetime.DialogDateTimePickerExtKt.dateTimePicker(DialogDateTimePickerExt.kt:41)聽
at com.afollestad.materialdialogs.datetime.DialogDateTimePickerExtKt.dateTimePicker$default(DialogDateTimePickerExt.kt:35)聽
at com.afollestad.materialdialogssample.MainActivity.showDateTimePicker(MainActivity.kt:792)聽
at com.afollestad.materialdialogssample.MainActivity.access$showDateTimePicker(MainActivity.kt:54)聽
at com.afollestad.materialdialogssample.MainActivity$onCreate$55.onClick(MainActivity.kt:683)聽
at android.view.View.performClick(View.java:6597)聽
For your exception:
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
That means you're mismatching different styles between AppCompat and MaterialComponents.
I think this kind of dialog already created as MaterialDateTimePicker
That doesn't mean it shouldn't be implemented here - one library with multiple modules is better than two libraries with different APIs
@anggrayudi I think MaterialDateTimePicker does not provide a combination of both Date and Time picker in one dialog, and this library here provides an awesome framework for android dialogs, it'd be a pity not to use it..
For your exception:
Caused by: java.lang.IllegalArgumentException: The style on this component requires your app theme to be Theme.AppCompat (or a descendant).
That means you're mismatching different styles between AppCompat and MaterialComponents.
@afollestad Okay, but where exactly? I mean setting the 'core-dialog-theme' to MaterialComponents will cut backwards compatibility with AppCompat...
Do you know where and how to solve this?
Indeed, that's the challenge
I would not recommend using a TabLayout in a dialog anyways cause it makes landscape messy. I found that out with the color chooser dialog and ended up just using dots for the page indicator.