// Path: app/src/blue/java/com/bruce/demo/demon/KDemonService.java
// @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
// public class KDemonService extends NotificationListenerService {
//     @Override
//     public void onNotificationPosted(StatusBarNotification sbn) {
// //        super.onNotificationPosted(sbn);
//     }
// 
//     @Override
//     public void onNotificationRemoved(StatusBarNotification sbn) {
// //        super.onNotificationRemoved(sbn);
//     }
// }
// 
// Path: app/src/blue/java/com/bruce/demo/demon/KService.java
// public class KService extends Service {
//     private int a = 0;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         LogUtils.i("service create");
//     }
// 
//     @Override
//     public int onStartCommand(Intent intent, int flags, int startId) {
//         LogUtils.i("service start");
//         new Thread(new Runnable() {
//             @Override
//             public void run() {
//                 while (a < 100000) {
//                     LogDetails.i("打印 %d 次", a);
//                     a++;
//                 }
//             }
//         }).start();
//         return super.onStartCommand(intent, flags, startId);
//     }
// 
//     @Nullable
//     @Override
//     public IBinder onBind(Intent intent) {
//         return null;
//     }
// }
// 
// Path: app/src/blue/java/com/bruce/demo/keeplive/OnepxReceiver.java
// public class OnepxReceiver extends BroadcastReceiver {
//     private static OnepxReceiver receiver;
// 
//     public static void register1pxReceiver(Context context) {
//         if (receiver == null) {
//             receiver = new OnepxReceiver();
//         }
//         context.registerReceiver(receiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
//         context.registerReceiver(receiver, new IntentFilter(Intent.ACTION_SCREEN_ON));
//     }
// 
//     public static void unregister1pxReceiver(Context context) {
//         context.unregisterReceiver(receiver);
//     }
// 
//     @Override
//     public void onReceive(Context context, Intent intent) {
//         if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
//             Intent it = new Intent(context, OnepxActivity.class);
//             it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//             context.startActivity(it);
//             LogUtils.i("1px--screen off-");
//         } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
//             context.sendBroadcast(new Intent("finish activity"));
//             LogUtils.i("1px--screen on-");
//         }
//     }
// }


import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bruce.demo.demon.KDemonService;
import com.bruce.demo.demon.KService;
import com.bruce.demo.keeplive.OnepxReceiver;
import com.bruceutils.base.BaseFragment;
import com.bruceutils.utils.PublicUtil;
import com.bruceutils.utils.StorageUtil;
import com.bruceutils.utils.logdetails.LogDetails;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;

    private void showScreenModeandValue() {
        // 获取屏幕亮度设置模式
        try {
            int screenMode = Settings.System.getInt(getActivity().getContentResolver(), Settings
                    .System.SCREEN_BRIGHTNESS_MODE);
            LogDetails.d("当前设备屏幕亮度模式为: " + screenMode);
            switch (screenMode) {
                case Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC:
                    LogDetails.d("当前设备屏幕亮度模式为自动调节屏幕亮度");
                    break;
                case Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL:
                    LogDetails.d("当前设备屏幕亮度模式为手动调节屏幕亮度");
                    break;
            }

            // 获取屏幕亮度值
            int screenValue = Settings.System.getInt(getActivity().getContentResolver(), Settings
                    .System.SCREEN_BRIGHTNESS, -1);
            LogDetails.d("当前设备亮度值为: " + screenValue);
            showToastShort(String.format("屏亮模式为 %s,值为 %d", screenMode == 1 ? "自动调节" : "手动调节",
                    screenValue));
        } catch (Settings.SettingNotFoundException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
// Path: app/src/blue/java/com/bruce/demo/demon/KDemonService.java
// @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
// public class KDemonService extends NotificationListenerService {
//     @Override
//     public void onNotificationPosted(StatusBarNotification sbn) {
// //        super.onNotificationPosted(sbn);
//     }
// 
//     @Override
//     public void onNotificationRemoved(StatusBarNotification sbn) {
// //        super.onNotificationRemoved(sbn);
//     }
// }
// 
// Path: app/src/blue/java/com/bruce/demo/demon/KService.java
// public class KService extends Service {
//     private int a = 0;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         LogUtils.i("service create");
//     }
// 
//     @Override
//     public int onStartCommand(Intent intent, int flags, int startId) {
//         LogUtils.i("service start");
//         new Thread(new Runnable() {
//             @Override
//             public void run() {
//                 while (a < 100000) {
//                     LogDetails.i("打印 %d 次", a);
//                     a++;
//                 }
//             }
//         }).start();
//         return super.onStartCommand(intent, flags, startId);
//     }
// 
//     @Nullable
//     @Override
//     public IBinder onBind(Intent intent) {
//         return null;
//     }
// }
// 
// Path: app/src/blue/java/com/bruce/demo/keeplive/OnepxReceiver.java
// public class OnepxReceiver extends BroadcastReceiver {
//     private static OnepxReceiver receiver;
// 
//     public static void register1pxReceiver(Context context) {
//         if (receiver == null) {
//             receiver = new OnepxReceiver();
//         }
//         context.registerReceiver(receiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
//         context.registerReceiver(receiver, new IntentFilter(Intent.ACTION_SCREEN_ON));
//     }
// 
//     public static void unregister1pxReceiver(Context context) {
//         context.unregisterReceiver(receiver);
//     }
// 
//     @Override
//     public void onReceive(Context context, Intent intent) {
//         if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
//             Intent it = new Intent(context, OnepxActivity.class);
//             it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//             context.startActivity(it);
//             LogUtils.i("1px--screen off-");
//         } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
//             context.sendBroadcast(new Intent("finish activity"));
//             LogUtils.i("1px--screen on-");
//         }
//     }
// }


// Path: app/src/blue/java/com/bruce/demo/BlueFragment.java
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bruce.demo.demon.KDemonService;
import com.bruce.demo.demon.KService;
import com.bruce.demo.keeplive.OnepxReceiver;
import com.bruceutils.base.BaseFragment;
import com.bruceutils.utils.PublicUtil;
import com.bruceutils.utils.StorageUtil;
import com.bruceutils.utils.logdetails.LogDetails;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;


    private void showScreenModeandValue() {
        // 获取屏幕亮度设置模式
        try {
            int screenMode = Settings.System.getInt(getActivity().getContentResolver(), Settings
                    .System.SCREEN_BRIGHTNESS_MODE);
            LogDetails.d("当前设备屏幕亮度模式为: " + screenMode);
            switch (screenMode) {
                case Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC:
                    LogDetails.d("当前设备屏幕亮度模式为自动调节屏幕亮度");
                    break;
                case Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL:
                    LogDetails.d("当前设备屏幕亮度模式为手动调节屏幕亮度");
                    break;
            }

            // 获取屏幕亮度值
            int screenValue = Settings.System.getInt(getActivity().getContentResolver(), Settings
                    .System.SCREEN_BRIGHTNESS, -1);
            LogDetails.d("当前设备亮度值为: " + screenValue);
            showToastShort(String.format("屏亮模式为 %s,值为 %d", screenMode == 1 ? "自动调节" : "手动调节",
                    screenValue));
        } catch (Settings.SettingNotFoundException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        OnepxReceiver.unregister1pxReceiver(getActivity());