diff --git a/app/build.gradle b/app/build.gradle index 7bbd781..3707a3e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -148,5 +148,5 @@ dependencies { //卡顿检测 // implementation 'com.github.markzhai:blockcanary-android:1.5.0' - implementation files('libs/tbs_sdk_thirdapp_v4.3.0.1148_43697_sharewithdownloadwithfile_withoutGame_obfs_20190805_175505.jar') + implementation 'com.tencent.tbs.tbssdk:sdk:43697' } diff --git a/app/libs/GDTSDK.unionNormal.4.100.970.aar b/app/libs/GDTSDK.unionNormal.4.100.970.aar deleted file mode 100644 index ff45cb3..0000000 Binary files a/app/libs/GDTSDK.unionNormal.4.100.970.aar and /dev/null differ diff --git a/app/libs/GDTSDK.unionNormal.4.176.1046.aar b/app/libs/GDTSDK.unionNormal.4.176.1046.aar new file mode 100644 index 0000000..211cf35 Binary files /dev/null and b/app/libs/GDTSDK.unionNormal.4.176.1046.aar differ diff --git a/app/libs/tbs_sdk_thirdapp_v4.3.0.1148_43697_sharewithdownloadwithfile_withoutGame_obfs_20190805_175505.jar b/app/libs/tbs_sdk_thirdapp_v4.3.0.1148_43697_sharewithdownloadwithfile_withoutGame_obfs_20190805_175505.jar deleted file mode 100644 index e43c52c..0000000 Binary files a/app/libs/tbs_sdk_thirdapp_v4.3.0.1148_43697_sharewithdownloadwithfile_withoutGame_obfs_20190805_175505.jar and /dev/null differ diff --git a/app/src/main/java/Interfaces/MagicBoxInterface.java b/app/src/main/java/Interfaces/MagicBoxInterface.java index bacdd91..a044dd7 100644 --- a/app/src/main/java/Interfaces/MagicBoxInterface.java +++ b/app/src/main/java/Interfaces/MagicBoxInterface.java @@ -1,5 +1,6 @@ package Interfaces; -public interface MagicBoxInterface { - void getData(String data); +public abstract class MagicBoxInterface { + public void getData(String data){}; + public void getData(String data,Object src){}; } diff --git a/app/src/main/java/com/yutou/jianr_mg/LoadingActivity.java b/app/src/main/java/com/yutou/jianr_mg/LoadingActivity.java index 6e3e2f8..e6c6760 100644 --- a/app/src/main/java/com/yutou/jianr_mg/LoadingActivity.java +++ b/app/src/main/java/com/yutou/jianr_mg/LoadingActivity.java @@ -82,7 +82,7 @@ public class LoadingActivity extends AppCompatActivity { System.out.println("update"); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); - //setContentView(R.layout.activity_loading); + setContentView(R.layout.activity_loading); Utils.setImmersion(this); if (url == null) { clazz = MainActivity.class; @@ -90,12 +90,12 @@ public class LoadingActivity extends AppCompatActivity { clazz = WebActivity.class; } handler = new Handler(); - /* initViews(); + initViews(); initData(); - initAd();*/ - JianRUtils.reloadShipType(); + initAd(); + /*JianRUtils.reloadShipType(); MapView mapView=new MapView(this); - setContentView(mapView.getView()); + setContentView(mapView.getView());*/ } private void login(String name, String pass) { @@ -473,6 +473,7 @@ public class LoadingActivity extends AppCompatActivity { return; } AdTools.upload(AdTools.Open,AdTools.req); + SplashAD splashAD= new SplashAD(this, ad.getAppid(), ad.getPosid(), new SplashADListener() { @Override public void onADDismissed() { @@ -503,7 +504,12 @@ public class LoadingActivity extends AppCompatActivity { public void onADExposure() { AdTools.upload(AdTools.Open,AdTools.show); } - }); + + @Override + public void onADLoaded(long l) { + + } + }); splashAD.fetchAndShowIn(adLayout); } diff --git a/app/src/main/java/com/yutou/jianr_mg/Network/HttpApi.java b/app/src/main/java/com/yutou/jianr_mg/Network/HttpApi.java index 0204cf3..e997b08 100644 --- a/app/src/main/java/com/yutou/jianr_mg/Network/HttpApi.java +++ b/app/src/main/java/com/yutou/jianr_mg/Network/HttpApi.java @@ -5,11 +5,11 @@ package com.yutou.jianr_mg.Network; */ public class HttpApi { - //public static final String HOME="http://jianr.jianrmod.cn/"; + public static final String HOME="http://jianr.jianrmod.cn/"; // public static final String HOME = "http://192.168.31.92:8080/"; //zzz_gz wifi // public static final String HOME = "http://192.168.43.68:8088/"; //zzz_gz wifi //public static final String HOME = "http://192.168.137.1:8088/"; //笔记本本身WIFI - public static final String HOME = "http://192.168.1.151:8080/"; //公司 + //public static final String HOME = "http://192.168.1.151:8080/"; //公司 public static final String HOME_URL=HOME+"android/"; //服务器 public static final String MOD_ALL = "mod/all.do"; diff --git a/app/src/main/java/com/yutou/jianr_mg/Tools/ModUtils.java b/app/src/main/java/com/yutou/jianr_mg/Tools/ModUtils.java index a3d4f85..f940b90 100644 --- a/app/src/main/java/com/yutou/jianr_mg/Tools/ModUtils.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/ModUtils.java @@ -4,6 +4,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; +import android.os.Environment; import android.os.Handler; import android.os.IBinder; import android.os.Looper; @@ -28,11 +29,14 @@ import com.yutou.jianr_mg.services.DownloadService; import com.yutou.jianr_mg.services.MagicBoxService; import org.json.JSONArray; +import org.json.JSONException; import org.json.JSONObject; import java.io.File; import java.util.ArrayList; import java.util.List; +import java.util.Timer; +import java.util.TimerTask; import Interfaces.MagicBoxInterface; import me.drakeet.materialdialog.MaterialDialog; @@ -247,7 +251,58 @@ public class ModUtils { Log.i(TAG, "找不到文件:" + src.getAbsolutePath()); } } + private int notRootInstallIndex=0; public void notRootInstallStart(ModInterface modInterface,boolean isBackup){ + notRootInstallIndex=0; + MagicBoxService service=MagicBoxService.init(); + try { + for (int j = 0; j < srcs.size(); j++) { + JSONObject order=new JSONObject(); + order.put("action","copy"); + if(isBackup){ + String path= srcs.get(j).getAbsolutePath().replace(srcs.get(j).getName(), "backup/" + packname.getPackname() + "/" + srcs.get(j).getName()); + order.put("args", new String[]{"files:" + paths.get(j).replace("/files/","")+srcs.get(j).getName(), + path}); + }else { + order.put("args", new String[]{srcs.get(j).getAbsolutePath(), "files:" + paths.get(j).replace("/files/", "") + srcs.get(j).getName()}); + } + service.setOrder(order, new MagicBoxInterface() { + @Override + public void getData(String data,Object src) { + JSONObject json= (JSONObject) src; + try { + System.out.println(">>>>"+((String[])json.get("args"))[0]); + } catch (JSONException e) { + e.printStackTrace(); + } + notRootInstallIndex++; + } + }); + } + new Timer().schedule(new TimerTask() { + int time=0; + @Override + public void run() { + time+=100; + if(notRootInstallIndex==srcs.size()){ + cancel(); + if(isBackup){ + notRootInstallStart(modInterface,false); + }else { + modInterface.onAction(true, 0); + } + } + if(time==10000){ + modInterface.onAction(false,-1); + } + } + },0,100); + }catch (Exception e){ + e.printStackTrace(); + } + + } + public void notRootInstallStart1(ModInterface modInterface,boolean isBackup){ try{ if(i==srcs.size()){ MagicBoxService.init().clearOrder(); @@ -268,24 +323,33 @@ public class ModUtils { modInterface.onAction(false,0); return; } - service.setOrder(order, data -> { //先备份 - try { - if(!isBackup){//如果不需要备份则按照安装逻辑进行 + service.setOrder(order, new MagicBoxInterface() { + @Override + public void getData(String data, Object src) { + super.getData(data, src); + try { + if(!isBackup){//如果不需要备份则按照安装逻辑进行 + i++; + MagicBoxService.init().clearOrder(); + notRootInstallStart(modInterface,false); + return; + } + order.put("action","copy"); + order.put("args",new String[]{srcs.get(i).getAbsolutePath(),"files:" + paths.get(i).replace("/files/","")+srcs.get(i).getName()}); i++; - MagicBoxService.init().clearOrder(); - notRootInstallStart(modInterface,false); - return; + + MagicBoxService.init().setOrder(order, new MagicBoxInterface() { + @Override + public void getData(String data, Object src) { + super.getData(data, src); + MagicBoxService.init().clearOrder(); + notRootInstallStart(modInterface,true); + } + }); + }catch (Exception e){ + e.printStackTrace(); + modInterface.onAction(false,0); } - order.put("action","copy"); - order.put("args",new String[]{srcs.get(i).getAbsolutePath(),"files:" + paths.get(i).replace("/files/","")+srcs.get(i).getName()}); - i++; - MagicBoxService.init().setOrder(order, data2 -> {//再安装 - MagicBoxService.init().clearOrder(); - notRootInstallStart(modInterface,true); - }); - }catch (Exception e){ - e.printStackTrace(); - modInterface.onAction(false,0); } }); diff --git a/app/src/main/java/com/yutou/jianr_mg/Tools/Utils.java b/app/src/main/java/com/yutou/jianr_mg/Tools/Utils.java index 232a99b..5f5b4a5 100644 --- a/app/src/main/java/com/yutou/jianr_mg/Tools/Utils.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/Utils.java @@ -89,7 +89,7 @@ public class Utils { } public static String getAppPath() { - String path = Application.application.getFilesDir() + "/jianRMG"; + String path = Application.application.getExternalFilesDir("") + "/jianRMG"; return path; } @@ -269,7 +269,6 @@ public class Utils { List packages = context.getPackageManager().getInstalledPackages(0); for (PackageInfo info : packages) { - System.out.println("被检测的包名:" + packName + " 当前包名:" + info.packageName); if (info.packageName.equals(packName)) { return true; } diff --git a/app/src/main/java/com/yutou/jianr_mg/services/MagicBoxService.java b/app/src/main/java/com/yutou/jianr_mg/services/MagicBoxService.java index 602b952..1704eb7 100644 --- a/app/src/main/java/com/yutou/jianr_mg/services/MagicBoxService.java +++ b/app/src/main/java/com/yutou/jianr_mg/services/MagicBoxService.java @@ -19,7 +19,9 @@ import org.json.JSONObject; import java.io.File; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Timer; import java.util.TimerTask; @@ -28,9 +30,7 @@ import Interfaces.MagicBoxInterface; import static android.content.Context.BIND_AUTO_CREATE; public class MagicBoxService { - private JSONObject order = null; private static MagicBoxService magicBoxService = null; - private MagicBoxInterface magicBoxInterface; private JSONObject dealNode, getWarResult; private boolean isClose = true, saveData = false; private String dataType, dataName; @@ -82,23 +82,26 @@ public class MagicBoxService { cancel(); return; } - if (order != null && !order.isNull("action")) { - try { - System.out.println("提交参数 action:" + order.getString("action") + " args:" + JSON.toJSONString(order.get("args"))); - } catch (Exception ignored) { - } - try { - if (order.getString("action").equals("getVersion")) { - magicBoxInterface.getData(boxBinder.getVersion() + ""); - } else { - magicBoxInterface.getData(boxBinder.action_remote(order.getString("action"), (String[]) order.get("args"))); + List> tmpList=new ArrayList<>(); + for (Map map : list) { + tmpList.add(map); + JSONObject order=map.keySet().iterator().next(); + MagicBoxInterface magicBoxInterface=map.get(order); + if(!order.isNull("action")){ + try { + if (order.getString("action").equals("getVersion")) { + magicBoxInterface.getData(boxBinder.getVersion() + ""); + } else { + String[] args=(String[]) order.get("args"); + System.out.println("执行:"+order.getString("action")+" "+args[0]+" > "+args[1]); + magicBoxInterface.getData(boxBinder.action_remote(order.getString("action"),args ),order); + } + }catch (Exception e){ + e.printStackTrace(); } - } catch (Exception e) { - Application.application.unbindService(connection); - isClose = true; - cancel(); } } + list.removeAll(tmpList); try { String str = boxBinder.action_remote("getLastLog", new String[]{"DealNode"}); if (str != null) { @@ -151,7 +154,6 @@ public class MagicBoxService { e.printStackTrace(); } - order = null; } }, 0, 500); } @@ -180,13 +182,14 @@ public class MagicBoxService { e.printStackTrace(); } } - + private List> list=new ArrayList<>(); public void setOrder(JSONObject order, MagicBoxInterface boxInterface) { if (isClose) { initMagicBox(); } - this.order = order; - this.magicBoxInterface = boxInterface; + Map map=new HashMap<>(); + map.put(order,boxInterface); + list.add(map); } private List interfaces; public void addInterface(MagicBoxInterface magicBoxInterface){ @@ -198,7 +201,7 @@ public class MagicBoxService { } public void clearOrder() { - order = null; + } public JSONObject getDealNode() { diff --git a/app/src/main/java/com/yutou/jianr_mg/services/WindowsService.java b/app/src/main/java/com/yutou/jianr_mg/services/WindowsService.java index 6e3375d..cd6a265 100644 --- a/app/src/main/java/com/yutou/jianr_mg/services/WindowsService.java +++ b/app/src/main/java/com/yutou/jianr_mg/services/WindowsService.java @@ -48,6 +48,8 @@ import java.util.List; import java.util.Timer; import java.util.TimerTask; +import Interfaces.MagicBoxInterface; + import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; public class WindowsService extends Service { @@ -144,20 +146,16 @@ public class WindowsService extends Service { try { JSONObject json = new JSONObject(); json.put("action", "getVersion"); - boxService.setOrder(json, data -> { - boxService.clearOrder(); - isRuntime = true; + boxService.setOrder(json, new MagicBoxInterface() { + @Override + public void getData(String data) { + super.getData(data); + boxService.clearOrder(); + isRuntime = true; + } }); if(listener) { listener=false; - boxService.setOnListener(data -> { - try{ - JSONObject jdata=new JSONObject(data); - //保留,还不知道干啥用 - }catch (Exception e){ - e.printStackTrace(); - } - }); } handler.post(() -> { if (isRuntime) {