weimingfei
2 天以前 3c5e5ed692e2e5248080b064b7d14b8eb9988a8c
keyCabinet-android/app/src/main/java/com/doumee/keyCabinet/ui/main/MainActivity.java
@@ -18,6 +18,7 @@
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.TextAppearanceSpan;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -117,16 +118,17 @@
import com.example.datalibrary.model.User;
import com.example.datalibrary.utils.ToastUtils;
import com.example.datalibrary.view.PreviewTexture;
import com.mc.enjoysdk.McHome;
import com.mc.enjoysdk.McSystemUi;
import com.mc.enjoysdk.transform.McSystemUiFlag;
import com.proembed.service.MyService;
import com.yanzhenjie.permission.runtime.Permission;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -166,8 +168,7 @@
    private int downCount = 0;
    private Long lastDownTime;
    private Long showTime;
    private McSystemUi mcSystemUi;
    private McHome mcHome;
    private MyService mXService;
    private Handler handler = new Handler(){
        @Override
@@ -226,9 +227,25 @@
        Intent intent2 = new Intent(MainActivity.this, FaceUpdateService.class);
        startService(intent2);*/
        getPermission();
        Timber.tag("====>").d(LMobileInfo.getDeviceUniqueId());
        mcSystemUi = McSystemUi.getInstance(this);
        mcHome = McHome.getInstance(this);
        mXService = new MyService(this);
        //Timber.tag("====>").d(LMobileInfo.getDeviceUniqueId());
        Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> {
            String time2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
            getVM().addInfo("GlobalException线程报错:" + thread.getName());
            try {
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                PrintStream print = new PrintStream(out);
                //导出发生异常的时间
                print.println(time2);
                print.println();
                throwable.printStackTrace(print);
                SpUtil.saveString(CrashHandler.FILE_NAME+time2,new String(out.toByteArray()));
                print.close();
            } catch (Exception e) {
                e.printStackTrace();
                getVM().addInfo("错误日志2"+e.getMessage());
            }
        });
    }
    private void initM(){
@@ -336,9 +353,7 @@
                    getDB().nsv.setVisibility(View.VISIBLE);
                }
                //显示状态栏
                mcSystemUi.temporarilySwitchStatusBar(true);
                //显示导航栏
                mcSystemUi.temporarilySwitchNavigation(true);
                MCUtils.show(mXService);
            }
        });
        upErrInfo();
@@ -498,8 +513,8 @@
        super.onResume();
        isShowing = true;
        getVM().setSubmit(true);
        MCUtils.hind(mcSystemUi);
        mcHome.setHomePackage("com.doumee.keyCabinet");
        MCUtils.hind(mXService);
        MCUtils.setHomePackage(mXService,"com.doumee.keyCabinet");
        showTime = System.currentTimeMillis();
        if(isHavePermission) {
            checkUpdate();
@@ -1597,7 +1612,17 @@
            //一号版
            bh = 1;
        }
        String[] sp = data.split("AA");
        List<String> sp = new ArrayList<>();
        String data2 = data.substring(8,data.length());
        while (data2.length()>0){
            if (data2.length()<22) {
                sp.add(data2+"");
                data2 = "";
            }else {
                sp.add(data2.substring(0,22));
                data2 = data2.substring(22);
            }
        }
        for(String s:sp){
            if(s.length()>=20){
                String key = SportUtils.intToHex(bh)+s.substring(4,6);
@@ -1611,7 +1636,7 @@
                    }else {
                        gridDo.setCurKeyCode("");
                    }
                    if("0101".equals(key)) {
                    if("0109".equals(key)) {
                        getVM().addInfo(key+" , "+isHaveKey+"  "+keyCode);
                        getVM().addInfo(key + "设置钥匙:" + gridDo.getCurKeyCode());
                    }