更新广点通
修复安装mod问题 备份mod还有问题
This commit is contained in:
parent
6ba724c96e
commit
30e527d6f2
@ -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'
|
||||
}
|
||||
|
Binary file not shown.
BIN
app/libs/GDTSDK.unionNormal.4.176.1046.aar
Normal file
BIN
app/libs/GDTSDK.unionNormal.4.176.1046.aar
Normal file
Binary file not shown.
Binary file not shown.
@ -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){};
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
@ -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";
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -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<PackageInfo> packages = context.getPackageManager().getInstalledPackages(0);
|
||||
for (PackageInfo info : packages) {
|
||||
System.out.println("被检测的包名:" + packName + " 当前包名:" + info.packageName);
|
||||
if (info.packageName.equals(packName)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -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<Map<JSONObject, MagicBoxInterface>> tmpList=new ArrayList<>();
|
||||
for (Map<JSONObject, MagicBoxInterface> 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<Map<JSONObject,MagicBoxInterface>> list=new ArrayList<>();
|
||||
public void setOrder(JSONObject order, MagicBoxInterface boxInterface) {
|
||||
if (isClose) {
|
||||
initMagicBox();
|
||||
}
|
||||
this.order = order;
|
||||
this.magicBoxInterface = boxInterface;
|
||||
Map<JSONObject,MagicBoxInterface> map=new HashMap<>();
|
||||
map.put(order,boxInterface);
|
||||
list.add(map);
|
||||
}
|
||||
private List<MagicBoxInterface> interfaces;
|
||||
public void addInterface(MagicBoxInterface magicBoxInterface){
|
||||
@ -198,7 +201,7 @@ public class MagicBoxService {
|
||||
}
|
||||
|
||||
public void clearOrder() {
|
||||
order = null;
|
||||
|
||||
}
|
||||
|
||||
public JSONObject getDealNode() {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user