package epson.print.widgets;

import android.os.Handler;
import android.view.MotionEvent;
import android.view.View;

public class LongTapRepeatAdapter {
    private static final int REPEAT_INTERVAL = 100;

    public static void bless(View view) {
        bless(100, view);
    }

    public static void bless(final int i, final View view) {
        final Handler handler = new Handler();
        final BooleanWrapper booleanWrapper = new BooleanWrapper(false);
        final C23741 r2 = new Runnable() {
            public void run() {
                if (!view.isEnabled()) {
                    booleanWrapper.value = false;
                }
                if (booleanWrapper.value) {
                    view.performClick();
                    handler.postDelayed(this, (long) i);
                }
            }
        };
        view.setOnLongClickListener(new View.OnLongClickListener() {
            public boolean onLongClick(View view) {
                booleanWrapper.value = true;
                handler.post(r2);
                return true;
            }
        });
        view.setOnTouchListener(new View.OnTouchListener() {
            public boolean onTouch(View view, MotionEvent motionEvent) {
                if (motionEvent.getAction() == 1) {
                    booleanWrapper.value = false;
                }
                return false;
            }
        });
    }

    private static class BooleanWrapper {
        public boolean value;

        public BooleanWrapper(boolean z) {
            value = z;
        }
    }
}
