发版前更新
新增悬浮窗设置选项
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
targetSdkVersion 29
versionCode 2
versionName "2.3"
versionName "2.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
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.R;
import com.yutou.jianr_mg.Tools.JianRUtils;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils;
import java.util.List;
@ -99,22 +100,22 @@ public class MagicTeamDataAdapter extends BaseAdapter {
if (Float.valueOf(data.getHp()) > (Float.valueOf(data.getHpMax()) / 2)) {
ClipDrawable d = new ClipDrawable(new ColorDrawable(Color.DKGRAY), Gravity.START, ClipDrawable.HORIZONTAL);
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)) {
ClipDrawable d = new ClipDrawable(new ColorDrawable(Color.YELLOW), Gravity.START, ClipDrawable.HORIZONTAL);
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) ) {
ClipDrawable d = new ClipDrawable(new ColorDrawable(Color.RED), Gravity.START, ClipDrawable.HORIZONTAL);
item.hpBar.setProgressDrawable(d);
System.out.println(data.getTitle()+"设置颜色:红色"+data.getHp()+"/"+data.getHpMax());
Log.i(data.getTitle()+"设置颜色:红色"+data.getHp()+"/"+data.getHpMax());
}else{
System.out.println("没有设置颜色");
Log.i("没有设置颜色");
}
if(data.getTitle().equals("")){
item.hpBar.setMax(100);
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
item.hpBar.setProgress((int) getHp(data.getHp(),data.getHpMax()));
@ -280,7 +281,7 @@ public class MagicTeamDataAdapter extends BaseAdapter {
msg.append(equipmnt.getDesc());
i=msg.toString().split("\n").length;
textView.setText(msg.toString());
// System.out.println(equipmnt.toString());
// Log.i(equipmnt.toString());
}else{
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.R;
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.views.BaseActivity;
@ -78,13 +79,13 @@ public class MainUtilsAdapter extends RecyclerAdapter<MAppTools> {
getContext().startService(intent);
break;
case "localActivity":
System.out.println("数据:" + data.toString());
Log.i("数据:" + data.toString());
intent = new Intent(getContext(), BaseActivity.class);
intent.putExtra("activityName", main);
intent.putExtra("jar", data.getUrl().split("/")[data.getUrl().split("/").length - 1]);
intent.putExtra("name", data.getName());
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) {
intent.putExtra("parameter", data.getParameter());
}

View File

@ -51,7 +51,7 @@ public class Application extends android.app.Application {
super.onCreate();
Application.application = this;
// BlockCanary.install(this, new AppBlockCanaryContext()).start();
System.out.println("开始初始化");
Log.i("开始初始化");
init();
initPlugs();
@ -61,7 +61,7 @@ public class Application extends android.app.Application {
initTx();
System.out.println("初始化结束");
Log.i("初始化结束");
}
private void initUmeng() {
@ -72,12 +72,12 @@ public class Application extends android.app.Application {
pushAgent.register(new IUmengRegisterCallback() {
@Override
public void onSuccess(String s) {
System.out.println("友盟推送注册成功:" + s);
Log.i("友盟推送注册成功:" + s);
}
@Override
public void onFailure(String s, String s1) {
System.out.println("友盟推送注册失败:" + s + "(" + s1 + ")");
Log.i("友盟推送注册失败:" + s + "(" + s1 + ")");
}
});
pushAgent.setMessageHandler(new UmengMessageHandler() {
@ -102,7 +102,7 @@ public class Application extends android.app.Application {
QbSdk.initX5Environment(this, new QbSdk.PreInitCallback() {
@Override
public void onCoreInitFinished() {
System.out.println("QDSDK初始化失败");
Log.i("QDSDK初始化失败");
}
@Override
@ -131,7 +131,7 @@ public class Application extends android.app.Application {
if (file.getName().contains(".jar")) {
DexClassLoader dexClassLoader = new DexClassLoader(file.getAbsolutePath(), dex.getAbsolutePath(), null, getClassLoader());
plugsin.put(file.getName(), dexClassLoader);
System.out.println("加载插件:"+file.getName());
Log.i("加载插件:"+file.getName());
// 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 md5 = Utils.getFileMD5(file);
System.out.println("MD5:" + md5);
Log.i("MD5:" + md5);
JSONObject plugs = new JSONObject();
plugs.put("appid", appid);
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.Data.MGamePackname;
import com.yutou.jianr_mg.Data.TMod;
import com.yutou.jianr_mg.Tools.Log;
import java.util.ArrayList;
import java.util.List;
@ -146,7 +147,7 @@ public class ModDatabase extends SQLiteOpenHelper {
}
cursor.close();
}
System.out.println(list.size());
Log.i(list.size()+"");
return list;
}
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.Databases.JianRDataDataBase;
import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.Log;
import org.angmarch.views.NiceSpinner;
import org.json.JSONObject;
@ -157,7 +158,7 @@ public class WarFragment extends Fragment {
return;
}
System.out.println(">>>>>>"+item.getInt("mapId"));
Log.i(">>>>>>"+item.getInt("mapId"));
if(Objects.requireNonNull(maps.get("DealNode")).getString("type").equals("DealNode")) {
getItem(i, srcList);
}

View File

@ -14,6 +14,7 @@ import android.widget.ListView;
import com.umeng.commonsdk.debug.W;
import com.yutou.jianr_mg.Fragments.GameDataFragments.WarLogFragments.Adapters.DaytimeListViewAdapter;
import com.yutou.jianr_mg.Tools.Log;
import org.json.JSONArray;
import org.json.JSONException;
@ -97,11 +98,11 @@ public class DaytimeFragment extends Fragment implements WarLogInterface{
List<WarData> list = new ArrayList<>();
try {
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++) {
System.out.println(nightAttacks.getJSONObject(i));
Log.i(nightAttacks.getJSONObject(i).toString());
WarData warData=WarData.getInstance(WarData.NIGHT_WAR,nightAttacks.getJSONObject(i),warReport);
System.out.println(warData.toString());
Log.i(warData.toString());
list.add(warData);
}
} 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.HttpUtils;
import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.Log;
import org.json.JSONObject;
@ -143,7 +144,7 @@ public class UtilsFragments extends Fragment {
}
}
private void setData() {
System.out.println(datas.size());
Log.i(datas.size()+"");
if(datas.size()>0){
adapter.addAll(datas);
recyclerView.dismissSwipeRefresh();

View File

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

View File

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

View File

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

View File

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

View File

@ -41,7 +41,7 @@ public class Log {
*/
public static void i(String title,String str) {
if(LOG)
System.out.println("["+title+"]"+str);
Log.i("["+title+"]"+str);
}
/**

View File

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

View File

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

View File

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

View File

@ -20,7 +20,7 @@ public class ZipUtils {
if (!descDirPath.exists()) {
descDirPath.mkdirs();
}
System.out.println("文件:" + zipFile.exists());
Log.i("文件:" + zipFile.exists());
try {
ZipFile _zipFile = new ZipFile(zipFile);
//_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.Databases.JianRDataDataBase;
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.views.WarView;
@ -49,7 +50,7 @@ public class MagicBoxService {
public static MagicBoxService init() {
JianRUtils.readClientVersionIsbigzhao(Application.application);
if (!Utils.getApplicationPackName(Application.application, AppData.magicPackageName)) {
System.out.println("没有安装客户端");
Log.i("没有安装客户端");
return null;
}
if (magicBoxService == null) {
@ -61,14 +62,14 @@ public class MagicBoxService {
private ServiceConnection connection;
private void initMagicBox() {
System.out.println("绑定大钊客户端");
Log.i("绑定大钊客户端");
isClose = false;
connection = new ServiceConnection() {
JianRDataDataBase dataBase;
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
System.out.println("链接大钊客户端");
Log.i("链接大钊客户端");
if (!Utils.testStringIsNull(dataName, dataType)) {
dataBase = JianRDataDataBase.init();
}
@ -78,7 +79,7 @@ public class MagicBoxService {
@Override
public void run() {
if (isClose) {
System.out.println("关闭连接");
Log.i("关闭连接");
cancel();
return;
}
@ -93,7 +94,7 @@ public class MagicBoxService {
magicBoxInterface.getData(boxBinder.getVersion() + "");
} else {
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);
}
}catch (Exception e){
@ -148,8 +149,8 @@ public class MagicBoxService {
boxInterface.getData(json2.toString());
}
}
// System.out.println("str = "+str);
// System.out.println("str2 = "+str2);
// Log.i("str = "+str);
// Log.i("str2 = "+str2);
} catch (Exception e) {
e.printStackTrace();
}
@ -160,7 +161,7 @@ public class MagicBoxService {
@Override
public void onServiceDisconnected(ComponentName componentName) {
System.out.println("大钊客户端连接失败:" + componentName.flattenToString());
Log.i("大钊客户端连接失败:" + componentName.flattenToString());
isClose = true;
}
};
@ -177,7 +178,7 @@ public class MagicBoxService {
intent.setAction(com.bigzhao.jianrmagicbox.IMagicBoxBinder.ACTION_SERVICE);
intent.setPackage(AppData.magicPackageName);
boolean tmp = Application.application.bindService(intent, connection, BIND_AUTO_CREATE);
System.out.println("重新绑定结果:" + tmp);
Log.i("重新绑定结果:" + tmp);
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -13,9 +13,11 @@ import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.provider.Settings;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.KeyEvent;
@ -36,6 +38,7 @@ import android.widget.SeekBar;
import com.yutou.jianr_mg.Data.AppData;
import com.yutou.jianr_mg.R;
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.views.ExcelActivity;
import com.yutou.jianr_mg.views.WarView;
@ -89,7 +92,7 @@ public class WindowsService extends Service {
saveData = intent.getBooleanExtra("saveData", false);
dataName = intent.getStringExtra("dataName");
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);
@ -99,7 +102,7 @@ public class WindowsService extends Service {
@Override
public void onCreate() {
super.onCreate();
System.out.println("触发悬浮窗");
Log.i("触发悬浮窗");
context = WindowsService.this;
handler = new Handler();
warView = new WarView(context, null, webW, handler);
@ -133,6 +136,7 @@ public class WindowsService extends Service {
timer.schedule(new TimerTask() {
boolean isRuntime = false;
boolean listener = true;
@Override
public void run() {
MagicBoxService boxService = MagicBoxService.init();
@ -242,7 +246,9 @@ public class WindowsService extends Service {
}
}
private int webW = 0, webH = 0;
private void reloadUi() {
if (webView.getLayoutParams().width > 0) {
webW = webView.getLayoutParams().width;
@ -262,11 +268,11 @@ public class WindowsService extends Service {
}
System.out.println("push size:" + pushSize);
System.out.println("side size:" + sideSize);
System.out.println("webs size:" + webSize);
Log.i("push size:" + pushSize);
Log.i("side size:" + sideSize);
Log.i("webs size:" + 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);
initWebUi();
}
@ -279,12 +285,12 @@ public class WindowsService extends Service {
// 横屏
width = metrics.widthPixels;
width = (int) (width - (width * 0.1));
System.out.println("横屏");
Log.i("横屏");
} else {
// 竖屏
width = metrics.widthPixels;
width = (int) (width - (width * 0.2));
System.out.println("竖屏");
Log.i("竖屏");
}
webView.getLayoutParams().width = width;
}
@ -299,7 +305,7 @@ public class WindowsService extends Service {
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
System.out.println("加载网页:" + url);
Log.i("加载网页:" + url);
view.loadUrl(url);
return true;
}
@ -343,9 +349,14 @@ public class WindowsService extends Service {
strategy.setTag(204);
strategy.setOnClickListener(new ButtonOnClick());
SharedPreferences winShared = this.getSharedPreferences("windowsConfig", Context.MODE_PRIVATE);
if (winShared.getBoolean("bbs", true))
list.add(bbs);
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);
return list;
@ -386,10 +397,14 @@ public class WindowsService extends Service {
expedition.setOnClickListener(new ButtonOnClick());
fix.setOnClickListener(new ButtonOnClick());
SharedPreferences winShared = this.getSharedPreferences("windowsConfig", Context.MODE_PRIVATE);
if (winShared.getBoolean("map", true))
list.add(map);
if (winShared.getBoolean("user", true))
list.add(user);
if (winShared.getBoolean("pool", true))
list.add(pool);
list.add(build);
//list.add(build);
//list.add(develop);
//list.add(expedition);
//list.add(fix);
@ -426,6 +441,7 @@ public class WindowsService extends Service {
super.onConfigurationChanged(newConfig);
reloadUi();
}
private void setWebUrl(String url) {
handler.post(() -> {
if (contextLayout.getVisibility() == View.GONE) {
@ -467,7 +483,7 @@ public class WindowsService extends Service {
bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
System.out.println("参数:" + i);
Log.i("参数:" + i);
params.alpha = i;
windowManager.updateViewLayout(mainLayout, params);
}
@ -587,9 +603,9 @@ public class WindowsService extends Service {
return;
JSONObject ext = new JSONObject(json.getString("ext"));
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", "-");
System.out.println("url:"+url);
Log.i("url:" + url);
setWebUrl(url);
}
reloadUi();
@ -601,9 +617,9 @@ public class WindowsService extends Service {
if (json == null)
return;
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");
System.out.println("url:"+url);
Log.i("url:" + url);
setWebUrl(url);
reloadUi();
}

View File

@ -41,8 +41,8 @@ public class BaseActivity extends AppCompatActivity {
DexClassLoader dexClassLoader= AppData.plugsin.get(jar);
try {
System.out.println("jar:"+jar);
System.out.println("BaseActivity:"+baseActivityName);
Log.i("jar:"+jar);
Log.i("BaseActivity:"+baseActivityName);
activityInterface= (BaseActivityInterface) dexClassLoader.loadClass(baseActivityName).newInstance();
activityInterface.onCreate(savedInstanceState,main_layut,this,getIntent());
} 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.HttpUtils;
import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.ModUtils;
import org.json.JSONArray;
@ -70,7 +71,7 @@ public class DownloadListActivity extends AppCompatActivity {
for (TMod mod : mods) {
for (TMod tMod : mods_) {
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();
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.R;
import com.yutou.jianr_mg.Tools.ExcelUtils;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils;
import org.json.JSONException;
@ -161,10 +162,10 @@ public class ExcelActivity extends AppCompatActivity {
try {
File file = new File(Utils.getAppPath() + "/data/" + parame.getString("fileName"));
// 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);
setTitle(parame.getString("name")+" by-"+parame.getString("by"));
System.out.println("------->"+excel.getReader().getHeight());
Log.i("------->"+excel.getReader().getHeight());
}catch (Exception e){
e.printStackTrace();
finish();

View File

@ -109,8 +109,8 @@ public class FavoritesActivity extends AppCompatActivity {
}
private void setData() {
System.out.println("列表数量");
System.out.println(modList.size());
Log.i("列表数量");
Log.i(modList.size()+"");
recyclerView.dismissSwipeRefresh();
if (isReload) {
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.HttpUtils;
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.Utils;
@ -85,7 +86,7 @@ public class GameDataActivity extends AppCompatActivity implements View.OnClickL
@Override
public void httpGetData(String string, int code) {
try {
System.out.println(string);
Log.i(string);
JSONObject json = new JSONObject(string);
if (json.getInt("code") == 100) {
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() {
@Override
public void httpGetData(String string, int code) {
System.out.println(string);
Log.i(string);
}
@Override

View File

@ -61,7 +61,7 @@ public class HomeHeader {
public static HomeHeader getHome(Context context) {
if (header == null) {
System.out.println("初始化头部");
Log.i("初始化头部");
header = new HomeHeader(context);
}
return header;
@ -180,7 +180,7 @@ public class HomeHeader {
@Override
public void onADReceive() {
System.out.println("测试Receive");
Log.i("测试Receive");
}
@Override
@ -230,7 +230,7 @@ public class HomeHeader {
return;
}
isFlash = false;
System.out.println("刷新一言");
Log.i("刷新一言");
HttpUtils.get(HttpApi.HITOKOTO_API, new HttpInterface() {
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.R;
import com.yutou.jianr_mg.Tools.JianRUtils;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils;
import org.json.JSONArray;
@ -218,7 +219,7 @@ public class MapTopActivity extends AppCompatActivity {
});
} catch (JSONException e) {
e.printStackTrace();
System.out.println(string);
Log.i(string);
}
handler.post(()->{
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.Databases.JianRDataDataBase;
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.services.MagicBoxService;
@ -87,28 +88,28 @@ public class WarView {
adapter.setData(JianRUtils.getUserTeam(message));
listView.setTag(1);
}
System.out.println("更新数据:"+adapter.getCount()+" "+listView.getTag());
System.out.println(adapter.getItem(0).toString());
Log.i("更新数据:"+adapter.getCount()+" "+listView.getTag());
Log.i(adapter.getItem(0).toString());
handler.post(() -> adapter.notifyDataSetChanged());
}
//夜战
nMsg=new JSONObject(WarView.this.nightData.getString("message"));
isNight = !nMsg.isNull("extraProgress");
if(!Utils.getMD5(nMsg.toString()).equals(nMd5)){
System.out.println("夜战TAG:"+listView.getTag());
Log.i("夜战TAG:"+listView.getTag());
nMd5=Utils.getMD5(nMsg.toString());
if(!nMsg.isNull("extraProgress")){
if((int)listView.getTag()==1){
System.out.println("夜战,敌舰");
Log.i("夜战,敌舰");
adapter.setData(JianRUtils.getNightEnemyTeam(nMsg));
listView.setTag(0);
}else {
System.out.println("夜战,己方");
Log.i("夜战,己方");
adapter.setData(JianRUtils.getNightUserTeam(nMsg));
listView.setTag(1);
}
System.out.println("更新夜战:"+adapter.getCount()+" "+listView.getTag());
System.out.println(adapter.getItem(0).toString());
Log.i("更新夜战:"+adapter.getCount()+" "+listView.getTag());
Log.i(adapter.getItem(0).toString());
handler.post(() -> adapter.notifyDataSetChanged());
}
}

View File

@ -1,9 +1,13 @@
package com.yutou.jianr_mg.views;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
@ -35,6 +39,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
private Button start;
private Button help;
private Button updata;
private Button config;
ArrayAdapter typeAdapter;
ArrayAdapter nameAdapter;
@ -54,6 +59,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
dataName = findViewById(R.id.dataName);
nameAdd = findViewById(R.id.nameAdd);
nameRemove = findViewById(R.id.nameRemove);
config = findViewById(R.id.config);
dataConfig = findViewById(R.id.dataConfig);
start = findViewById(R.id.start);
help = findViewById(R.id.help);
@ -66,6 +72,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
start.setOnClickListener(this);
help.setOnClickListener(this);
updata.setOnClickListener(this);
config.setOnClickListener(this);
saveData.setOnCheckedChangeListener((compoundButton, b) -> {
@ -95,6 +102,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
});
reloadSpinner();
}
private void reloadSpinner() {
nameAdapter.clear();
typeAdapter.clear();
@ -108,6 +116,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
nameAdapter.notifyDataSetChanged();
typeAdapter.notifyDataSetChanged();
}
public List<String> getType() {
List<String> list = new ArrayList<>();
try {
@ -168,6 +177,9 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
hpIntent.putExtra("url", "http://bbs.jianrmod.cn/forum.php?mod=viewthread&tid=185&page=1&extra=#pid340");
startActivity(hpIntent);
break;
case R.id.config:
showConfigDialog();
break;
}
}
@ -188,6 +200,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
});
dialog.show();
}
public void removeName() {
MaterialDialog dialog = new MaterialDialog(this);
dialog.setTitle("删除数据库");
@ -265,4 +278,106 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
});
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_constraintStart_toEndOf="@+id/start"
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>

View File

@ -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;
}

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;
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"); //设置编码格式支持中文

View File

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

View File

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