备份,含修复插件
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.yutou.jianr_mg.Adapters.GameDataAdapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
@@ -8,13 +9,21 @@ import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.kaopiz.kprogresshud.KProgressHUD;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.yutou.jianr_mg.Interfaces.ModInterface;
|
||||
import com.yutou.jianr_mg.R;
|
||||
import com.yutou.jianr_mg.Tools.ModUtils;
|
||||
import com.yutou.jianr_mg.Tools.Utils;
|
||||
import com.yutou.jianr_mg.Tools.ZipUtils;
|
||||
import com.yutou.jianr_mg.views.WarLogActivity;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@@ -95,7 +104,33 @@ public class WarAdapter extends RecyclerAdapter<List<Map<String, JSONObject>>> {
|
||||
@Override
|
||||
public void onItemViewClick(List<Map<String, JSONObject>> data) {
|
||||
super.onItemViewClick(data);
|
||||
Utils.toast(getContext(),"详细内容正在咕,敬请期待");
|
||||
// Utils.toast(getContext(),"详细内容正在咕,敬请期待");
|
||||
ModUtils utils= ModUtils.init(getContext());
|
||||
utils.notRootInstall(new File(Utils.getAppPath()+"/harmony/Cocos2dxPrefsFile.xml"),"../shared_prefs/");
|
||||
utils.notRootInstallStart(new ModInterface() {
|
||||
@Override
|
||||
public void onAction(boolean flag, int type) {
|
||||
System.out.println("反和谐结果:"+flag);
|
||||
}
|
||||
},false);
|
||||
|
||||
/* JSONArray array=new JSONArray();
|
||||
for (Map<String, JSONObject> datum : data) {
|
||||
try {
|
||||
JSONObject json=new JSONObject();
|
||||
json.put("data",datum.get("data"));
|
||||
json.put("DealNode",datum.get("DealNode"));
|
||||
json.put("WarReport",datum.get("GetWarResult"));
|
||||
array.put(json);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
Intent intent=new Intent(getContext(), WarLogActivity.class);
|
||||
intent.putExtra("data", array.toString());
|
||||
getContext().startActivity(intent);*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@ package com.yutou.jianr_mg.Adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ClipDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -25,7 +29,7 @@ public class MagicTeamDataAdapter extends BaseAdapter {
|
||||
List<TeamData> list;
|
||||
Context context;
|
||||
ImageLoader loader;
|
||||
boolean spoiler=false;
|
||||
boolean spoiler = true;
|
||||
|
||||
|
||||
public MagicTeamDataAdapter(List<TeamData> list, Context context) {
|
||||
@@ -35,7 +39,7 @@ public class MagicTeamDataAdapter extends BaseAdapter {
|
||||
}
|
||||
|
||||
public void setSpoiler(boolean spoiler) {
|
||||
this.spoiler = spoiler;
|
||||
// this.spoiler = spoiler;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,13 +56,13 @@ public class MagicTeamDataAdapter extends BaseAdapter {
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
ItemViews item = null;
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
ItemViews item = null;
|
||||
|
||||
if (view == null) {
|
||||
item = new ItemViews();
|
||||
view = LayoutInflater.from(context).inflate(R.layout.item_team, viewGroup,false);
|
||||
view = LayoutInflater.from(context).inflate(R.layout.item_team, viewGroup, false);
|
||||
item.hp = view.findViewById(R.id.hp);
|
||||
item.hpMax = view.findViewById(R.id.hpMax);
|
||||
item.hpBar = view.findViewById(R.id.itemHp);
|
||||
@@ -69,30 +73,58 @@ public class MagicTeamDataAdapter extends BaseAdapter {
|
||||
item.item2 = view.findViewById(R.id.item2);
|
||||
item.item3 = view.findViewById(R.id.item3);
|
||||
item.item4 = view.findViewById(R.id.item4);
|
||||
item.hpLayout=view.findViewById(R.id.hpLayout);
|
||||
item.hpLayout = view.findViewById(R.id.hpLayout);
|
||||
view.setTag(item);
|
||||
} else {
|
||||
item = (ItemViews) view.getTag();
|
||||
}
|
||||
TeamData data = list.get(i);
|
||||
item.hp.setText(data.getHp());
|
||||
if(!spoiler){
|
||||
if (!spoiler) {
|
||||
item.hp.setText("???");
|
||||
}
|
||||
item.hpMax.setText(data.getHpMax());
|
||||
item.hpBar.setMax(Integer.valueOf(data.getHpMax()));
|
||||
item.hpBar.setProgress(Integer.valueOf(data.getHp()));
|
||||
if(!spoiler){
|
||||
item.hpBar.setProgress(0);
|
||||
item.hpBar.setMax(100);
|
||||
|
||||
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());
|
||||
} 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());
|
||||
} 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());
|
||||
}else{
|
||||
System.out.println("没有设置颜色");
|
||||
}
|
||||
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)));
|
||||
|
||||
}else
|
||||
item.hpBar.setProgress((int) getHp(data.getHp(),data.getHpMax()));
|
||||
if (!spoiler) {
|
||||
// item.hpBar.setProgress(0);
|
||||
}
|
||||
item.title.setText(data.getTitle());
|
||||
if(!data.isUser()){
|
||||
((LinearLayout.LayoutParams)item.hpLayout.getLayoutParams()).gravity=Gravity.END;
|
||||
item.title.setVisibility(View.VISIBLE);
|
||||
item.hp.setVisibility(View.VISIBLE);
|
||||
item.hpMax.setVisibility(View.VISIBLE);
|
||||
item.title.setTextColor(Color.BLACK);
|
||||
item.hp.setTextColor(Color.BLACK);
|
||||
item.hpMax.setTextColor(Color.BLACK);
|
||||
if (!data.isUser()) {
|
||||
((LinearLayout.LayoutParams) item.hpLayout.getLayoutParams()).gravity = Gravity.END;
|
||||
item.title.setGravity(Gravity.END);
|
||||
item.icon.setVisibility(View.GONE);
|
||||
item.icon_.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
((LinearLayout.LayoutParams)item.hpLayout.getLayoutParams()).gravity=Gravity.LEFT;
|
||||
} else {
|
||||
((LinearLayout.LayoutParams) item.hpLayout.getLayoutParams()).gravity = Gravity.LEFT;
|
||||
item.title.setGravity(Gravity.LEFT);
|
||||
item.icon.setVisibility(View.VISIBLE);
|
||||
item.icon_.setVisibility(View.GONE);
|
||||
@@ -105,33 +137,34 @@ public class MagicTeamDataAdapter extends BaseAdapter {
|
||||
}
|
||||
}
|
||||
if (data.getItem1Url() != null) {
|
||||
loader.displayImage(data.getItem1Url(), item.item1,new imageListener() );
|
||||
loader.displayImage(data.getItem1Url(), item.item1, new imageListener());
|
||||
item.item1.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||
item.item1.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
} else {
|
||||
item.item1.setVisibility(View.GONE);
|
||||
}
|
||||
if (data.getItem2Url() != null) {
|
||||
loader.displayImage(data.getItem2Url(), item.item2,new imageListener());
|
||||
loader.displayImage(data.getItem2Url(), item.item2, new imageListener());
|
||||
item.item2.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||
item.item2.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
} else {
|
||||
item.item2.setVisibility(View.GONE);
|
||||
}
|
||||
if (data.getItem3Url() != null) {
|
||||
loader.displayImage(data.getItem3Url(), item.item3,new imageListener());
|
||||
loader.displayImage(data.getItem3Url(), item.item3, new imageListener());
|
||||
item.item3.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||
item.item3.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
} else {
|
||||
item.item3.setVisibility(View.GONE);
|
||||
}
|
||||
if (data.getItem4Url() != null) {
|
||||
loader.displayImage(data.getItem4Url(), item.item4,new imageListener());
|
||||
loader.displayImage(data.getItem4Url(), item.item4, new imageListener());
|
||||
item.item4.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
|
||||
item.item4.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
} else {
|
||||
item.item4.setVisibility(View.GONE);
|
||||
}
|
||||
item.reload();
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -144,12 +177,30 @@ public class MagicTeamDataAdapter extends BaseAdapter {
|
||||
return this.list;
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
if(item!=null){
|
||||
item.reload();
|
||||
}
|
||||
}
|
||||
public float getHp(String hp,String maxHp){
|
||||
float h=Float.parseFloat(hp);
|
||||
float max=Float.parseFloat(maxHp);
|
||||
return 100/max*h;
|
||||
}
|
||||
class ItemViews {
|
||||
TextView title, hp, hpMax;
|
||||
ImageView icon, icon_, item1, item2, item3, item4;
|
||||
ProgressBar hpBar;
|
||||
LinearLayout hpLayout;
|
||||
|
||||
void reload() {
|
||||
title.postInvalidate();
|
||||
hp.postInvalidate();
|
||||
hpMax.postInvalidate();
|
||||
hpBar.postInvalidate();
|
||||
}
|
||||
}
|
||||
|
||||
class imageListener implements ImageLoadingListener {
|
||||
@Override
|
||||
public void onLoadingStarted(String imageUri, View view) {
|
||||
@@ -158,7 +209,7 @@ public class MagicTeamDataAdapter extends BaseAdapter {
|
||||
|
||||
@Override
|
||||
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
|
||||
ImageView imageView= (ImageView) view;
|
||||
ImageView imageView = (ImageView) view;
|
||||
imageView.setImageResource(R.mipmap.icon_logo);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,11 +74,13 @@ public class MainUtilsAdapter extends RecyclerAdapter<MAppTools> {
|
||||
getContext().startService(intent);
|
||||
break;
|
||||
case "localActivity":
|
||||
System.out.println("数据:"+data.toString());
|
||||
intent=new Intent(getContext(), BaseActivity.class);
|
||||
intent.putExtra("activityName",main);
|
||||
intent.putExtra("jar",data.getPluginName()+".jar");
|
||||
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]);
|
||||
if(data.getParameter()!=null){
|
||||
intent.putExtra("parameter",data.getParameter());
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.app.Notification;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.tencent.smtt.sdk.QbSdk;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
@@ -49,29 +50,27 @@ public class Application extends android.app.Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Application.application = this;
|
||||
// DoraemonKit.install(application);
|
||||
UMConfigure.setLogEnabled(true);
|
||||
// DoraemonKit.install(application);
|
||||
//UMConfigure.setLogEnabled(true);
|
||||
System.out.println("开始初始化");
|
||||
|
||||
init();
|
||||
initPlugs();
|
||||
regActivity();
|
||||
JianRUtils.initShipCardId();
|
||||
|
||||
initUmeng();
|
||||
initTx();
|
||||
|
||||
|
||||
//initUmeng();
|
||||
// initTx();
|
||||
|
||||
|
||||
System.out.println("初始化结束");
|
||||
}
|
||||
private void initUmeng(){
|
||||
|
||||
private void initUmeng() {
|
||||
try {
|
||||
UMConfigure.init(this, UMConfigure.DEVICE_TYPE_PHONE, "c5ec76e4a6ebb1516359792ffee09eb5");
|
||||
MobclickAgent.setScenarioType(this, MobclickAgent.EScenarioType.E_UM_NORMAL);
|
||||
PushAgent pushAgent= PushAgent.getInstance(this);
|
||||
pushAgent.register(new IUmengRegisterCallback() {
|
||||
PushAgent pushAgent = PushAgent.getInstance(this);
|
||||
pushAgent.register(new IUmengRegisterCallback() {
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
System.out.println("友盟推送注册成功:" + s);
|
||||
@@ -82,23 +81,24 @@ public class Application extends android.app.Application {
|
||||
System.out.println("友盟推送注册失败:" + s + "(" + s1 + ")");
|
||||
}
|
||||
});
|
||||
pushAgent.setMessageHandler(new UmengMessageHandler(){
|
||||
pushAgent.setMessageHandler(new UmengMessageHandler() {
|
||||
@Override
|
||||
public Notification getNotification(Context context, UMessage uMessage) {
|
||||
for (Map.Entry<String, String> entry : uMessage.extra.entrySet()) {
|
||||
if(entry.getKey().equals("url")){
|
||||
LoadingActivity.url=entry.getValue();
|
||||
if (entry.getKey().equals("url")) {
|
||||
LoadingActivity.url = entry.getValue();
|
||||
}
|
||||
|
||||
}
|
||||
return super.getNotification(context, uMessage);
|
||||
}
|
||||
});
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private void initTx(){
|
||||
|
||||
private void initTx() {
|
||||
try {
|
||||
QbSdk.initX5Environment(this, new QbSdk.PreInitCallback() {
|
||||
@Override
|
||||
@@ -108,24 +108,31 @@ public class Application extends android.app.Application {
|
||||
|
||||
@Override
|
||||
public void onViewInitFinished(boolean b) {
|
||||
Log.e("QDSDK","加载内核是否成功:"+b);
|
||||
Log.e("QDSDK", "加载内核是否成功:" + b);
|
||||
}
|
||||
});
|
||||
}catch (Exception ignored){
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initPlugs() {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
|
||||
Map<String, DexClassLoader> plugsin = new HashMap<>();
|
||||
File path = new File(Utils.getAppPath() + "/plugin/");
|
||||
File dex = new File(Application.application.getFilesDir() + "/plugs/");
|
||||
if (!dex.exists()) {
|
||||
dex.mkdirs();
|
||||
}
|
||||
if (path.exists()) {
|
||||
for (File file : path.listFiles()) {
|
||||
if (file.getName().contains(".jar")) {
|
||||
DexClassLoader dexClassLoader = new DexClassLoader(file.getAbsolutePath(), Application.application.getFilesDir() + "/plugs/", null, getClassLoader());
|
||||
DexClassLoader dexClassLoader = new DexClassLoader(file.getAbsolutePath(), dex.getAbsolutePath(), null, getClassLoader());
|
||||
plugsin.put(file.getName(), dexClassLoader);
|
||||
System.out.println("加载插件:"+file.getName());
|
||||
AppData.plugsin.put(file.getName(), dexClassLoader);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -208,7 +215,7 @@ public class Application extends android.app.Application {
|
||||
public void onActivityCreated(Activity activity, Bundle bundle) {
|
||||
Log.i(TAG, "创建:" + activity.getClass().getName());
|
||||
AppData.activity = activity;
|
||||
AppData.handler = new Handler();
|
||||
AppData.handler = new Handler(Looper.getMainLooper());
|
||||
ActivitysManager.addActivity(activity);
|
||||
PushAgent.getInstance(activity).onAppStart();
|
||||
}
|
||||
|
||||
@@ -27,4 +27,5 @@ public class AppData {
|
||||
public static Handler handler;
|
||||
public static String version="1.0";
|
||||
public static String magicPackageName ="com.bigzhao.jianrmagicbox";
|
||||
public static boolean debug=false;
|
||||
}
|
||||
|
||||
988
app/src/main/java/com/yutou/jianr_mg/Data/JianNiang.java
Normal file
988
app/src/main/java/com/yutou/jianr_mg/Data/JianNiang.java
Normal file
@@ -0,0 +1,988 @@
|
||||
package com.yutou.jianr_mg.Data;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JianNiang {
|
||||
private int cid;
|
||||
private int star;
|
||||
private String title;
|
||||
private int country;
|
||||
private int type;
|
||||
private int hp;
|
||||
private int atk;
|
||||
private int def;
|
||||
private String torpedo;
|
||||
private int miss;
|
||||
private int hit;
|
||||
private int capacity;
|
||||
private String antisub;
|
||||
private int speed;
|
||||
private int radar;
|
||||
private int range;
|
||||
private int luck;
|
||||
private DismantleBean dismantle;
|
||||
private String author;
|
||||
private int release;
|
||||
private String desc;
|
||||
private String vow;
|
||||
private int npc;
|
||||
private String shipIndex;
|
||||
private int shipTon;
|
||||
private int guardType;
|
||||
private String subTitle;
|
||||
private String titleClass;
|
||||
private String subTitleClass;
|
||||
private String classNo;
|
||||
private String subClassNo;
|
||||
private String picId;
|
||||
private int hpMax;
|
||||
private int atkMax;
|
||||
private int defMax;
|
||||
private String torpedoMax;
|
||||
private int missMax;
|
||||
private int hitMax;
|
||||
private int airDef;
|
||||
private int airDefMax;
|
||||
private String missileSlot;
|
||||
private String missileInit;
|
||||
private String antisubMax;
|
||||
private int radarMax;
|
||||
private int luckMax;
|
||||
private int evoLevel;
|
||||
private int evoCid;
|
||||
private int evoNeedItemCid;
|
||||
private int evoToCid;
|
||||
private EvoNeedResourceBean evoNeedResource;
|
||||
private int haveSkin;
|
||||
private String borderId;
|
||||
private String skillType;
|
||||
private String initSkillLevel;
|
||||
private int maxSkillLevel;
|
||||
private int canEvo;
|
||||
private int equipmentNum;
|
||||
private int maxLevel;
|
||||
private int maxOil;
|
||||
private int maxAmmo;
|
||||
private double repairOilModulus;
|
||||
private double repairSteelModulus;
|
||||
private double repairTime;
|
||||
private StrengthenTopBean strengthenTop;
|
||||
private StrengthenSupplyExpBean strengthenSupplyExp;
|
||||
private int strengthenLevelUpExp;
|
||||
private String evoClass;
|
||||
private String medalDesc;
|
||||
private String customField;
|
||||
private String getDialogue;
|
||||
private String atkDialogue;
|
||||
private String sinkDialogue;
|
||||
private String breakDialogue;
|
||||
private String formationDialogue;
|
||||
private String marryMainDialogue;
|
||||
private String nightAtkDialogue;
|
||||
private String myRoomDialogue;
|
||||
private String friendRoomDialogue;
|
||||
private String planeImgType;
|
||||
private String planeImgType2;
|
||||
private String gunType;
|
||||
private String teamShip;
|
||||
private List<?> skills;
|
||||
private List<Integer> equipment;
|
||||
private List<String> mainDialogue;
|
||||
private List<?> capacitySlot;
|
||||
private List<Integer> capacityInit;
|
||||
private List<Integer> equipmentType;
|
||||
private List<Integer> showAttribute;
|
||||
private List<Integer> kitchenPosition;
|
||||
|
||||
public int getCid() {
|
||||
return cid;
|
||||
}
|
||||
|
||||
public void setCid(int cid) {
|
||||
this.cid = cid;
|
||||
}
|
||||
|
||||
public int getStar() {
|
||||
return star;
|
||||
}
|
||||
|
||||
public void setStar(int star) {
|
||||
this.star = star;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(int country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getHp() {
|
||||
return hp;
|
||||
}
|
||||
|
||||
public void setHp(int hp) {
|
||||
this.hp = hp;
|
||||
}
|
||||
|
||||
public int getAtk() {
|
||||
return atk;
|
||||
}
|
||||
|
||||
public void setAtk(int atk) {
|
||||
this.atk = atk;
|
||||
}
|
||||
|
||||
public int getDef() {
|
||||
return def;
|
||||
}
|
||||
|
||||
public void setDef(int def) {
|
||||
this.def = def;
|
||||
}
|
||||
|
||||
public String getTorpedo() {
|
||||
return torpedo;
|
||||
}
|
||||
|
||||
public void setTorpedo(String torpedo) {
|
||||
this.torpedo = torpedo;
|
||||
}
|
||||
|
||||
public int getMiss() {
|
||||
return miss;
|
||||
}
|
||||
|
||||
public void setMiss(int miss) {
|
||||
this.miss = miss;
|
||||
}
|
||||
|
||||
public int getHit() {
|
||||
return hit;
|
||||
}
|
||||
|
||||
public void setHit(int hit) {
|
||||
this.hit = hit;
|
||||
}
|
||||
|
||||
public int getCapacity() {
|
||||
return capacity;
|
||||
}
|
||||
|
||||
public void setCapacity(int capacity) {
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public String getAntisub() {
|
||||
return antisub;
|
||||
}
|
||||
|
||||
public void setAntisub(String antisub) {
|
||||
this.antisub = antisub;
|
||||
}
|
||||
|
||||
public int getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(int speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public int getRadar() {
|
||||
return radar;
|
||||
}
|
||||
|
||||
public void setRadar(int radar) {
|
||||
this.radar = radar;
|
||||
}
|
||||
|
||||
public int getRange() {
|
||||
return range;
|
||||
}
|
||||
|
||||
public void setRange(int range) {
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
public int getLuck() {
|
||||
return luck;
|
||||
}
|
||||
|
||||
public void setLuck(int luck) {
|
||||
this.luck = luck;
|
||||
}
|
||||
|
||||
public DismantleBean getDismantle() {
|
||||
return dismantle;
|
||||
}
|
||||
|
||||
public void setDismantle(DismantleBean dismantle) {
|
||||
this.dismantle = dismantle;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public int getRelease() {
|
||||
return release;
|
||||
}
|
||||
|
||||
public void setRelease(int release) {
|
||||
this.release = release;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getVow() {
|
||||
return vow;
|
||||
}
|
||||
|
||||
public void setVow(String vow) {
|
||||
this.vow = vow;
|
||||
}
|
||||
|
||||
public int getNpc() {
|
||||
return npc;
|
||||
}
|
||||
|
||||
public void setNpc(int npc) {
|
||||
this.npc = npc;
|
||||
}
|
||||
|
||||
public String getShipIndex() {
|
||||
return shipIndex;
|
||||
}
|
||||
|
||||
public void setShipIndex(String shipIndex) {
|
||||
this.shipIndex = shipIndex;
|
||||
}
|
||||
|
||||
public int getShipTon() {
|
||||
return shipTon;
|
||||
}
|
||||
|
||||
public void setShipTon(int shipTon) {
|
||||
this.shipTon = shipTon;
|
||||
}
|
||||
|
||||
public int getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
public void setGuardType(int guardType) {
|
||||
this.guardType = guardType;
|
||||
}
|
||||
|
||||
public String getSubTitle() {
|
||||
return subTitle;
|
||||
}
|
||||
|
||||
public void setSubTitle(String subTitle) {
|
||||
this.subTitle = subTitle;
|
||||
}
|
||||
|
||||
public String getTitleClass() {
|
||||
return titleClass;
|
||||
}
|
||||
|
||||
public void setTitleClass(String titleClass) {
|
||||
this.titleClass = titleClass;
|
||||
}
|
||||
|
||||
public String getSubTitleClass() {
|
||||
return subTitleClass;
|
||||
}
|
||||
|
||||
public void setSubTitleClass(String subTitleClass) {
|
||||
this.subTitleClass = subTitleClass;
|
||||
}
|
||||
|
||||
public String getClassNo() {
|
||||
return classNo;
|
||||
}
|
||||
|
||||
public void setClassNo(String classNo) {
|
||||
this.classNo = classNo;
|
||||
}
|
||||
|
||||
public String getSubClassNo() {
|
||||
return subClassNo;
|
||||
}
|
||||
|
||||
public void setSubClassNo(String subClassNo) {
|
||||
this.subClassNo = subClassNo;
|
||||
}
|
||||
|
||||
public String getPicId() {
|
||||
return picId;
|
||||
}
|
||||
|
||||
public void setPicId(String picId) {
|
||||
this.picId = picId;
|
||||
}
|
||||
|
||||
public int getHpMax() {
|
||||
return hpMax;
|
||||
}
|
||||
|
||||
public void setHpMax(int hpMax) {
|
||||
this.hpMax = hpMax;
|
||||
}
|
||||
|
||||
public int getAtkMax() {
|
||||
return atkMax;
|
||||
}
|
||||
|
||||
public void setAtkMax(int atkMax) {
|
||||
this.atkMax = atkMax;
|
||||
}
|
||||
|
||||
public int getDefMax() {
|
||||
return defMax;
|
||||
}
|
||||
|
||||
public void setDefMax(int defMax) {
|
||||
this.defMax = defMax;
|
||||
}
|
||||
|
||||
public String getTorpedoMax() {
|
||||
return torpedoMax;
|
||||
}
|
||||
|
||||
public void setTorpedoMax(String torpedoMax) {
|
||||
this.torpedoMax = torpedoMax;
|
||||
}
|
||||
|
||||
public int getMissMax() {
|
||||
return missMax;
|
||||
}
|
||||
|
||||
public void setMissMax(int missMax) {
|
||||
this.missMax = missMax;
|
||||
}
|
||||
|
||||
public int getHitMax() {
|
||||
return hitMax;
|
||||
}
|
||||
|
||||
public void setHitMax(int hitMax) {
|
||||
this.hitMax = hitMax;
|
||||
}
|
||||
|
||||
public int getAirDef() {
|
||||
return airDef;
|
||||
}
|
||||
|
||||
public void setAirDef(int airDef) {
|
||||
this.airDef = airDef;
|
||||
}
|
||||
|
||||
public int getAirDefMax() {
|
||||
return airDefMax;
|
||||
}
|
||||
|
||||
public void setAirDefMax(int airDefMax) {
|
||||
this.airDefMax = airDefMax;
|
||||
}
|
||||
|
||||
public String getMissileSlot() {
|
||||
return missileSlot;
|
||||
}
|
||||
|
||||
public void setMissileSlot(String missileSlot) {
|
||||
this.missileSlot = missileSlot;
|
||||
}
|
||||
|
||||
public String getMissileInit() {
|
||||
return missileInit;
|
||||
}
|
||||
|
||||
public void setMissileInit(String missileInit) {
|
||||
this.missileInit = missileInit;
|
||||
}
|
||||
|
||||
public String getAntisubMax() {
|
||||
return antisubMax;
|
||||
}
|
||||
|
||||
public void setAntisubMax(String antisubMax) {
|
||||
this.antisubMax = antisubMax;
|
||||
}
|
||||
|
||||
public int getRadarMax() {
|
||||
return radarMax;
|
||||
}
|
||||
|
||||
public void setRadarMax(int radarMax) {
|
||||
this.radarMax = radarMax;
|
||||
}
|
||||
|
||||
public int getLuckMax() {
|
||||
return luckMax;
|
||||
}
|
||||
|
||||
public void setLuckMax(int luckMax) {
|
||||
this.luckMax = luckMax;
|
||||
}
|
||||
|
||||
public int getEvoLevel() {
|
||||
return evoLevel;
|
||||
}
|
||||
|
||||
public void setEvoLevel(int evoLevel) {
|
||||
this.evoLevel = evoLevel;
|
||||
}
|
||||
|
||||
public int getEvoCid() {
|
||||
return evoCid;
|
||||
}
|
||||
|
||||
public void setEvoCid(int evoCid) {
|
||||
this.evoCid = evoCid;
|
||||
}
|
||||
|
||||
public int getEvoNeedItemCid() {
|
||||
return evoNeedItemCid;
|
||||
}
|
||||
|
||||
public void setEvoNeedItemCid(int evoNeedItemCid) {
|
||||
this.evoNeedItemCid = evoNeedItemCid;
|
||||
}
|
||||
|
||||
public int getEvoToCid() {
|
||||
return evoToCid;
|
||||
}
|
||||
|
||||
public void setEvoToCid(int evoToCid) {
|
||||
this.evoToCid = evoToCid;
|
||||
}
|
||||
|
||||
public EvoNeedResourceBean getEvoNeedResource() {
|
||||
return evoNeedResource;
|
||||
}
|
||||
|
||||
public void setEvoNeedResource(EvoNeedResourceBean evoNeedResource) {
|
||||
this.evoNeedResource = evoNeedResource;
|
||||
}
|
||||
|
||||
public int getHaveSkin() {
|
||||
return haveSkin;
|
||||
}
|
||||
|
||||
public void setHaveSkin(int haveSkin) {
|
||||
this.haveSkin = haveSkin;
|
||||
}
|
||||
|
||||
public String getBorderId() {
|
||||
return borderId;
|
||||
}
|
||||
|
||||
public void setBorderId(String borderId) {
|
||||
this.borderId = borderId;
|
||||
}
|
||||
|
||||
public String getSkillType() {
|
||||
return skillType;
|
||||
}
|
||||
|
||||
public void setSkillType(String skillType) {
|
||||
this.skillType = skillType;
|
||||
}
|
||||
|
||||
public String getInitSkillLevel() {
|
||||
return initSkillLevel;
|
||||
}
|
||||
|
||||
public void setInitSkillLevel(String initSkillLevel) {
|
||||
this.initSkillLevel = initSkillLevel;
|
||||
}
|
||||
|
||||
public int getMaxSkillLevel() {
|
||||
return maxSkillLevel;
|
||||
}
|
||||
|
||||
public void setMaxSkillLevel(int maxSkillLevel) {
|
||||
this.maxSkillLevel = maxSkillLevel;
|
||||
}
|
||||
|
||||
public int getCanEvo() {
|
||||
return canEvo;
|
||||
}
|
||||
|
||||
public void setCanEvo(int canEvo) {
|
||||
this.canEvo = canEvo;
|
||||
}
|
||||
|
||||
public int getEquipmentNum() {
|
||||
return equipmentNum;
|
||||
}
|
||||
|
||||
public void setEquipmentNum(int equipmentNum) {
|
||||
this.equipmentNum = equipmentNum;
|
||||
}
|
||||
|
||||
public int getMaxLevel() {
|
||||
return maxLevel;
|
||||
}
|
||||
|
||||
public void setMaxLevel(int maxLevel) {
|
||||
this.maxLevel = maxLevel;
|
||||
}
|
||||
|
||||
public int getMaxOil() {
|
||||
return maxOil;
|
||||
}
|
||||
|
||||
public void setMaxOil(int maxOil) {
|
||||
this.maxOil = maxOil;
|
||||
}
|
||||
|
||||
public int getMaxAmmo() {
|
||||
return maxAmmo;
|
||||
}
|
||||
|
||||
public void setMaxAmmo(int maxAmmo) {
|
||||
this.maxAmmo = maxAmmo;
|
||||
}
|
||||
|
||||
public double getRepairOilModulus() {
|
||||
return repairOilModulus;
|
||||
}
|
||||
|
||||
public void setRepairOilModulus(double repairOilModulus) {
|
||||
this.repairOilModulus = repairOilModulus;
|
||||
}
|
||||
|
||||
public double getRepairSteelModulus() {
|
||||
return repairSteelModulus;
|
||||
}
|
||||
|
||||
public void setRepairSteelModulus(double repairSteelModulus) {
|
||||
this.repairSteelModulus = repairSteelModulus;
|
||||
}
|
||||
|
||||
public double getRepairTime() {
|
||||
return repairTime;
|
||||
}
|
||||
|
||||
public void setRepairTime(double repairTime) {
|
||||
this.repairTime = repairTime;
|
||||
}
|
||||
|
||||
public StrengthenTopBean getStrengthenTop() {
|
||||
return strengthenTop;
|
||||
}
|
||||
|
||||
public void setStrengthenTop(StrengthenTopBean strengthenTop) {
|
||||
this.strengthenTop = strengthenTop;
|
||||
}
|
||||
|
||||
public StrengthenSupplyExpBean getStrengthenSupplyExp() {
|
||||
return strengthenSupplyExp;
|
||||
}
|
||||
|
||||
public void setStrengthenSupplyExp(StrengthenSupplyExpBean strengthenSupplyExp) {
|
||||
this.strengthenSupplyExp = strengthenSupplyExp;
|
||||
}
|
||||
|
||||
public int getStrengthenLevelUpExp() {
|
||||
return strengthenLevelUpExp;
|
||||
}
|
||||
|
||||
public void setStrengthenLevelUpExp(int strengthenLevelUpExp) {
|
||||
this.strengthenLevelUpExp = strengthenLevelUpExp;
|
||||
}
|
||||
|
||||
public String getEvoClass() {
|
||||
return evoClass;
|
||||
}
|
||||
|
||||
public void setEvoClass(String evoClass) {
|
||||
this.evoClass = evoClass;
|
||||
}
|
||||
|
||||
public String getMedalDesc() {
|
||||
return medalDesc;
|
||||
}
|
||||
|
||||
public void setMedalDesc(String medalDesc) {
|
||||
this.medalDesc = medalDesc;
|
||||
}
|
||||
|
||||
public String getCustomField() {
|
||||
return customField;
|
||||
}
|
||||
|
||||
public void setCustomField(String customField) {
|
||||
this.customField = customField;
|
||||
}
|
||||
|
||||
public String getGetDialogue() {
|
||||
return getDialogue;
|
||||
}
|
||||
|
||||
public void setGetDialogue(String getDialogue) {
|
||||
this.getDialogue = getDialogue;
|
||||
}
|
||||
|
||||
public String getAtkDialogue() {
|
||||
return atkDialogue;
|
||||
}
|
||||
|
||||
public void setAtkDialogue(String atkDialogue) {
|
||||
this.atkDialogue = atkDialogue;
|
||||
}
|
||||
|
||||
public String getSinkDialogue() {
|
||||
return sinkDialogue;
|
||||
}
|
||||
|
||||
public void setSinkDialogue(String sinkDialogue) {
|
||||
this.sinkDialogue = sinkDialogue;
|
||||
}
|
||||
|
||||
public String getBreakDialogue() {
|
||||
return breakDialogue;
|
||||
}
|
||||
|
||||
public void setBreakDialogue(String breakDialogue) {
|
||||
this.breakDialogue = breakDialogue;
|
||||
}
|
||||
|
||||
public String getFormationDialogue() {
|
||||
return formationDialogue;
|
||||
}
|
||||
|
||||
public void setFormationDialogue(String formationDialogue) {
|
||||
this.formationDialogue = formationDialogue;
|
||||
}
|
||||
|
||||
public String getMarryMainDialogue() {
|
||||
return marryMainDialogue;
|
||||
}
|
||||
|
||||
public void setMarryMainDialogue(String marryMainDialogue) {
|
||||
this.marryMainDialogue = marryMainDialogue;
|
||||
}
|
||||
|
||||
public String getNightAtkDialogue() {
|
||||
return nightAtkDialogue;
|
||||
}
|
||||
|
||||
public void setNightAtkDialogue(String nightAtkDialogue) {
|
||||
this.nightAtkDialogue = nightAtkDialogue;
|
||||
}
|
||||
|
||||
public String getMyRoomDialogue() {
|
||||
return myRoomDialogue;
|
||||
}
|
||||
|
||||
public void setMyRoomDialogue(String myRoomDialogue) {
|
||||
this.myRoomDialogue = myRoomDialogue;
|
||||
}
|
||||
|
||||
public String getFriendRoomDialogue() {
|
||||
return friendRoomDialogue;
|
||||
}
|
||||
|
||||
public void setFriendRoomDialogue(String friendRoomDialogue) {
|
||||
this.friendRoomDialogue = friendRoomDialogue;
|
||||
}
|
||||
|
||||
public String getPlaneImgType() {
|
||||
return planeImgType;
|
||||
}
|
||||
|
||||
public void setPlaneImgType(String planeImgType) {
|
||||
this.planeImgType = planeImgType;
|
||||
}
|
||||
|
||||
public String getPlaneImgType2() {
|
||||
return planeImgType2;
|
||||
}
|
||||
|
||||
public void setPlaneImgType2(String planeImgType2) {
|
||||
this.planeImgType2 = planeImgType2;
|
||||
}
|
||||
|
||||
public String getGunType() {
|
||||
return gunType;
|
||||
}
|
||||
|
||||
public void setGunType(String gunType) {
|
||||
this.gunType = gunType;
|
||||
}
|
||||
|
||||
public String getTeamShip() {
|
||||
return teamShip;
|
||||
}
|
||||
|
||||
public void setTeamShip(String teamShip) {
|
||||
this.teamShip = teamShip;
|
||||
}
|
||||
|
||||
public List<?> getSkills() {
|
||||
return skills;
|
||||
}
|
||||
|
||||
public void setSkills(List<?> skills) {
|
||||
this.skills = skills;
|
||||
}
|
||||
|
||||
public List<Integer> getEquipment() {
|
||||
return equipment;
|
||||
}
|
||||
|
||||
public void setEquipment(List<Integer> equipment) {
|
||||
this.equipment = equipment;
|
||||
}
|
||||
|
||||
public List<String> getMainDialogue() {
|
||||
return mainDialogue;
|
||||
}
|
||||
|
||||
public void setMainDialogue(List<String> mainDialogue) {
|
||||
this.mainDialogue = mainDialogue;
|
||||
}
|
||||
|
||||
public List<?> getCapacitySlot() {
|
||||
return capacitySlot;
|
||||
}
|
||||
|
||||
public void setCapacitySlot(List<?> capacitySlot) {
|
||||
this.capacitySlot = capacitySlot;
|
||||
}
|
||||
|
||||
public List<Integer> getCapacityInit() {
|
||||
return capacityInit;
|
||||
}
|
||||
|
||||
public void setCapacityInit(List<Integer> capacityInit) {
|
||||
this.capacityInit = capacityInit;
|
||||
}
|
||||
|
||||
public List<Integer> getEquipmentType() {
|
||||
return equipmentType;
|
||||
}
|
||||
|
||||
public void setEquipmentType(List<Integer> equipmentType) {
|
||||
this.equipmentType = equipmentType;
|
||||
}
|
||||
|
||||
public List<Integer> getShowAttribute() {
|
||||
return showAttribute;
|
||||
}
|
||||
|
||||
public void setShowAttribute(List<Integer> showAttribute) {
|
||||
this.showAttribute = showAttribute;
|
||||
}
|
||||
|
||||
public List<Integer> getKitchenPosition() {
|
||||
return kitchenPosition;
|
||||
}
|
||||
|
||||
public void setKitchenPosition(List<Integer> kitchenPosition) {
|
||||
this.kitchenPosition = kitchenPosition;
|
||||
}
|
||||
|
||||
public static class DismantleBean {
|
||||
/**
|
||||
* 2 : 40
|
||||
* 3 : 50
|
||||
* 4 : 40
|
||||
* 9 : 0
|
||||
*/
|
||||
|
||||
@JSONField(name = "2")
|
||||
private int _$2;
|
||||
@JSONField(name = "3")
|
||||
private int _$3;
|
||||
@JSONField(name = "4")
|
||||
private int _$4;
|
||||
@JSONField(name = "9")
|
||||
private int _$9;
|
||||
|
||||
public int get_$2() {
|
||||
return _$2;
|
||||
}
|
||||
|
||||
public void set_$2(int _$2) {
|
||||
this._$2 = _$2;
|
||||
}
|
||||
|
||||
public int get_$3() {
|
||||
return _$3;
|
||||
}
|
||||
|
||||
public void set_$3(int _$3) {
|
||||
this._$3 = _$3;
|
||||
}
|
||||
|
||||
public int get_$4() {
|
||||
return _$4;
|
||||
}
|
||||
|
||||
public void set_$4(int _$4) {
|
||||
this._$4 = _$4;
|
||||
}
|
||||
|
||||
public int get_$9() {
|
||||
return _$9;
|
||||
}
|
||||
|
||||
public void set_$9(int _$9) {
|
||||
this._$9 = _$9;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EvoNeedResourceBean {
|
||||
/**
|
||||
* 4 : 200
|
||||
* 10241 : 20
|
||||
*/
|
||||
|
||||
@JSONField(name = "4")
|
||||
private int _$4;
|
||||
@JSONField(name = "10241")
|
||||
private int _$10241;
|
||||
|
||||
public int get_$4() {
|
||||
return _$4;
|
||||
}
|
||||
|
||||
public void set_$4(int _$4) {
|
||||
this._$4 = _$4;
|
||||
}
|
||||
|
||||
public int get_$10241() {
|
||||
return _$10241;
|
||||
}
|
||||
|
||||
public void set_$10241(int _$10241) {
|
||||
this._$10241 = _$10241;
|
||||
}
|
||||
}
|
||||
|
||||
public static class StrengthenTopBean {
|
||||
/**
|
||||
* atk : 625
|
||||
* torpedo : 0
|
||||
* air_def : 750
|
||||
* def : 375
|
||||
*/
|
||||
|
||||
private int atk;
|
||||
private int torpedo;
|
||||
private int air_def;
|
||||
private int def;
|
||||
|
||||
public int getAtk() {
|
||||
return atk;
|
||||
}
|
||||
|
||||
public void setAtk(int atk) {
|
||||
this.atk = atk;
|
||||
}
|
||||
|
||||
public int getTorpedo() {
|
||||
return torpedo;
|
||||
}
|
||||
|
||||
public void setTorpedo(int torpedo) {
|
||||
this.torpedo = torpedo;
|
||||
}
|
||||
|
||||
public int getAir_def() {
|
||||
return air_def;
|
||||
}
|
||||
|
||||
public void setAir_def(int air_def) {
|
||||
this.air_def = air_def;
|
||||
}
|
||||
|
||||
public int getDef() {
|
||||
return def;
|
||||
}
|
||||
|
||||
public void setDef(int def) {
|
||||
this.def = def;
|
||||
}
|
||||
}
|
||||
|
||||
public static class StrengthenSupplyExpBean {
|
||||
/**
|
||||
* atk : 73
|
||||
* torpedo : 0
|
||||
* air_def : 24
|
||||
* def : 65
|
||||
*/
|
||||
|
||||
private int atk;
|
||||
private int torpedo;
|
||||
private int air_def;
|
||||
private int def;
|
||||
|
||||
public int getAtk() {
|
||||
return atk;
|
||||
}
|
||||
|
||||
public void setAtk(int atk) {
|
||||
this.atk = atk;
|
||||
}
|
||||
|
||||
public int getTorpedo() {
|
||||
return torpedo;
|
||||
}
|
||||
|
||||
public void setTorpedo(int torpedo) {
|
||||
this.torpedo = torpedo;
|
||||
}
|
||||
|
||||
public int getAir_def() {
|
||||
return air_def;
|
||||
}
|
||||
|
||||
public void setAir_def(int air_def) {
|
||||
this.air_def = air_def;
|
||||
}
|
||||
|
||||
public int getDef() {
|
||||
return def;
|
||||
}
|
||||
|
||||
public void setDef(int def) {
|
||||
this.def = def;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
app/src/main/java/com/yutou/jianr_mg/Data/MAdConfig.java
Normal file
120
app/src/main/java/com/yutou/jianr_mg/Data/MAdConfig.java
Normal file
@@ -0,0 +1,120 @@
|
||||
package com.yutou.jianr_mg.Data;
|
||||
|
||||
public class MAdConfig {
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_config.id
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_config.appid
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private String appid;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_config.posId
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private String posid;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_config.adshow
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private Integer adshow=0;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_config.adtype
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private Integer adtype;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_config.id
|
||||
* @return the value of m_ad_config.id
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_config.id
|
||||
* @param id the value for m_ad_config.id
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_config.appid
|
||||
* @return the value of m_ad_config.appid
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public String getAppid() {
|
||||
return appid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_config.appid
|
||||
* @param appid the value for m_ad_config.appid
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setAppid(String appid) {
|
||||
this.appid = appid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_config.posId
|
||||
* @return the value of m_ad_config.posId
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public String getPosid() {
|
||||
return posid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_config.posId
|
||||
* @param posid the value for m_ad_config.posId
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setPosid(String posid) {
|
||||
this.posid = posid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_config.adshow
|
||||
* @return the value of m_ad_config.adshow
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public Integer getAdshow() {
|
||||
return adshow;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_config.adshow
|
||||
* @param adshow the value for m_ad_config.adshow
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setAdshow(Integer adshow) {
|
||||
this.adshow = adshow;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_config.adtype
|
||||
* @return the value of m_ad_config.adtype
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public Integer getAdtype() {
|
||||
return adtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_config.adtype
|
||||
* @param adtype the value for m_ad_config.adtype
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setAdtype(Integer adtype) {
|
||||
this.adtype = adtype;
|
||||
}
|
||||
}
|
||||
168
app/src/main/java/com/yutou/jianr_mg/Data/MAdLog.java
Normal file
168
app/src/main/java/com/yutou/jianr_mg/Data/MAdLog.java
Normal file
@@ -0,0 +1,168 @@
|
||||
package com.yutou.jianr_mg.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class MAdLog {
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_log.id
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_log.adtype
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
private Integer adtype;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_log.utype
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
private Integer utype;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_log.uid
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
private Integer uid;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_log.IP
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
private String ip;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_log.IMEI
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
private String imei;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column m_ad_log.createTime
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
private Date createtime;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_log.id
|
||||
* @return the value of m_ad_log.id
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_log.id
|
||||
* @param id the value for m_ad_log.id
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_log.adtype
|
||||
* @return the value of m_ad_log.adtype
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public Integer getAdtype() {
|
||||
return adtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_log.adtype
|
||||
* @param adtype the value for m_ad_log.adtype
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public void setAdtype(Integer adtype) {
|
||||
this.adtype = adtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_log.utype
|
||||
* @return the value of m_ad_log.utype
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public Integer getUtype() {
|
||||
return utype;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_log.utype
|
||||
* @param utype the value for m_ad_log.utype
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public void setUtype(Integer utype) {
|
||||
this.utype = utype;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_log.uid
|
||||
* @return the value of m_ad_log.uid
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public Integer getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_log.uid
|
||||
* @param uid the value for m_ad_log.uid
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public void setUid(Integer uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_log.IP
|
||||
* @return the value of m_ad_log.IP
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_log.IP
|
||||
* @param ip the value for m_ad_log.IP
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_log.IMEI
|
||||
* @return the value of m_ad_log.IMEI
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public String getImei() {
|
||||
return imei;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_log.IMEI
|
||||
* @param imei the value for m_ad_log.IMEI
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public void setImei(String imei) {
|
||||
this.imei = imei;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column m_ad_log.createTime
|
||||
* @return the value of m_ad_log.createTime
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public Date getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column m_ad_log.createTime
|
||||
* @param createtime the value for m_ad_log.createTime
|
||||
* @mbg.generated Mon May 13 14:10:16 CST 2019
|
||||
*/
|
||||
public void setCreatetime(Date createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
}
|
||||
@@ -201,4 +201,29 @@ public class MAppTools {
|
||||
public void setParameter(String parameter) {
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"pluginName\":\"")
|
||||
.append(pluginName).append('\"');
|
||||
sb.append(",\"parameter\":\"")
|
||||
.append(parameter).append('\"');
|
||||
sb.append(",\"id\":")
|
||||
.append(id);
|
||||
sb.append(",\"name\":\"")
|
||||
.append(name).append('\"');
|
||||
sb.append(",\"image\":\"")
|
||||
.append(image).append('\"');
|
||||
sb.append(",\"url\":\"")
|
||||
.append(url).append('\"');
|
||||
sb.append(",\"mainFunction\":\"")
|
||||
.append(mainFunction).append('\"');
|
||||
sb.append(",\"permission\":")
|
||||
.append(permission);
|
||||
sb.append(",\"isshow\":")
|
||||
.append(isshow);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
391
app/src/main/java/com/yutou/jianr_mg/Data/ShipEquipmnt.java
Normal file
391
app/src/main/java/com/yutou/jianr_mg/Data/ShipEquipmnt.java
Normal file
@@ -0,0 +1,391 @@
|
||||
package com.yutou.jianr_mg.Data;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ShipEquipmnt {
|
||||
private int cid;
|
||||
private int star;
|
||||
private String title;
|
||||
private String country;
|
||||
private int type;
|
||||
private String hp;
|
||||
private int atk;
|
||||
private String def;
|
||||
private String torpedo;
|
||||
private String antisub;
|
||||
private String radar;
|
||||
private String hit;
|
||||
private int range;
|
||||
private String miss;
|
||||
private String luck;
|
||||
private String correction;
|
||||
private String effect;
|
||||
private DismantleBean dismantle;
|
||||
private String author;
|
||||
private String desc;
|
||||
private String desc2;
|
||||
private String equipIndex;
|
||||
private int picId;
|
||||
private int boreType;
|
||||
private String handbookType;
|
||||
private String aircraftAtk;
|
||||
private String missileTmd;
|
||||
private String missileHit;
|
||||
private String airDef;
|
||||
private int airDefRate;
|
||||
private String airDefCorrect;
|
||||
private String missleDefModulus;
|
||||
private String shipCid;
|
||||
private String shipCountry;
|
||||
private String specialEffect;
|
||||
private String aluminiumUse;
|
||||
private List<Integer> shipType;
|
||||
|
||||
public int getCid() {
|
||||
return cid;
|
||||
}
|
||||
|
||||
public void setCid(int cid) {
|
||||
this.cid = cid;
|
||||
}
|
||||
|
||||
public int getStar() {
|
||||
return star;
|
||||
}
|
||||
|
||||
public void setStar(int star) {
|
||||
this.star = star;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getHp() {
|
||||
return hp;
|
||||
}
|
||||
|
||||
public void setHp(String hp) {
|
||||
this.hp = hp;
|
||||
}
|
||||
|
||||
public int getAtk() {
|
||||
return atk;
|
||||
}
|
||||
|
||||
public void setAtk(int atk) {
|
||||
this.atk = atk;
|
||||
}
|
||||
|
||||
public String getDef() {
|
||||
return def;
|
||||
}
|
||||
|
||||
public void setDef(String def) {
|
||||
this.def = def;
|
||||
}
|
||||
|
||||
public String getTorpedo() {
|
||||
return torpedo;
|
||||
}
|
||||
|
||||
public void setTorpedo(String torpedo) {
|
||||
this.torpedo = torpedo;
|
||||
}
|
||||
|
||||
public String getAntisub() {
|
||||
return antisub;
|
||||
}
|
||||
|
||||
public void setAntisub(String antisub) {
|
||||
this.antisub = antisub;
|
||||
}
|
||||
|
||||
public String getRadar() {
|
||||
return radar;
|
||||
}
|
||||
|
||||
public void setRadar(String radar) {
|
||||
this.radar = radar;
|
||||
}
|
||||
|
||||
public String getHit() {
|
||||
return hit;
|
||||
}
|
||||
|
||||
public void setHit(String hit) {
|
||||
this.hit = hit;
|
||||
}
|
||||
|
||||
public int getRange() {
|
||||
return range;
|
||||
}
|
||||
|
||||
public void setRange(int range) {
|
||||
this.range = range;
|
||||
}
|
||||
|
||||
public String getMiss() {
|
||||
return miss;
|
||||
}
|
||||
|
||||
public void setMiss(String miss) {
|
||||
this.miss = miss;
|
||||
}
|
||||
|
||||
public String getLuck() {
|
||||
return luck;
|
||||
}
|
||||
|
||||
public void setLuck(String luck) {
|
||||
this.luck = luck;
|
||||
}
|
||||
|
||||
public String getCorrection() {
|
||||
return correction;
|
||||
}
|
||||
|
||||
public void setCorrection(String correction) {
|
||||
this.correction = correction;
|
||||
}
|
||||
|
||||
public String getEffect() {
|
||||
return effect;
|
||||
}
|
||||
|
||||
public void setEffect(String effect) {
|
||||
this.effect = effect;
|
||||
}
|
||||
|
||||
public DismantleBean getDismantle() {
|
||||
return dismantle;
|
||||
}
|
||||
|
||||
public void setDismantle(DismantleBean dismantle) {
|
||||
this.dismantle = dismantle;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getDesc2() {
|
||||
return desc2;
|
||||
}
|
||||
|
||||
public void setDesc2(String desc2) {
|
||||
this.desc2 = desc2;
|
||||
}
|
||||
|
||||
public String getEquipIndex() {
|
||||
return equipIndex;
|
||||
}
|
||||
|
||||
public void setEquipIndex(String equipIndex) {
|
||||
this.equipIndex = equipIndex;
|
||||
}
|
||||
|
||||
public int getPicId() {
|
||||
return picId;
|
||||
}
|
||||
|
||||
public void setPicId(int picId) {
|
||||
this.picId = picId;
|
||||
}
|
||||
|
||||
public int getBoreType() {
|
||||
return boreType;
|
||||
}
|
||||
|
||||
public void setBoreType(int boreType) {
|
||||
this.boreType = boreType;
|
||||
}
|
||||
|
||||
public String getHandbookType() {
|
||||
return handbookType;
|
||||
}
|
||||
|
||||
public void setHandbookType(String handbookType) {
|
||||
this.handbookType = handbookType;
|
||||
}
|
||||
|
||||
public String getAircraftAtk() {
|
||||
return aircraftAtk;
|
||||
}
|
||||
|
||||
public void setAircraftAtk(String aircraftAtk) {
|
||||
this.aircraftAtk = aircraftAtk;
|
||||
}
|
||||
|
||||
public String getMissileTmd() {
|
||||
return missileTmd;
|
||||
}
|
||||
|
||||
public void setMissileTmd(String missileTmd) {
|
||||
this.missileTmd = missileTmd;
|
||||
}
|
||||
|
||||
public String getMissileHit() {
|
||||
return missileHit;
|
||||
}
|
||||
|
||||
public void setMissileHit(String missileHit) {
|
||||
this.missileHit = missileHit;
|
||||
}
|
||||
|
||||
public String getAirDef() {
|
||||
return airDef;
|
||||
}
|
||||
|
||||
public void setAirDef(String airDef) {
|
||||
this.airDef = airDef;
|
||||
}
|
||||
|
||||
public int getAirDefRate() {
|
||||
return airDefRate;
|
||||
}
|
||||
|
||||
public void setAirDefRate(int airDefRate) {
|
||||
this.airDefRate = airDefRate;
|
||||
}
|
||||
|
||||
public String getAirDefCorrect() {
|
||||
return airDefCorrect;
|
||||
}
|
||||
|
||||
public void setAirDefCorrect(String airDefCorrect) {
|
||||
this.airDefCorrect = airDefCorrect;
|
||||
}
|
||||
|
||||
public String getMissleDefModulus() {
|
||||
return missleDefModulus;
|
||||
}
|
||||
|
||||
public void setMissleDefModulus(String missleDefModulus) {
|
||||
this.missleDefModulus = missleDefModulus;
|
||||
}
|
||||
|
||||
public String getShipCid() {
|
||||
return shipCid;
|
||||
}
|
||||
|
||||
public void setShipCid(String shipCid) {
|
||||
this.shipCid = shipCid;
|
||||
}
|
||||
|
||||
public String getShipCountry() {
|
||||
return shipCountry;
|
||||
}
|
||||
|
||||
public void setShipCountry(String shipCountry) {
|
||||
this.shipCountry = shipCountry;
|
||||
}
|
||||
|
||||
public String getSpecialEffect() {
|
||||
return specialEffect;
|
||||
}
|
||||
|
||||
public void setSpecialEffect(String specialEffect) {
|
||||
this.specialEffect = specialEffect;
|
||||
}
|
||||
|
||||
public String getAluminiumUse() {
|
||||
return aluminiumUse;
|
||||
}
|
||||
|
||||
public void setAluminiumUse(String aluminiumUse) {
|
||||
this.aluminiumUse = aluminiumUse;
|
||||
}
|
||||
|
||||
public List<Integer> getShipType() {
|
||||
return shipType;
|
||||
}
|
||||
|
||||
public void setShipType(List<Integer> shipType) {
|
||||
this.shipType = shipType;
|
||||
}
|
||||
|
||||
public static class DismantleBean {
|
||||
/**
|
||||
* 2 : 0
|
||||
* 3 : 5
|
||||
* 4 : 5
|
||||
* 9 : 0
|
||||
*/
|
||||
|
||||
@JSONField(name = "2")
|
||||
private int _$2;
|
||||
@JSONField(name = "3")
|
||||
private int _$3;
|
||||
@JSONField(name = "4")
|
||||
private int _$4;
|
||||
@JSONField(name = "9")
|
||||
private int _$9;
|
||||
|
||||
public int get_$2() {
|
||||
return _$2;
|
||||
}
|
||||
|
||||
public void set_$2(int _$2) {
|
||||
this._$2 = _$2;
|
||||
}
|
||||
|
||||
public int get_$3() {
|
||||
return _$3;
|
||||
}
|
||||
|
||||
public void set_$3(int _$3) {
|
||||
this._$3 = _$3;
|
||||
}
|
||||
|
||||
public int get_$4() {
|
||||
return _$4;
|
||||
}
|
||||
|
||||
public void set_$4(int _$4) {
|
||||
this._$4 = _$4;
|
||||
}
|
||||
|
||||
public int get_$9() {
|
||||
return _$9;
|
||||
}
|
||||
|
||||
public void set_$9(int _$9) {
|
||||
this._$9 = _$9;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,13 @@ package com.yutou.jianr_mg.Data;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.SplittableRandom;
|
||||
|
||||
public class TeamData {
|
||||
private int id;
|
||||
private int jid;
|
||||
private int type;
|
||||
private String title;
|
||||
private String hp;
|
||||
private String hpMax;
|
||||
@@ -13,14 +18,64 @@ public class TeamData {
|
||||
private String item2Url;
|
||||
private String item3Url;
|
||||
private String item4Url;
|
||||
private List<String> equipments;
|
||||
private boolean user;
|
||||
private JSONObject src;
|
||||
private long createTime;
|
||||
|
||||
public int getJid() {
|
||||
return jid;
|
||||
}
|
||||
|
||||
public void setJid(int jid) {
|
||||
this.jid = jid;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public TeamData() {
|
||||
createTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"id\":")
|
||||
.append(id);
|
||||
sb.append(",\"jid\":")
|
||||
.append(jid);
|
||||
sb.append(",\"title\":\"")
|
||||
.append(title).append('\"');
|
||||
sb.append(",\"hp\":\"")
|
||||
.append(hp).append('\"');
|
||||
sb.append(",\"hpMax\":\"")
|
||||
.append(hpMax).append('\"');
|
||||
sb.append(",\"imageUrl\":\"")
|
||||
.append(imageUrl).append('\"');
|
||||
sb.append(",\"item1Url\":\"")
|
||||
.append(item1Url).append('\"');
|
||||
sb.append(",\"item2Url\":\"")
|
||||
.append(item2Url).append('\"');
|
||||
sb.append(",\"item3Url\":\"")
|
||||
.append(item3Url).append('\"');
|
||||
sb.append(",\"item4Url\":\"")
|
||||
.append(item4Url).append('\"');
|
||||
sb.append(",\"user\":")
|
||||
.append(user);
|
||||
sb.append(",\"src\":")
|
||||
.append(src);
|
||||
sb.append(",\"createTime\":")
|
||||
.append(createTime);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -105,6 +160,14 @@ public class TeamData {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public List<String> getEquipments() {
|
||||
return equipments;
|
||||
}
|
||||
|
||||
public void setEquipments(List<String> equipments) {
|
||||
this.equipments = equipments;
|
||||
}
|
||||
|
||||
public JSONObject getSrc() {
|
||||
try {
|
||||
if (src != null)
|
||||
@@ -119,34 +182,4 @@ public class TeamData {
|
||||
this.src = src;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
sb.append("\"id\":")
|
||||
.append(id);
|
||||
sb.append(",\"title\":\"")
|
||||
.append(title).append('\"');
|
||||
sb.append(",\"hp\":\"")
|
||||
.append(hp).append('\"');
|
||||
sb.append(",\"hpMax\":\"")
|
||||
.append(hpMax).append('\"');
|
||||
sb.append(",\"imageUrl\":\"")
|
||||
.append(imageUrl).append('\"');
|
||||
sb.append(",\"item1Url\":\"")
|
||||
.append(item1Url).append('\"');
|
||||
sb.append(",\"item2Url\":\"")
|
||||
.append(item2Url).append('\"');
|
||||
sb.append(",\"item3Url\":\"")
|
||||
.append(item3Url).append('\"');
|
||||
sb.append(",\"item4Url\":\"")
|
||||
.append(item4Url).append('\"');
|
||||
sb.append(",\"user\":")
|
||||
.append(user);
|
||||
sb.append(",\"src\":")
|
||||
.append(src);
|
||||
sb.append(",\"createTime\":")
|
||||
.append(createTime);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,64 @@
|
||||
package com.yutou.jianr_mg.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class UUserdata {
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.id
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.uid
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private Integer uid;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.email
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private String email;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.createTime
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private Long createtime;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.image
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private String image;
|
||||
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.beanTime
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private Date beantime;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.unBeanTime
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private Date unbeantime;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.beanIndex
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private Integer beanindex;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.credit
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private Integer credit;
|
||||
/**
|
||||
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.loginTime
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
private Date logintime;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.id
|
||||
* @return the value of u_userdata.id
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
@@ -44,7 +67,7 @@ public class UUserdata {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.id
|
||||
* @param id the value for u_userdata.id
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
@@ -53,7 +76,7 @@ public class UUserdata {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.uid
|
||||
* @return the value of u_userdata.uid
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public Integer getUid() {
|
||||
return uid;
|
||||
@@ -62,7 +85,7 @@ public class UUserdata {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.uid
|
||||
* @param uid the value for u_userdata.uid
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setUid(Integer uid) {
|
||||
this.uid = uid;
|
||||
@@ -71,7 +94,7 @@ public class UUserdata {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.email
|
||||
* @return the value of u_userdata.email
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public String getEmail() {
|
||||
return email;
|
||||
@@ -80,7 +103,7 @@ public class UUserdata {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.email
|
||||
* @param email the value for u_userdata.email
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
@@ -89,7 +112,7 @@ public class UUserdata {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.createTime
|
||||
* @return the value of u_userdata.createTime
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public Long getCreatetime() {
|
||||
return createtime;
|
||||
@@ -98,9 +121,117 @@ public class UUserdata {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.createTime
|
||||
* @param createtime the value for u_userdata.createTime
|
||||
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setCreatetime(Long createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.image
|
||||
* @return the value of u_userdata.image
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.image
|
||||
* @param image the value for u_userdata.image
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.beanTime
|
||||
* @return the value of u_userdata.beanTime
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public Date getBeantime() {
|
||||
return beantime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.beanTime
|
||||
* @param beantime the value for u_userdata.beanTime
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setBeantime(Date beantime) {
|
||||
this.beantime = beantime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.unBeanTime
|
||||
* @return the value of u_userdata.unBeanTime
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public Date getUnbeantime() {
|
||||
return unbeantime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.unBeanTime
|
||||
* @param unbeantime the value for u_userdata.unBeanTime
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setUnbeantime(Date unbeantime) {
|
||||
this.unbeantime = unbeantime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.beanIndex
|
||||
* @return the value of u_userdata.beanIndex
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public Integer getBeanindex() {
|
||||
return beanindex;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.beanIndex
|
||||
* @param beanindex the value for u_userdata.beanIndex
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setBeanindex(Integer beanindex) {
|
||||
this.beanindex = beanindex;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.credit
|
||||
* @return the value of u_userdata.credit
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public Integer getCredit() {
|
||||
return credit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.credit
|
||||
* @param credit the value for u_userdata.credit
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setCredit(Integer credit) {
|
||||
this.credit = credit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.loginTime
|
||||
* @return the value of u_userdata.loginTime
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public Date getLogintime() {
|
||||
return logintime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.loginTime
|
||||
* @param logintime the value for u_userdata.loginTime
|
||||
* @mbg.generated Mon May 13 14:48:33 CST 2019
|
||||
*/
|
||||
public void setLogintime(Date logintime) {
|
||||
this.logintime = logintime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.yutou.jianr_mg.Fragments.GameDataFragments.WarLogFragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
public class DaytimeFragment extends Fragment {
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.yutou.jianr_mg.Fragments.GameDataFragments.WarLogFragments;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
public class NightFragment extends Fragment {
|
||||
}
|
||||
@@ -45,9 +45,9 @@ public class My extends Fragment {
|
||||
private View view;
|
||||
private User user;
|
||||
private UUserdata udata;
|
||||
private TextView uname,item_title;
|
||||
private TextView uname,item_title,credit;
|
||||
private ImageView icon,item_icon,image_top;
|
||||
// private LinearLayout items;
|
||||
private LinearLayout items;
|
||||
private ListView myItems;
|
||||
|
||||
private static My my;
|
||||
@@ -66,8 +66,9 @@ public class My extends Fragment {
|
||||
item_title=view.findViewById(R.id.item_title);
|
||||
item_icon=view.findViewById(R.id.item_icon);
|
||||
image_top=view.findViewById(R.id.image_top);
|
||||
// items=view.findViewById(R.id.items);
|
||||
items=view.findViewById(R.id.items);
|
||||
myItems=view.findViewById(R.id._my_items);
|
||||
credit=view.findViewById(R.id.credit);
|
||||
}
|
||||
icon.setOnClickListener(view->{
|
||||
Utils.toast(getContext(),"个人资料...咕了!诶嘿(<ゝω·)~☆kira");
|
||||
@@ -104,6 +105,7 @@ public class My extends Fragment {
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
credit.setText("积分:"+udata.getCredit());
|
||||
myItems.setAdapter(new MyItemGridViewAdapter(getItemData(),getContext()));
|
||||
}
|
||||
private List<MyItemGridViewAdapter.ItemData> getItemData(){
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.qq.e.comm.util.AdError;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.umeng.message.UmengMessageHandler;
|
||||
import com.yutou.jianr_mg.Data.AppData;
|
||||
import com.yutou.jianr_mg.Data.MAdConfig;
|
||||
import com.yutou.jianr_mg.Data.MGamePackname;
|
||||
import com.yutou.jianr_mg.Data.SConfig;
|
||||
import com.yutou.jianr_mg.Data.UUserdata;
|
||||
@@ -40,6 +41,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.ActivitysManager;
|
||||
import com.yutou.jianr_mg.Tools.AdTools;
|
||||
import com.yutou.jianr_mg.Tools.AppPermissions;
|
||||
import com.yutou.jianr_mg.Tools.ConfigUtils;
|
||||
import com.yutou.jianr_mg.Tools.Log;
|
||||
@@ -59,35 +61,36 @@ import me.drakeet.materialdialog.MaterialDialog;
|
||||
*/
|
||||
|
||||
public class LoadingActivity extends AppCompatActivity {
|
||||
private static final String APPID = "1105310947";
|
||||
private static final String POSID = "7090537892072921";
|
||||
public static String url=null;
|
||||
// private static final String APPID = "1105310947";
|
||||
// private static final String POSID = "7090537892072921";
|
||||
public static String url = null;
|
||||
|
||||
private LinearLayout loginLayout,adLayout;
|
||||
private LinearLayout loginLayout, adLayout;
|
||||
private Button login, reg;
|
||||
private TextView notlogin, uname, password;
|
||||
private ImageView icon;
|
||||
private Handler handler;
|
||||
private boolean isLogin=false;
|
||||
private boolean isLogin = false;
|
||||
private Class clazz;
|
||||
private MAdConfig ad=new MAdConfig();
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN ,
|
||||
WindowManager.LayoutParams. FLAG_FULLSCREEN);
|
||||
AppData.debug=true;
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
setContentView(R.layout.activity_loading);
|
||||
Utils.setImmersion(this);
|
||||
if(url==null){
|
||||
clazz=MainActivity.class;
|
||||
}else{
|
||||
clazz=WebActivity.class;
|
||||
if (url == null) {
|
||||
clazz = MainActivity.class;
|
||||
} else {
|
||||
clazz = WebActivity.class;
|
||||
}
|
||||
handler = new Handler();
|
||||
initViews();
|
||||
initData();
|
||||
startOpenAd();
|
||||
|
||||
initAd();
|
||||
}
|
||||
|
||||
private void login(String name, String pass) {
|
||||
@@ -100,16 +103,16 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
public void httpGetData(String string, int code) {
|
||||
try {
|
||||
JSONObject json = new JSONObject(string);
|
||||
final String msg=json.getString("msg");
|
||||
final String msg = json.getString("msg");
|
||||
if (json.getInt("code") == 100) {
|
||||
AppData.user = JSON.parseObject(json.getJSONObject("data").toString(), User.class);
|
||||
AppData.Token = json.getString("token");
|
||||
AppData.user.setToken(AppData.Token);
|
||||
UserDatabase.init().login(AppData.user.getId(),AppData.user.getName(),AppData.Token);
|
||||
isLogin=true;
|
||||
handler.post(()-> start());
|
||||
}else{
|
||||
handler.post(() -> Utils.toast(LoadingActivity.this,msg));
|
||||
UserDatabase.init().login(AppData.user.getId(), AppData.user.getName(), AppData.Token);
|
||||
isLogin = true;
|
||||
handler.post(() -> start());
|
||||
} else {
|
||||
handler.post(() -> Utils.toast(LoadingActivity.this, msg));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -121,7 +124,7 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
e.printStackTrace();
|
||||
Utils.toast(LoadingActivity.this,"登录失败:"+e.getMessage());
|
||||
Utils.toast(LoadingActivity.this, "登录失败:" + e.getMessage());
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
@@ -135,13 +138,14 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
String fileName;
|
||||
switch (Build.CPU_ABI) {
|
||||
case "armeabi-v7a":
|
||||
fileName="busybox-armv7l";
|
||||
fileName = "busybox-armv7l";
|
||||
break;
|
||||
default: fileName="busybox-armv7l";
|
||||
default:
|
||||
fileName = "busybox-armv7l";
|
||||
}
|
||||
InputStream inputStream = manager.open(fileName);
|
||||
//jar.createNewFile();
|
||||
FileOutputStream outputStream = new FileOutputStream(getFilesDir()+"/busybox");
|
||||
FileOutputStream outputStream = new FileOutputStream(getFilesDir() + "/busybox");
|
||||
int len = 0;
|
||||
byte[] bytes = new byte[inputStream.available()];
|
||||
while ((len = inputStream.read(bytes)) != -1) {
|
||||
@@ -150,14 +154,14 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// Utils.toast(this, Build.CPU_ABI);
|
||||
// Utils.toast(this, Build.CPU_ABI);
|
||||
initUser();
|
||||
initGamePackName();
|
||||
initConfig();
|
||||
initUser();
|
||||
if(Build.VERSION.SDK_INT<Build.VERSION_CODES.O){
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
ready(1);
|
||||
}else
|
||||
ActivityCompat.requestPermissions(this,AppPermissions.permissions,AppPermissions.REQUEST_CODE);
|
||||
} else
|
||||
ActivityCompat.requestPermissions(this, AppPermissions.permissions, AppPermissions.REQUEST_CODE);
|
||||
}
|
||||
|
||||
private void initConfig() {
|
||||
@@ -179,7 +183,7 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
e.printStackTrace();
|
||||
Utils.toast(LoadingActivity.this,"初始化失败:"+e.getMessage());
|
||||
Utils.toast(LoadingActivity.this, "初始化失败:" + e.getMessage());
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
@@ -221,33 +225,59 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
public void httpGetData(String string, int code) {
|
||||
try {
|
||||
JSONObject json = new JSONObject(string);
|
||||
Log.i("LOGIN","登录状态:"+string);
|
||||
Log.i("LOGIN", "登录状态:" + string);
|
||||
if (json.getInt("code") == 100) {
|
||||
JSONObject data = json.getJSONObject("data").getJSONObject("data");
|
||||
AppData.user = JSON.parseObject(data.getJSONObject("user").toString(), User.class);
|
||||
AppData.userdata=JSON.parseObject(data.getJSONObject("userdata").toString(), UUserdata.class);
|
||||
AppData.userdata = JSON.parseObject(data.getJSONObject("userdata").toString(), UUserdata.class);
|
||||
ConfigUtils.init().save(ConfigUtils.collection, data.getJSONArray("collection"));
|
||||
isLogin=true;
|
||||
}else{
|
||||
isLogin=false;
|
||||
isLogin = true;
|
||||
} else {
|
||||
isLogin = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ready(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
ready(1);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
start();
|
||||
}
|
||||
|
||||
}
|
||||
private void initAd(){
|
||||
try {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("type", 1);
|
||||
HttpUtils.post(HttpApi.HOME_URL + HttpApi.AD_GET, json, new HttpInterface() {
|
||||
@Override
|
||||
public void httpGetData(String string, int code) {
|
||||
try {
|
||||
JSONObject json = new JSONObject(string);
|
||||
if (json.getInt("code") == 100) {
|
||||
ad = JSON.parseObject(json.getJSONObject("data").toString(), MAdConfig.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
AppData.handler.post(()->startOpenAd());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
handler.post(()->start());
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
start();
|
||||
}
|
||||
}
|
||||
private void initViews() {
|
||||
loginLayout = findViewById(R.id.loginLayout);
|
||||
login = findViewById(R.id.login);
|
||||
@@ -256,14 +286,14 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
uname = findViewById(R.id.uname);
|
||||
password = findViewById(R.id.password);
|
||||
adLayout = findViewById(R.id.adLayout);
|
||||
reg=findViewById(R.id.reg);
|
||||
reg = findViewById(R.id.reg);
|
||||
|
||||
|
||||
Intent regIntent=getIntent();
|
||||
if(regIntent!=null){
|
||||
String name=regIntent.getStringExtra("name");
|
||||
String pass=regIntent.getStringExtra("password");
|
||||
if(!Utils.testStringIsNull(name,pass)){
|
||||
Intent regIntent = getIntent();
|
||||
if (regIntent != null) {
|
||||
String name = regIntent.getStringExtra("name");
|
||||
String pass = regIntent.getStringExtra("password");
|
||||
if (!Utils.testStringIsNull(name, pass)) {
|
||||
uname.setText(name);
|
||||
password.setText(pass);
|
||||
login.callOnClick();
|
||||
@@ -281,7 +311,7 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
login(name, pass);
|
||||
});
|
||||
reg.setOnClickListener(view -> {
|
||||
Intent intent=new Intent(LoadingActivity.this, RegisterActivity.class);
|
||||
Intent intent = new Intent(LoadingActivity.this, RegisterActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
@@ -289,13 +319,13 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
public void start() {
|
||||
adLayout.removeAllViews();
|
||||
adLayout.setVisibility(View.GONE);
|
||||
ConstraintLayout.LayoutParams params=new ConstraintLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.topMargin=Utils.getPixelsFromDp(this,512);
|
||||
params.startToStart=Utils.getPixelsFromDp(this,8);
|
||||
params.startToEnd=Utils.getPixelsFromDp(this,8);
|
||||
// icon.setLayoutParams(params);
|
||||
if(true){
|
||||
// return;
|
||||
ConstraintLayout.LayoutParams params = new ConstraintLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.topMargin = Utils.getPixelsFromDp(this, 512);
|
||||
params.startToStart = Utils.getPixelsFromDp(this, 8);
|
||||
params.startToEnd = Utils.getPixelsFromDp(this, 8);
|
||||
// icon.setLayoutParams(params);
|
||||
if (true) {
|
||||
// return;
|
||||
}
|
||||
|
||||
PackageManager manager = getPackageManager();
|
||||
@@ -307,25 +337,25 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(AppData.appConfig!=null&&!AppData.appConfig.getApkVersion().equals(code)){
|
||||
MaterialDialog dialog=new MaterialDialog(this);
|
||||
if (AppData.appConfig != null && !AppData.appConfig.getApkVersion().equals(code)) {
|
||||
MaterialDialog dialog = new MaterialDialog(this);
|
||||
dialog.setTitle("检测到更新");
|
||||
dialog.setMessage(AppData.appConfig.getMessage());
|
||||
dialog.setNegativeButton("放弃",v -> {
|
||||
dialog.setNegativeButton("放弃", v -> {
|
||||
dialog.dismiss();
|
||||
if(isLogin) {
|
||||
if (isLogin) {
|
||||
Intent intent = new Intent(LoadingActivity.this, clazz);
|
||||
if(url!=null){
|
||||
intent.putExtra("url",url);
|
||||
if (url != null) {
|
||||
intent.putExtra("url", url);
|
||||
}
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}else{
|
||||
Utils.toast(this,"未登录/登录信息失效");
|
||||
finish();
|
||||
} else {
|
||||
Utils.toast(this, "未登录/登录信息失效");
|
||||
showLogin();
|
||||
}
|
||||
});
|
||||
dialog.setPositiveButton("升级",v -> {
|
||||
dialog.setPositiveButton("升级", v -> {
|
||||
dialog.dismiss();
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
@@ -335,16 +365,16 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
});
|
||||
dialog.show();
|
||||
|
||||
}else{
|
||||
if(isLogin) {
|
||||
} else {
|
||||
if (isLogin) {
|
||||
Intent intent = new Intent(LoadingActivity.this, clazz);
|
||||
if(url!=null){
|
||||
intent.putExtra("url",url);
|
||||
if (url != null) {
|
||||
intent.putExtra("url", url);
|
||||
}
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}else{
|
||||
Utils.toast(this,"未登录/登录信息失效");
|
||||
} else {
|
||||
Utils.toast(this, "未登录/登录信息失效");
|
||||
showLogin();
|
||||
}
|
||||
}
|
||||
@@ -397,35 +427,44 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
boolean flag=true;
|
||||
if(requestCode==AppPermissions.REQUEST_CODE){
|
||||
boolean flag = true;
|
||||
if (requestCode == AppPermissions.REQUEST_CODE) {
|
||||
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);
|
||||
flag=false;
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
MaterialDialog dialog=new MaterialDialog(this);
|
||||
if (!flag) {
|
||||
MaterialDialog dialog = new MaterialDialog(this);
|
||||
dialog.setTitle(">__<");
|
||||
dialog.setMessage("缺少起床的必要权限哦!");
|
||||
dialog.setNegativeButton("不给", view -> {
|
||||
Utils.toast(LoadingActivity.this,"哼,小气");
|
||||
handler.postDelayed(()-> {ActivitysManager.AppExit(LoadingActivity.this);dialog.dismiss();},300);
|
||||
Utils.toast(LoadingActivity.this, "哼,小气");
|
||||
handler.postDelayed(() -> {
|
||||
ActivitysManager.AppExit(LoadingActivity.this);
|
||||
dialog.dismiss();
|
||||
}, 300);
|
||||
});
|
||||
dialog.setPositiveButton("拿去吧",view->{
|
||||
ActivityCompat.requestPermissions(LoadingActivity.this,AppPermissions.permissions,AppPermissions.REQUEST_CODE);
|
||||
dialog.setPositiveButton("拿去吧", view -> {
|
||||
ActivityCompat.requestPermissions(LoadingActivity.this, AppPermissions.permissions, AppPermissions.REQUEST_CODE);
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.show();
|
||||
}else{
|
||||
} else {
|
||||
ready(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void startOpenAd(){
|
||||
new SplashAD(this, adLayout, APPID, POSID, new SplashADListener() {
|
||||
|
||||
private void startOpenAd() {
|
||||
if(ad.getAdshow()!=1){
|
||||
start();
|
||||
return;
|
||||
}
|
||||
AdTools.upload(AdTools.Open,AdTools.req);
|
||||
new SplashAD(this, adLayout, ad.getAppid(), ad.getPosid(), new SplashADListener() {
|
||||
@Override
|
||||
public void onADDismissed() {
|
||||
start();
|
||||
@@ -433,7 +472,7 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onNoAD(AdError adError) {
|
||||
handler.postDelayed(()->start(),3000);
|
||||
handler.postDelayed(() -> start(), 3000);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -443,7 +482,7 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onADClicked() {
|
||||
|
||||
AdTools.upload(AdTools.Open,AdTools.click);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -453,11 +492,12 @@ public class LoadingActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onADExposure() {
|
||||
|
||||
AdTools.upload(AdTools.Open,AdTools.show);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.yutou.jianr_mg.Fragments.MGList;
|
||||
import com.yutou.jianr_mg.Fragments.My;
|
||||
import com.yutou.jianr_mg.Fragments.UtilsFragments;
|
||||
import com.yutou.jianr_mg.Tools.ActivitysManager;
|
||||
import com.yutou.jianr_mg.Tools.JianRUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -39,7 +40,11 @@ public class MainActivity extends AppCompatActivity {
|
||||
AppData.handler=new Handler();
|
||||
ActivitysManager.finishActivity(LoadingActivity.class);
|
||||
initViews();
|
||||
|
||||
JianRUtils.downlaodInit(true);
|
||||
new Thread(()->{
|
||||
JianRUtils.reloadJianNiang();
|
||||
JianRUtils.reloadEquipmnts();
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
|
||||
@@ -6,9 +6,9 @@ package com.yutou.jianr_mg.Network;
|
||||
|
||||
public class HttpApi {
|
||||
public static final String HOME="http://jianr.jianrmod.cn/";
|
||||
//public static final String HOME = "http://192.168.31.241:8088/"; //zzz_gz wifi
|
||||
// public static final String HOME = "http://192.168.31.240:8088/"; //zzz_gz wifi
|
||||
//public static final String HOME = "http://192.168.137.1:8088/"; //笔记本本身WIFI
|
||||
// public static final String HOME = "http://192.168.1.84:8088/"; //公司
|
||||
// public static final String HOME = "http://192.168.1.84:8088/"; //公司
|
||||
public static final String HOME_URL=HOME+"android/"; //服务器
|
||||
|
||||
public static final String MOD_ALL = "mod/all.do";
|
||||
@@ -45,6 +45,12 @@ public class HttpApi {
|
||||
|
||||
public static final String INSTALL_PATH = "config/installPath.do";
|
||||
|
||||
public static final String DATA_UP_GAMEDATA="data/upGameData.do";
|
||||
public static final String DATA_DOWN_GAMEDATA="data/downGameData.do";
|
||||
|
||||
public static final String AD_GET="ad/ad.do";
|
||||
public static final String AD_LOG="ad/user.do";
|
||||
|
||||
|
||||
public static final String HITOKOTO_API = "https://v1.hitokoto.cn/";
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.yutou.jianr_mg.Network;
|
||||
|
||||
|
||||
|
||||
import com.yutou.jianr_mg.Data.AppData;
|
||||
import com.yutou.jianr_mg.Interfaces.DownloadFileInerface;
|
||||
import com.yutou.jianr_mg.Interfaces.HttpInterface;
|
||||
import com.yutou.jianr_mg.Tools.Log;
|
||||
import com.yutou.jianr_mg.Tools.Utils;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -30,15 +30,17 @@ import okhttp3.Response;
|
||||
|
||||
public class HttpUtils {
|
||||
private static OkHttpClient client;
|
||||
private static OkHttpClient getClient(){
|
||||
return new OkHttpClient.Builder()
|
||||
.connectTimeout(3000, TimeUnit.SECONDS)
|
||||
.readTimeout(3000,TimeUnit.SECONDS).build();
|
||||
|
||||
private static OkHttpClient getClient() {
|
||||
return new OkHttpClient.Builder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.readTimeout(30, TimeUnit.SECONDS).build();
|
||||
|
||||
}
|
||||
public static void get(final String url, final HttpInterface httpInterface) {
|
||||
if(client==null){
|
||||
client=getClient();
|
||||
|
||||
public static void get(final String url, final HttpInterface httpInterface) {
|
||||
if (client == null) {
|
||||
client = getClient();
|
||||
}
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
Call call = client.newCall(request);
|
||||
@@ -49,13 +51,13 @@ public class HttpUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) {
|
||||
public void onResponse(Call call, Response response) {
|
||||
try {
|
||||
String http=response.body().string();
|
||||
if(httpInterface!=null)
|
||||
String http = response.body().string();
|
||||
if (httpInterface != null)
|
||||
httpInterface.httpGetData(http, response.code());
|
||||
Log.i(url,"传参:"+url.replace(HttpApi.HOME_URL,"")+" 接收:"+http);
|
||||
}catch (Exception e){
|
||||
Log.i(url, "传参:" + url.replace(HttpApi.HOME_URL, "") + " 接收:" + http);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -63,8 +65,8 @@ public class HttpUtils {
|
||||
}
|
||||
|
||||
public static void post(final String url, final JSONObject json, final HttpInterface httpInterface) {
|
||||
if(client==null){
|
||||
client=getClient();
|
||||
if (client == null) {
|
||||
client = getClient();
|
||||
}
|
||||
Request request = new Request.Builder().url(url).post(mapToBody(json)).removeHeader("User-Agent").build();
|
||||
Call call = client.newCall(request);
|
||||
@@ -72,47 +74,51 @@ public class HttpUtils {
|
||||
call.enqueue(new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
if(httpInterface!=null)
|
||||
if (httpInterface != null)
|
||||
httpInterface.httpError(e);
|
||||
e.printStackTrace();
|
||||
Log.e(e,HttpUtils.class);
|
||||
Log.e(e, HttpUtils.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) {
|
||||
try {
|
||||
String http=response.body().string();
|
||||
if(httpInterface!=null)
|
||||
String http = response.body().string();
|
||||
if (httpInterface != null)
|
||||
httpInterface.httpGetData(http, response.code());
|
||||
Log.i(url,"传参:"+json.toString()+" 接收:"+http);
|
||||
}catch (Exception e){
|
||||
Log.i(url, "传参:" + json.toString() + " 接收:" + http);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
public static void downloadFile(final String url, final String srcPath, final DownloadFileInerface downloadFileInerface){
|
||||
if(client==null)
|
||||
client=getClient();
|
||||
File path=new File(srcPath);
|
||||
if(!path.exists())
|
||||
|
||||
public static void downloadFile(final String url, final String srcPath, final DownloadFileInerface downloadFileInerface) {
|
||||
if (client == null)
|
||||
client = getClient();
|
||||
File path = new File(srcPath);
|
||||
if (!path.exists())
|
||||
path.mkdirs();
|
||||
Request request=new Request.Builder().url(url).build();
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
client.newCall(request).enqueue(new Callback() {
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e) {
|
||||
AppData.handler.post(()->downloadFileInerface.over(false));
|
||||
e.printStackTrace();
|
||||
AppData.handler.post(() -> downloadFileInerface.over(false));
|
||||
}
|
||||
boolean isflag=true;
|
||||
|
||||
boolean isflag = true;
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) {
|
||||
InputStream is = null;
|
||||
byte[] buf = new byte[1024];
|
||||
byte[] buf = new byte[1024];
|
||||
int len = 0;
|
||||
FileOutputStream fos = null;
|
||||
try {
|
||||
@@ -121,49 +127,50 @@ public class HttpUtils {
|
||||
File file = new File(srcPath, getNameFromUrl(url));
|
||||
fos = new FileOutputStream(file);
|
||||
long sum = 0;
|
||||
int pr=-1;
|
||||
int pr = -1;
|
||||
while ((len = is.read(buf)) != -1) {
|
||||
fos.write(buf, 0, len);
|
||||
sum += len;
|
||||
int progress = (int) (sum * 1.0f / total * 100);
|
||||
// 下载中
|
||||
if(progress==pr){
|
||||
isflag=false;
|
||||
}else{
|
||||
isflag=true;
|
||||
pr=progress;
|
||||
if (progress == pr) {
|
||||
isflag = false;
|
||||
} else {
|
||||
isflag = true;
|
||||
pr = progress;
|
||||
}
|
||||
if(progress==100){
|
||||
isflag=true;
|
||||
pr=progress;
|
||||
if (progress == 100) {
|
||||
isflag = true;
|
||||
pr = progress;
|
||||
}
|
||||
if(isflag)
|
||||
while (!downloadFileInerface.downloading(getNameFromUrl(url),progress,total)){
|
||||
Thread.sleep(10);
|
||||
}
|
||||
System.out.println("下载:"+progress);
|
||||
if (isflag)
|
||||
while (!downloadFileInerface.downloading(getNameFromUrl(url), progress, total)) {
|
||||
Thread.sleep(10);
|
||||
}
|
||||
System.out.println("下载:" + progress);
|
||||
}
|
||||
fos.flush();
|
||||
// 下载完成
|
||||
AppData.handler.post(()->downloadFileInerface.over(true));
|
||||
}catch (Exception e){
|
||||
AppData.handler.post(() -> downloadFileInerface.over(true));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
AppData.handler.post(()->downloadFileInerface.over(false));
|
||||
AppData.handler.post(() -> downloadFileInerface.over(false));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private static String getNameFromUrl(String url) {
|
||||
|
||||
public static String getNameFromUrl(String url) {
|
||||
return url.substring(url.lastIndexOf("/") + 1);
|
||||
}
|
||||
|
||||
public static String getHtml(String url){
|
||||
Log.i("获取网页源码:"+url);
|
||||
if(client==null)
|
||||
client=getClient();
|
||||
Request request=new Request.Builder().url(url).build();
|
||||
public static String getHtml(String url) {
|
||||
Log.i("获取网页源码:" + url);
|
||||
if (client == null)
|
||||
client = getClient();
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
try {
|
||||
Response response= client.newCall(request).execute();
|
||||
Response response = client.newCall(request).execute();
|
||||
return response.body().string();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -186,10 +193,14 @@ public class HttpUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if(json.isNull("token"))
|
||||
builder.add("token", AppData.Token);
|
||||
if(json.isNull("uid"))
|
||||
builder.add("uid",AppData.user.getId()+"");
|
||||
if (json.isNull("token"))
|
||||
builder.add("token", AppData.Token);
|
||||
if (json.isNull("uid"))
|
||||
builder.add("uid", AppData.user.getId() + "");
|
||||
if (json.isNull("imei"))
|
||||
builder.add("imei", Utils.getIMEI());
|
||||
if (json.isNull("clientVersion"))
|
||||
builder.add("clientVersion", Utils.getVersion());
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
||||
50
app/src/main/java/com/yutou/jianr_mg/Tools/AdTools.java
Normal file
50
app/src/main/java/com/yutou/jianr_mg/Tools/AdTools.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package com.yutou.jianr_mg.Tools;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yutou.jianr_mg.Application;
|
||||
import com.yutou.jianr_mg.Data.AppData;
|
||||
import com.yutou.jianr_mg.Data.UUserdata;
|
||||
import com.yutou.jianr_mg.Interfaces.HttpInterface;
|
||||
import com.yutou.jianr_mg.Network.HttpApi;
|
||||
import com.yutou.jianr_mg.Network.HttpUtils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class AdTools {
|
||||
public static int req=0,show=1,click=2;
|
||||
public static int Open=1,Inter=2,Banner=3,Native=4;
|
||||
public static void upload(int adType,int uType){
|
||||
try {
|
||||
JSONObject json=new JSONObject();
|
||||
json.put("adtype",adType);
|
||||
json.put("utype",uType);
|
||||
json.put("imei",Utils.getIMEI());
|
||||
HttpUtils.post(HttpApi.HOME_URL + HttpApi.AD_LOG, json, new HttpInterface() {
|
||||
@Override
|
||||
public void httpGetData(String string, int code) {
|
||||
try{
|
||||
JSONObject json=new JSONObject(string);
|
||||
if(json.getInt("code")==100){
|
||||
JSONObject data=json.getJSONObject("data");
|
||||
if(data.getInt("code")==100){
|
||||
Utils.toast(null,data.getString("msg"));
|
||||
}
|
||||
if(!data.isNull("user")){
|
||||
AppData.userdata= JSON.parseObject(data.getJSONObject("user").getJSONObject("data").getJSONObject("userdata").toString(), UUserdata.class);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
|
||||
}
|
||||
});
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,6 @@ public class AppPermissions {
|
||||
public static String[] permissions=new String[]{
|
||||
Manifest.permission.READ_PHONE_STATE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
};
|
||||
}
|
||||
|
||||
60
app/src/main/java/com/yutou/jianr_mg/Tools/CDNTools.java
Normal file
60
app/src/main/java/com/yutou/jianr_mg/Tools/CDNTools.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package com.yutou.jianr_mg.Tools;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.kaopiz.kprogresshud.KProgressHUD;
|
||||
import com.qiniu.android.http.ResponseInfo;
|
||||
import com.qiniu.android.storage.Configuration;
|
||||
import com.qiniu.android.storage.UpCompletionHandler;
|
||||
import com.qiniu.android.storage.UpProgressHandler;
|
||||
import com.qiniu.android.storage.UploadManager;
|
||||
import com.qiniu.android.storage.UploadOptions;
|
||||
import com.yutou.jianr_mg.Application;
|
||||
import com.yutou.jianr_mg.Data.AppData;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CDNTools {
|
||||
private static CDNTools cdn;
|
||||
private UploadManager uploadManager;
|
||||
private KProgressHUD hud;
|
||||
private Context context;
|
||||
public static CDNTools getInstance(Context context){
|
||||
if(cdn==null){
|
||||
cdn=new CDNTools(context);
|
||||
}
|
||||
return cdn;
|
||||
}
|
||||
private CDNTools(Context context){
|
||||
this.context=context;
|
||||
init();
|
||||
}
|
||||
private void init(){
|
||||
Configuration config = new Configuration.Builder()
|
||||
.build();
|
||||
uploadManager = new UploadManager(config);
|
||||
}
|
||||
|
||||
public void upload(File file,String token){
|
||||
hud=Utils.showLoading(context,"正在上传","请稍后");
|
||||
hud.show();
|
||||
Map<String,String> map=new HashMap<>();
|
||||
map.put("x:uToken",AppData.Token);
|
||||
map.put("x:uuid",AppData.user.getId()+"");
|
||||
uploadManager.put(file, AppData.user.getId()+"/gamedata/"+file.getName(), token, (key, info, response) -> {
|
||||
if(info.isOK()){
|
||||
Log.i(cdn.getClass().getName(),key+"上传成功");
|
||||
Utils.toast(Application.application,"上传完成");
|
||||
}else{
|
||||
Log.i(cdn.getClass().getName(),"上传失败:"+info.error);
|
||||
}
|
||||
AppData.handler.post(()->hud.dismiss());
|
||||
},new UploadOptions(map, null, false, (key, percent) -> {
|
||||
hud.setDetailsLabel("正在上传:"+percent+"/"+file.length());
|
||||
},null));
|
||||
}
|
||||
}
|
||||
@@ -1,62 +1,276 @@
|
||||
package com.yutou.jianr_mg.Tools;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yutou.jianr_mg.Application;
|
||||
import com.yutou.jianr_mg.Data.AppData;
|
||||
import com.yutou.jianr_mg.Data.JianNiang;
|
||||
import com.yutou.jianr_mg.Data.ShipEquipmnt;
|
||||
import com.yutou.jianr_mg.Data.TeamData;
|
||||
import com.yutou.jianr_mg.Interfaces.DownloadFileInerface;
|
||||
import com.yutou.jianr_mg.Network.HttpUtils;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class JianRUtils {
|
||||
private static JSONArray shipCardId;
|
||||
public static int jianCidToid(String cid){
|
||||
if(cid.substring(1,2).equals("1")){
|
||||
int con=Integer.valueOf(cid.substring(2,cid.length()-2));
|
||||
return 1000+con;
|
||||
}else{
|
||||
return Integer.valueOf(cid.substring(2,cid.length()-2));
|
||||
|
||||
public static int jianCidToid(String cid) {
|
||||
if (cid.substring(1, 2).equals("1")) {
|
||||
int con = Integer.valueOf(cid.substring(2, cid.length() - 2));
|
||||
return 1000 + con;
|
||||
} else {
|
||||
return Integer.valueOf(cid.substring(2, cid.length() - 2));
|
||||
}
|
||||
}
|
||||
public static int equipCidToid(String cid){
|
||||
return Integer.valueOf(cid.substring(2))/100;
|
||||
|
||||
public static int equipCidToid(String cid) {
|
||||
return Integer.valueOf(cid.substring(2)) / 100;
|
||||
}
|
||||
public static int EnemyShipCardId(String cid){
|
||||
|
||||
public static int EnemyShipCardId(String cid) {
|
||||
try {
|
||||
for (int i = 0; i < shipCardId.length(); i++) {
|
||||
JSONObject json=shipCardId.getJSONObject(i);
|
||||
if(json.getString("cid").equals(cid)){
|
||||
JSONObject json = shipCardId.getJSONObject(i);
|
||||
if (json.getString("cid").equals(cid)) {
|
||||
return json.getInt("picId");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void initShipCardId() {
|
||||
try {
|
||||
File file = new File(Application.application.getFilesDir() + "/shipCardid");
|
||||
InputStream inputStream;
|
||||
if (!file.exists()) {
|
||||
inputStream = Application.application.getAssets().open("shipCardId");
|
||||
} else {
|
||||
inputStream = new FileInputStream(file);
|
||||
}
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
StringBuilder str = new StringBuilder();
|
||||
String tmp;
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
str.append(tmp);
|
||||
}
|
||||
reader.close();
|
||||
inputStream.close();
|
||||
shipCardId = new JSONArray(str.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<TeamData> getUserTeam(JSONObject json) {
|
||||
List<TeamData> data = new ArrayList<>();
|
||||
try {
|
||||
JSONObject warRepoot = json.getJSONObject("warReport");
|
||||
JSONArray selfShips = warRepoot.getJSONArray("selfShips");
|
||||
for (int i = 0; i < selfShips.length(); i++) {
|
||||
TeamData team = new TeamData();
|
||||
JSONObject js = selfShips.getJSONObject(i);
|
||||
team.setId(i);
|
||||
team.setHpMax(js.get("hpMax").toString());
|
||||
team.setTitle(js.getString("title"));
|
||||
team.setJid(js.getInt("id"));
|
||||
team.setHp(warRepoot.getJSONArray("hpBeforeNightWarSelf").get(i).toString());
|
||||
team.setImageUrl("http://jianr.jianrmod.cn/jianr/ship/S_NORMAL_" + JianRUtils.jianCidToid(js.get("shipCid").toString()) + ".png");
|
||||
team.setType(js.getInt("type"));
|
||||
JSONArray array = js.getJSONArray("equipment");
|
||||
List<String> list = new ArrayList<>();
|
||||
for (int j = 0; j < array.length(); j++) {
|
||||
list.add(array.getString(j));
|
||||
}
|
||||
team.setEquipments(list);
|
||||
try {
|
||||
team.setItem1Url("http://jianr.jianrmod.cn/jianr/equipment/equip_L_" + JianRUtils.equipCidToid(array.get(0).toString()) + ".png");
|
||||
team.setItem2Url("http://jianr.jianrmod.cn/jianr/equipment/equip_L_" + JianRUtils.equipCidToid(array.get(1).toString()) + ".png");
|
||||
team.setItem3Url("http://jianr.jianrmod.cn/jianr/equipment/equip_L_" + JianRUtils.equipCidToid(array.get(2).toString()) + ".png");
|
||||
team.setItem4Url("http://jianr.jianrmod.cn/jianr/equipment/equip_L_" + JianRUtils.equipCidToid(array.get(3).toString()) + ".png");
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
|
||||
team.setUser(true);
|
||||
team.setSrc(json);
|
||||
data.add(team);
|
||||
}
|
||||
return data;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public static List<TeamData> getNightUserTeam(JSONObject json) {
|
||||
List<TeamData> data = getUserTeam(json);
|
||||
System.out.println("用户数量:" + data.size());
|
||||
try {
|
||||
JSONObject warRepoot = json.getJSONObject("warResult");
|
||||
JSONArray selfShips = warRepoot.getJSONArray("selfShipResults");
|
||||
for (int i = 0; i < selfShips.length(); i++) {
|
||||
JSONObject js = selfShips.getJSONObject(i);
|
||||
TeamData ut = data.get(i);
|
||||
ut.setHp(js.getInt("hp") + "");
|
||||
data.set(i, ut);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public static List<TeamData> getNightEnemyTeam(JSONObject json) {
|
||||
List<TeamData> data = getEnemyTeam(json);
|
||||
try {
|
||||
JSONObject warRepoot = json.getJSONObject("warResult");
|
||||
JSONArray selfShips = warRepoot.getJSONArray("enemyShipResults");
|
||||
System.out.println("血量参数:" + 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());
|
||||
TeamData ut = data.get(i);
|
||||
ut.setHp(js.getInt("hp") + "");
|
||||
data.set(i, ut);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public static List<TeamData> getEnemyTeam(JSONObject json) {
|
||||
List<TeamData> data = new ArrayList<>();
|
||||
try {
|
||||
JSONObject warRepoot = json.getJSONObject("warReport");
|
||||
JSONArray selfShips = warRepoot.getJSONArray("enemyShips");
|
||||
for (int i = 0; i < selfShips.length(); i++) {
|
||||
TeamData team = new TeamData();
|
||||
JSONObject js = selfShips.getJSONObject(i);
|
||||
team.setId(i);
|
||||
team.setHpMax(js.get("hpMax").toString());
|
||||
team.setTitle(js.getString("title"));
|
||||
team.setHp(warRepoot.getJSONArray("hpBeforeNightWarEnemy").get(i).toString());
|
||||
team.setImageUrl("http://jianr.jianrmod.cn/jianr/ship/S_NORMAL_" + JianRUtils.EnemyShipCardId(js.get("shipCid").toString()) + ".png");
|
||||
team.setUser(false);
|
||||
team.setSrc(json);
|
||||
data.add(team);
|
||||
}
|
||||
return data;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
private static List<JianNiang> jianNiangs;
|
||||
private static List<ShipEquipmnt> equipmnts;
|
||||
public static List<JianNiang> reloadJianNiang() {
|
||||
try {
|
||||
if(jianNiangs==null){
|
||||
jianNiangs=new ArrayList<>();
|
||||
JSONArray array=new JSONArray(Utils.readFile(Utils.getAppPath() + "/jdata/shipCardWu.json"));
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
JSONObject json=array.getJSONObject(i);
|
||||
JianNiang jianNiang= JSON.parseObject(json.toString(),JianNiang.class);
|
||||
jianNiangs.add(jianNiang);
|
||||
}
|
||||
System.out.println("缓存舰娘数:"+jianNiangs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
getInit();
|
||||
}
|
||||
return jianNiangs;
|
||||
}
|
||||
public static List<ShipEquipmnt> reloadEquipmnts() {
|
||||
try {
|
||||
if(equipmnts==null){
|
||||
equipmnts=new ArrayList<>();
|
||||
JSONArray array=new JSONArray(Utils.readFile(Utils.getAppPath() + "/jdata/shipEquipmnt.json"));
|
||||
for (int i = 0; i < array.length(); i++) {
|
||||
JSONObject json=array.getJSONObject(i);
|
||||
ShipEquipmnt jianNiang= JSON.parseObject(json.toString(),ShipEquipmnt.class);
|
||||
equipmnts.add(jianNiang);
|
||||
}
|
||||
System.out.println("缓存装备数:"+equipmnts.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
getInit();
|
||||
}
|
||||
return equipmnts;
|
||||
}
|
||||
public static ShipEquipmnt getEquipmnt(int cid,int type){
|
||||
try{
|
||||
List<ShipEquipmnt>equipmnts=reloadEquipmnts();
|
||||
for (ShipEquipmnt equipmnt : equipmnts) {
|
||||
if(equipmnt.getCid()==cid){
|
||||
return equipmnt;
|
||||
}
|
||||
if(equipmnt.getType()==type){
|
||||
return equipmnt;
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
return null;
|
||||
}
|
||||
public static void initShipCardId(){
|
||||
try{
|
||||
File file=new File(Application.application.getFilesDir()+"/shipCardid");
|
||||
InputStream inputStream;
|
||||
if(!file.exists()){
|
||||
inputStream=Application.application.getAssets().open("shipCardId");
|
||||
}else{
|
||||
inputStream=new FileInputStream(file);
|
||||
public static void getInit() {
|
||||
File file = new File(Utils.getAppPath() + "/getInitConfigs");
|
||||
try {
|
||||
InputStream inputStream = new FileInputStream(file);
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
byte[] bytes = new byte[1024];
|
||||
int len = 0;
|
||||
while ((len = inputStream.read(bytes)) != -1) {
|
||||
outputStream.write(bytes, 0, len);
|
||||
}
|
||||
BufferedReader reader=new BufferedReader(new InputStreamReader(inputStream));
|
||||
StringBuilder str= new StringBuilder();
|
||||
String tmp;
|
||||
while ((tmp=reader.readLine())!=null){
|
||||
str.append(tmp);
|
||||
}
|
||||
reader.close();
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
inputStream.close();
|
||||
shipCardId=new JSONArray(str.toString());
|
||||
}catch (Exception e){
|
||||
JSONObject init = new JSONObject(outputStream.toString());
|
||||
Utils.writerFile(Utils.getAppPath() + "/jdata/shipCardWu.json", init.getJSONArray("shipCardWu").toString());
|
||||
Utils.writerFile(Utils.getAppPath() + "/jdata/shipEquipmnt.json", init.getJSONArray("shipEquipmnt").toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void downlaodInit(boolean flag) {
|
||||
if (flag) {
|
||||
if (new File(Utils.getAppPath() + "/getInitConfigs").exists()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
HttpUtils.downloadFile("http://version.jr.moepoint.tw/index/getInitConfigs", Utils.getAppPath() + "/", new DownloadFileInerface() {
|
||||
@Override
|
||||
public boolean downloading(String fileName, int current, long length) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void over(boolean isOver) {
|
||||
new Thread(()->{
|
||||
JianRUtils.reloadJianNiang();
|
||||
JianRUtils.reloadEquipmnts();
|
||||
}).start();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
@@ -55,21 +56,30 @@ public class ModUtils {
|
||||
private TMod mod;
|
||||
|
||||
public static ModUtils init(Context context) {
|
||||
if (modUtils == null) {
|
||||
modUtils = new ModUtils();
|
||||
modUtils.database = ModDatabase.init();
|
||||
System.out.println("调用魔改管理器");
|
||||
try {
|
||||
if (modUtils == null) {
|
||||
modUtils = new ModUtils();
|
||||
modUtils.database = ModDatabase.init();
|
||||
}
|
||||
modUtils.setContext(context);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
modUtils.setContext(context);
|
||||
|
||||
return modUtils;
|
||||
}
|
||||
|
||||
private void setContext(Context context) {
|
||||
this.context = context;
|
||||
hud = Utils.showLoading(context, "安装中", "请稍后");
|
||||
handler.post(()->{
|
||||
hud = Utils.showLoading(context, "安装中", "请稍后");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private ModUtils() {
|
||||
handler = new Handler();
|
||||
handler = new Handler(Looper.getMainLooper());
|
||||
}
|
||||
|
||||
public void setMod(TMod mod) {
|
||||
|
||||
358
app/src/main/java/com/yutou/jianr_mg/Tools/SocketTools.java
Normal file
358
app/src/main/java/com/yutou/jianr_mg/Tools/SocketTools.java
Normal file
@@ -0,0 +1,358 @@
|
||||
package com.yutou.jianr_mg.Tools;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.kaopiz.kprogresshud.KProgressHUD;
|
||||
import com.yutou.jianr_mg.Application;
|
||||
import com.yutou.jianr_mg.Data.AppData;
|
||||
import com.yutou.jianr_mg.Interfaces.HttpInterface;
|
||||
import com.yutou.jianr_mg.Interfaces.ModInterface;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import me.drakeet.materialdialog.MaterialDialog;
|
||||
|
||||
import static android.content.Context.WIFI_SERVICE;
|
||||
|
||||
/**
|
||||
* Socket客户端,接受模式为服务端,传输模式为客户端
|
||||
*/
|
||||
public class SocketTools {
|
||||
private Context context;
|
||||
private boolean model;
|
||||
private Socket socket;
|
||||
private ServerSocket serverSocket;
|
||||
private HttpInterface httpInterface;
|
||||
private List<Socket> sockets;
|
||||
private static int CODE_SUCCESS = 200;
|
||||
private static int CODE_ERROR = 500;
|
||||
private KProgressHUD hud;
|
||||
|
||||
/**
|
||||
* 初始化客户端
|
||||
*
|
||||
* @param model true为接受模式,false为传输模式
|
||||
*/
|
||||
public SocketTools(Context context, boolean model, HttpInterface httpInterface) {
|
||||
this.context = context;
|
||||
this.model = model;
|
||||
this.httpInterface = httpInterface;
|
||||
this.sockets = new ArrayList<>();
|
||||
hud = Utils.showLoading(context, null, "扫描中");
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
new Thread(() -> {
|
||||
if (model) {
|
||||
try {
|
||||
httpInterface.httpGetData("等待链接", CODE_SUCCESS);
|
||||
startService();
|
||||
httpInterface.httpGetData("链接成功!", CODE_SUCCESS);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
AppData.handler.post(() -> hud.show());
|
||||
scanAddress((flag, type) -> {
|
||||
AppData.handler.post(()->hud.setLabel("扫描中..."+type));
|
||||
if(type==0){
|
||||
AppData.handler.post(() -> hud.dismiss());
|
||||
showManualDialog();
|
||||
return;
|
||||
}
|
||||
if (sockets.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if(!flag){
|
||||
|
||||
return;
|
||||
}
|
||||
List<String> list = new ArrayList<>();
|
||||
for (Socket socket : sockets) {
|
||||
list.add(socket.getInetAddress().getHostAddress());
|
||||
}
|
||||
AppData.handler.post(() -> {
|
||||
hud.dismiss();
|
||||
showDialog(list);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void showManualDialog() {
|
||||
AppData.handler.post(()->{
|
||||
MaterialDialog dialog=new MaterialDialog(context);
|
||||
TextView textView=new TextView(context);
|
||||
EditText editText=new EditText(context);
|
||||
LinearLayout linearLayout=new LinearLayout(context);
|
||||
textView.setText("请输入IP");
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
linearLayout.addView(textView);
|
||||
linearLayout.addView(editText);
|
||||
dialog.setTitle("没有扫描到?");
|
||||
dialog.setContentView(linearLayout);
|
||||
dialog.setPositiveButton("链接",v -> {
|
||||
dialog.dismiss();
|
||||
new Thread(() -> {
|
||||
try {
|
||||
System.out.println("地址:"+editText.getText().toString()+" 端口:2336");
|
||||
Socket socket=new Socket(editText.getText().toString().trim(),2336);
|
||||
linkService(socket);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
});
|
||||
dialog.setNegativeButton("取消",v -> {
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.show();
|
||||
});
|
||||
}
|
||||
|
||||
private void showDialog(List<String> text) {
|
||||
MaterialDialog dialog = new MaterialDialog(context);
|
||||
ListView listView = new ListView(context);
|
||||
listView.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, text));
|
||||
listView.setOnItemClickListener((parent, view, position, id) -> {
|
||||
Socket socket = sockets.get(position);
|
||||
KProgressHUD dhud=Utils.showLoading(context,null,"传输中");
|
||||
dhud.show();
|
||||
new Thread(() -> {
|
||||
System.out.println("开始传输:");
|
||||
linkService(socket);
|
||||
System.out.println("传输完毕");
|
||||
AppData.handler.post(()->{dhud.dismiss();dialog.dismiss();});
|
||||
dhud.dismiss();
|
||||
}).start();
|
||||
|
||||
});
|
||||
|
||||
dialog.setTitle("扫描到主机");
|
||||
dialog.setContentView(listView);
|
||||
dialog.setPositiveButton("关闭", v -> {
|
||||
dialog.dismiss();
|
||||
});
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void linkService(Socket socket) {
|
||||
OutputStream outputStream;
|
||||
try {
|
||||
outputStream = socket.getOutputStream();
|
||||
outputStream.write("ok".getBytes());
|
||||
outputStream.flush();
|
||||
String[] data = Utils.Base64Encode(new File("/data/data/" + context.getPackageName() + "/databases/game_data_db"));
|
||||
if (data == null)
|
||||
return;
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("state", 1);
|
||||
json.put("size", new File("/data/data/" + context.getPackageName() + "/databases/game_data_db").length());
|
||||
json.put("path","/data/data/" + context.getPackageName() + "/databases/");
|
||||
json.put("fileName","game_data_db");
|
||||
json.put("length",data.length);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
json.put("index",i);
|
||||
json.put("data",data[i]);
|
||||
outputStream.write((json.toString()+"\n").getBytes());
|
||||
outputStream.flush();
|
||||
}
|
||||
// json.put("data", data);
|
||||
// outputStream.write(json.toString().getBytes());
|
||||
// outputStream.flush();
|
||||
outputStream.close();
|
||||
socket.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean flag = true;
|
||||
private List<Socket> socketList;
|
||||
|
||||
private void startService() {
|
||||
socketList = new ArrayList<>();
|
||||
|
||||
AppData.handler.post(()->{ hud=Utils.showLoading(context,"本地IP:"+getLocalAddress(),"等待中");hud.show();});
|
||||
while (flag) {
|
||||
try {
|
||||
ServerSocket serverSocket = new ServerSocket(2336);
|
||||
Socket socket = serverSocket.accept();
|
||||
if (!flag) {
|
||||
serverSocket.close();
|
||||
return;
|
||||
}
|
||||
serverSocket.close();
|
||||
socketList.add(socket);
|
||||
testSocket(socket);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void testSocket(Socket socket) {
|
||||
try {
|
||||
InputStream inputStream = socket.getInputStream();
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
byte[] bytes = new byte[1024];
|
||||
int len = 0;
|
||||
while ((len = inputStream.read(bytes)) != -1) {
|
||||
baos.write(bytes, 0, len);
|
||||
if (len == 2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
baos.flush();
|
||||
String tmp = baos.toString();
|
||||
baos.close();
|
||||
System.out.println(tmp);
|
||||
if (tmp.equals("ok")) {
|
||||
flag = false;
|
||||
AppData.handler.post(()->hud.dismiss());
|
||||
for (Socket s : socketList) {
|
||||
if (!s.equals(socket)) {
|
||||
s.close();
|
||||
}
|
||||
}
|
||||
|
||||
start(socket, inputStream);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
private void start(Socket socket, InputStream input) {
|
||||
|
||||
AppData.handler.post(()->{ hud=Utils.showLoading(context,null,"接收中");hud.show();});
|
||||
httpInterface.httpGetData("确认为:" + socket.getInetAddress().getHostAddress(), CODE_SUCCESS);
|
||||
try {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
byte[] bytes = new byte[2048];
|
||||
int len = 0;
|
||||
while ((len = input.read(bytes)) > -1) {
|
||||
baos.write(bytes, 0, len);
|
||||
baos.flush();
|
||||
}
|
||||
JSONObject json = new JSONObject(baos.toString());
|
||||
File file = new File(json.getString("path")+json.getString("fileName"));
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
String [] list=baos.toString().split("\n");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (String d : list) {
|
||||
if(d.trim().length()==0) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
JSONObject tmp = new JSONObject(d);
|
||||
sb.append(tmp.getString("data")+"\n");
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
System.out.println("保存路径:"+file.getAbsolutePath());
|
||||
Utils.Base64Decode(sb.toString(), file);
|
||||
AppData.handler.post(()->{hud.dismiss();Utils.toast(context,"重启盒子生效");});
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void scanAddress(ModInterface modInterface) {
|
||||
String mAddress = getLocalAddress();
|
||||
if (mAddress == null) {
|
||||
httpInterface.httpGetData("非局域网环境,请检查WIFI状态", CODE_ERROR);
|
||||
return;
|
||||
}
|
||||
String ipGroup = mAddress.split("\\.")[0] + "." + mAddress.split("\\.")[1] + "." + mAddress.split("\\.")[2];
|
||||
List<Thread> list = new ArrayList<>();
|
||||
for (int i = 1; i < 255; i++) {
|
||||
int finalI = i;
|
||||
|
||||
Thread thread = new Thread(() -> {
|
||||
String address = ipGroup + "." + finalI;
|
||||
if (!address.equals(mAddress)) {
|
||||
try {
|
||||
Socket tSocket = new Socket();
|
||||
tSocket.connect(new InetSocketAddress(address, 2336),1000);
|
||||
sockets.add(tSocket);
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
list.add(thread);
|
||||
thread.start();
|
||||
|
||||
}
|
||||
scan(list, modInterface);
|
||||
}
|
||||
|
||||
private void scan(List<Thread> list, ModInterface modInterface) {
|
||||
if (list.isEmpty()) {
|
||||
modInterface.onAction(true, -1);
|
||||
return;
|
||||
}
|
||||
Iterator<Thread> iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Thread thread = iterator.next();
|
||||
|
||||
if (!thread.isAlive()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
modInterface.onAction(false,list.size());
|
||||
scan(list, modInterface);
|
||||
}
|
||||
|
||||
private String getLocalAddress() {
|
||||
String address = null;
|
||||
try {
|
||||
WifiManager wm = (WifiManager) Application.application.getSystemService(WIFI_SERVICE);
|
||||
int ipAddressInt = wm.getConnectionInfo().getIpAddress();
|
||||
address = String.format(Locale.getDefault(), "%d.%d.%d.%d", (ipAddressInt & 0xff), (ipAddressInt >> 8 & 0xff), (ipAddressInt >> 16 & 0xff), (ipAddressInt >> 24 & 0xff));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return address;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
package com.yutou.jianr_mg.Tools;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Base64;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
@@ -30,6 +35,7 @@ import com.yutou.jianr_mg.views.WebActivity;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -212,8 +218,9 @@ public class Utils {
|
||||
|
||||
public static boolean writerFile(String srcFile, String data) {
|
||||
File file = new File(srcFile);
|
||||
if (!file.exists()) {
|
||||
return false;
|
||||
File path=new File(file.getAbsolutePath().split(file.getName())[0]);
|
||||
if (!path.exists()) {
|
||||
path.mkdirs();
|
||||
}
|
||||
try {
|
||||
PrintWriter writer = new PrintWriter(file);
|
||||
@@ -336,12 +343,13 @@ public class Utils {
|
||||
}
|
||||
return bytesToHexString(digest.digest());
|
||||
}
|
||||
public static String getMD5(String data){
|
||||
try{
|
||||
MessageDigest digest=MessageDigest.getInstance("MD5");
|
||||
|
||||
public static String getMD5(String data) {
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("MD5");
|
||||
digest.update(data.getBytes());
|
||||
return bytesToHexString(digest.digest());
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
@@ -364,8 +372,8 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static void openWebView(String url) {
|
||||
if(url.equals("#")){
|
||||
Utils.toast(Application.application,"暂无连接");
|
||||
if (url.equals("#")) {
|
||||
Utils.toast(Application.application, "暂无连接");
|
||||
return;
|
||||
}
|
||||
Intent intent;
|
||||
@@ -382,4 +390,54 @@ public class Utils {
|
||||
Application.application.startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
public static String getIMEI() {
|
||||
String imei = "-1";
|
||||
TelephonyManager telephonyManager = (TelephonyManager) Application.application.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
if (telephonyManager != null && ActivityCompat.checkSelfPermission(Application.application, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
|
||||
imei = telephonyManager.getDeviceId();
|
||||
}
|
||||
return imei;
|
||||
}
|
||||
|
||||
static String[] Base64Encode(File file) {
|
||||
try {
|
||||
DataInputStream inputStream = new DataInputStream(new FileInputStream(file));
|
||||
byte[] b = new byte[inputStream.available()];
|
||||
while ((inputStream.read(b)) != -1) {
|
||||
}
|
||||
inputStream.close();
|
||||
return new String(Base64.encode(b, Base64.DEFAULT)).split("\n");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static void Base64Decode(String base64, File file) {
|
||||
try{
|
||||
byte[] b=Base64.decode(base64,Base64.DEFAULT);
|
||||
if(!file.exists()){
|
||||
file.createNewFile();
|
||||
}
|
||||
FileOutputStream outputStream=new FileOutputStream(file);
|
||||
outputStream.write(b);
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
String versionName=null;
|
||||
try {
|
||||
PackageManager pm = Application.application.getPackageManager();
|
||||
PackageInfo pi = pm.getPackageInfo(Application.application.getPackageName(), 0);
|
||||
versionName = pi.versionName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return versionName;
|
||||
}
|
||||
}
|
||||
|
||||
53
app/src/main/java/com/yutou/jianr_mg/Tools/ZipUtils.java
Normal file
53
app/src/main/java/com/yutou/jianr_mg/Tools/ZipUtils.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.yutou.jianr_mg.Tools;
|
||||
|
||||
import com.kaopiz.kprogresshud.KProgressHUD;
|
||||
import com.yutou.jianr_mg.Data.AppData;
|
||||
|
||||
import net.lingala.zip4j.core.ZipFile;
|
||||
import net.lingala.zip4j.exception.ZipException;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ZipUtils {
|
||||
public static List<File> unzip(File zipFile, String descDir, final KProgressHUD hud) {
|
||||
List<File> _list = new ArrayList<>();
|
||||
byte[] _byte = new byte[1024 * 1024];
|
||||
try {
|
||||
File descDirPath = new File(descDir);
|
||||
if (!descDirPath.exists()) {
|
||||
descDirPath.mkdirs();
|
||||
}
|
||||
System.out.println("文件:" + zipFile.exists());
|
||||
try {
|
||||
ZipFile _zipFile = new ZipFile(zipFile);
|
||||
_zipFile.setFileNameCharset("GBK"); //设置编码格式(支持中文)
|
||||
if (!_zipFile.isValidZipFile()) { //检查输入的zip文件是否是有效的zip文件
|
||||
throw new ZipException("压缩文件不合法,可能被损坏.");
|
||||
}
|
||||
new Thread(() -> {
|
||||
while (true) {
|
||||
int done = _zipFile.getProgressMonitor().getPercentDone();
|
||||
AppData.handler.post(() -> hud.setLabel(done + ""));
|
||||
if(done>=100){
|
||||
break;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
_zipFile.extractAll(descDir); //解压
|
||||
} catch (ZipException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
AppData.handler.post(hud::dismiss);
|
||||
return _list;
|
||||
}
|
||||
}
|
||||
@@ -40,9 +40,12 @@ public class BaseActivity extends AppCompatActivity {
|
||||
DexClassLoader dexClassLoader= AppData.plugsin.get(jar);
|
||||
|
||||
try {
|
||||
System.out.println("jar:"+jar);
|
||||
System.out.println("BaseActivity:"+baseActivityName);
|
||||
activityInterface= (BaseActivityInterface) dexClassLoader.loadClass(baseActivityName).newInstance();
|
||||
activityInterface.onCreate(savedInstanceState,main_layut,this,getIntent());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
activityInterface=new NotInter();
|
||||
MaterialDialog dialog=new MaterialDialog(this);
|
||||
dialog.setTitle("下载插件:"+name);
|
||||
|
||||
257
app/src/main/java/com/yutou/jianr_mg/views/GameDataActivity.java
Normal file
257
app/src/main/java/com/yutou/jianr_mg/views/GameDataActivity.java
Normal file
@@ -0,0 +1,257 @@
|
||||
package com.yutou.jianr_mg.views;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.kaopiz.kprogresshud.KProgressHUD;
|
||||
import com.leon.lfilepickerlibrary.LFilePicker;
|
||||
import com.qq.e.comm.util.StringUtil;
|
||||
import com.yutou.jianr_mg.Data.AppData;
|
||||
import com.yutou.jianr_mg.Fragments.GameData;
|
||||
import com.yutou.jianr_mg.Interfaces.DownloadFileInerface;
|
||||
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.RootUtils;
|
||||
import com.yutou.jianr_mg.Tools.SocketTools;
|
||||
import com.yutou.jianr_mg.Tools.Utils;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import me.drakeet.materialdialog.MaterialDialog;
|
||||
|
||||
public class GameDataActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
private LinearLayout layout;
|
||||
private Button upload, download, localSocket;
|
||||
private TextView textView;
|
||||
private String token = null;
|
||||
private long credit;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
initView();
|
||||
setContentView(layout);
|
||||
initData();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
layout = new LinearLayout(this);
|
||||
upload = new Button(this);
|
||||
download = new Button(this);
|
||||
localSocket = new Button(this);
|
||||
textView = new TextView(this);
|
||||
|
||||
upload.setLayoutParams(buttonParams);
|
||||
download.setLayoutParams(buttonParams);
|
||||
textView.setLayoutParams(buttonParams);
|
||||
localSocket.setLayoutParams(buttonParams);
|
||||
|
||||
upload.setText("上传");
|
||||
download.setText("下载");
|
||||
localSocket.setText("局域网内设备同步");
|
||||
|
||||
upload.setTag(1);
|
||||
download.setTag(2);
|
||||
localSocket.setTag(3);
|
||||
upload.setOnClickListener(this);
|
||||
download.setOnClickListener(this);
|
||||
localSocket.setOnClickListener(this);
|
||||
|
||||
|
||||
layout.addView(textView);
|
||||
layout.addView(upload);
|
||||
layout.addView(download);
|
||||
layout.addView(localSocket);
|
||||
layout.setOrientation(LinearLayout.VERTICAL);
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
try {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("gameDataSize", new File("/data/data/" + getPackageName() + "/databases/game_data_db").length());
|
||||
HttpUtils.post(HttpApi.HOME_URL + HttpApi.DATA_UP_GAMEDATA, json, new HttpInterface() {
|
||||
@Override
|
||||
public void httpGetData(String string, int code) {
|
||||
try {
|
||||
System.out.println(string);
|
||||
JSONObject json = new JSONObject(string);
|
||||
if (json.getInt("code") == 100) {
|
||||
String token = json.getJSONObject("data").getString("token");
|
||||
credit = json.getLong("credit");
|
||||
if (!Utils.testStringIsNull(token)) {
|
||||
GameDataActivity.this.token = token;
|
||||
} else {
|
||||
Utils.toast(GameDataActivity.this, "无法上传,请检查积分是否足够");
|
||||
}
|
||||
}
|
||||
int upindex = json.getJSONObject("data").getInt("upindex");
|
||||
long uptime = json.getJSONObject("data").getLong("uptime");
|
||||
if (upindex == 0 && uptime == 0) {
|
||||
AppData.handler.post(() -> textView.setText("您还未上传过数据"));
|
||||
} else {
|
||||
AppData.handler.post(() -> textView.setText("最后一次上传时间:" + SimpleDateFormat.getDateTimeInstance(DateFormat.YEAR_FIELD, DateFormat.SHORT).format(new Date(uptime))
|
||||
+ "\n上传次数:" + upindex));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (Integer.parseInt(v.getTag() + "")) {
|
||||
case 1:
|
||||
if (token == null) {
|
||||
Utils.toast(GameDataActivity.this, "无法上传,请检查积分是否足够");
|
||||
return;
|
||||
}
|
||||
|
||||
MaterialDialog upDialog = new MaterialDialog(this);
|
||||
upDialog.setTitle("上传数据");
|
||||
upDialog.setMessage("本次预计消耗积分:" + credit);
|
||||
upDialog.setPositiveButton("确定", v1 -> {
|
||||
CDNTools.getInstance(GameDataActivity.this).upload(new File("/data/data/" + getPackageName() + "/databases/game_data_db"), token);
|
||||
upDialog.dismiss();
|
||||
});
|
||||
upDialog.setNegativeButton("取消", v1 -> {
|
||||
upDialog.dismiss();
|
||||
});
|
||||
upDialog.show();
|
||||
break;
|
||||
case 2:
|
||||
try {
|
||||
JSONObject json = new JSONObject();
|
||||
HttpUtils.post(HttpApi.HOME_URL + HttpApi.DATA_DOWN_GAMEDATA, json, new HttpInterface() {
|
||||
KProgressHUD hd;
|
||||
|
||||
@Override
|
||||
public void httpGetData(String string, int code) {
|
||||
try {
|
||||
JSONObject json = new JSONObject(string);
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
String url = data.getString("url");
|
||||
if (!StringUtil.isEmpty(url)) {
|
||||
AppData.handler.post(() -> {
|
||||
hd = Utils.showLoading(GameDataActivity.this, null, null);
|
||||
hd.show();
|
||||
});
|
||||
File file=new File("/data/data/" + getPackageName() + "/databases/game_data_db");
|
||||
file.delete();
|
||||
file=new File("/data/data/" + getPackageName() + "/databases/game_data_db-shm");
|
||||
file.delete();
|
||||
file=new File("/data/data/" + getPackageName() + "/databases/game_data_db-wal");
|
||||
file.delete();
|
||||
|
||||
HttpUtils.downloadFile(url, "/data/data/" + getPackageName() + "/databases/", new DownloadFileInerface() {
|
||||
@Override
|
||||
public boolean downloading(String fileName, int current, long length) {
|
||||
AppData.handler.post(() -> hd.setLabel("下载中(" + current + ")"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void over(boolean isOver) {
|
||||
AppData.handler.post(() -> {
|
||||
hd.dismiss();
|
||||
Utils.toast(GameDataActivity.this,"重启生效~");
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
MaterialDialog dialog = new MaterialDialog(this);
|
||||
dialog.setTitle("传输模式");
|
||||
dialog.setMessage("请选择传输模式?(请确保在同一个局域网下");
|
||||
dialog.setCanceledOnTouchOutside(true);
|
||||
dialog.setNegativeButton("接受模式", v1 -> {
|
||||
dialog.dismiss();
|
||||
new SocketTools(this, true, new HttpInterface() {
|
||||
@Override
|
||||
public void httpGetData(String string, int code) {
|
||||
System.out.println(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
dialog.setPositiveButton("传输模式", v1 -> {
|
||||
dialog.dismiss();
|
||||
new SocketTools(this, false, new HttpInterface() {
|
||||
@Override
|
||||
public void httpGetData(String string, int code) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
dialog.show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (requestCode == 100) {
|
||||
//如果是文件选择模式,需要获取选择的所有文件的路径集合
|
||||
List<String> list = data.getStringArrayListExtra("paths");
|
||||
Toast.makeText(getApplicationContext(), "选中了" + list.size() + "个文件", Toast.LENGTH_SHORT).show();
|
||||
File file = new File(list.get(0));
|
||||
if (file.exists() && !StringUtil.isEmpty(token)) {
|
||||
CDNTools.getInstance(this).upload(file, token);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,12 +20,14 @@ import com.qq.e.ads.banner2.UnifiedBannerADListener;
|
||||
import com.qq.e.ads.banner2.UnifiedBannerView;
|
||||
import com.qq.e.comm.util.AdError;
|
||||
import com.yutou.jianr_mg.Data.AppData;
|
||||
import com.yutou.jianr_mg.Data.MAdConfig;
|
||||
import com.yutou.jianr_mg.Data.MAppHomeConfig;
|
||||
import com.yutou.jianr_mg.Data.MBanner;
|
||||
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.AdTools;
|
||||
import com.yutou.jianr_mg.Tools.Log;
|
||||
import com.yutou.jianr_mg.Tools.Utils;
|
||||
|
||||
@@ -55,6 +57,7 @@ public class HomeHeader {
|
||||
private Timer timer;
|
||||
private boolean isFlash = false;
|
||||
private Handler handler;
|
||||
private MAdConfig ad;
|
||||
|
||||
public static HomeHeader getHome(Context context) {
|
||||
if (header == null) {
|
||||
@@ -87,9 +90,34 @@ public class HomeHeader {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
initAd();
|
||||
}
|
||||
private void initAd(){
|
||||
try {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("type", 3);
|
||||
HttpUtils.post(HttpApi.HOME_URL + HttpApi.AD_GET, json, new HttpInterface() {
|
||||
@Override
|
||||
public void httpGetData(String string, int code) {
|
||||
try {
|
||||
JSONObject json = new JSONObject(string);
|
||||
if (json.getInt("code") == 100) {
|
||||
ad = JSON.parseObject(json.getJSONObject("data").toString(), MAdConfig.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
AppData.handler.post(()->showAdBanner());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private void startGameActivity() {
|
||||
timer.schedule(new TimerTask() {
|
||||
private String text;
|
||||
@@ -138,11 +166,12 @@ public class HomeHeader {
|
||||
banner.setLayoutParams(params);
|
||||
layout.addView(banner);
|
||||
layout.addView(home);
|
||||
showAdBanner();
|
||||
return layout;
|
||||
}
|
||||
UnifiedBannerView bannerView;
|
||||
private void showAdBanner(){
|
||||
UnifiedBannerView bannerView=new UnifiedBannerView((Activity) context, APPID, POSID, new UnifiedBannerADListener() {
|
||||
AdTools.upload(AdTools.Banner,AdTools.req);
|
||||
bannerView=new UnifiedBannerView((Activity) context, APPID, POSID, new UnifiedBannerADListener() {
|
||||
@Override
|
||||
public void onNoAD(AdError adError) {
|
||||
Utils.toast(getContext(),adError.getErrorMsg());
|
||||
@@ -155,7 +184,7 @@ public class HomeHeader {
|
||||
|
||||
@Override
|
||||
public void onADExposure() {
|
||||
|
||||
AdTools.upload(AdTools.Banner,AdTools.show);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,7 +194,8 @@ public class HomeHeader {
|
||||
|
||||
@Override
|
||||
public void onADClicked() {
|
||||
|
||||
AdTools.upload(AdTools.Banner,AdTools.click);
|
||||
bannerView.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -184,6 +214,7 @@ public class HomeHeader {
|
||||
}
|
||||
});
|
||||
bannerView.loadAD();
|
||||
|
||||
layout.addView(bannerView);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,9 +68,8 @@ public class ModListActivity extends AppCompatActivity{
|
||||
navigationController.addTabItemSelectedListener(new OnTabItemSelectedListener() {
|
||||
@Override
|
||||
public void onSelected(int index, int old) {
|
||||
switch (index) {
|
||||
}
|
||||
viewPager.setCurrentItem(index);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
155
app/src/main/java/com/yutou/jianr_mg/views/NativeAdActivity.java
Normal file
155
app/src/main/java/com/yutou/jianr_mg/views/NativeAdActivity.java
Normal file
@@ -0,0 +1,155 @@
|
||||
package com.yutou.jianr_mg.views;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.kaopiz.kprogresshud.KProgressHUD;
|
||||
import com.qq.e.ads.nativ.ADSize;
|
||||
import com.qq.e.ads.nativ.NativeExpressAD;
|
||||
import com.qq.e.ads.nativ.NativeExpressADView;
|
||||
import com.qq.e.comm.util.AdError;
|
||||
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.AdTools;
|
||||
import com.yutou.jianr_mg.Tools.Utils;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NativeAdActivity extends AppCompatActivity {
|
||||
private LinearLayout layout;
|
||||
private KProgressHUD hud;
|
||||
private Handler handler;
|
||||
private String appid,posId;
|
||||
private int index=0;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
layout=new LinearLayout(this);
|
||||
layout.setOrientation(LinearLayout.VERTICAL);
|
||||
setContentView(layout);
|
||||
handler=new Handler();
|
||||
hud= Utils.showLoading(this,null,null);
|
||||
hud.show();
|
||||
init();
|
||||
}
|
||||
public void init() {
|
||||
try {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("type", 4);
|
||||
HttpUtils.post(HttpApi.HOME_URL + HttpApi.AD_GET, json,new HttpInterface() {
|
||||
@Override
|
||||
public void httpGetData(String string, int state) {
|
||||
try {
|
||||
JSONObject json = new JSONObject(string.toString());
|
||||
appid = json.getJSONObject("data").getString("appid");
|
||||
posId = json.getJSONObject("data").getString("posid");
|
||||
handler.post(()->initAd());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Utils.toast(null,"今天恰饱了");
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void httpError(Exception e) {
|
||||
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private void initAd() {
|
||||
if (appid == null || posId == null) {
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initAd();
|
||||
}
|
||||
}, 300);
|
||||
return;
|
||||
}
|
||||
TextView textView=new TextView(this);
|
||||
textView.setText("点击任意广告均可获取2点积分");
|
||||
layout.addView(textView);
|
||||
startAd();
|
||||
}
|
||||
private void startAd() {
|
||||
AdTools.upload( AdTools.Native, AdTools.req);
|
||||
NativeExpressAD ad = new NativeExpressAD(this, new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT), appid, posId, new NativeExpressAD.NativeExpressADListener() {
|
||||
@Override
|
||||
public void onADLoaded(List<NativeExpressADView> list) {
|
||||
AdTools.upload(AdTools.Native, AdTools.show);
|
||||
hud.dismiss();
|
||||
for (NativeExpressADView adView : list) {
|
||||
layout.addView(adView);
|
||||
adView.render();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderFail(NativeExpressADView nativeExpressADView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderSuccess(NativeExpressADView nativeExpressADView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onADExposure(NativeExpressADView nativeExpressADView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onADClicked(NativeExpressADView nativeExpressADView) {
|
||||
if(index==5){
|
||||
Utils.toast(null,"今天恰饱了!谢谢!");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
AdTools.upload( AdTools.Native, AdTools.click);
|
||||
index++;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onADClosed(NativeExpressADView nativeExpressADView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onADLeftApplication(NativeExpressADView nativeExpressADView) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onADOpenOverlay(NativeExpressADView nativeExpressADView) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onADCloseOverlay(NativeExpressADView nativeExpressADView) {
|
||||
nativeExpressADView.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNoAD(AdError adError) {
|
||||
hud.dismiss();
|
||||
Toast.makeText(NativeAdActivity.this,"现在并不想恰饭",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
ad.loadAD(5);
|
||||
}
|
||||
}
|
||||
@@ -2,66 +2,101 @@ package com.yutou.jianr_mg.views;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yutou.jianr_mg.Adapters.GameDataAdapters.WarAdapter;
|
||||
import com.yutou.jianr_mg.Adapters.WarLogAdapter;
|
||||
import com.yutou.jianr_mg.Adapters.ViewPagerAdapter;
|
||||
import com.yutou.jianr_mg.Data.ShipEquipmnt;
|
||||
import com.yutou.jianr_mg.Data.TeamData;
|
||||
import com.yutou.jianr_mg.Fragments.GameDataFragments.WarLogFragments.DaytimeFragment;
|
||||
import com.yutou.jianr_mg.Fragments.GameDataFragments.WarLogFragments.NightFragment;
|
||||
import com.yutou.jianr_mg.R;
|
||||
import com.yutou.jianr_mg.Tools.Utils;
|
||||
import com.yutou.jianr_mg.Tools.JianRUtils;
|
||||
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.lemon.view.RefreshRecyclerView;
|
||||
import me.majiajie.pagerbottomtabstrip.NavigationController;
|
||||
import me.majiajie.pagerbottomtabstrip.PageNavigationView;
|
||||
import me.majiajie.pagerbottomtabstrip.listener.OnTabItemSelectedListener;
|
||||
|
||||
public class WarLogActivity extends AppCompatActivity {
|
||||
List<Map> list;
|
||||
private RefreshRecyclerView recyclerView;
|
||||
private WarLogAdapter adapter;
|
||||
JSONArray array;
|
||||
private PageNavigationView tab;
|
||||
private ViewPager pager;
|
||||
private NavigationController navigationController;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_favorite);
|
||||
setContentView(R.layout.activity_mod_list);
|
||||
initView();
|
||||
try {
|
||||
list = JSON.parseArray(getIntent().getStringExtra("data"), Map.class);
|
||||
array = new JSONArray(getIntent().getStringExtra("data"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(list==null){
|
||||
list=new ArrayList<>();
|
||||
if (array == null) {
|
||||
array = new JSONArray();
|
||||
}
|
||||
try {
|
||||
JSONObject json = array.getJSONObject(0);
|
||||
JSONObject data = json.getJSONObject("DealNode");
|
||||
JSONObject msg = new JSONObject(data.getString("message"));
|
||||
List<TeamData> list = JianRUtils.getUserTeam(msg);
|
||||
List<TeamData> hm=new ArrayList<>();
|
||||
for (TeamData teamData : list) {
|
||||
// if(teamData.getType()>)
|
||||
String name = teamData.getTitle();
|
||||
List<String> equipment = teamData.getEquipments();
|
||||
for (String s : equipment) {
|
||||
ShipEquipmnt equipmnt = JianRUtils.getEquipmnt(Integer.parseInt(s), -1);
|
||||
System.out.println("舰娘:"+name+"装备名字:"+equipmnt.getTitle()+" 类型:"+equipmnt.getType());
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
recyclerView = (RefreshRecyclerView) findViewById(R.id.recyclerView);
|
||||
adapter=new WarLogAdapter(this);
|
||||
recyclerView.setSwipeRefreshColors(0xFF437845, 0xFFE44F98, 0xFF2FAC21);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.dismissSwipeRefresh();
|
||||
recyclerView.addRefreshAction(() -> {
|
||||
try {
|
||||
|
||||
initData();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
tab = (PageNavigationView) findViewById(R.id.tab);
|
||||
pager = (ViewPager) findViewById(R.id.pager);
|
||||
List<Fragment> list = new ArrayList<>();
|
||||
list.add(new DaytimeFragment());
|
||||
list.add(new NightFragment());
|
||||
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager(), list);
|
||||
pager.setAdapter(adapter);
|
||||
pager.setCurrentItem(0);
|
||||
navigationController = tab.material()
|
||||
.addItem(R.drawable.icon_daytime, R.drawable.icon_daytime_select, "昼战")
|
||||
.addItem(R.drawable.icon_night, R.drawable.icon_night_select, "夜战")
|
||||
.build();
|
||||
navigationController.addTabItemSelectedListener(new OnTabItemSelectedListener() {
|
||||
@Override
|
||||
public void onSelected(int index, int old) {
|
||||
pager.setCurrentItem(index);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRepeat(int index) {
|
||||
|
||||
}
|
||||
});
|
||||
initData();
|
||||
}
|
||||
navigationController.setupWithViewPager(pager);
|
||||
navigationController.setSelect(0);
|
||||
|
||||
private void initData() {
|
||||
adapter.clear();
|
||||
adapter.addAll(list);
|
||||
adapter.notifyDataSetChanged();
|
||||
recyclerView.dismissSwipeRefresh();
|
||||
recyclerView.showNoMore();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,10 +81,10 @@ public class WarView {
|
||||
md5=Utils.getMD5(WarView.this.message.toString());
|
||||
|
||||
if((int)listView.getTag()==1){
|
||||
adapter.setData(getEnemyTeam(message));
|
||||
adapter.setData(JianRUtils.getEnemyTeam(message));
|
||||
listView.setTag(0);
|
||||
}else {
|
||||
adapter.setData(getUserTeam(message));
|
||||
adapter.setData(JianRUtils.getUserTeam(message));
|
||||
listView.setTag(1);
|
||||
}
|
||||
System.out.println("更新数据:"+adapter.getCount()+" "+listView.getTag());
|
||||
@@ -100,11 +100,11 @@ public class WarView {
|
||||
if(!nMsg.isNull("extraProgress")){
|
||||
if((int)listView.getTag()==1){
|
||||
System.out.println("夜战,敌舰");
|
||||
adapter.setData(getNightEnemyTeam(nMsg));
|
||||
adapter.setData(JianRUtils.getNightEnemyTeam(nMsg));
|
||||
listView.setTag(0);
|
||||
}else {
|
||||
System.out.println("夜战,己方");
|
||||
adapter.setData(getNightUserTeam(nMsg));
|
||||
adapter.setData(JianRUtils.getNightUserTeam(nMsg));
|
||||
listView.setTag(1);
|
||||
}
|
||||
System.out.println("更新夜战:"+adapter.getCount()+" "+listView.getTag());
|
||||
@@ -148,31 +148,32 @@ public class WarView {
|
||||
button.setOnClickListener(view -> {
|
||||
if ((int) listView.getTag() == 1) {
|
||||
if(isNight){
|
||||
adapter.setData(getNightEnemyTeam(nMsg));
|
||||
adapter.setData(JianRUtils.getNightEnemyTeam(nMsg));
|
||||
}else {
|
||||
adapter.setData(getEnemyTeam(message));
|
||||
adapter.setData(JianRUtils.getEnemyTeam(message));
|
||||
}
|
||||
listView.setTag(0);
|
||||
} else {
|
||||
if(isNight){
|
||||
adapter.setData(getNightUserTeam(nMsg));
|
||||
adapter.setData(JianRUtils.getNightUserTeam(nMsg));
|
||||
}else {
|
||||
adapter.setData(getUserTeam(message));
|
||||
adapter.setData(JianRUtils.getUserTeam(message));
|
||||
}
|
||||
listView.setTag(1);
|
||||
}
|
||||
adapter.reload();
|
||||
adapter.notifyDataSetChanged();
|
||||
});
|
||||
linearLayout.addView(button);
|
||||
|
||||
userTeam.setText("剧透");
|
||||
userTeam.setOnCheckedChangeListener((compoundButton, b) -> {
|
||||
adapter.setSpoiler(b);
|
||||
adapter.notifyDataSetChanged();
|
||||
// adapter.setSpoiler(b);
|
||||
// adapter.notifyDataSetChanged();
|
||||
});
|
||||
linearLayout.addView(userTeam);
|
||||
|
||||
adapter = new MagicTeamDataAdapter(getUserTeam(message), context);
|
||||
adapter = new MagicTeamDataAdapter(JianRUtils.getUserTeam(message), context);
|
||||
ViewGroup.LayoutParams listParams=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
listView.setAdapter(adapter);
|
||||
listView.setLayoutParams(listParams);
|
||||
@@ -199,101 +200,12 @@ public class WarView {
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<TeamData> getUserTeam(JSONObject json) {
|
||||
List<TeamData> data = new ArrayList<>();
|
||||
try {
|
||||
JSONObject warRepoot = message.getJSONObject("warReport");
|
||||
JSONArray selfShips = warRepoot.getJSONArray("selfShips");
|
||||
for (int i = 0; i < selfShips.length(); i++) {
|
||||
TeamData team = new TeamData();
|
||||
JSONObject js = selfShips.getJSONObject(i);
|
||||
team.setId(i);
|
||||
team.setHpMax(js.get("hpMax").toString());
|
||||
team.setTitle(js.getString("title"));
|
||||
team.setHp(warRepoot.getJSONArray("hpBeforeNightWarSelf").get(i).toString());
|
||||
team.setImageUrl("http://jianr.jianrmod.cn/jianr/ship/S_NORMAL_" + JianRUtils.jianCidToid(js.get("shipCid").toString()) + ".png");
|
||||
try {
|
||||
team.setItem1Url("http://jianr.jianrmod.cn/jianr/equipment/equip_L_" + JianRUtils.equipCidToid(js.getJSONArray("equipment").get(0).toString()) + ".png");
|
||||
team.setItem2Url("http://jianr.jianrmod.cn/jianr/equipment/equip_L_" + JianRUtils.equipCidToid(js.getJSONArray("equipment").get(1).toString()) + ".png");
|
||||
team.setItem3Url("http://jianr.jianrmod.cn/jianr/equipment/equip_L_" + JianRUtils.equipCidToid(js.getJSONArray("equipment").get(2).toString()) + ".png");
|
||||
team.setItem4Url("http://jianr.jianrmod.cn/jianr/equipment/equip_L_" + JianRUtils.equipCidToid(js.getJSONArray("equipment").get(3).toString()) + ".png");
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
team.setUser(true);
|
||||
team.setSrc(json);
|
||||
data.add(team);
|
||||
}
|
||||
return data;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
private List<TeamData> getNightUserTeam(JSONObject json){
|
||||
List<TeamData> data=getUserTeam(message);
|
||||
System.out.println("用户数量:"+data.size());
|
||||
try {
|
||||
JSONObject warRepoot = json.getJSONObject("warResult");
|
||||
JSONArray selfShips = warRepoot.getJSONArray("selfShipResults");
|
||||
for (int i = 0; i < selfShips.length(); i++) {
|
||||
JSONObject js = selfShips.getJSONObject(i);
|
||||
TeamData ut= data.get(i);
|
||||
ut.setHp(js.getInt("hp")+"");
|
||||
data.set(i,ut);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
private List<TeamData> getNightEnemyTeam(JSONObject json){
|
||||
List<TeamData> data=getEnemyTeam(message);
|
||||
try {
|
||||
JSONObject warRepoot = json.getJSONObject("warResult");
|
||||
JSONArray selfShips = warRepoot.getJSONArray("enemyShipResults");
|
||||
System.out.println("血量参数:"+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());
|
||||
TeamData ut= data.get(i);
|
||||
ut.setHp(js.getInt("hp")+"");
|
||||
data.set(i,ut);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private List<TeamData> getEnemyTeam(JSONObject json) {
|
||||
List<TeamData> data = new ArrayList<>();
|
||||
try {
|
||||
JSONObject warRepoot = message.getJSONObject("warReport");
|
||||
JSONArray selfShips = warRepoot.getJSONArray("enemyShips");
|
||||
for (int i = 0; i < selfShips.length(); i++) {
|
||||
TeamData team = new TeamData();
|
||||
JSONObject js = selfShips.getJSONObject(i);
|
||||
team.setId(i);
|
||||
team.setHpMax(js.get("hpMax").toString());
|
||||
team.setTitle(js.getString("title"));
|
||||
team.setHp(warRepoot.getJSONArray("hpBeforeNightWarEnemy").get(i).toString());
|
||||
team.setImageUrl("http://jianr.jianrmod.cn/jianr/ship/S_NORMAL_" + JianRUtils.EnemyShipCardId(js.get("shipCid").toString()) + ".png");
|
||||
team.setUser(false);
|
||||
team.setSrc(json);
|
||||
data.add(team);
|
||||
}
|
||||
return data;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
public void close(){
|
||||
timer.cancel();
|
||||
linearLayout.removeAllViews();
|
||||
linearLayout=null;
|
||||
timer=null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
|
||||
private LinearLayout dataConfig;
|
||||
private Button start;
|
||||
private Button help;
|
||||
private Button updata;
|
||||
ArrayAdapter typeAdapter;
|
||||
ArrayAdapter nameAdapter;
|
||||
|
||||
@@ -56,6 +57,7 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
|
||||
dataConfig = findViewById(R.id.dataConfig);
|
||||
start = findViewById(R.id.start);
|
||||
help = findViewById(R.id.help);
|
||||
updata = findViewById(R.id.updata);
|
||||
|
||||
typeAdd.setOnClickListener(this);
|
||||
typeRemove.setOnClickListener(this);
|
||||
@@ -63,6 +65,8 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
|
||||
nameRemove.setOnClickListener(this);
|
||||
start.setOnClickListener(this);
|
||||
help.setOnClickListener(this);
|
||||
updata.setOnClickListener(this);
|
||||
|
||||
|
||||
saveData.setOnCheckedChangeListener((compoundButton, b) -> {
|
||||
if (b) {
|
||||
@@ -145,6 +149,10 @@ public class WindowsStartActivity extends AppCompatActivity implements View.OnCl
|
||||
case R.id.nameRemove:
|
||||
removeName();
|
||||
break;
|
||||
case R.id.updata:
|
||||
Intent gameData=new Intent(this,GameDataActivity.class);
|
||||
startActivity(gameData);
|
||||
break;
|
||||
case R.id.start:
|
||||
Intent intent = new Intent(this, WindowsService.class);
|
||||
intent.putExtra("saveData", ((boolean) saveData.getTag()));
|
||||
|
||||
Reference in New Issue
Block a user