// Path: app/src/main/java/in/blogspot/anselmbros/torchie/main/manager/device/output/torch/Torch.java
// public abstract class Torch extends OutputDevice {
//     public static final String TYPE = Constants.ID_DEVICE_OUTPUT_TORCH;
// 
//     public Torch(Context context) {
//         super(context);
//         this.deviceType = TYPE;
//     }
// }
// 
// Path: app/src/main/java/in/blogspot/anselmbros/torchie/ui/activity/ScreenflashActivity.java
// public class ScreenflashActivity extends Activity {
// 
//     CloseActivityReceiver closeActivityReceiver;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
// 
//         requestWindowFeature(Window.FEATURE_NO_TITLE);
//         getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
//                 WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
//                 WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
//                 WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
// 
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_screenflash);
// 
//         setScreenBrightness(1f);
// 
//         closeActivityReceiver = new CloseActivityReceiver();
//         registerReceiver(closeActivityReceiver, new IntentFilter(CLOSE_ACTIVITY_IDENTIFIER));
//     }
// 
//     @Override
//     protected void onPause() {
//         overridePendingTransition(0, 0); //Disable exit animation
//         super.onPause();
//     }
// 
//     @Override
//     protected void onDestroy() {
//         unregisterReceiver(closeActivityReceiver);
//         super.onDestroy();
//     }
// 
//     private void setScreenBrightness(float value) {
//         WindowManager.LayoutParams lp = getWindow().getAttributes();
//         lp.screenBrightness = value; // 0f - no backlight ... 1f - full backlight
//         getWindow().setAttributes(lp);
//     }
// 
//     public class CloseActivityReceiver extends BroadcastReceiver {
//         @Override
//         public void onReceive(Context context, Intent intent) {
//             if (intent.getAction().equals(CLOSE_ACTIVITY_IDENTIFIER)) {
//                 finish();
//             }
//         }
//     }
// }
// 
// 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 android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import in.blogspot.anselmbros.torchie.main.manager.device.output.torch.Torch;
import in.blogspot.anselmbros.torchie.ui.activity.ScreenflashActivity;
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.output.torch.screenlight;



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

public class Screenlight extends Torch {
    public static final String TYPE = Constants.ID_DEVICE_OUTPUT_TORCH_SCREEN;
    public final static String CLOSE_ACTIVITY_IDENTIFIER = "in.blogspot.anselmbros.torchie.CLOSE_ACTIVITY";

    private ScreenlightOffReceiver screenlightOffReceiver;

    public Screenlight(Context context) {
        super(context);
        this.deviceType = TYPE;
    }

    @Override
    protected void turnOn() {
// Path: app/src/main/java/in/blogspot/anselmbros/torchie/main/manager/device/output/torch/Torch.java
// public abstract class Torch extends OutputDevice {
//     public static final String TYPE = Constants.ID_DEVICE_OUTPUT_TORCH;
// 
//     public Torch(Context context) {
//         super(context);
//         this.deviceType = TYPE;
//     }
// }
// 
// Path: app/src/main/java/in/blogspot/anselmbros/torchie/ui/activity/ScreenflashActivity.java
// public class ScreenflashActivity extends Activity {
// 
//     CloseActivityReceiver closeActivityReceiver;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
// 
//         requestWindowFeature(Window.FEATURE_NO_TITLE);
//         getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
//                 WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
//                 WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
//                 WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
// 
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_screenflash);
// 
//         setScreenBrightness(1f);
// 
//         closeActivityReceiver = new CloseActivityReceiver();
//         registerReceiver(closeActivityReceiver, new IntentFilter(CLOSE_ACTIVITY_IDENTIFIER));
//     }
// 
//     @Override
//     protected void onPause() {
//         overridePendingTransition(0, 0); //Disable exit animation
//         super.onPause();
//     }
// 
//     @Override
//     protected void onDestroy() {
//         unregisterReceiver(closeActivityReceiver);
//         super.onDestroy();
//     }
// 
//     private void setScreenBrightness(float value) {
//         WindowManager.LayoutParams lp = getWindow().getAttributes();
//         lp.screenBrightness = value; // 0f - no backlight ... 1f - full backlight
//         getWindow().setAttributes(lp);
//     }
// 
//     public class CloseActivityReceiver extends BroadcastReceiver {
//         @Override
//         public void onReceive(Context context, Intent intent) {
//             if (intent.getAction().equals(CLOSE_ACTIVITY_IDENTIFIER)) {
//                 finish();
//             }
//         }
//     }
// }
// 
// 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/output/torch/screenlight/Screenlight.java
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import in.blogspot.anselmbros.torchie.main.manager.device.output.torch.Torch;
import in.blogspot.anselmbros.torchie.ui.activity.ScreenflashActivity;
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.output.torch.screenlight;



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

public class Screenlight extends Torch {
    public static final String TYPE = Constants.ID_DEVICE_OUTPUT_TORCH_SCREEN;
    public final static String CLOSE_ACTIVITY_IDENTIFIER = "in.blogspot.anselmbros.torchie.CLOSE_ACTIVITY";

    private ScreenlightOffReceiver screenlightOffReceiver;

    public Screenlight(Context context) {
        super(context);
        this.deviceType = TYPE;
    }

    @Override
    protected void turnOn() {
        Intent intent = new Intent(this.mContext, ScreenflashActivity.class);