// Path: app/src/main/java/in/blogspot/anselmbros/torchie/main/manager/device/input/InputDevice.java
// public abstract class InputDevice extends Device {
//     public static final String TYPE = Constants.ID_DEVICE_INPUT;
//     public final static int INP_LOW = 0;
//     public final static int INP_HIGH = 1;
//     public final static int INP_TRIGGER = 2;
//     private InputDeviceListener mListener;
// 
//     public InputDevice(Context context) {
//         super(context);
//         this.deviceType = TYPE;
//     }
// 
//     public final void setListener(InputDeviceListener listener) {
//         this.mListener = listener;
//     }
// 
//     public final boolean setInputEvent(InputEvent event) {
//         if (this.isEnabled) {
//             return this.setEvent(event);
//         }
//         return false;
//     }
// 
//     protected abstract boolean setEvent(InputEvent event);
// 
//     public abstract void getStatusRequest();
// 
//     protected final void updateCurrentSignal(int signal) {
//         if (this.mListener != null) {
//             this.mListener.onValueChanged(this.deviceType, signal);
//         }
//     }
// }
// 
// Path: app/src/main/java/in/blogspot/anselmbros/torchie/main/manager/timer/CountTimer.java
// public class CountTimer extends CountDownTimer {
// 
//     private CountTimerListener mListener;
//     private String id;
// 
//     public CountTimer(String id, double seconds, CountTimerListener listener) {
//         super((long) (seconds * 1000), (long) (seconds * 1000));
//         this.id = id;
//         this.mListener = listener;
//     }
// 
//     @Override
//     public void onTick(long millisUntilFinished) {
// 
//     }
// 
//     @Override
//     public void onFinish() {
//         if (this.mListener != null) {
//             this.mListener.onCountEnd(this.id);
//         }
//     }
// }
// 
// Path: app/src/main/java/in/blogspot/anselmbros/torchie/main/manager/timer/CountTimerListener.java
// public interface CountTimerListener {
//     void onCountEnd(String id);
// }
// 
// Path: app/src/main/java/in/blogspot/anselmbros/torchie/utils/Constants.java
// public class Constants {
//     public final static String ID_DEVICE = "0";
// 
//     public final static String ID_DEVICE_OUTPUT = "1";
//     public final static String ID_DEVICE_OUTPUT_TORCH = "10";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH = "11";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH_LEGACY = "12";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH_NEW = "13";
//     public final static String ID_DEVICE_OUTPUT_TORCH_SCREEN = "14";
//     public final static String ID_DEVICE_OUTPUT_VIBRATOR = "15";
// 
//     public final static String ID_DEVICE_INPUT = "2";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY = "20";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY_NATIVE = "21";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY_ROCKER = "22";
//     public final static String ID_DEVICE_INPUT_PROXIMITY = "23";
// 
//     public final static String PLAY_URI = "https://play.google.com/store/apps/details?id=in.blogspot.anselmbros.torchie";
//     public final static String WEB_URI = "https://torchieapp.wordpress.com";
//     public final static String ABOUTANSELM_URI = "https://anselm.in";
//     public final static String FACEBOOK_URI = "https://facebook.com/torchieapp";
//     public final static String WEB_DONATE_URI = "https://torchieapp.wordpress.com/donate/";
// }


import static android.content.Context.SENSOR_SERVICE;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.view.InputEvent;
import in.blogspot.anselmbros.torchie.main.manager.device.input.InputDevice;
import in.blogspot.anselmbros.torchie.main.manager.timer.CountTimer;
import in.blogspot.anselmbros.torchie.main.manager.timer.CountTimerListener;
import in.blogspot.anselmbros.torchie.utils.Constants;
/*
 *     Copyright (C) 2016  Merbin J Anselm <merbinjanselm@gmail.com>
 *
 *     This program is free software; you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License along
 *     with this program; if not, write to the Free Software Foundation, Inc.,
 *     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

package in.blogspot.anselmbros.torchie.main.manager.device.input.proximity;




/**
 * Created by Merbin J Anselm on 04-Feb-17.
 */

