package nl.dionsegijn.simple_demo;

import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import nl.dionsegijn.konfetti.KonfettiView;
import nl.dionsegijn.konfetti_core.models.Shape;
import nl.dionsegijn.konfetti_core.models.Size;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final Drawable drawable = ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_heart);
        final Shape.DrawableShape drawableShape = new Shape.DrawableShape(drawable, true);

        final KonfettiView konfettiView = findViewById(R.id.konfettiView);
        konfettiView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(final View view) {
                konfettiView.build()
                        .addColors(Color.YELLOW, Color.GREEN, Color.MAGENTA)
                        .setDirection(0.0, 359.0)
                        .setSpeed(1f, 5f)
                        .setFadeOutEnabled(true)
                        .setTimeToLive(2000L)
                        .addShapes(new Shape.Rectangle(0.2f), drawableShape)
                        .addSizes(new Size(12, 5f))
                        .setPosition(-50f, konfettiView.getWidth() + 50f, -50f, -50f)
                        .streamFor(300, 5000L);
            }
        });
    }
}

@@ -132,34 +132,8 @@
 dle;
-%0Aimport android.view.View;
 %0A%0Aim
@@ -903,125 +903,15 @@
 ner(
-new View.OnClickListener() %7B%0A            @Override%0A            public void onClick(final View view) %7B%0A               
+view -%3E
  kon
@@ -928,24 +928,16 @@
 build()%0A
-        
         
@@ -1009,32 +1009,24 @@
             
-        
 .setDirectio
@@ -1051,32 +1051,24 @@
             
-   
-     
 .setSpeed(1f
@@ -1073,24 +1073,16 @@
 1f, 5f)%0A
-        
         
@@ -1126,32 +1126,24 @@
             
-        
 .setTimeToLi
@@ -1164,32 +1164,24 @@
             
-     
-   
 .addShapes(n
@@ -1233,32 +1233,24 @@
             
-        
 .addSizes(ne
@@ -1277,32 +1277,24 @@
             
-  
-      
 .setPosition
@@ -1359,24 +1359,16 @@
         
-       
- 
 .streamF
@@ -1385,33 +1385,8 @@
 00L)
-;%0A            %7D%0A        %7D
 );%0A 

Simplify onClick