2.4
发版前更新 新增悬浮窗设置选项
This commit is contained in:
@@ -17,6 +17,7 @@ import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.jianrmod.plugins.harmony.Log;
|
||||
import com.jianrmod.plugins.harmony.Tools.ClientUttls;
|
||||
import com.jianrmod.plugins.harmony.Tools.HttpInterface;
|
||||
import com.jianrmod.plugins.harmony.Tools.HttpTools;
|
||||
@@ -162,7 +163,7 @@ public class MainActivity implements BaseActivityInterface {
|
||||
Toast.makeText(context,"网络请求失败,1秒钟后再试试",Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
System.out.println("httpData:"+httpData);
|
||||
Log.i("httpData:"+httpData);
|
||||
hud.show();
|
||||
final File file = new File(Utils.getAppPath(context) + "/harmony/");
|
||||
if(!file.exists()){
|
||||
@@ -175,28 +176,28 @@ public class MainActivity implements BaseActivityInterface {
|
||||
return;
|
||||
}
|
||||
File xml = new File(file.getAbsolutePath() + "/Cocos2dxPrefsFile.xml");
|
||||
System.out.println(xml.getAbsoluteFile());
|
||||
Log.i(xml.getAbsoluteFile().getAbsolutePath());
|
||||
if (xml.exists()) {
|
||||
ClientUttls.install(context, xml, "../shared_prefs/", new ModInterface() {
|
||||
@Override
|
||||
public void onAction(boolean flag, int type) {
|
||||
System.out.println("处理xml:" + flag);
|
||||
Log.i("处理xml:" + flag);
|
||||
if (flag) {
|
||||
for (File listFile : file.listFiles()) {
|
||||
System.out.println("处理文件:" + listFile.getAbsolutePath());
|
||||
Log.i("处理文件:" + listFile.getAbsolutePath());
|
||||
if (listFile.getName().endsWith(".zip")) {
|
||||
File path;
|
||||
if (siwtch.isChecked()) {
|
||||
path = new File(Utils.getSDCardPath(context) + "/Android/data/com.huanmeng.zhanjian2/"+httpData);
|
||||
System.out.println("操作对象:覆盖版");
|
||||
Log.i("操作对象:覆盖版");
|
||||
} else {
|
||||
path = new File(Utils.getSDCardPath(context) + "/Android/data/com.bigzhao.jianrmagicbox/"+httpData);
|
||||
System.out.println("操作对象:共存版");
|
||||
Log.i("操作对象:共存版");
|
||||
}
|
||||
if (!path.exists()) {
|
||||
path.mkdirs();
|
||||
}
|
||||
System.out.println("准备处理zip");
|
||||
Log.i("准备处理zip");
|
||||
ZipUtils.unzip(listFile, path.getAbsolutePath(), hud);
|
||||
break;
|
||||
}
|
||||
|
||||
61
harmony/src/main/java/com/jianrmod/plugins/harmony/Log.java
Normal file
61
harmony/src/main/java/com/jianrmod/plugins/harmony/Log.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package com.jianrmod.plugins.harmony;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* Created by 58381 on 2018/1/20.
|
||||
*/
|
||||
|
||||
public class Log {
|
||||
private static final boolean LOG=true;
|
||||
/**
|
||||
* 错误输出
|
||||
* @param str 正文
|
||||
*/
|
||||
public static void e(String str) {
|
||||
if(LOG)
|
||||
System.err.println(str);
|
||||
}
|
||||
/**
|
||||
* 普通输出
|
||||
* @param str 正文
|
||||
*/
|
||||
public static void i(String str) {
|
||||
if(LOG)
|
||||
Log.i(str);
|
||||
}
|
||||
/**
|
||||
* 错误输出带标题
|
||||
* @param title 标题
|
||||
* @param str 正文
|
||||
*/
|
||||
public static void e(String title,String str) {
|
||||
if(LOG)
|
||||
System.err.println("["+title+"]"+str);
|
||||
}
|
||||
/**
|
||||
* 普通输出带标题
|
||||
* @param title 标题
|
||||
* @param str 正文
|
||||
*/
|
||||
public static void i(String title,String str) {
|
||||
if(LOG)
|
||||
Log.i("["+title+"]"+str);
|
||||
|
||||
}
|
||||
/**
|
||||
* 异常输出
|
||||
* @param e 异常
|
||||
* @param object 异常所在的类
|
||||
* @return
|
||||
*/
|
||||
public static String e(Exception e,Object object) {
|
||||
StringWriter writer=new StringWriter();
|
||||
PrintWriter printWriter=new PrintWriter(writer);
|
||||
e.printStackTrace(printWriter);
|
||||
if(LOG)
|
||||
System.err.println("["+object.getClass().getName()+"]"+writer.toString());
|
||||
return "["+object.getClass().getName()+"]"+writer.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jianrmod.plugins.harmony.Tools;
|
||||
|
||||
import com.jianrmod.plugins.harmony.Log;
|
||||
import com.kaopiz.kprogresshud.KProgressHUD;
|
||||
|
||||
import com.zip4j.core.ZipFile;
|
||||
@@ -20,7 +21,7 @@ public class ZipUtils {
|
||||
descDirPath.mkdirs();
|
||||
}
|
||||
|
||||
System.out.println("文件:" + zipFile.exists());
|
||||
Log.i("文件:" + zipFile.exists());
|
||||
try {
|
||||
final ZipFile _zipFile = new ZipFile(zipFile);
|
||||
_zipFile.setFileNameCharset("GBK"); //设置编码格式(支持中文)
|
||||
|
||||
Reference in New Issue
Block a user