public class ProximitySensor extends InputDevice implements SensorEventListener, CountTimerListener {
    public static final String TYPE = Constants.ID_DEVICE_INPUT_PROXIMITY;
    private static ProximitySensor mInstance;
// Path: app/src/main/java/in/blogspot/anselmbros/torchie/main/manager/device/input/InputDevice.java
// public abstract class InputDevice extends Device {
//     public static final String TYPE = Constants.ID_DEVICE_INPUT;
//     public final static int INP_LOW = 0;
//     public final static int INP_HIGH = 1;
//     public final static int INP_TRIGGER = 2;
//     private InputDeviceListener mListener;
// 
//     public InputDevice(Context context) {
//         super(context);
//         this.deviceType = TYPE;
//     }
// 
//     public final void setListener(InputDeviceListener listener) {
//         this.mListener = listener;
//     }
// 
//     public final boolean setInputEvent(InputEvent event) {
//         if (this.isEnabled) {
//             return this.setEvent(event);
//         }
//         return false;
//     }
// 
//     protected abstract boolean setEvent(InputEvent event);
// 
//     public abstract void getStatusRequest();
// 
//     protected final void updateCurrentSignal(int signal) {
//         if (this.mListener != null) {
//             this.mListener.onValueChanged(this.deviceType, signal);
//         }
//     }
// }
// 
// Path: app/src/main/java/in/blogspot/anselmbros/torchie/main/manager/timer/CountTimer.java
// public class CountTimer extends CountDownTimer {
// 
//     private CountTimerListener mListener;
//     private String id;
// 
//     public CountTimer(String id, double seconds, CountTimerListener listener) {
//         super((long) (seconds * 1000), (long) (seconds * 1000));
//         this.id = id;
//         this.mListener = listener;
//     }
// 
//     @Override
//     public void onTick(long millisUntilFinished) {
// 
//     }
// 
//     @Override
//     public void onFinish() {
//         if (this.mListener != null) {
//             this.mListener.onCountEnd(this.id);
//         }
//     }
// }
// 
// Path: app/src/main/java/in/blogspot/anselmbros/torchie/main/manager/timer/CountTimerListener.java
// public interface CountTimerListener {
//     void onCountEnd(String id);
// }
// 
// Path: app/src/main/java/in/blogspot/anselmbros/torchie/utils/Constants.java
// public class Constants {
//     public final static String ID_DEVICE = "0";
// 
//     public final static String ID_DEVICE_OUTPUT = "1";
//     public final static String ID_DEVICE_OUTPUT_TORCH = "10";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH = "11";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH_LEGACY = "12";
//     public final static String ID_DEVICE_OUTPUT_TORCH_FLASH_NEW = "13";
//     public final static String ID_DEVICE_OUTPUT_TORCH_SCREEN = "14";
//     public final static String ID_DEVICE_OUTPUT_VIBRATOR = "15";
// 
//     public final static String ID_DEVICE_INPUT = "2";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY = "20";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY_NATIVE = "21";
//     public final static String ID_DEVICE_INPUT_VOLUMEKEY_ROCKER = "22";
//     public final static String ID_DEVICE_INPUT_PROXIMITY = "23";
// 
//     public final static String PLAY_URI = "https://play.google.com/store/apps/details?id=in.blogspot.anselmbros.torchie";
//     public final static String WEB_URI = "https://torchieapp.wordpress.com";
//     public final static String ABOUTANSELM_URI = "https://anselm.in";
//     public final static String FACEBOOK_URI = "https://facebook.com/torchieapp";
//     public final static String WEB_DONATE_URI = "https://torchieapp.wordpress.com/donate/";
// }


// Path: app/src/main/java/in/blogspot/anselmbros/torchie/main/manager/device/input/proximity/ProximitySensor.java
import static android.content.Context.SENSOR_SERVICE;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.view.InputEvent;
import in.blogspot.anselmbros.torchie.main.manager.device.input.InputDevice;
import in.blogspot.anselmbros.torchie.main.manager.timer.CountTimer;
import in.blogspot.anselmbros.torchie.main.manager.timer.CountTimerListener;
import in.blogspot.anselmbros.torchie.utils.Constants;

/*
 *     Copyright (C) 2016  Merbin J Anselm <merbinjanselm@gmail.com>
 *
 *     This program is free software; you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation; either version 2 of the License, or
 *     (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License along
 *     with this program; if not, write to the Free Software Foundation, Inc.,
 *     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

package in.blogspot.anselmbros.torchie.main.manager.device.input.proximity;




/**
 * Created by Merbin J Anselm on 04-Feb-17.
 */

public class ProximitySensor extends InputDevice implements SensorEventListener, CountTimerListener {
    public static final String TYPE = Constants.ID_DEVICE_INPUT_PROXIMITY;
    private static ProximitySensor mInstance;
    private CountTimer mCountTimer;