arcadefire / nice-spinner

A nice spinner for Android
Apache License 2.0
2.84k stars 445 forks source link

Crashed when I set hideArrow="true" in the xml file. #9

Closed iluhcm closed 9 years ago

iluhcm commented 9 years ago

Hi,

Great project just like your name :). Sorry to trouble you for a moment. I met a problem when I set hideArrow="true" in my xml files as the following seen:

<?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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <org.angmarch.views.NiceSpinner
        android:id="@+id/test_nice_spinner"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        app:hideArrow="true" />

</LinearLayout>

When I clicked on this text view, my app crashed, see the following:

08-28 16:52:19.229  24907-24907/com.amap.mock E/MessageQueue-JNI﹕ java.lang.NullPointerException
            at android.animation.PropertyValuesHolder.setupSetterAndGetter(PropertyValuesHolder.java:505)
            at android.animation.ObjectAnimator.initAnimation(ObjectAnimator.java:487)
            at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:517)
            at android.animation.ValueAnimator.start(ValueAnimator.java:936)
            at android.animation.ValueAnimator.start(ValueAnimator.java:946)
            at android.animation.ObjectAnimator.start(ObjectAnimator.java:465)
            at org.angmarch.views.NiceSpinner.animateArrow(NiceSpinner.java:256)
            at org.angmarch.views.NiceSpinner.showDropDown(NiceSpinner.java:265)
            at org.angmarch.views.NiceSpinner.onTouchEvent(NiceSpinner.java:242)
            at android.view.View.dispatchTouchEvent(View.java:7714)
            at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
            at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
            at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
            at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
            at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
            at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
            at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
            at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
            at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
            at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
            at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
            at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2068)
            at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1515)
            at android.app.Activity.dispatchTouchEvent(Activity.java:2478)
            at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2016)
            at android.view.View.dispatchPointerEvent(View.java:7894)
            at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4034)
            at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3913)
            at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3474)
            at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3524)
            at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3493)
            at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3600)
            at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3501)
            at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3657)
            at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3474)
            at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3524)
            at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3493)
            at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3501)
            at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3474)
            at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5619)
            at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5599)
            at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5570)
            at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5699)
            at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
            at android.os.MessageQueue.nativePollOnce(Native Method)
            at android.os.MessageQueue.next(MessageQueue.java:138)
            at android.os.Looper.loop(Looper.java:123)
            at android.app.ActivityThread.main(ActivityThread.java:5014)
            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:806)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
            at dalvik.system.NativeS

_It seems that you haven't initialised mDrawable when hideArrow is set to true. _

arcadefire commented 9 years ago

Hey, thank you for reporting this and for the PR as well :)