package io.akessler.elixircounter;

import android.content.Context;
import android.support.v7.widget.AppCompatButton;
import android.view.MotionEvent;
import android.view.View;

/**
 * Created by Andy on 9/15/2017.
 */
public class CounterButton extends AppCompatButton implements View.OnTouchListener, View.OnClickListener {

    private int counterValue;

    public CounterButton(Context context, int counterValue) {
        super(context);
        this.counterValue = counterValue;
    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
    }

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        // TODO Auto-generated method stub
        return false;
    }
}

@@ -169,16 +169,129 @@
 ew.View;
+%0Aimport android.view.View.OnClickListener;%0Aimport android.view.View.OnTouchListener;%0Aimport android.widget.Toast;
 %0A%0A/**%0A *
@@ -387,21 +387,16 @@
 lements 
-View.
 OnTouchL
@@ -404,21 +404,16 @@
 stener, 
-View.
 OnClickL
@@ -423,16 +423,45 @@
 ener %7B%0A%0A
+    private Context context;%0A
     priv
@@ -569,16 +569,48 @@
 ntext);%0A
+        this.context = context;%0A
         
@@ -651,101 +651,263 @@
     
-%7D%0A%0A    @Override%0A    public void onClick(View v) %7B%0A        // TODO Auto-generated method stub
+    setOnTouchListener(this);%0A        setOnClickListener(this);%0A        setText(String.valueOf(counterValue));%0A    %7D%0A%0A    @Override%0A    public void onClick(View v) %7B%0A        Toast.makeText(context, String.valueOf(counterValue), Toast.LENGTH_SHORT).show();
 %0A   
@@ -1052,9 +1052,8 @@
 %0A    %7D%0A%7D
-%0A

Add event handlers, set text as number, temporarily toast on click