florent37 / SingleDateAndTimePicker

You can now select a date and a time with only one widget !
Apache License 2.0
1.02k stars 334 forks source link

IOOBE on start #136

Closed rostislav-maslov closed 6 years ago

rostislav-maslov commented 6 years ago

Version 2.0.4 Added in BottomSheetDialogFragment

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="12dp"
    android:background="@drawable/shape_white_top_corners_round">

...
    <com.github.florent37.singledateandtimepicker.SingleDateAndTimePicker
        android:id="@+id/sp_picker_picker"
        android:layout_width="wrap_content"
        android:layout_height="238dp"
        app:picker_curved="true"
        app:picker_cyclic="true"
        app:picker_selectedTextColor="@color/cherry_red"
        app:picker_todayText="@string/activity_order_date_today" />
</LinearLayout>

Directly to the picker do not appeal And at the start I get the following

java.lang.ArrayIndexOutOfBoundsException: length=729; index=-1
        at java.util.ArrayList.get(ArrayList.java:439)
        at com.github.florent37.singledateandtimepicker.widget.WheelPicker.setDefaultDate(WheelPicker.java:252)
        at com.github.florent37.singledateandtimepicker.SingleDateAndTimePicker.setDefaultDate(SingleDateAndTimePicker.java:361)
        at com.github.florent37.singledateandtimepicker.SingleDateAndTimePicker.onAttachedToWindow(SingleDateAndTimePicker.java:165)
        at android.view.View.dispatchAttachedToWindow(View.java:17445)

Device Nexus6P Android 8.1.0

On the OnePlus3t (Android 8.0) and Honor 9 lite (Android 8.0) code above working great

After removing attributes in xml

        app:picker_todayText="@string/activity_order_date_today"

Works fine. I don't know, why that attr crushing app, but it's a fact