scratchCardLayout icon indicating copy to clipboard operation
scratchCardLayout copied to clipboard

onScratchComplete

Open codewithrish opened this issue 3 years ago • 1 comments

it's being called zillions of time if you keep scrolling. i wanna do something on complete it's doing that thousands of times.

codewithrish avatar Aug 30 '21 09:08 codewithrish

Hi Rishabh,

I am also facing this issue, but I found one solution for this...

For me it is working perfectly as per my requirement.

Please you try this to and let me know:

please copy and paste this code.

 ScratchCardLayout scratchCardLayout = findViewById(R.id.scratchCard);
    
    scratchCardLayout.setScratchDrawable(getResources().getDrawable(R.drawable.top));
    scratchCardLayout.setScratchWidthDip(60f);
    
    scratchCardLayout.setScratchEnabled(true);

    scratchCardLayout.setScratchListener(new ScratchListener() {
        @Override
        public void onScratchStarted() {

        }

        @Override
        public void onScratchProgress(ScratchCardLayout scratchCardLayout, int i) {

            if (i >= 50) {
                scratchCardLayout.setRevealFullAtPercent(i);
                System.out.println("print I : " + i);
                System.out.println("Revealed."); // this will call one time only after this I did not use **onScratchComplete** method
            }
        }

        @Override
        public void onScratchComplete() {

        }
    });

guptaAbhinav1993 avatar Sep 06 '21 11:09 guptaAbhinav1993