发版前更新
新增悬浮窗设置选项
This commit is contained in:
Yutousama 2020-04-01 18:00:52 +08:00
parent 458206ae23
commit 8e5775b45b
36 changed files with 384 additions and 168 deletions

View File

@ -8,7 +8,7 @@ android {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 2 versionCode 2
versionName "2.3" versionName "2.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk { ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips" abiFilters "armeabi", "armeabi-v7a", "x86", "mips"

View File

@ -25,6 +25,7 @@ import com.yutou.jianr_mg.Data.ShipEquipmnt;
import com.yutou.jianr_mg.Data.TeamData; import com.yutou.jianr_mg.Data.TeamData;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.JianRUtils; import com.yutou.jianr_mg.Tools.JianRUtils;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils; import com.yutou.jianr_mg.Tools.Utils;
import java.util.List; import java.util.List;
@ -99,22 +100,22 @@ public class MagicTeamDataAdapter extends BaseAdapter {
if (Float.valueOf(data.getHp()) > (Float.valueOf(data.getHpMax()) / 2)) { if (Float.valueOf(data.getHp()) > (Float.valueOf(data.getHpMax()) / 2)) {
ClipDrawable d = new ClipDrawable(new ColorDrawable(Color.DKGRAY), Gravity.START, ClipDrawable.HORIZONTAL); ClipDrawable d = new ClipDrawable(new ColorDrawable(Color.DKGRAY), Gravity.START, ClipDrawable.HORIZONTAL);
item.hpBar.setProgressDrawable(d); item.hpBar.setProgressDrawable(d);
System.out.println(data.getTitle()+"设置颜色:绿色"+data.getHp()+"/"+data.getHpMax()); Log.i(data.getTitle()+"设置颜色:绿色"+data.getHp()+"/"+data.getHpMax());
} else if (Float.valueOf(data.getHp()) < (Float.valueOf(data.getHpMax()) / 2)&&Float.valueOf(data.getHp()) >= (Float.valueOf(data.getHpMax()) / 2/ 2)) { } else if (Float.valueOf(data.getHp()) < (Float.valueOf(data.getHpMax()) / 2)&&Float.valueOf(data.getHp()) >= (Float.valueOf(data.getHpMax()) / 2/ 2)) {
ClipDrawable d = new ClipDrawable(new ColorDrawable(Color.YELLOW), Gravity.START, ClipDrawable.HORIZONTAL); ClipDrawable d = new ClipDrawable(new ColorDrawable(Color.YELLOW), Gravity.START, ClipDrawable.HORIZONTAL);
item.hpBar.setProgressDrawable(d); item.hpBar.setProgressDrawable(d);
System.out.println(data.getTitle()+"设置颜色:黄色"+data.getHp()+"/"+data.getHpMax()); Log.i(data.getTitle()+"设置颜色:黄色"+data.getHp()+"/"+data.getHpMax());
} else if (Float.valueOf(data.getHp()) < (Float.valueOf(data.getHpMax()) / 2/ 2) ) { } else if (Float.valueOf(data.getHp()) < (Float.valueOf(data.getHpMax()) / 2/ 2) ) {
ClipDrawable d = new ClipDrawable(new ColorDrawable(Color.RED), Gravity.START, ClipDrawable.HORIZONTAL); ClipDrawable d = new ClipDrawable(new ColorDrawable(Color.RED), Gravity.START, ClipDrawable.HORIZONTAL);
item.hpBar.setProgressDrawable(d); item.hpBar.setProgressDrawable(d);
System.out.println(data.getTitle()+"设置颜色:红色"+data.getHp()+"/"+data.getHpMax()); Log.i(data.getTitle()+"设置颜色:红色"+data.getHp()+"/"+data.getHpMax());
}else{ }else{
System.out.println("没有设置颜色"); Log.i("没有设置颜色");
} }
if(data.getTitle().equals("")){ if(data.getTitle().equals("")){
item.hpBar.setMax(100); item.hpBar.setMax(100);
item.hpBar.setProgress(86); item.hpBar.setProgress(86);
System.out.println("赤城的参数"+getHp(data.getHp(),data.getHpMax())+" "+(Float.valueOf(data.getHp()) > (Float.valueOf(data.getHpMax()) / 2))); Log.i("赤城的参数"+getHp(data.getHp(),data.getHpMax())+" "+(Float.valueOf(data.getHp()) > (Float.valueOf(data.getHpMax()) / 2)));
}else }else
item.hpBar.setProgress((int) getHp(data.getHp(),data.getHpMax())); item.hpBar.setProgress((int) getHp(data.getHp(),data.getHpMax()));
@ -280,7 +281,7 @@ public class MagicTeamDataAdapter extends BaseAdapter {
msg.append(equipmnt.getDesc()); msg.append(equipmnt.getDesc());
i=msg.toString().split("\n").length; i=msg.toString().split("\n").length;
textView.setText(msg.toString()); textView.setText(msg.toString());
// System.out.println(equipmnt.toString()); // Log.i(equipmnt.toString());
}else{ }else{
textView.setText("Not Equipmnt Info"); textView.setText("Not Equipmnt Info");
} }

View File

@ -12,6 +12,7 @@ import com.yutou.jianr_mg.Data.AppData;
import com.yutou.jianr_mg.Data.MAppTools; import com.yutou.jianr_mg.Data.MAppTools;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.JianRUtils; import com.yutou.jianr_mg.Tools.JianRUtils;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils; import com.yutou.jianr_mg.Tools.Utils;
import com.yutou.jianr_mg.views.BaseActivity; import com.yutou.jianr_mg.views.BaseActivity;
@ -78,13 +79,13 @@ public class MainUtilsAdapter extends RecyclerAdapter<MAppTools> {
getContext().startService(intent); getContext().startService(intent);
break; break;
case "localActivity": case "localActivity":
System.out.println("数据:" + data.toString()); Log.i("数据:" + data.toString());
intent = new Intent(getContext(), BaseActivity.class); intent = new Intent(getContext(), BaseActivity.class);
intent.putExtra("activityName", main); intent.putExtra("activityName", main);
intent.putExtra("jar", data.getUrl().split("/")[data.getUrl().split("/").length - 1]); intent.putExtra("jar", data.getUrl().split("/")[data.getUrl().split("/").length - 1]);
intent.putExtra("name", data.getName()); intent.putExtra("name", data.getName());
intent.putExtra("url", data.getUrl()); intent.putExtra("url", data.getUrl());
System.out.println("插件数据:" + data.getUrl().split("/")[data.getUrl().split("/").length - 1]); Log.i("插件数据:" + data.getUrl().split("/")[data.getUrl().split("/").length - 1]);
if (data.getParameter() != null) { if (data.getParameter() != null) {
intent.putExtra("parameter", data.getParameter()); intent.putExtra("parameter", data.getParameter());
} }

View File

@ -51,7 +51,7 @@ public class Application extends android.app.Application {
super.onCreate(); super.onCreate();
Application.application = this; Application.application = this;
// BlockCanary.install(this, new AppBlockCanaryContext()).start(); // BlockCanary.install(this, new AppBlockCanaryContext()).start();
System.out.println("开始初始化"); Log.i("开始初始化");
init(); init();
initPlugs(); initPlugs();
@ -61,7 +61,7 @@ public class Application extends android.app.Application {
initTx(); initTx();
System.out.println("初始化结束"); Log.i("初始化结束");
} }
private void initUmeng() { private void initUmeng() {
@ -72,12 +72,12 @@ public class Application extends android.app.Application {
pushAgent.register(new IUmengRegisterCallback() { pushAgent.register(new IUmengRegisterCallback() {
@Override @Override
public void onSuccess(String s) { public void onSuccess(String s) {
System.out.println("友盟推送注册成功:" + s); Log.i("友盟推送注册成功:" + s);
} }
@Override @Override
public void onFailure(String s, String s1) { public void onFailure(String s, String s1) {
System.out.println("友盟推送注册失败:" + s + "(" + s1 + ")"); Log.i("友盟推送注册失败:" + s + "(" + s1 + ")");
} }
}); });
pushAgent.setMessageHandler(new UmengMessageHandler() { pushAgent.setMessageHandler(new UmengMessageHandler() {
@ -102,7 +102,7 @@ public class Application extends android.app.Application {
QbSdk.initX5Environment(this, new QbSdk.PreInitCallback() { QbSdk.initX5Environment(this, new QbSdk.PreInitCallback() {
@Override @Override
public void onCoreInitFinished() { public void onCoreInitFinished() {
System.out.println("QDSDK初始化失败"); Log.i("QDSDK初始化失败");
} }
@Override @Override
@ -131,7 +131,7 @@ public class Application extends android.app.Application {
if (file.getName().contains(".jar")) { if (file.getName().contains(".jar")) {
DexClassLoader dexClassLoader = new DexClassLoader(file.getAbsolutePath(), dex.getAbsolutePath(), null, getClassLoader()); DexClassLoader dexClassLoader = new DexClassLoader(file.getAbsolutePath(), dex.getAbsolutePath(), null, getClassLoader());
plugsin.put(file.getName(), dexClassLoader); plugsin.put(file.getName(), dexClassLoader);
System.out.println("加载插件:"+file.getName()); Log.i("加载插件:"+file.getName());
// AppData.plugsin.put(file.getName(), dexClassLoader); // AppData.plugsin.put(file.getName(), dexClassLoader);
} }
} }
@ -148,7 +148,7 @@ public class Application extends android.app.Application {
} }
String appid = (String) plugsin.get(file.getName()).loadClass("com.yutou.jianr_mg.plugins.Data").getField("appId").get(null); String appid = (String) plugsin.get(file.getName()).loadClass("com.yutou.jianr_mg.plugins.Data").getField("appId").get(null);
String md5 = Utils.getFileMD5(file); String md5 = Utils.getFileMD5(file);
System.out.println("MD5:" + md5); Log.i("MD5:" + md5);
JSONObject plugs = new JSONObject(); JSONObject plugs = new JSONObject();
plugs.put("appid", appid); plugs.put("appid", appid);
plugs.put("md5", md5); plugs.put("md5", md5);

View File

@ -8,6 +8,7 @@ import android.database.sqlite.SQLiteOpenHelper;
import com.yutou.jianr_mg.Application; import com.yutou.jianr_mg.Application;
import com.yutou.jianr_mg.Data.MGamePackname; import com.yutou.jianr_mg.Data.MGamePackname;
import com.yutou.jianr_mg.Data.TMod; import com.yutou.jianr_mg.Data.TMod;
import com.yutou.jianr_mg.Tools.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -146,7 +147,7 @@ public class ModDatabase extends SQLiteOpenHelper {
} }
cursor.close(); cursor.close();
} }
System.out.println(list.size()); Log.i(list.size()+"");
return list; return list;
} }
public int getModVersion(TMod mod){ public int getModVersion(TMod mod){

View File

@ -16,6 +16,7 @@ import com.yutou.jianr_mg.Adapters.GameDataAdapters.WarAdapter;
import com.yutou.jianr_mg.Data.AppData; import com.yutou.jianr_mg.Data.AppData;
import com.yutou.jianr_mg.Databases.JianRDataDataBase; import com.yutou.jianr_mg.Databases.JianRDataDataBase;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.Log;
import org.angmarch.views.NiceSpinner; import org.angmarch.views.NiceSpinner;
import org.json.JSONObject; import org.json.JSONObject;
@ -157,7 +158,7 @@ public class WarFragment extends Fragment {
return; return;
} }
System.out.println(">>>>>>"+item.getInt("mapId")); Log.i(">>>>>>"+item.getInt("mapId"));
if(Objects.requireNonNull(maps.get("DealNode")).getString("type").equals("DealNode")) { if(Objects.requireNonNull(maps.get("DealNode")).getString("type").equals("DealNode")) {
getItem(i, srcList); getItem(i, srcList);
} }

View File

@ -14,6 +14,7 @@ import android.widget.ListView;
import com.umeng.commonsdk.debug.W; import com.umeng.commonsdk.debug.W;
import com.yutou.jianr_mg.Fragments.GameDataFragments.WarLogFragments.Adapters.DaytimeListViewAdapter; import com.yutou.jianr_mg.Fragments.GameDataFragments.WarLogFragments.Adapters.DaytimeListViewAdapter;
import com.yutou.jianr_mg.Tools.Log;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -97,11 +98,11 @@ public class DaytimeFragment extends Fragment implements WarLogInterface{
List<WarData> list = new ArrayList<>(); List<WarData> list = new ArrayList<>();
try { try {
JSONArray nightAttacks = new JSONObject(json.getJSONObject("WarReport").getString("message")).getJSONObject("extraProgress").getJSONArray("nightAttacks"); JSONArray nightAttacks = new JSONObject(json.getJSONObject("WarReport").getString("message")).getJSONObject("extraProgress").getJSONArray("nightAttacks");
System.out.println("--------->夜战数量:"+nightAttacks.length()); Log.i("--------->夜战数量:"+nightAttacks.length());
for (int i = 0; i < nightAttacks.length(); i++) { for (int i = 0; i < nightAttacks.length(); i++) {
System.out.println(nightAttacks.getJSONObject(i)); Log.i(nightAttacks.getJSONObject(i).toString());
WarData warData=WarData.getInstance(WarData.NIGHT_WAR,nightAttacks.getJSONObject(i),warReport); WarData warData=WarData.getInstance(WarData.NIGHT_WAR,nightAttacks.getJSONObject(i),warReport);
System.out.println(warData.toString()); Log.i(warData.toString());
list.add(warData); list.add(warData);
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -19,6 +19,7 @@ import com.yutou.jianr_mg.Interfaces.HttpInterface;
import com.yutou.jianr_mg.Network.HttpApi; import com.yutou.jianr_mg.Network.HttpApi;
import com.yutou.jianr_mg.Network.HttpUtils; import com.yutou.jianr_mg.Network.HttpUtils;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.Log;
import org.json.JSONObject; import org.json.JSONObject;
@ -143,7 +144,7 @@ public class UtilsFragments extends Fragment {
} }
} }
private void setData() { private void setData() {
System.out.println(datas.size()); Log.i(datas.size()+"");
if(datas.size()>0){ if(datas.size()>0){
adapter.addAll(datas); adapter.addAll(datas);
recyclerView.dismissSwipeRefresh(); recyclerView.dismissSwipeRefresh();

View File

@ -79,7 +79,7 @@ public class LoadingActivity extends AppCompatActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
AppData.debug=true; AppData.debug=true;
System.out.println("update"); Log.i("update");
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN); WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_loading); setContentView(R.layout.activity_loading);
@ -435,7 +435,7 @@ public class LoadingActivity extends AppCompatActivity {
if (requestCode == AppPermissions.REQUEST_CODE) { if (requestCode == AppPermissions.REQUEST_CODE) {
for (String permission : AppPermissions.permissions) { for (String permission : AppPermissions.permissions) {
if (ActivityCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {
System.out.println(permission); Log.i(permission);
flag = false; flag = false;
break; break;
} }

View File

@ -9,7 +9,7 @@ public class HttpApi {
// public static final String HOME = "http://192.168.31.92:8080/"; //zzz_gz wifi // 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.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.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 HOME_URL=HOME+"android/"; //服务器
public static final String MOD_ALL = "mod/all.do"; public static final String MOD_ALL = "mod/all.do";

View File

@ -148,7 +148,7 @@ public class HttpUtils {
while (!downloadFileInerface.downloading(getNameFromUrl(url), progress, total)) { while (!downloadFileInerface.downloading(getNameFromUrl(url), progress, total)) {
Thread.sleep(10); Thread.sleep(10);
} }
System.out.println("下载:" + progress); Log.i("下载:" + progress);
} }
fos.flush(); fos.flush();
// 下载完成 // 下载完成

View File

@ -28,7 +28,7 @@ public class ExcelUtils {
bundle.putString("filePath", file.getAbsolutePath()); bundle.putString("filePath", file.getAbsolutePath());
bundle.putString("tempPath", Utils.getAppPath()+ "/" + "TbsReaderTemp"); bundle.putString("tempPath", Utils.getAppPath()+ "/" + "TbsReaderTemp");
boolean flag= tbs.preOpen("xlsx", false); boolean flag= tbs.preOpen("xlsx", false);
System.out.println("打开文件:"+flag); Log.i("打开文件:"+flag);
tbs.openFile(bundle); tbs.openFile(bundle);
} }
public void close(){ public void close(){

View File

@ -127,7 +127,7 @@ public class JianRUtils {
public static List<TeamData> getNightUserTeam(JSONObject json) { public static List<TeamData> getNightUserTeam(JSONObject json) {
List<TeamData> data = getUserTeam(json); List<TeamData> data = getUserTeam(json);
System.out.println("用户数量:" + data.size()); Log.i("用户数量:" + data.size());
try { try {
JSONObject warRepoot = json.getJSONObject("warResult"); JSONObject warRepoot = json.getJSONObject("warResult");
JSONArray selfShips = warRepoot.getJSONArray("selfShipResults"); JSONArray selfShips = warRepoot.getJSONArray("selfShipResults");
@ -148,11 +148,11 @@ public class JianRUtils {
try { try {
JSONObject warRepoot = json.getJSONObject("warResult"); JSONObject warRepoot = json.getJSONObject("warResult");
JSONArray selfShips = warRepoot.getJSONArray("enemyShipResults"); JSONArray selfShips = warRepoot.getJSONArray("enemyShipResults");
System.out.println("血量参数:" + selfShips.length()); Log.i("血量参数:" + selfShips.length());
for (int i = 0; i < selfShips.length(); i++) { for (int i = 0; i < selfShips.length(); i++) {
JSONObject js = selfShips.getJSONObject(i); JSONObject js = selfShips.getJSONObject(i);
System.out.println("敌方血量:" + js.getInt("hp")); Log.i("敌方血量:" + js.getInt("hp"));
System.out.println("敌方数量:" + data.size()); Log.i("敌方数量:" + data.size());
TeamData ut = data.get(i); TeamData ut = data.get(i);
ut.setHp(js.getInt("hp") + ""); ut.setHp(js.getInt("hp") + "");
data.set(i, ut); data.set(i, ut);
@ -211,7 +211,7 @@ public class JianRUtils {
JianNiang jianNiang = JSON.parseObject(json.toString(), JianNiang.class); JianNiang jianNiang = JSON.parseObject(json.toString(), JianNiang.class);
jianNiangs.add(jianNiang); jianNiangs.add(jianNiang);
} }
System.out.println("缓存舰娘数:" + jianNiangs.size()); Log.i("缓存舰娘数:" + jianNiangs.size());
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -273,7 +273,7 @@ public class JianRUtils {
ShipEquipmnt jianNiang = JSON.parseObject(json.toString(), ShipEquipmnt.class); ShipEquipmnt jianNiang = JSON.parseObject(json.toString(), ShipEquipmnt.class);
equipmnts.add(jianNiang); equipmnts.add(jianNiang);
} }
System.out.println("缓存装备数:" + equipmnts.size()); Log.i("缓存装备数:" + equipmnts.size());
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -23,7 +23,7 @@ public class Log {
*/ */
public static void i(String str) { public static void i(String str) {
if(LOG) if(LOG)
System.out.println(str); System.out.println(str);
} }
/** /**
* 错误输出带标题 * 错误输出带标题
@ -41,7 +41,7 @@ public class Log {
*/ */
public static void i(String title,String str) { public static void i(String title,String str) {
if(LOG) if(LOG)
System.out.println("["+title+"]"+str); Log.i("["+title+"]"+str);
} }
/** /**

View File

@ -61,7 +61,7 @@ public class ModUtils {
private TMod mod; private TMod mod;
public static ModUtils init(Context context) { public static ModUtils init(Context context) {
System.out.println("调用魔改管理器"); Log.i("调用魔改管理器");
try { try {
if (modUtils == null) { if (modUtils == null) {
modUtils = new ModUtils(); modUtils = new ModUtils();
@ -271,7 +271,7 @@ public class ModUtils {
public void getData(String data,Object src) { public void getData(String data,Object src) {
JSONObject json= (JSONObject) src; JSONObject json= (JSONObject) src;
try { try {
System.out.println(">>>>"+((String[])json.get("args"))[0]); Log.i(">>>>"+((String[])json.get("args"))[0]);
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -86,7 +86,7 @@ public class RootUtils {
println("chmod +x" + Application.application.getFilesDir() + "/files/busybox"); println("chmod +x" + Application.application.getFilesDir() + "/files/busybox");
isBusyBox=tmp; isBusyBox=tmp;
} }
System.out.println("尝试获取ROOT权限"); Log.i("尝试获取ROOT权限");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -118,7 +118,7 @@ public class RootUtils {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
result = localProcess.waitFor(500, TimeUnit.MILLISECONDS); result = localProcess.waitFor(500, TimeUnit.MILLISECONDS);
}else{ }else{
System.out.println("b"); Log.i("b");
resultCode=localProcess.waitFor(); resultCode=localProcess.waitFor();
} }
localDataOutputStream.close(); localDataOutputStream.close();

View File

@ -119,7 +119,7 @@ public class SocketTools {
dialog.dismiss(); dialog.dismiss();
new Thread(() -> { new Thread(() -> {
try { try {
System.out.println("地址:"+editText.getText().toString()+" 端口:2336"); Log.i("地址:"+editText.getText().toString()+" 端口:2336");
Socket socket=new Socket(editText.getText().toString().trim(),2336); Socket socket=new Socket(editText.getText().toString().trim(),2336);
linkService(socket); linkService(socket);
@ -144,9 +144,9 @@ public class SocketTools {
KProgressHUD dhud=Utils.showLoading(context,null,"传输中"); KProgressHUD dhud=Utils.showLoading(context,null,"传输中");
dhud.show(); dhud.show();
new Thread(() -> { new Thread(() -> {
System.out.println("开始传输:"); Log.i("开始传输:");
linkService(socket); linkService(socket);
System.out.println("传输完毕"); Log.i("传输完毕");
AppData.handler.post(()->{dhud.dismiss();dialog.dismiss();}); AppData.handler.post(()->{dhud.dismiss();dialog.dismiss();});
dhud.dismiss(); dhud.dismiss();
}).start(); }).start();
@ -233,7 +233,7 @@ public class SocketTools {
baos.flush(); baos.flush();
String tmp = baos.toString(); String tmp = baos.toString();
baos.close(); baos.close();
System.out.println(tmp); Log.i(tmp);
if (tmp.equals("ok")) { if (tmp.equals("ok")) {
flag = false; flag = false;
AppData.handler.post(()->hud.dismiss()); AppData.handler.post(()->hud.dismiss());
@ -280,7 +280,7 @@ public class SocketTools {
// TODO: handle exception // TODO: handle exception
} }
} }
System.out.println("保存路径:"+file.getAbsolutePath()); Log.i("保存路径:"+file.getAbsolutePath());
Utils.Base64Decode(sb.toString(), file); Utils.Base64Decode(sb.toString(), file);
AppData.handler.post(()->{hud.dismiss();Utils.toast(context,"重启盒子生效");}); AppData.handler.post(()->{hud.dismiss();Utils.toast(context,"重启盒子生效");});
} catch (Exception e) { } catch (Exception e) {

View File

@ -20,7 +20,7 @@ public class ZipUtils {
if (!descDirPath.exists()) { if (!descDirPath.exists()) {
descDirPath.mkdirs(); descDirPath.mkdirs();
} }
System.out.println("文件:" + zipFile.exists()); Log.i("文件:" + zipFile.exists());
try { try {
ZipFile _zipFile = new ZipFile(zipFile); ZipFile _zipFile = new ZipFile(zipFile);
//_zipFile.setFileNameCharset("GBK"); //设置编码格式支持中文 //_zipFile.setFileNameCharset("GBK"); //设置编码格式支持中文

View File

@ -11,6 +11,7 @@ import com.yutou.jianr_mg.Application;
import com.yutou.jianr_mg.Data.AppData; import com.yutou.jianr_mg.Data.AppData;
import com.yutou.jianr_mg.Databases.JianRDataDataBase; import com.yutou.jianr_mg.Databases.JianRDataDataBase;
import com.yutou.jianr_mg.Tools.JianRUtils; import com.yutou.jianr_mg.Tools.JianRUtils;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils; import com.yutou.jianr_mg.Tools.Utils;
import com.yutou.jianr_mg.views.WarView; import com.yutou.jianr_mg.views.WarView;
@ -49,7 +50,7 @@ public class MagicBoxService {
public static MagicBoxService init() { public static MagicBoxService init() {
JianRUtils.readClientVersionIsbigzhao(Application.application); JianRUtils.readClientVersionIsbigzhao(Application.application);
if (!Utils.getApplicationPackName(Application.application, AppData.magicPackageName)) { if (!Utils.getApplicationPackName(Application.application, AppData.magicPackageName)) {
System.out.println("没有安装客户端"); Log.i("没有安装客户端");
return null; return null;
} }
if (magicBoxService == null) { if (magicBoxService == null) {
@ -61,14 +62,14 @@ public class MagicBoxService {
private ServiceConnection connection; private ServiceConnection connection;
private void initMagicBox() { private void initMagicBox() {
System.out.println("绑定大钊客户端"); Log.i("绑定大钊客户端");
isClose = false; isClose = false;
connection = new ServiceConnection() { connection = new ServiceConnection() {
JianRDataDataBase dataBase; JianRDataDataBase dataBase;
@Override @Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) { public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
System.out.println("链接大钊客户端"); Log.i("链接大钊客户端");
if (!Utils.testStringIsNull(dataName, dataType)) { if (!Utils.testStringIsNull(dataName, dataType)) {
dataBase = JianRDataDataBase.init(); dataBase = JianRDataDataBase.init();
} }
@ -78,7 +79,7 @@ public class MagicBoxService {
@Override @Override
public void run() { public void run() {
if (isClose) { if (isClose) {
System.out.println("关闭连接"); Log.i("关闭连接");
cancel(); cancel();
return; return;
} }
@ -93,7 +94,7 @@ public class MagicBoxService {
magicBoxInterface.getData(boxBinder.getVersion() + ""); magicBoxInterface.getData(boxBinder.getVersion() + "");
} else { } else {
String[] args=(String[]) order.get("args"); String[] args=(String[]) order.get("args");
System.out.println("执行:"+order.getString("action")+" "+args[0]+" > "+args[1]); Log.i("执行:"+order.getString("action")+" "+args[0]+" > "+args[1]);
magicBoxInterface.getData(boxBinder.action_remote(order.getString("action"),args ),order); magicBoxInterface.getData(boxBinder.action_remote(order.getString("action"),args ),order);
} }
}catch (Exception e){ }catch (Exception e){
@ -148,8 +149,8 @@ public class MagicBoxService {
boxInterface.getData(json2.toString()); boxInterface.getData(json2.toString());
} }
} }
// System.out.println("str = "+str); // Log.i("str = "+str);
// System.out.println("str2 = "+str2); // Log.i("str2 = "+str2);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -160,7 +161,7 @@ public class MagicBoxService {
@Override @Override
public void onServiceDisconnected(ComponentName componentName) { public void onServiceDisconnected(ComponentName componentName) {
System.out.println("大钊客户端连接失败:" + componentName.flattenToString()); Log.i("大钊客户端连接失败:" + componentName.flattenToString());
isClose = true; isClose = true;
} }
}; };
@ -177,7 +178,7 @@ public class MagicBoxService {
intent.setAction(com.bigzhao.jianrmagicbox.IMagicBoxBinder.ACTION_SERVICE); intent.setAction(com.bigzhao.jianrmagicbox.IMagicBoxBinder.ACTION_SERVICE);
intent.setPackage(AppData.magicPackageName); intent.setPackage(AppData.magicPackageName);
boolean tmp = Application.application.bindService(intent, connection, BIND_AUTO_CREATE); boolean tmp = Application.application.bindService(intent, connection, BIND_AUTO_CREATE);
System.out.println("重新绑定结果:" + tmp); Log.i("重新绑定结果:" + tmp);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -13,9 +13,11 @@ import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.provider.Settings; import android.provider.Settings;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintLayout;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -36,6 +38,7 @@ import android.widget.SeekBar;
import com.yutou.jianr_mg.Data.AppData; import com.yutou.jianr_mg.Data.AppData;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.ExcelUtils; import com.yutou.jianr_mg.Tools.ExcelUtils;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils; import com.yutou.jianr_mg.Tools.Utils;
import com.yutou.jianr_mg.views.ExcelActivity; import com.yutou.jianr_mg.views.ExcelActivity;
import com.yutou.jianr_mg.views.WarView; import com.yutou.jianr_mg.views.WarView;
@ -65,8 +68,8 @@ public class WindowsService extends Service {
private ExcelUtils excel; private ExcelUtils excel;
private File excelFile; private File excelFile;
private Context context; private Context context;
private boolean input_flag = false,saveData=false; private boolean input_flag = false, saveData = false;
private String dataType,dataName; private String dataType, dataName;
private WarView warView; private WarView warView;
private class MyBinder extends Binder { private class MyBinder extends Binder {
@ -87,9 +90,9 @@ public class WindowsService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) { public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null) { if (intent != null) {
saveData = intent.getBooleanExtra("saveData", false); saveData = intent.getBooleanExtra("saveData", false);
dataName=intent.getStringExtra("dataName"); dataName = intent.getStringExtra("dataName");
dataType=intent.getStringExtra("dataType"); dataType = intent.getStringExtra("dataType");
System.out.println("接收到配置,开关 = "+saveData+" name = "+dataName+" type = "+dataType); Log.i("接收到配置,开关 = " + saveData + " name = " + dataName + " type = " + dataType);
} }
return super.onStartCommand(intent, flags, startId); return super.onStartCommand(intent, flags, startId);
@ -99,10 +102,10 @@ public class WindowsService extends Service {
@Override @Override
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
System.out.println("触发悬浮窗"); Log.i("触发悬浮窗");
context = WindowsService.this; context = WindowsService.this;
handler = new Handler(); handler = new Handler();
warView=new WarView(context,null,webW,handler); warView = new WarView(context, null, webW, handler);
try { try {
SharedPreferences sp = getSharedPreferences(ExcelActivity.excelName, MODE_PRIVATE); SharedPreferences sp = getSharedPreferences(ExcelActivity.excelName, MODE_PRIVATE);
excelFile = new File(sp.getString("default", "null.xlsx")); excelFile = new File(sp.getString("default", "null.xlsx"));
@ -132,7 +135,8 @@ public class WindowsService extends Service {
timer = new Timer(); timer = new Timer();
timer.schedule(new TimerTask() { timer.schedule(new TimerTask() {
boolean isRuntime = false; boolean isRuntime = false;
boolean listener=true; boolean listener = true;
@Override @Override
public void run() { public void run() {
MagicBoxService boxService = MagicBoxService.init(); MagicBoxService boxService = MagicBoxService.init();
@ -140,8 +144,8 @@ public class WindowsService extends Service {
Utils.toast(context, "未安装专用客户端,部分功能将无法使用"); Utils.toast(context, "未安装专用客户端,部分功能将无法使用");
cancel(); cancel();
return; return;
}else{ } else {
boxService.setSaveData(saveData,dataName,dataType); boxService.setSaveData(saveData, dataName, dataType);
} }
try { try {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
@ -154,8 +158,8 @@ public class WindowsService extends Service {
isRuntime = true; isRuntime = true;
} }
}); });
if(listener) { if (listener) {
listener=false; listener = false;
} }
handler.post(() -> { handler.post(() -> {
if (isRuntime) { if (isRuntime) {
@ -210,10 +214,10 @@ public class WindowsService extends Service {
Utils.toast(context, "专用客户端未安装(仅限共存版)"); Utils.toast(context, "专用客户端未安装(仅限共存版)");
} else { } else {
Utils.toast(context, "专用客户端未启动"); Utils.toast(context, "专用客户端未启动");
MagicBoxService service= MagicBoxService.init(); MagicBoxService service = MagicBoxService.init();
if(service!=null){ if (service != null) {
service.startService(); service.startService();
} }
} }
} }
}); });
@ -242,31 +246,33 @@ public class WindowsService extends Service {
} }
} }
private int webW=0,webH=0;
private int webW = 0, webH = 0;
private void reloadUi() { private void reloadUi() {
if(webView.getLayoutParams().width>0) { if (webView.getLayoutParams().width > 0) {
webW = webView.getLayoutParams().width; webW = webView.getLayoutParams().width;
webH = webView.getLayoutParams().height; webH = webView.getLayoutParams().height;
contextLayout.getLayoutParams().width=webW; contextLayout.getLayoutParams().width = webW;
} }
int pushSize = Utils.getPixelsFromDp(AppData.activity, 10); int pushSize = Utils.getPixelsFromDp(AppData.activity, 10);
int sideSize = Utils.getPixelsFromDp(AppData.activity, 45); int sideSize = Utils.getPixelsFromDp(AppData.activity, 45);
int webSize =contextLayout.getLayoutParams().width; int webSize = contextLayout.getLayoutParams().width;
if (side.getVisibility() == View.GONE) { if (side.getVisibility() == View.GONE) {
sideSize = 0; sideSize = 0;
} }
if (contextLayout.getVisibility() == View.GONE) { if (contextLayout.getVisibility() == View.GONE) {
webSize = 0; webSize = 0;
} }
if(webSize<0){ if (webSize < 0) {
} }
System.out.println("push size:" + pushSize); Log.i("push size:" + pushSize);
System.out.println("side size:" + sideSize); Log.i("side size:" + sideSize);
System.out.println("webs size:" + webSize); Log.i("webs size:" + webSize);
params.width =pushSize + sideSize +webSize; params.width = pushSize + sideSize + webSize;
System.out.println("悬浮窗大小:" + params.width+" push="+pushSize+" side="+sideSize+" wr="+webSize+" wit="+Utils.getMetrics(AppData.activity).widthPixels); Log.i("悬浮窗大小:" + params.width + " push=" + pushSize + " side=" + sideSize + " wr=" + webSize + " wit=" + Utils.getMetrics(AppData.activity).widthPixels);
windowManager.updateViewLayout(mainLayout, params); windowManager.updateViewLayout(mainLayout, params);
initWebUi(); initWebUi();
} }
@ -279,12 +285,12 @@ public class WindowsService extends Service {
// 横屏 // 横屏
width = metrics.widthPixels; width = metrics.widthPixels;
width = (int) (width - (width * 0.1)); width = (int) (width - (width * 0.1));
System.out.println("横屏"); Log.i("横屏");
} else { } else {
// 竖屏 // 竖屏
width = metrics.widthPixels; width = metrics.widthPixels;
width = (int) (width - (width * 0.2)); width = (int) (width - (width * 0.2));
System.out.println("竖屏"); Log.i("竖屏");
} }
webView.getLayoutParams().width = width; webView.getLayoutParams().width = width;
} }
@ -299,7 +305,7 @@ public class WindowsService extends Service {
webView.setWebViewClient(new WebViewClient() { webView.setWebViewClient(new WebViewClient() {
@Override @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
System.out.println("加载网页:" + url); Log.i("加载网页:" + url);
view.loadUrl(url); view.loadUrl(url);
return true; return true;
} }
@ -343,17 +349,22 @@ public class WindowsService extends Service {
strategy.setTag(204); strategy.setTag(204);
strategy.setOnClickListener(new ButtonOnClick()); strategy.setOnClickListener(new ButtonOnClick());
list.add(bbs); SharedPreferences winShared = this.getSharedPreferences("windowsConfig", Context.MODE_PRIVATE);
list.add(strategy); if (winShared.getBoolean("bbs", true))
list.add(address); list.add(bbs);
list.add(input); if (winShared.getBoolean("strategy", true))
list.add(strategy);
if (winShared.getBoolean("address", true))
list.add(address);
if (winShared.getBoolean("input", true))
list.add(input);
// list.add(bookmark); // list.add(bookmark);
return list; return list;
} }
private List<Button> getMagicButtons() { private List<Button> getMagicButtons() {
List<Button> list = new ArrayList<>(); List<Button> list = new ArrayList<>();
if (MagicBoxService.init() != null||true) { if (MagicBoxService.init() != null || true) {
Button map = new Button(context); Button map = new Button(context);
Button user = new Button(context); Button user = new Button(context);
Button pool = new Button(context); Button pool = new Button(context);
@ -386,10 +397,14 @@ public class WindowsService extends Service {
expedition.setOnClickListener(new ButtonOnClick()); expedition.setOnClickListener(new ButtonOnClick());
fix.setOnClickListener(new ButtonOnClick()); fix.setOnClickListener(new ButtonOnClick());
list.add(map); SharedPreferences winShared = this.getSharedPreferences("windowsConfig", Context.MODE_PRIVATE);
list.add(user); if (winShared.getBoolean("map", true))
list.add(pool); list.add(map);
list.add(build); if (winShared.getBoolean("user", true))
list.add(user);
if (winShared.getBoolean("pool", true))
list.add(pool);
//list.add(build);
//list.add(develop); //list.add(develop);
//list.add(expedition); //list.add(expedition);
//list.add(fix); //list.add(fix);
@ -426,12 +441,13 @@ public class WindowsService extends Service {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
reloadUi(); reloadUi();
} }
private void setWebUrl(String url){
handler.post(()->{ private void setWebUrl(String url) {
handler.post(() -> {
if (contextLayout.getVisibility() == View.GONE) { if (contextLayout.getVisibility() == View.GONE) {
contextLayout.setVisibility(View.VISIBLE); contextLayout.setVisibility(View.VISIBLE);
} }
if(excel!=null) { if (excel != null) {
excel.close(); excel.close();
excel = null; excel = null;
} }
@ -441,7 +457,7 @@ public class WindowsService extends Service {
} }
setView(webView); setView(webView);
reloadUi(); reloadUi();
webView.loadUrl(url); webView.loadUrl(url);
}); });
} }
@ -467,7 +483,7 @@ public class WindowsService extends Service {
bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override @Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) { public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
System.out.println("参数:" + i); Log.i("参数:" + i);
params.alpha = i; params.alpha = i;
windowManager.updateViewLayout(mainLayout, params); windowManager.updateViewLayout(mainLayout, params);
} }
@ -488,9 +504,9 @@ public class WindowsService extends Service {
.setPositiveButton("确定", (dialogInterface, i) -> dialogInterface.dismiss()).create(); .setPositiveButton("确定", (dialogInterface, i) -> dialogInterface.dismiss()).create();
dialog.getWindow().setType(params.type); dialog.getWindow().setType(params.type);
dialog.show(); dialog.show();
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
Utils.toast(context,"可能您的设备不支持调节透明度"); Utils.toast(context, "可能您的设备不支持调节透明度");
} }
break; break;
@ -503,7 +519,7 @@ public class WindowsService extends Service {
if (excel != null) { if (excel != null) {
excel.stop(); excel.stop();
} }
if(warView!=null){ if (warView != null) {
warView.close(); warView.close();
} }
stopSelf(); stopSelf();
@ -570,26 +586,26 @@ public class WindowsService extends Service {
return; return;
} }
if(excel==null){ if (excel == null) {
excel=new ExcelUtils(AppData.activity); excel = new ExcelUtils(AppData.activity);
setView(excel.getReader()); setView(excel.getReader());
excel.getReader().getLayoutParams().height=contextLayout.getLayoutParams().height; excel.getReader().getLayoutParams().height = contextLayout.getLayoutParams().height;
excel.start(excelFile); excel.start(excelFile);
} }
reloadUi(); reloadUi();
break; break;
case 100: case 100:
if(service!=null){ if (service != null) {
json=service.getDealNode(); json = service.getDealNode();
service.getGetWarResult(); service.getGetWarResult();
if(json==null) if (json == null)
return; return;
JSONObject ext=new JSONObject(json.getString("ext")); JSONObject ext = new JSONObject(json.getString("ext"));
if(ext.getString("s").equals("pve")){ if (ext.getString("s").equals("pve")) {
System.out.println("原参数:"+ext.toString()); Log.i("原参数:" + ext.toString());
String url="http://js.ntwikis.com/jsp/apps/cancollezh/maps/detailnew.jsp?detailid="+((ext.getInt("n")/100)+"").replace("0","-"); String url = "http://js.ntwikis.com/jsp/apps/cancollezh/maps/detailnew.jsp?detailid=" + ((ext.getInt("n") / 100) + "").replace("0", "-");
System.out.println("url:"+url); Log.i("url:" + url);
setWebUrl(url); setWebUrl(url);
} }
reloadUi(); reloadUi();
@ -598,20 +614,20 @@ public class WindowsService extends Service {
case 101: case 101:
if (service != null) { if (service != null) {
json = service.getDealNode(); json = service.getDealNode();
if(json==null) if (json == null)
return; return;
JSONObject ext=new JSONObject(json.getString("ext")); JSONObject ext = new JSONObject(json.getString("ext"));
System.out.println("EXT源"+ext.toString()); Log.i("EXT源" + ext.toString());
String url="http://www.jianrmod.cn/data/nodeDropInfo.html?node="+ext.getInt("n"); String url = "http://www.jianrmod.cn/data/nodeDropInfo.html?node=" + ext.getInt("n");
System.out.println("url:"+url); Log.i("url:" + url);
setWebUrl(url); setWebUrl(url);
reloadUi(); reloadUi();
} }
break; break;
case 102: case 102:
if(service!=null) { if (service != null) {
setView(warView.initView()); setView(warView.initView());
warView.update(service,webW); warView.update(service, webW);
} }
break; break;
} }

View File

@ -41,8 +41,8 @@ public class BaseActivity extends AppCompatActivity {
DexClassLoader dexClassLoader= AppData.plugsin.get(jar); DexClassLoader dexClassLoader= AppData.plugsin.get(jar);
try { try {
System.out.println("jar:"+jar); Log.i("jar:"+jar);
System.out.println("BaseActivity:"+baseActivityName); Log.i("BaseActivity:"+baseActivityName);
activityInterface= (BaseActivityInterface) dexClassLoader.loadClass(baseActivityName).newInstance(); activityInterface= (BaseActivityInterface) dexClassLoader.loadClass(baseActivityName).newInstance();
activityInterface.onCreate(savedInstanceState,main_layut,this,getIntent()); activityInterface.onCreate(savedInstanceState,main_layut,this,getIntent());
} catch (Exception e) { } catch (Exception e) {

View File

@ -16,6 +16,7 @@ import com.yutou.jianr_mg.Interfaces.HttpInterface;
import com.yutou.jianr_mg.Network.HttpApi; import com.yutou.jianr_mg.Network.HttpApi;
import com.yutou.jianr_mg.Network.HttpUtils; import com.yutou.jianr_mg.Network.HttpUtils;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.ModUtils; import com.yutou.jianr_mg.Tools.ModUtils;
import org.json.JSONArray; import org.json.JSONArray;
@ -70,7 +71,7 @@ public class DownloadListActivity extends AppCompatActivity {
for (TMod mod : mods) { for (TMod mod : mods) {
for (TMod tMod : mods_) { for (TMod tMod : mods_) {
if (tMod.getTitle().equals(mod.getTitle()) && tMod.getModversion() < mod.getModversion()) { if (tMod.getTitle().equals(mod.getTitle()) && tMod.getModversion() < mod.getModversion()) {
System.out.println(tMod.getTitle() + " " + tMod.getModversion() + " " + mod.getTitle() + " " + mod.getModversion()); Log.i(tMod.getTitle() + " " + tMod.getModversion() + " " + mod.getTitle() + " " + mod.getModversion());
title += "\n" + tMod.getTitle(); title += "\n" + tMod.getTitle();
ids.add(mod); ids.add(mod);
} }

View File

@ -17,6 +17,7 @@ import com.yutou.jianr_mg.Interfaces.DownloadFileInerface;
import com.yutou.jianr_mg.Network.HttpUtils; import com.yutou.jianr_mg.Network.HttpUtils;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.ExcelUtils; import com.yutou.jianr_mg.Tools.ExcelUtils;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils; import com.yutou.jianr_mg.Tools.Utils;
import org.json.JSONException; import org.json.JSONException;
@ -161,10 +162,10 @@ public class ExcelActivity extends AppCompatActivity {
try { try {
File file = new File(Utils.getAppPath() + "/data/" + parame.getString("fileName")); File file = new File(Utils.getAppPath() + "/data/" + parame.getString("fileName"));
// file = new File("/storage/emulated/0/jianRMG/data/jianrData.xlsx"); // file = new File("/storage/emulated/0/jianRMG/data/jianrData.xlsx");
System.out.println(file.getAbsolutePath()+" "+file.exists()); Log.i(file.getAbsolutePath()+" "+file.exists());
excel.start(file); excel.start(file);
setTitle(parame.getString("name")+" by-"+parame.getString("by")); setTitle(parame.getString("name")+" by-"+parame.getString("by"));
System.out.println("------->"+excel.getReader().getHeight()); Log.i("------->"+excel.getReader().getHeight());
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
finish(); finish();

View File

@ -109,8 +109,8 @@ public class FavoritesActivity extends AppCompatActivity {
} }
private void setData() { private void setData() {
System.out.println("列表数量"); Log.i("列表数量");
System.out.println(modList.size()); Log.i(modList.size()+"");
recyclerView.dismissSwipeRefresh(); recyclerView.dismissSwipeRefresh();
if (isReload) { if (isReload) {
adapter.clear(); adapter.clear();

View File

@ -18,6 +18,7 @@ import com.yutou.jianr_mg.Interfaces.HttpInterface;
import com.yutou.jianr_mg.Network.HttpApi; import com.yutou.jianr_mg.Network.HttpApi;
import com.yutou.jianr_mg.Network.HttpUtils; import com.yutou.jianr_mg.Network.HttpUtils;
import com.yutou.jianr_mg.Tools.CDNTools; import com.yutou.jianr_mg.Tools.CDNTools;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.SocketTools; import com.yutou.jianr_mg.Tools.SocketTools;
import com.yutou.jianr_mg.Tools.Utils; import com.yutou.jianr_mg.Tools.Utils;
@ -85,7 +86,7 @@ public class GameDataActivity extends AppCompatActivity implements View.OnClickL
@Override @Override
public void httpGetData(String string, int code) { public void httpGetData(String string, int code) {
try { try {
System.out.println(string); Log.i(string);
JSONObject json = new JSONObject(string); JSONObject json = new JSONObject(string);
if (json.getInt("code") == 100) { if (json.getInt("code") == 100) {
String token = json.getJSONObject("data").getString("token"); String token = json.getJSONObject("data").getString("token");
@ -205,7 +206,7 @@ public class GameDataActivity extends AppCompatActivity implements View.OnClickL
new SocketTools(this, true, new HttpInterface() { new SocketTools(this, true, new HttpInterface() {
@Override @Override
public void httpGetData(String string, int code) { public void httpGetData(String string, int code) {
System.out.println(string); Log.i(string);
} }
@Override @Override

View File

@ -61,7 +61,7 @@ public class HomeHeader {
public static HomeHeader getHome(Context context) { public static HomeHeader getHome(Context context) {
if (header == null) { if (header == null) {
System.out.println("初始化头部"); Log.i("初始化头部");
header = new HomeHeader(context); header = new HomeHeader(context);
} }
return header; return header;
@ -180,7 +180,7 @@ public class HomeHeader {
@Override @Override
public void onADReceive() { public void onADReceive() {
System.out.println("测试Receive"); Log.i("测试Receive");
} }
@Override @Override
@ -230,7 +230,7 @@ public class HomeHeader {
return; return;
} }
isFlash = false; isFlash = false;
System.out.println("刷新一言"); Log.i("刷新一言");
HttpUtils.get(HttpApi.HITOKOTO_API, new HttpInterface() { HttpUtils.get(HttpApi.HITOKOTO_API, new HttpInterface() {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();

View File

@ -26,6 +26,7 @@ import com.yutou.jianr_mg.Network.HttpApi;
import com.yutou.jianr_mg.Network.HttpUtils; import com.yutou.jianr_mg.Network.HttpUtils;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.JianRUtils; import com.yutou.jianr_mg.Tools.JianRUtils;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils; import com.yutou.jianr_mg.Tools.Utils;
import org.json.JSONArray; import org.json.JSONArray;
@ -218,7 +219,7 @@ public class MapTopActivity extends AppCompatActivity {
}); });
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
System.out.println(string); Log.i(string);
} }
handler.post(()->{ handler.post(()->{
hud.dismiss(); hud.dismiss();

View File

@ -14,6 +14,7 @@ import com.yutou.jianr_mg.Adapters.MagicTeamDataAdapter;
import com.yutou.jianr_mg.Data.TeamData; import com.yutou.jianr_mg.Data.TeamData;
import com.yutou.jianr_mg.Databases.JianRDataDataBase; import com.yutou.jianr_mg.Databases.JianRDataDataBase;
import com.yutou.jianr_mg.Tools.JianRUtils; import com.yutou.jianr_mg.Tools.JianRUtils;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils; import com.yutou.jianr_mg.Tools.Utils;
import com.yutou.jianr_mg.services.MagicBoxService; import com.yutou.jianr_mg.services.MagicBoxService;
@ -87,28 +88,28 @@ public class WarView {
adapter.setData(JianRUtils.getUserTeam(message)); adapter.setData(JianRUtils.getUserTeam(message));
listView.setTag(1); listView.setTag(1);
} }
System.out.println("更新数据:"+adapter.getCount()+" "+listView.getTag()); Log.i("更新数据:"+adapter.getCount()+" "+listView.getTag());
System.out.println(adapter.getItem(0).toString()); Log.i(adapter.getItem(0).toString());
handler.post(() -> adapter.notifyDataSetChanged()); handler.post(() -> adapter.notifyDataSetChanged());
} }
//夜战 //夜战
nMsg=new JSONObject(WarView.this.nightData.getString("message")); nMsg=new JSONObject(WarView.this.nightData.getString("message"));
isNight = !nMsg.isNull("extraProgress"); isNight = !nMsg.isNull("extraProgress");
if(!Utils.getMD5(nMsg.toString()).equals(nMd5)){ if(!Utils.getMD5(nMsg.toString()).equals(nMd5)){
System.out.println("夜战TAG:"+listView.getTag()); Log.i("夜战TAG:"+listView.getTag());
nMd5=Utils.getMD5(nMsg.toString()); nMd5=Utils.getMD5(nMsg.toString());
if(!nMsg.isNull("extraProgress")){ if(!nMsg.isNull("extraProgress")){
if((int)listView.getTag()==1){ if((int)listView.getTag()==1){
System.out.println("夜战,敌舰"); Log.i("夜战,敌舰");
adapter.setData(JianRUtils.getNightEnemyTeam(nMsg)); adapter.setData(JianRUtils.getNightEnemyTeam(nMsg));
listView.setTag(0); listView.setTag(0);
}else { }else {
System.out.println("夜战,己方"); Log.i("夜战,己方");
adapter.setData(JianRUtils.getNightUserTeam(nMsg)); adapter.setData(JianRUtils.getNightUserTeam(nMsg));
listView.setTag(1); listView.setTag(1);
} }
System.out.println("更新夜战:"+adapter.getCount()+" "+listView.getTag()); Log.i("更新夜战:"+adapter.getCount()+" "+listView.getTag());
System.out.println(adapter.getItem(0).toString()); Log.i(adapter.getItem(0).toString());
handler.post(() -> adapter.notifyDataSetChanged()); handler.post(() -> adapter.notifyDataSetChanged());
} }
} }

View File

@ -1,9 +1,13 @@
package com.yutou.jianr_mg.views; package com.yutou.jianr_mg.views;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
@ -35,6 +39,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
private Button start; private Button start;
private Button help; private Button help;
private Button updata; private Button updata;
private Button config;
ArrayAdapter typeAdapter; ArrayAdapter typeAdapter;
ArrayAdapter nameAdapter; ArrayAdapter nameAdapter;
@ -54,6 +59,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
dataName = findViewById(R.id.dataName); dataName = findViewById(R.id.dataName);
nameAdd = findViewById(R.id.nameAdd); nameAdd = findViewById(R.id.nameAdd);
nameRemove = findViewById(R.id.nameRemove); nameRemove = findViewById(R.id.nameRemove);
config = findViewById(R.id.config);
dataConfig = findViewById(R.id.dataConfig); dataConfig = findViewById(R.id.dataConfig);
start = findViewById(R.id.start); start = findViewById(R.id.start);
help = findViewById(R.id.help); help = findViewById(R.id.help);
@ -66,6 +72,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
start.setOnClickListener(this); start.setOnClickListener(this);
help.setOnClickListener(this); help.setOnClickListener(this);
updata.setOnClickListener(this); updata.setOnClickListener(this);
config.setOnClickListener(this);
saveData.setOnCheckedChangeListener((compoundButton, b) -> { saveData.setOnCheckedChangeListener((compoundButton, b) -> {
@ -78,8 +85,8 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
} }
}); });
saveData.setTag(true); saveData.setTag(true);
typeAdapter=new ArrayAdapter<>(this,android.R.layout.simple_spinner_dropdown_item,getType()); typeAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, getType());
nameAdapter=new ArrayAdapter<>(this,android.R.layout.simple_spinner_dropdown_item,getName(null)); nameAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, getName(null));
dataName.setAdapter(nameAdapter); dataName.setAdapter(nameAdapter);
dataType.setAdapter(typeAdapter); dataType.setAdapter(typeAdapter);
dataType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { dataType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@ -95,23 +102,25 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
}); });
reloadSpinner(); reloadSpinner();
} }
private void reloadSpinner(){
private void reloadSpinner() {
nameAdapter.clear(); nameAdapter.clear();
typeAdapter.clear(); typeAdapter.clear();
typeAdapter.addAll(getType()); typeAdapter.addAll(getType());
try { try {
nameAdapter.addAll(getName(dataType.getSelectedItem().toString())); nameAdapter.addAll(getName(dataType.getSelectedItem().toString()));
}catch (Exception e){ } catch (Exception e) {
nameAdapter.addAll(getName(null)); nameAdapter.addAll(getName(null));
} }
nameAdapter.notifyDataSetChanged(); nameAdapter.notifyDataSetChanged();
typeAdapter.notifyDataSetChanged(); typeAdapter.notifyDataSetChanged();
} }
public List<String> getType() { public List<String> getType() {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
try { try {
list.addAll(JianRDataDataBase.init().getTypes()); list.addAll(JianRDataDataBase.init().getTypes());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -124,7 +133,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
public List<String> getName(String type) { public List<String> getName(String type) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
try { try {
list.addAll(JianRDataDataBase.init().getNames(type)); list.addAll(JianRDataDataBase.init().getNames(type));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -150,13 +159,13 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
removeName(); removeName();
break; break;
case R.id.updata: case R.id.updata:
Intent gameData=new Intent(this,GameDataActivity.class); Intent gameData = new Intent(this, GameDataActivity.class);
startActivity(gameData); startActivity(gameData);
break; break;
case R.id.start: case R.id.start:
Intent intent = new Intent(this, WindowsService.class); Intent intent = new Intent(this, WindowsService.class);
intent.putExtra("saveData", ((boolean) saveData.getTag())); intent.putExtra("saveData", ((boolean) saveData.getTag()));
if((boolean)saveData.getTag()) { if ((boolean) saveData.getTag()) {
intent.putExtra("dataType", dataType.getSelectedItem().toString()); intent.putExtra("dataType", dataType.getSelectedItem().toString());
intent.putExtra("dataName", dataName.getSelectedItem().toString()); intent.putExtra("dataName", dataName.getSelectedItem().toString());
} }
@ -164,10 +173,13 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
finish(); finish();
break; break;
case R.id.help: case R.id.help:
Intent hpIntent=new Intent(this,WebActivity.class); Intent hpIntent = new Intent(this, WebActivity.class);
hpIntent.putExtra("url","http://bbs.jianrmod.cn/forum.php?mod=viewthread&tid=185&page=1&extra=#pid340"); hpIntent.putExtra("url", "http://bbs.jianrmod.cn/forum.php?mod=viewthread&tid=185&page=1&extra=#pid340");
startActivity(hpIntent); startActivity(hpIntent);
break; break;
case R.id.config:
showConfigDialog();
break;
} }
} }
@ -188,6 +200,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
}); });
dialog.show(); dialog.show();
} }
public void removeName() { public void removeName() {
MaterialDialog dialog = new MaterialDialog(this); MaterialDialog dialog = new MaterialDialog(this);
dialog.setTitle("删除数据库"); dialog.setTitle("删除数据库");
@ -196,7 +209,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
dialog.setNegativeButton("取消", view -> dialog.dismiss()); dialog.setNegativeButton("取消", view -> dialog.dismiss());
dialog.setPositiveButton("确定", view -> { dialog.setPositiveButton("确定", view -> {
try { try {
if(dataType.getSelectedItem().toString().equals("-请从右侧按钮添加-")){ if (dataType.getSelectedItem().toString().equals("-请从右侧按钮添加-")) {
Utils.toast(this, "请先选择分类"); Utils.toast(this, "请先选择分类");
return; return;
} }
@ -251,12 +264,12 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
editText.setText("默认"); editText.setText("默认");
return; return;
} }
if(dataType.getSelectedItem().toString().equals("-请从右侧按钮添加-")){ if (dataType.getSelectedItem().toString().equals("-请从右侧按钮添加-")) {
Utils.toast(this, "请先选择分类"); Utils.toast(this, "请先选择分类");
return; return;
} }
try { try {
JianRDataDataBase.init().addName(dataType.getSelectedItem().toString(),editText.getText().toString()); JianRDataDataBase.init().addName(dataType.getSelectedItem().toString(), editText.getText().toString());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -265,4 +278,106 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
}); });
dialog.show(); dialog.show();
} }
private void showConfigDialog() {
SharedPreferences winShared = this.getSharedPreferences("windowsConfig", Context.MODE_PRIVATE);
Switch map = new Switch(this);
Switch user = new Switch(this);
Switch pool = new Switch(this);
Switch bbs = new Switch(this);
Switch strategy = new Switch(this);
Switch input = new Switch(this);
Switch address = new Switch(this);
Switch win = new Switch(this);
Switch alpha = new Switch(this);
Switch exit = new Switch(this);
map.setText("地图信息");
user.setText("当前地图掉落");
pool.setText("战斗剧透");
bbs.setText("论坛");
strategy.setText("离线地图攻略");
address.setText("浏览器地址");
input.setText("悬浮窗输入法监听");
win.setText("悬浮窗最大化");
alpha.setText("透明度");
exit.setText("退出悬浮窗");
win.setEnabled(false);
alpha.setEnabled(false);
exit.setEnabled(false);
if (winShared.getBoolean("map", true))
map.setChecked(true);
if (winShared.getBoolean("user", true))
user.setChecked(true);
if (winShared.getBoolean("pool", true))
pool.setChecked(true);
if (winShared.getBoolean("bbs", true))
bbs.setChecked(true);
if (winShared.getBoolean("strategy", true))
strategy.setChecked(true);
if (winShared.getBoolean("address", true))
address.setChecked(true);
if (winShared.getBoolean("input", true))
input.setChecked(true);
win.setChecked(true);
alpha.setChecked(true);
exit.setChecked(true);
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
layout.addView(map);
layout.addView(user);
layout.addView(pool);
layout.addView(bbs);
layout.addView(strategy);
layout.addView(address);
layout.addView(input);
layout.addView(win);
layout.addView(alpha);
layout.addView(exit);
MaterialDialog dialog = new MaterialDialog(this);
dialog.setTitle("悬浮窗设置");
dialog.setContentView(layout);
dialog.setPositiveButton("确定", new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = winShared.edit();
if (map.isChecked())
editor.putBoolean("map", true);
else
editor.putBoolean("map", false);
if (user.isChecked())
editor.putBoolean("user", true);
else
editor.putBoolean("user", false);
if (pool.isChecked())
editor.putBoolean("pool", true);
else
editor.putBoolean("pool", false);
if (bbs.isChecked())
editor.putBoolean("bbs", true);
else
editor.putBoolean("bbs", false);
if (strategy.isChecked())
editor.putBoolean("strategy", true);
else
editor.putBoolean("strategy", false);
if (address.isChecked())
editor.putBoolean("address", true);
else
editor.putBoolean("address", false);
if (input.isChecked())
editor.putBoolean("input", true);
else
editor.putBoolean("input", false);
editor.apply();
dialog.dismiss();
}
});
dialog.show();
}
} }

View File

@ -132,4 +132,14 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/start" app:layout_constraintStart_toEndOf="@+id/start"
app:layout_constraintTop_toBottomOf="@+id/help" /> app:layout_constraintTop_toBottomOf="@+id/help" />
<Button
android:id="@+id/config"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="悬浮窗设置"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/start"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dataConfig" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -17,6 +17,7 @@ import android.widget.Switch;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.jianrmod.plugins.harmony.Log;
import com.jianrmod.plugins.harmony.Tools.ClientUttls; import com.jianrmod.plugins.harmony.Tools.ClientUttls;
import com.jianrmod.plugins.harmony.Tools.HttpInterface; import com.jianrmod.plugins.harmony.Tools.HttpInterface;
import com.jianrmod.plugins.harmony.Tools.HttpTools; import com.jianrmod.plugins.harmony.Tools.HttpTools;
@ -162,7 +163,7 @@ public class MainActivity implements BaseActivityInterface {
Toast.makeText(context,"网络请求失败1秒钟后再试试",Toast.LENGTH_LONG).show(); Toast.makeText(context,"网络请求失败1秒钟后再试试",Toast.LENGTH_LONG).show();
return; return;
} }
System.out.println("httpData:"+httpData); Log.i("httpData:"+httpData);
hud.show(); hud.show();
final File file = new File(Utils.getAppPath(context) + "/harmony/"); final File file = new File(Utils.getAppPath(context) + "/harmony/");
if(!file.exists()){ if(!file.exists()){
@ -175,28 +176,28 @@ public class MainActivity implements BaseActivityInterface {
return; return;
} }
File xml = new File(file.getAbsolutePath() + "/Cocos2dxPrefsFile.xml"); File xml = new File(file.getAbsolutePath() + "/Cocos2dxPrefsFile.xml");
System.out.println(xml.getAbsoluteFile()); Log.i(xml.getAbsoluteFile().getAbsolutePath());
if (xml.exists()) { if (xml.exists()) {
ClientUttls.install(context, xml, "../shared_prefs/", new ModInterface() { ClientUttls.install(context, xml, "../shared_prefs/", new ModInterface() {
@Override @Override
public void onAction(boolean flag, int type) { public void onAction(boolean flag, int type) {
System.out.println("处理xml" + flag); Log.i("处理xml" + flag);
if (flag) { if (flag) {
for (File listFile : file.listFiles()) { for (File listFile : file.listFiles()) {
System.out.println("处理文件:" + listFile.getAbsolutePath()); Log.i("处理文件:" + listFile.getAbsolutePath());
if (listFile.getName().endsWith(".zip")) { if (listFile.getName().endsWith(".zip")) {
File path; File path;
if (siwtch.isChecked()) { if (siwtch.isChecked()) {
path = new File(Utils.getSDCardPath(context) + "/Android/data/com.huanmeng.zhanjian2/"+httpData); path = new File(Utils.getSDCardPath(context) + "/Android/data/com.huanmeng.zhanjian2/"+httpData);
System.out.println("操作对象:覆盖版"); Log.i("操作对象:覆盖版");
} else { } else {
path = new File(Utils.getSDCardPath(context) + "/Android/data/com.bigzhao.jianrmagicbox/"+httpData); path = new File(Utils.getSDCardPath(context) + "/Android/data/com.bigzhao.jianrmagicbox/"+httpData);
System.out.println("操作对象:共存版"); Log.i("操作对象:共存版");
} }
if (!path.exists()) { if (!path.exists()) {
path.mkdirs(); path.mkdirs();
} }
System.out.println("准备处理zip"); Log.i("准备处理zip");
ZipUtils.unzip(listFile, path.getAbsolutePath(), hud); ZipUtils.unzip(listFile, path.getAbsolutePath(), hud);
break; break;
} }

View 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();
}
}

View File

@ -1,5 +1,6 @@
package com.jianrmod.plugins.harmony.Tools; package com.jianrmod.plugins.harmony.Tools;
import com.jianrmod.plugins.harmony.Log;
import com.kaopiz.kprogresshud.KProgressHUD; import com.kaopiz.kprogresshud.KProgressHUD;
import com.zip4j.core.ZipFile; import com.zip4j.core.ZipFile;
@ -20,7 +21,7 @@ public class ZipUtils {
descDirPath.mkdirs(); descDirPath.mkdirs();
} }
System.out.println("文件:" + zipFile.exists()); Log.i("文件:" + zipFile.exists());
try { try {
final ZipFile _zipFile = new ZipFile(zipFile); final ZipFile _zipFile = new ZipFile(zipFile);
_zipFile.setFileNameCharset("GBK"); //设置编码格式支持中文 _zipFile.setFileNameCharset("GBK"); //设置编码格式支持中文

View File

@ -36,7 +36,7 @@ public class PluginHttpTools {
} }
public void httpGet(final String url, final PluginHttpInterface networkInterface) { public void httpGet(final String url, final PluginHttpInterface networkInterface) {
System.out.println("HTTP>>>>"+url); Log.i("HTTP>>>>"+url);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -61,17 +61,17 @@ public class PluginHttpTools {
} }
public static void post(final String url, final JSONObject body, final PluginHttpInterface networkInterface) throws Exception{ public static void post(final String url, final JSONObject body, final PluginHttpInterface networkInterface) throws Exception{
System.out.println(1); Log.i(1);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
System.out.println(2); Log.i(2);
String tmp, str = ""; String tmp, str = "";
try { try {
System.out.println(3); Log.i(3);
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.connect(); connection.connect();
System.out.println(4); Log.i(4);
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
while ((tmp = reader.readLine()) != null) { while ((tmp = reader.readLine()) != null) {
str += tmp; str += tmp;

View File

@ -34,7 +34,7 @@ public class PlugsAdTools {
if(json.getInt("code")==100){ if(json.getInt("code")==100){
JSONObject data=json.getJSONObject("data"); JSONObject data=json.getJSONObject("data");
final String msg=data.getString("msg"); final String msg=data.getString("msg");
System.out.println("服务器回调:"+msg); Log.i("服务器回调:"+msg);
if(data.getInt("code")==100){ if(data.getInt("code")==100){
MainActivity.handler.post(new Runnable() { MainActivity.handler.post(new Runnable() {
@Override @Override