Browse Source

fix: init

sibichiAi
高志龙 10 months ago
parent
commit
0725b14725
  1. 1
      app/build.gradle
  2. BIN
      app/libs/sdkapi.jar
  3. 29
      app/src/main/java/qianmu/container/activity/BaseActivity.java
  4. 7
      app/src/main/java/qianmu/container/app/Constant.java
  5. 12
      app/src/main/java/qianmu/container/app/MyApplication.java
  6. 22
      app/src/main/java/qianmu/container/data/PowerData.java

1
app/build.gradle

@ -98,6 +98,7 @@ dependencies {
implementation files('libs\\toolbox_kit.jar')// implementation files('libs\\toolbox_kit.jar')//
implementation files('libs\\shockman.jar')// implementation files('libs\\shockman.jar')//
implementation files('libs/signway.jar') // implementation files('libs/signway.jar') //
implementation files('libs\\sdkapi.jar') //Bv-3588
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

BIN
app/libs/sdkapi.jar

Binary file not shown.

29
app/src/main/java/qianmu/container/activity/BaseActivity.java

@ -102,9 +102,6 @@ public abstract class BaseActivity extends AppCompatActivity {
sendPackageName(); sendPackageName();
Constant.whoActivity = currRoute; Constant.whoActivity = currRoute;
Log.e("TAG", "哪个activty:" + Constant.whoActivity); Log.e("TAG", "哪个activty:" + Constant.whoActivity);
if(Constant.androidBoardType.equals("huamo") && Constant.ROUTE_SCREEN_SAVER==currRoute){
}
} }
@Override @Override
@ -130,7 +127,8 @@ public abstract class BaseActivity extends AppCompatActivity {
if (Constant.ACTION_CAPTURE_SCREEN.equals(message.getCode())) { if (Constant.ACTION_CAPTURE_SCREEN.equals(message.getCode())) {
uploadScreenCapture(); uploadScreenCapture();
} else if (Constant.ACTION_SHOW_SPLASH.equals(message.getCode())) { } else if (Constant.ACTION_SHOW_SPLASH.equals(message.getCode())) {
if (currRoute == Constant.ROUTE_SCREEN_SAVER) return;
if (currRoute == Constant.ROUTE_SCREEN_SAVER)
return;
ScreenSaverActivity.startAction(this); ScreenSaverActivity.startAction(this);
// ARouter.getInstance().build(Constant.ROUTE_SCREEN_SAVER).navigation(); // ARouter.getInstance().build(Constant.ROUTE_SCREEN_SAVER).navigation();
} else if (Constant.UPDATE_DEVICE_IP.equals(message.getCode())) { } else if (Constant.UPDATE_DEVICE_IP.equals(message.getCode())) {
@ -140,9 +138,13 @@ public abstract class BaseActivity extends AppCompatActivity {
} else if (Constant.ACTION_UPDATE_WEBVIEW.equals(message.getCode())) { } else if (Constant.ACTION_UPDATE_WEBVIEW.equals(message.getCode())) {
// 显示主页,并更新webview // 显示主页,并更新webview
LoggerUtil.e("BaseActivity", "ACTION_UPDATE_WEBVIEW"); LoggerUtil.e("BaseActivity", "ACTION_UPDATE_WEBVIEW");
if(DeviceData.getDeviceInfo(DeviceData.HINT_DEVICE_TYPE).equals("信发") || DeviceData.getDeviceInfo(DeviceData.HINT_DEVICE_TYPE).equals("双面屏")) return;
if (currRoute == Constant.ROUTE_WEB_VIEW || currRoute == Constant.ROUTE_UPDATE_FILE) return;
ARouter.getInstance().build(Constant.ROUTE_WEB_VIEW).withBoolean(Constant.KEY_LOAD_H5_URL, true).navigation();
if (DeviceData.getDeviceInfo(DeviceData.HINT_DEVICE_TYPE).equals("信发")
|| DeviceData.getDeviceInfo(DeviceData.HINT_DEVICE_TYPE).equals("双面屏"))
return;
if (currRoute == Constant.ROUTE_WEB_VIEW || currRoute == Constant.ROUTE_UPDATE_FILE)
return;
ARouter.getInstance().build(Constant.ROUTE_WEB_VIEW).withBoolean(Constant.KEY_LOAD_H5_URL, true)
.navigation();
} else if (Constant.ACTION_RESTART_APP.equals(message.getCode())) { } else if (Constant.ACTION_RESTART_APP.equals(message.getCode())) {
// 重启app // 重启app
@ -173,7 +175,8 @@ public abstract class BaseActivity extends AppCompatActivity {
// 上传界面截图 // 上传界面截图
private void uploadScreenCapture() { private void uploadScreenCapture() {
String dataStr = StringUtil.strSplice("{\"code\":\"", DeviceData.getDeviceInfo(DeviceData.HINT_DEVICE_CODE), "\",\"filename\":\"screenshot.jpg\"}");
String dataStr = StringUtil.strSplice("{\"code\":\"", DeviceData.getDeviceInfo(DeviceData.HINT_DEVICE_CODE),
"\",\"filename\":\"screenshot.jpg\"}");
final byte[] bytes1 = StringUtil.strSplice(String.format("%06d", dataStr.length()), dataStr).getBytes(); // ip和文件名转成字节数组 final byte[] bytes1 = StringUtil.strSplice(String.format("%06d", dataStr.length()), dataStr).getBytes(); // ip和文件名转成字节数组
// 图片转成字节数组 // 图片转成字节数组
String filePath = BitmapUtil.saveBitmapToSDCard(captureScreen()); String filePath = BitmapUtil.saveBitmapToSDCard(captureScreen());
@ -187,6 +190,7 @@ public abstract class BaseActivity extends AppCompatActivity {
* *
* */ * */
Long onkey = 0l; Long onkey = 0l;
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.e("TAG", "按键:" + keyCode); Log.e("TAG", "按键:" + keyCode);
@ -223,10 +227,9 @@ public abstract class BaseActivity extends AppCompatActivity {
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
} }
/** /**
* 发送广播给奔溃自启app告诉包名 * 发送广播给奔溃自启app告诉包名
* */
*/
public void sendPackageName() { public void sendPackageName() {
Intent intent = new Intent(Constant.APP_SEND_PACKAGE_NAME); Intent intent = new Intent(Constant.APP_SEND_PACKAGE_NAME);
intent.putExtra(Constant.PACKAGE_NAME, DeviceUtil.getPackageName()); intent.putExtra(Constant.PACKAGE_NAME, DeviceUtil.getPackageName());
@ -235,7 +238,7 @@ public abstract class BaseActivity extends AppCompatActivity {
/** /**
* 发送广播给奔溃自启app告诉包名 * 发送广播给奔溃自启app告诉包名
* */
*/
public void sendExitPackageName() { public void sendExitPackageName() {
Intent intent = new Intent(Constant.APP_SEND_PACKAGE_NAME); Intent intent = new Intent(Constant.APP_SEND_PACKAGE_NAME);
intent.putExtra(Constant.PACKAGE_NAME, "packageName"); intent.putExtra(Constant.PACKAGE_NAME, "packageName");
@ -244,7 +247,7 @@ public abstract class BaseActivity extends AppCompatActivity {
/** /**
* 退出软件 * 退出软件
* */
*/
public void exitApp() { public void exitApp() {
LoggerUtil.e("BaseActivity", "退出软件"); LoggerUtil.e("BaseActivity", "退出软件");
sendExitPackageName(); sendExitPackageName();
@ -286,7 +289,7 @@ public abstract class BaseActivity extends AppCompatActivity {
/** /**
* 重启软件 * 重启软件
* */
*/
public void restartApp() { public void restartApp() {
LoggerUtil.e("BaseActivity", "重启软件"); LoggerUtil.e("BaseActivity", "重启软件");
stopService(new Intent(this, ContainerService.class)); stopService(new Intent(this, ContainerService.class));

7
app/src/main/java/qianmu/container/app/Constant.java

@ -23,14 +23,15 @@ public class Constant {
public static boolean newGuide = false; // 指路机类型,true:新版指路机 false:老板指路机(流花) public static boolean newGuide = false; // 指路机类型,true:新版指路机 false:老板指路机(流花)
public static String mqttState = ""; // 屏幕连接方式 public static String mqttState = ""; // 屏幕连接方式
// public static String androidBoardType = ""; //设备板子型号 无固定版 // public static String androidBoardType = ""; //设备板子型号 无固定版
public static String androidBoardType = "ys"; // 设备板子型号 ys(亿晟) 北京颐堤港定制touch
// public static String androidBoardType = "ys"; // 设备板子型号 ys(亿晟) 北京颐堤港定制touch
// public static String androidBoardType = "xwst"; //设备板子型号 xwst(欣威视通3399) // public static String androidBoardType = "xwst"; //设备板子型号 xwst(欣威视通3399)
// public static String androidBoardType = "xwst2"; //设备板子型号
// xwst2(欣威视通3588、T982、3576)
// public static String androidBoardType = "xwst2"; //设备板子型号 xwst2(欣威视通3588、T982、3576)
// public static String androidBoardType = "zc"; //设备板子型号 zc(卓策主板——王府井喜悦、杨浦中心医院) // public static String androidBoardType = "zc"; //设备板子型号 zc(卓策主板——王府井喜悦、杨浦中心医院)
// public static String androidBoardType = "sx"; //设备板子型号 sx(视想) // public static String androidBoardType = "sx"; //设备板子型号 sx(视想)
// public static String androidBoardType = "nova"; //设备板子型号 诺瓦盒子 华贸LED // public static String androidBoardType = "nova"; //设备板子型号 诺瓦盒子 华贸LED
// public static String androidBoardType = "huidu"; //设备板子型号 huidu(灰度主板) 罗湖寻车机 // public static String androidBoardType = "huidu"; //设备板子型号 huidu(灰度主板) 罗湖寻车机
public static String androidBoardType = "bv"; // Bv-3588M
public static String whoActivity = ""; // 哪个activity页面 public static String whoActivity = ""; // 哪个activity页面
// 本地缓存地址 // 本地缓存地址
public static final String CACHE_PATH = StringUtil.strSplice(Environment.getExternalStorageDirectory().getPath(), public static final String CACHE_PATH = StringUtil.strSplice(Environment.getExternalStorageDirectory().getPath(),

12
app/src/main/java/qianmu/container/app/MyApplication.java

@ -10,6 +10,7 @@ import android.os.PowerManager;
import com.alibaba.android.arouter.BuildConfig; import com.alibaba.android.arouter.BuildConfig;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.jakewharton.processphoenix.ProcessPhoenix; import com.jakewharton.processphoenix.ProcessPhoenix;
import com.lztek.toolkit.Lztek;
import com.lzy.okgo.OkGo; import com.lzy.okgo.OkGo;
import com.sdkapi.api.SdkApi; import com.sdkapi.api.SdkApi;
import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.LeakCanary;
@ -47,6 +48,7 @@ public class MyApplication extends Application {
public static long lastClick = 0;//最后点击时间 public static long lastClick = 0;//最后点击时间
public static long lastClickTime = 0;//最后点击时间 public static long lastClickTime = 0;//最后点击时间
public static int clickTimes = 0;//累计点击次数 public static int clickTimes = 0;//累计点击次数
private Lztek lztek=null;
public SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); public SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@ -65,9 +67,19 @@ public class MyApplication extends Application {
initOkGo(); initOkGo();
SocketServerManager.startSocketServer(); SocketServerManager.startSocketServer();
initDefaultUncaughtExceptionHandler(); initDefaultUncaughtExceptionHandler();
if(Constant.androidBoardType.equals("ys")){
lztek = Lztek.create(this.getBaseContext());
}
// refWatcher = LeakCanary.install(this); // refWatcher = LeakCanary.install(this);
} }
public Lztek getLztek() {
if(lztek == null){
lztek = Lztek.create(this.getBaseContext());
}
return lztek;
}
//初始化页面路由框架 //初始化页面路由框架
private void initARouter() { private void initARouter() {
try { try {

22
app/src/main/java/qianmu/container/data/PowerData.java

@ -75,11 +75,31 @@ public class PowerData extends BaseData {
long currentLong = System.currentTimeMillis();//当前时间 long currentLong = System.currentTimeMillis();//当前时间
String s = TimeUtil.stampToDate(currentLong); String s = TimeUtil.stampToDate(currentLong);
long bootLong = TimeUtil.pareTLong2(s + " " + bootTime);//开机时间 long bootLong = TimeUtil.pareTLong2(s + " " + bootTime);//开机时间
if(Math.abs(currentLong-bootLong)<30000){
if(Math.abs(currentLong-bootLong)<60000){
LoggerUtil.e("PowerData","避免设备定时失效,进行重新设置定时开关机"); LoggerUtil.e("PowerData","避免设备定时失效,进行重新设置定时开关机");
newTimeInfo=""; newTimeInfo="";
} }
} }
//BV-3588 定时开关机
if(Constant.androidBoardType.equals("bv") && !bootTime.isEmpty()){
long currentLong = System.currentTimeMillis();//当前时间
String s = TimeUtil.stampToDate(currentLong);
long parameterLong = TimeUtil.pareTLong2(s + " " + parameter);//关机时间
long bootLong = TimeUtil.pareTLong2(s + " " + bootTime);//开机时间
long bootLong2 = bootLong+24*60*60*1000;//第二天开机时间
if(Math.abs(currentLong-parameterLong)<65000){
//并且设定的开机与关机时间必须超过当前时间,否则,会清除掉已设定的开机时间或关机时间,导致不能达到预想的要求。
if(parameterLong > bootLong) {
//关机时间大于开机时间,第二天开机
int second =(int)(bootLong2-currentLong)/1000;
MyApplication.getInstance().getLztek().alarmPoweron(second);
}else {
//关机时间小于开机时间,当天关机,当天开机
int second =(int)(bootLong-currentLong)/1000;
MyApplication.getInstance().getLztek().alarmPoweron(second);
}
}
}
//华贸设备设置开关屏 //华贸设备设置开关屏
if(Constant.androidBoardType.equals("nova") && !bootTime.isEmpty()){ if(Constant.androidBoardType.equals("nova") && !bootTime.isEmpty()){

Loading…
Cancel
Save