File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
app/src/main/java/com/anupkumarpanwar/scratchview
scratchview/src/main/java/com/anupkumarpanwar/scratchview Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 44import android .support .annotation .RequiresApi ;
55import android .support .v7 .app .AppCompatActivity ;
66import android .os .Bundle ;
7+ import android .util .Log ;
78import android .widget .Toast ;
89
910public class MainActivity extends AppCompatActivity {
1011
1112 ScratchView scratchView ;
12- boolean revealed = false ;
1313
1414 @ RequiresApi (api = Build .VERSION_CODES .KITKAT )
1515 @ Override
@@ -21,14 +21,13 @@ protected void onCreate(Bundle savedInstanceState) {
2121 scratchView .setRevealListener (new ScratchView .IRevealListener () {
2222 @ Override
2323 public void onRevealed (ScratchView scratchView ) {
24- Toast .makeText (getApplicationContext (), "Image reveled " , Toast .LENGTH_LONG ).show ();;
24+ Toast .makeText (getApplicationContext (), "Reveled " , Toast .LENGTH_LONG ).show ();;
2525 }
2626
2727 @ Override
2828 public void onRevealPercentChangedListener (ScratchView scratchView , float percent ) {
29- if (percent >=0.5 && ! revealed ) {
30- Toast .makeText (getApplicationContext (), "Revealed" , Toast .LENGTH_LONG ).show ();;
31- revealed = true ;
29+ if (percent >=0.5 ) {
30+ Log .d ("Reveal Percentage" , "onRevealPercentChangedListener: " + String .valueOf (percent ));
3231 }
3332 }
3433 });
Original file line number Diff line number Diff line change @@ -343,7 +343,7 @@ public void setRevealListener(IRevealListener listener) {
343343 }
344344
345345 public boolean isRevealed () {
346- return mRevealPercent == 1 ;
346+ return mRevealPercent >= 0.50 ;
347347 }
348348
349349 private void checkRevealed () {
You can’t perform that action at this time.
0 commit comments