timusus / RecyclerView-FastScroll

A simple FastScroller for Android's RecyclerView
Other
1.39k stars 182 forks source link

Autohide not working or even crashing #24

Closed mbarrben closed 8 years ago

mbarrben commented 8 years ago

Hi,

There are some cases where the autohide feature is not working for me. In Android 4.x it's even crashing:

Fatal Exception: java.lang.NullPointerException
       at android.animation.PropertyValuesHolder.setupSetterAndGetter(PropertyValuesHolder.java:513)
       at android.animation.ObjectAnimator.initAnimation(ObjectAnimator.java:392)
       at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:544)
       at android.animation.ValueAnimator.start(ValueAnimator.java:934)
       at android.animation.ValueAnimator.start(ValueAnimator.java:957)
       at android.animation.ObjectAnimator.start(ObjectAnimator.java:370)
       at com.simplecityapps.recyclerview_fastscroll.views.FastScroller$1.run(SourceFile:118)
       at android.os.Handler.handleCallback(Handler.java:605)

This is my XML:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    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"
    >

    <com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:fastScrollAutoHide="true"
        app:fastScrollAutoHideDelay="1500"
        app:fastScrollPopupBgColor="@color/accent"
        app:fastScrollPopupTextColor="@android:color/white"
        app:fastScrollThumbColor="@color/accent"
        />

    <ProgressBar
        android:id="@+id/list_progressbar"
        android:layout_gravity="center"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:indeterminate="true"
        />

    <TextView
        android:id="@+id/contact_list_all_empty_text"
        android:layout_gravity="center"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/empty_title"
        android:visibility="gone"
        />

</FrameLayout>

Any clue what might be happening?

Thanks!

mbarrben commented 8 years ago

Ok, the problem was with Proguard, this was only happening on release builds. I still don't understand the reason, but keeping classes from being obfuscated does the trick:

-keep class com.simplecityapps.recyclerview_fastscroll.** { *; }