wasabeef / Blurry

Blurry is an easy blur library for Android
Apache License 2.0
5.59k stars 604 forks source link

use blurry inside listView #40

Open miladheydari opened 8 years ago

miladheydari commented 8 years ago

hi i use your blurry .... but part of list not blurred it's my code ... i would items>=2 blurred but some one not blurred

    final View finalConvertView = convertView;
    final ViewHolder finalHolder = holder;

    if (pos >= 2) {

        finalConvertView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                finalHolder.blurView.setVisibility(View.GONE);
                Blurry.with(context)
                        .radius(3)
                        .sampling(3)
                        .capture(finalConvertView)
                        .into(finalHolder.blurView);
                finalHolder.blurView.setVisibility(View.VISIBLE);
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                    finalConvertView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                } else {
                    finalConvertView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                }
            }
        });

    } else {
        finalHolder.blurView.setVisibility(View.GONE);
        finalHolder.blurView.setImageBitmap(null);
    }
cbedoy commented 7 years ago

Remember that you're using an Adapter by ListView, all the items are going to be recycled, maybe that would be the problem