emilsjolander / android-FlipView

A small, easy to use android library for implementing flipping between views as seen in the popular Flipboard application
Apache License 2.0
924 stars 273 forks source link

Refresh FlipView to update screen #25

Open kaciula opened 10 years ago

kaciula commented 10 years ago

In my adapter I fetch images from the Internet via the Picasso library and I use a placeholder image while the download is in progress. In some cases, the placeholder image is overlayed on top of the downloaded image. If I touch the image and start a flip, the overlay disappears and everything is OK.

Is there a way to refresh the FlipView when the image has been downloaded in order to update the screen?

emilsjolander commented 10 years ago

i am surprised that you are seeing this behaviour. I have myself used picasso with this library and it works just fine.

kaciula commented 10 years ago

My setup is very simple. I have a FlipView in a layout and set a simple adapter which has the following getView() method:

@Override public View getView(int position, View convertView, ViewGroup parent) { final ImageView screenShot; if (convertView == null) screenShot = (ImageView) mInflater.inflate(R.layout.widget_screenshot, parent, false); else screenShot = (ImageView) convertView;

    screenShot.setOnClickListener(this);

    String url = ((ScreenShotResponse) getItem(position)).url;
    if (!MiscUtils.isValidUrl(url))
        screenShot.setImageResource(R.drawable.loading_error);
    else
        NetService.getPicasso().load(url).placeholder(R.drawable.loading).error(R.drawable
                .loading_error).into(screenShot);
    return screenShot;
}

One thing I noticed is that on Android 2.3 this does not happen. On Android 4.3 and 4.1 it happens.