fresco icon indicating copy to clipboard operation
fresco copied to clipboard

Setting fresco:pressedStateOverlayImage to a color in layout XML causes crash

Open shanus opened this issue 11 years ago • 6 comments

Using the following XML

<com.facebook.drawee.view.SimpleDraweeView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/image_view"
        fresco:placeholderImage="@drawable/download_photo"
        fresco:failureImage="@drawable/photo_error"
        fresco:actualImageScaleType="centerCrop"
        fresco:placeholderImageScaleType="centerInside"
        fresco:failureImageScaleType="centerInside"
        fresco:pressedStateOverlayImage="@color/black_overlay"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:contentDescription="@string/accessibility_photo"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"/>

causes a crash in Jellybean, API level 18, and Lollipop, API 22, when inflating the view

FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #10: Error inflating class com.facebook.drawee.view.SimpleDraweeView
        at android.view.LayoutInflater.createView(LayoutInflater.java:620)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 

When I remove the fresco:pressedStateOverlayImage="@color/black_overlay" then the Inflater works and the app behaves as expected without a crash. Using any color also results in a crash so that is not the problem. Perhaps the documentation is incorrect and a color cannot be used?

shanus avatar Mar 30 '15 04:03 shanus

please add "fresco:overlayImage="@color/transparent"" ,so it just work!

blackiedm avatar Mar 30 '15 09:03 blackiedm

Thanks, that worked. Maybe adding something to the documentation about both of them needing to be set would be useful.

shanus avatar Mar 30 '15 13:03 shanus

This looks like a bug. I'll look into it.

plamenko avatar Mar 30 '15 17:03 plamenko

Yeah, NPE slipped, i'm sending a fix.

plamenko avatar Mar 30 '15 17:03 plamenko

Fixed in source.

tyronen avatar Apr 01 '15 17:04 tyronen

It's not crashing for me if I use color in pressedStateOverlayImage . But it isn't working either. I'm using the 0.1.0 jar. fresco:overlayImage="@color/transparent" fresco:pressedStateOverlayImage="@color/blue"

Nothing happens when I touch the image.

ghost avatar Apr 09 '15 07:04 ghost