// 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;
        linearLayout.setBackgroundColor(getResources().getColor(android.R.color.black));

        TextView tv1 = new TextView(getActivity());
        tv1.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        tv1.setText("Blue module");
        tv1.setTextColor(getResources().getColor(android.R.color.holo_blue_dark));

        linearLayout.addView(tv1);

        Button btn1 = new Button(getActivity());
        btn1.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        btn1.setText("获取当前屏幕亮度和模式");
        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showScreenModeandValue();
            }
        });

        linearLayout.addView(btn1);

        Button btn2 = new Button(getActivity());
        btn2.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        btn2.setText("开启新进程");
        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
// 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;

        linearLayout.setBackgroundColor(getResources().getColor(android.R.color.black));

        TextView tv1 = new TextView(getActivity());
        tv1.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        tv1.setText("Blue module");
        tv1.setTextColor(getResources().getColor(android.R.color.holo_blue_dark));

        linearLayout.addView(tv1);

        Button btn1 = new Button(getActivity());
        btn1.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        btn1.setText("获取当前屏幕亮度和模式");
        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showScreenModeandValue();
            }
        });

        linearLayout.addView(btn1);

        Button btn2 = new Button(getActivity());
        btn2.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        btn2.setText("开启新进程");
        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getActivity().startService(new Intent(getActivity(), KService.class));