fresco icon indicating copy to clipboard operation
fresco copied to clipboard

fade in effect is gone when setProgressbarImage or setRoundingParams

Open sourceyii opened this issue 11 years ago • 7 comments

in 0.7.0 when I use GenericDraweeHierarchyBuilder to setProgressBarImage or setRoundingParams the default fade in effect is gone,the image comes out directly...

If I delete setProgressBarImage and setRoundingParams, everything is normal and effect comes back

same problem also occur in older relases

sourceyii avatar Sep 15 '15 08:09 sourceyii

We have tried the use case and everything is fine. Could you provide other details of the problem please? Are you using the Drawee in the layout document or instantiate directly in the code?

massimocarli avatar Sep 16 '15 16:09 massimocarli

I wrote a class which extends SimpleDraweeView and in constructor method

GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources());
GenericDraweeHierarchy hierarchy = builder
                .setPlaceholderImage(mProgressDrawable)
                .setFadeDuration(400)
                .setRoundingParams(new RoundingParams() {
                    @Override
                    public boolean getRoundAsCircle() {
                        return true;
                    }
                })
                .build();
        setHierarchy(hierarchy);

In other files, I use this custom class to show images.

I use my custom class in XML just like SimpleDraweeView

sourceyii avatar Sep 17 '15 01:09 sourceyii

I don't see a problem in your code using SimpleDraweeView. What do you mean by my custom class in XML just like SimpleDraweeView. Can you please share the code and provide more detail what your custom class looks like?

aagnes-zz avatar Sep 21 '15 18:09 aagnes-zz

Sorry for late response...

My code looks like:

public class MyDrawee extends SimpleDraweeView  {

    public MyDrawee (Context context) {
        this(context);
        init();
    }

    public MyDrawee (Context context, AttributeSet attrs) {
        this(context, attrs);
        init();
    }

    public MyDrawee (Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
    }

    private void init() {
        GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(getResources());
        GenericDraweeHierarchy h = builder
                .setProgressBarImage(new MyProgressImage() )
                .setFadeDuration(400)
                .setRoundingParams(new RoundingParams() {
                      @Override
                      public boolean getRoundAsCircle() {
                          return true;
                      }
                  })
                .build();
        this.setHierarchy(h);
    }

    public void setImageUrl(String url) {
        Uri uri = Uri.parse(url);
        setImageURI(uri);
    }

}

int XML:

    <com.hello.frescotest.MyDrawee 
        android:id="@+id/my_image"
        android:layout_width="100dp"
        android:layout_height="100dp" />

int Activity:

MyDrawee img = findViewById(R.id.my_image);
img.setImageUrl("http://ichef.bbci.co.uk/news/660/cpsprodpb/17A21/production/_85310869_85310700.jpg");

sourceyii avatar Sep 23 '15 08:09 sourceyii

There's an issue with your constructor. please check your constructor if it's typo. Also if setImageUrl, setProgressBarImage, setFadeDuration and setRoundingParams are all you need. You don't see a custom view, using SimpleDraweeView and refer to Demo app. May I ask what device & os are you using for the test app?

aagnes-zz avatar Sep 23 '15 09:09 aagnes-zz

you are right, there is a typo in first two constructors , I used super(....) in my actual code. all the settings are necessary for my project. I don't want to do the same setting work everywhere, so I choose to use a custom view.

my device is Nexus 5 , Android 5.1.1

sourceyii avatar Sep 23 '15 12:09 sourceyii

I'm cleaning up very old issues. If this still causes problems please comment and we can re-open.

As another thought, these properties can be set via XML, either in the layout file or as part of a style.

kirwan avatar Aug 31 '17 14:08 kirwan