From 458206ae23468e5d367855ea11a7b2877e0e459a Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Mon, 30 Mar 2020 17:28:43 +0800 Subject: [PATCH] =?UTF-8?q?2.3=20=E7=AB=8B=E7=BB=98=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9C=B0=E5=9D=80=20=E8=88=B0=E5=A8=98?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=94=B9=E4=B8=BA=E5=9B=BD=E5=86=85=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=20S=E5=9B=BE=E7=89=87=E6=94=B9=E4=B8=BA=E5=B1=85?= =?UTF-8?q?=E4=B8=AD=20=E5=9C=B0=E5=9B=BE=E6=94=BB=E7=95=A5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=8C=E6=88=90=20=E6=88=98=E6=96=97=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=8A=9F=E8=83=BD=E5=AE=8C=E6=88=90=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=AC=AC=E4=B8=89=E6=96=B9=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/caches/build_file_checksums.ser | Bin 695 -> 647 bytes .idea/gradle.xml | 7 +- .idea/misc.xml | 20 +++- .idea/modules.xml | 9 +- RefreshRecyclerView/build.gradle | 4 +- app/build.gradle | 18 +-- app/src/main/AndroidManifest.xml | 2 + .../Adapters/MagicTeamDataAdapter.java | 80 ++++++++++++- .../Adapters/MapUserTeamRecyclierAdapter.java | 107 ------------------ .../com/yutou/jianr_mg/Data/ShipEquipmnt.java | 43 +++++++ .../GameDataFragments/DropFragment.java | 2 +- .../Adapters/DaytimeListViewAdapter.java | 21 ++++ .../WarLogFragments/WarData.java | 13 +++ .../com/yutou/jianr_mg/LoadingActivity.java | 4 +- .../com/yutou/jianr_mg/Tools/JianRUtils.java | 31 ++--- .../com/yutou/jianr_mg/Tools/ZipUtils.java | 6 +- .../jianr_mg/views/MapStrategyActivity.java | 15 +++ .../yutou/jianr_mg/views/MapTopActivity.java | 20 +++- .../jianr_mg/views/MapUserTeamActivity.java | 40 +++---- .../com/yutou/jianr_mg/views/MapView.java | 4 +- app/src/main/res/layout/item_team.xml | 5 + app/src/main/res/layout/item_war.xml | 42 +++++-- 22 files changed, 305 insertions(+), 188 deletions(-) delete mode 100644 app/src/main/java/com/yutou/jianr_mg/Adapters/MapUserTeamRecyclierAdapter.java create mode 100644 app/src/main/java/com/yutou/jianr_mg/views/MapStrategyActivity.java diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index ab0238abf9f8c3444ba56bc92c9dfac9a0390d52..2b71aaac2c7bd227b23764ce83f5299edc1d91e7 100644 GIT binary patch delta 272 zcmdna+Ri#*I%}cUu6)gjb9}NmN*DwZ3kqVAN;7j(^wNtGQ*u&Eix`-qoz{F7|G~x) z@_>nfp`w6+fkEJ@>^z-V#WNeXX}wWK67FTEJ1v5=vTfeobgi`JXl zR;dkZqdu8dgskm3R>HtDc>ej&V%M&CH8|x+i9`0h6@w71^Gf{S2E}UN&&fc=N*v=x#xf_~c3^0mcdd D=)hzo delta 288 zcmZo?-Of5;I%{5Sxs>q4IX + - + diff --git a/.idea/modules.xml b/.idea/modules.xml index 0c73721..a781d5f 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,11 +2,10 @@ - - - - - + + + + \ No newline at end of file diff --git a/RefreshRecyclerView/build.gradle b/RefreshRecyclerView/build.gradle index a156ea1..0ea2a2f 100644 --- a/RefreshRecyclerView/build.gradle +++ b/RefreshRecyclerView/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 25 + compileSdkVersion 29 buildToolsVersion '28.0.3' defaultConfig { minSdkVersion 15 - targetSdkVersion 25 + targetSdkVersion 29 versionCode 6 versionName "1.3.0" } diff --git a/app/build.gradle b/app/build.gradle index 3707a3e..d3f8647 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,10 +63,10 @@ dependencies { //okhttp - implementation 'com.squareup.okhttp3:okhttp:3.11.0' + implementation 'com.squareup.okhttp3:okhttp:4.4.1' //FastJson - implementation 'com.alibaba:fastjson:1.2.41' + implementation 'com.alibaba:fastjson:1.2.68' //轮播图 implementation 'com.bigkoo:convenientbanner:2.0.5' @@ -78,8 +78,8 @@ dependencies { implementation 'com.github.siyamed:android-shape-imageview:0.9.3@aar' //滑动Tabs - implementation 'com.ogaclejapan.smarttablayout:library:1.6.1@aar' - implementation 'com.ogaclejapan.smarttablayout:utils-v13:1.6.1@aar' + implementation 'com.ogaclejapan.smarttablayout:library:2.0.0@aar' + implementation 'com.ogaclejapan.smarttablayout:utils-v13:1.7.0@aar' //MD 对话框 implementation 'me.drakeet.materialdialog:library:1.3.1' @@ -121,11 +121,11 @@ dependencies { implementation 'com.github.arcadefire:nice-spinner:1.3.4' //glide - implementation 'com.github.bumptech.glide:glide:4.10.0' - annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0' + implementation 'com.github.bumptech.glide:glide:4.11.0' + annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' //友盟 - implementation 'com.umeng.umsdk:analytics:8.1.3' + implementation 'com.umeng.umsdk:analytics:8.1.6' implementation 'com.umeng.umsdk:common:2.0.0' //友盟推动 @@ -140,10 +140,10 @@ dependencies { api project(path: ':UserModel')*/ //七牛云 - implementation 'com.qiniu:qiniu-android-sdk:7.3.15' + implementation 'com.qiniu:qiniu-android-sdk:7.5.2' //zip4j - implementation 'net.lingala.zip4j:zip4j:1.3.3' + implementation 'net.lingala.zip4j:zip4j:2.5.1' //卡顿检测 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5424797..988cf0b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -24,6 +24,7 @@ android:roundIcon="@mipmap/icon_logo_round" android:usesCleartextTraffic="true" android:networkSecurityConfig="@xml/network_security_config" + android:requestLegacyExternalStorage="true" android:supportsRtl="true" android:theme="@style/AppTheme" android:fullBackupContent="@xml/backup_descriptor" @@ -95,6 +96,7 @@ + list, Context context,boolean isNotHP) { + this.list = list; + this.context = context; + loader = Utils.initImageLoader(context); + this.isNotHP=isNotHP; + } public void setSpoiler(boolean spoiler) { // this.spoiler = spoiler; } @@ -111,6 +121,9 @@ public class MagicTeamDataAdapter extends BaseAdapter { if (!spoiler) { // item.hpBar.setProgress(0); } + if(isNotHP){ + item.hpBar.setVisibility(View.GONE); + } item.title.setText(data.getTitle()); item.title.setVisibility(View.VISIBLE); item.hp.setVisibility(View.VISIBLE); @@ -139,6 +152,7 @@ public class MagicTeamDataAdapter extends BaseAdapter { if (data.getItem1Url() != null) { loader.displayImage(data.getItem1Url(), item.item1, new imageListener()); item.item1.setScaleType(ImageView.ScaleType.CENTER_INSIDE); + item.item1.setOnClickListener(new EquipmentClick(data.getEquipments().get(0))); item.item1.setVisibility(View.VISIBLE); } else { item.item1.setVisibility(View.GONE); @@ -146,6 +160,7 @@ public class MagicTeamDataAdapter extends BaseAdapter { if (data.getItem2Url() != null) { loader.displayImage(data.getItem2Url(), item.item2, new imageListener()); item.item2.setScaleType(ImageView.ScaleType.CENTER_INSIDE); + item.item2.setOnClickListener(new EquipmentClick(data.getEquipments().get(1))); item.item2.setVisibility(View.VISIBLE); } else { item.item2.setVisibility(View.GONE); @@ -153,6 +168,7 @@ public class MagicTeamDataAdapter extends BaseAdapter { if (data.getItem3Url() != null) { loader.displayImage(data.getItem3Url(), item.item3, new imageListener()); item.item3.setScaleType(ImageView.ScaleType.CENTER_INSIDE); + item.item3.setOnClickListener(new EquipmentClick(data.getEquipments().get(2))); item.item3.setVisibility(View.VISIBLE); } else { item.item3.setVisibility(View.GONE); @@ -160,6 +176,7 @@ public class MagicTeamDataAdapter extends BaseAdapter { if (data.getItem4Url() != null) { loader.displayImage(data.getItem4Url(), item.item4, new imageListener()); item.item4.setScaleType(ImageView.ScaleType.CENTER_INSIDE); + item.item4.setOnClickListener(new EquipmentClick(data.getEquipments().get(3))); item.item4.setVisibility(View.VISIBLE); } else { item.item4.setVisibility(View.GONE); @@ -201,7 +218,7 @@ public class MagicTeamDataAdapter extends BaseAdapter { } } - class imageListener implements ImageLoadingListener { + private static class imageListener implements ImageLoadingListener { @Override public void onLoadingStarted(String imageUri, View view) { @@ -222,4 +239,63 @@ public class MagicTeamDataAdapter extends BaseAdapter { } } + private class EquipmentClick implements View.OnClickListener{ + private PopupWindow popupWindow; + public EquipmentClick(String index){ + ShipEquipmnt equipmnt= JianRUtils.getEquipmnt(Integer.parseInt(index),-1); + TextView textView=new TextView(context); + int i=1; + if(equipmnt!=null) { + StringBuilder msg=new StringBuilder(); + msg.append(equipmnt.getTitle()).append("\n"); + msg.append("稀有度:").append(equipmnt.getStar()).append("\n"); + + if(equipmnt.getAtk()!=0){ + msg.append("攻击+").append(equipmnt.getAtk()).append("\n"); + } + if(!equipmnt.getDef().equals("0")){ + msg.append("防御+").append(equipmnt.getDef()).append("\n"); + } + if(!equipmnt.getTorpedo().equals("0")){ + msg.append("鱼雷+").append(equipmnt.getTorpedo()).append("\n"); + } + if(!equipmnt.getAntisub().equals("0")){ + msg.append("反潜+").append(equipmnt.getAntisub()).append("\n"); + } + if(!equipmnt.getRadar().equals("0")){ + msg.append("索敌+").append(equipmnt.getRadar()).append("\n"); + } + if (!equipmnt.getHit().equals("0")){ + msg.append("命中+").append(equipmnt.getHit()).append("\n"); + } + if(equipmnt.getRange()!=0){ + msg.append("范围+").append(equipmnt.getRange()).append("\n"); + } + if (!equipmnt.getMiss().equals("0")){ + msg.append("回避+").append(equipmnt.getMiss()).append("\n"); + } + if(!equipmnt.getLuck().equals("0")){ + msg.append("幸运+").append(equipmnt.getLuck()).append("\n"); + } + msg.append(equipmnt.getDesc()); + i=msg.toString().split("\n").length; + textView.setText(msg.toString()); + // System.out.println(equipmnt.toString()); + }else{ + textView.setText("Not Equipmnt Info"); + } + textView.setTextColor(Color.BLACK); + textView.setBackgroundColor(Color.WHITE); + popupWindow=new PopupWindow(textView,300,i*100); + popupWindow.setOutsideTouchable(false); + } + @Override + public void onClick(View v) { + if(popupWindow.isShowing()){ + popupWindow.dismiss(); + }else { + popupWindow.showAsDropDown(v); + } + } + } } diff --git a/app/src/main/java/com/yutou/jianr_mg/Adapters/MapUserTeamRecyclierAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Adapters/MapUserTeamRecyclierAdapter.java deleted file mode 100644 index bb0f1d9..0000000 --- a/app/src/main/java/com/yutou/jianr_mg/Adapters/MapUserTeamRecyclierAdapter.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.yutou.jianr_mg.Adapters; - -import android.annotation.SuppressLint; -import android.content.Context; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.ProgressBar; -import android.widget.TextView; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.nostra13.universalimageloader.core.ImageLoader; -import com.yutou.jianr_mg.Data.JianNiang; -import com.yutou.jianr_mg.Data.ShipEquipmnt; -import com.yutou.jianr_mg.R; -import com.yutou.jianr_mg.Tools.JianRUtils; -import com.yutou.jianr_mg.Tools.Utils; - -import cn.lemon.view.adapter.BaseViewHolder; -import cn.lemon.view.adapter.RecyclerAdapter; - -public class MapUserTeamRecyclierAdapter extends RecyclerAdapter { - ImageLoader loader; - - public MapUserTeamRecyclierAdapter(Context context) { - super(context); - loader = Utils.initImageLoader(context); - } - - @Override - public BaseViewHolder onCreateBaseViewHolder(ViewGroup parent, int viewType) { - return new ViewHolder(parent, R.layout.item_team); - } - - private class ViewHolder extends BaseViewHolder { - TextView title, hp, hpMax; - ImageView icon, icon_, item1, item2, item3, item4; - ProgressBar hpBar; - LinearLayout hpLayout; - - public ViewHolder(ViewGroup parent, int layoutId) { - super(parent, layoutId); - hp = findViewById(R.id.hp); - hpMax = findViewById(R.id.hpMax); - hpBar = findViewById(R.id.itemHp); - title = findViewById(R.id.title); - icon = findViewById(R.id.icon); - icon_ = findViewById(R.id.icon_); - item1 = findViewById(R.id.item1); - item2 = findViewById(R.id.item2); - item3 = findViewById(R.id.item3); - item4 = findViewById(R.id.item4); - hpLayout = findViewById(R.id.hpLayout); - hpBar.setVisibility(View.GONE); - hpLayout.setVisibility(View.GONE); - - } - - @SuppressLint("SetTextI18n") - @Override - public void setData(JSONObject data) { - super.setData(data); - JianNiang jianNiang = JianRUtils.getJianNiangByCId(data.getInteger("cid")); - if (jianNiang == null) - return; - title.setText(jianNiang.getTitle() + " Level:" + data.getInteger("level")); - loader.displayImage(JianRUtils.getShipImageByCid(data.getInteger("cid"), true), icon); - JSONArray equipment = data.getJSONArray("equipment"); - if (equipment.getString(0) != null) { - loader.displayImage(JianRUtils.getShipImageByCid(Integer.parseInt(equipment.getString(0)), false), item1); - item1.setOnClickListener(view -> { - ShipEquipmnt shipEquipmnt = JianRUtils.getEquipmnt(Integer.parseInt(equipment.getString(0)), -2); - if (shipEquipmnt != null) - Utils.toast(getContext(), shipEquipmnt.getTitle()); - }); - } - if (equipment.getString(1) != null) { - loader.displayImage(JianRUtils.getShipImageByCid(Integer.parseInt(equipment.getString(1)), false), item2); - item2.setOnClickListener(view -> { - ShipEquipmnt shipEquipmnt = JianRUtils.getEquipmnt(Integer.parseInt(equipment.getString(1)), -2); - if (shipEquipmnt != null) - Utils.toast(getContext(), shipEquipmnt.getTitle()); - }); - } - if (equipment.getString(2) != null) { - loader.displayImage(JianRUtils.getShipImageByCid(Integer.parseInt(equipment.getString(2)), false), item3); - item3.setOnClickListener(view -> { - ShipEquipmnt shipEquipmnt = JianRUtils.getEquipmnt(Integer.parseInt(equipment.getString(2)), -2); - if (shipEquipmnt != null) - Utils.toast(getContext(), shipEquipmnt.getTitle()); - }); - } - if (equipment.getString(3) != null) { - loader.displayImage(JianRUtils.getShipImageByCid(Integer.parseInt(equipment.getString(3)), false), item4); - item4.setOnClickListener(view -> { - ShipEquipmnt shipEquipmnt = JianRUtils.getEquipmnt(Integer.parseInt(equipment.getString(3)), -2); - if (shipEquipmnt != null) - Utils.toast(getContext(), shipEquipmnt.getTitle()); - }); - } - - } - } - -} diff --git a/app/src/main/java/com/yutou/jianr_mg/Data/ShipEquipmnt.java b/app/src/main/java/com/yutou/jianr_mg/Data/ShipEquipmnt.java index 5714067..49baa0e 100644 --- a/app/src/main/java/com/yutou/jianr_mg/Data/ShipEquipmnt.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/ShipEquipmnt.java @@ -339,6 +339,49 @@ public class ShipEquipmnt { this.shipType = shipType; } + @Override + public String toString() { + return "ShipEquipmnt{" + + "cid=" + cid + + ", star=" + star + + ", title='" + title + '\'' + + ", country='" + country + '\'' + + ", type=" + type + + ", hp='" + hp + '\'' + + ", atk=" + atk + + ", def='" + def + '\'' + + ", torpedo='" + torpedo + '\'' + + ", antisub='" + antisub + '\'' + + ", radar='" + radar + '\'' + + ", hit='" + hit + '\'' + + ", range=" + range + + ", miss='" + miss + '\'' + + ", luck='" + luck + '\'' + + ", correction='" + correction + '\'' + + ", effect='" + effect + '\'' + + ", dismantle=" + dismantle + + ", author='" + author + '\'' + + ", desc='" + desc + '\'' + + ", desc2='" + desc2 + '\'' + + ", equipIndex='" + equipIndex + '\'' + + ", picId=" + picId + + ", boreType=" + boreType + + ", handbookType='" + handbookType + '\'' + + ", aircraftAtk='" + aircraftAtk + '\'' + + ", missileTmd='" + missileTmd + '\'' + + ", missileHit='" + missileHit + '\'' + + ", airDef='" + airDef + '\'' + + ", airDefRate=" + airDefRate + + ", airDefCorrect='" + airDefCorrect + '\'' + + ", missleDefModulus='" + missleDefModulus + '\'' + + ", shipCid='" + shipCid + '\'' + + ", shipCountry='" + shipCountry + '\'' + + ", specialEffect='" + specialEffect + '\'' + + ", aluminiumUse='" + aluminiumUse + '\'' + + ", shipType=" + shipType + + '}'; + } + public static class DismantleBean { /** * 2 : 0 diff --git a/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/DropFragment.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/DropFragment.java index 755be80..9d32359 100644 --- a/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/DropFragment.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/DropFragment.java @@ -160,7 +160,7 @@ public class DropFragment extends Fragment { Map map = new ArrayMap<>(); String cid = json.get("cid").toString(); String title = json.getString("title"); - map.put("icon", "http://jianr.jianrmod.cn/jianr/ship/S_NORMAL_" + JianRUtils.jianCidToid(cid) + ".png"); + map.put("icon", "http://jianr.jianrmod.cn/jianr/moeassisstant/zjsnr/illustration/ships/S/NORMAL/S_NORMAL_" + JianRUtils.jianCidToid(cid) + ".png"); map.put("name", title); /* map.put("time", new SimpleDateFormat("yyyy年MM月dd HH:mm:ss") .format(new Date(Long.valueOf(json.getJSONObject("data").getString("createTime")))));*/ diff --git a/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/WarLogFragments/Adapters/DaytimeListViewAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/WarLogFragments/Adapters/DaytimeListViewAdapter.java index 432337e..bbd9125 100644 --- a/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/WarLogFragments/Adapters/DaytimeListViewAdapter.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/WarLogFragments/Adapters/DaytimeListViewAdapter.java @@ -6,20 +6,27 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; +import android.widget.ImageView; import android.widget.TextView; +import com.alibaba.fastjson.JSONArray; +import com.nostra13.universalimageloader.core.ImageLoader; import com.yutou.jianr_mg.Fragments.GameDataFragments.WarLogFragments.WarData; import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.JianRUtils; +import com.yutou.jianr_mg.Tools.Utils; import java.util.List; public class DaytimeListViewAdapter extends BaseAdapter { private Context context; private List list; + private ImageLoader imageLoader; public DaytimeListViewAdapter(Context context, List list) { this.context = context; this.list = list; + imageLoader= Utils.initImageLoader(context); } @Override @@ -44,6 +51,8 @@ public class DaytimeListViewAdapter extends BaseAdapter { if (view == null) { view = LayoutInflater.from(context).inflate(R.layout.item_war, null); holder = new ViewHolder(); + holder.userIcon=view.findViewById(R.id.userIcon); + holder.enemyIcon=view.findViewById(R.id.enemyIcon); holder.user = view.findViewById(R.id.user); holder.arrow = view.findViewById(R.id.arrow); holder.enemy = view.findViewById(R.id.enemy); @@ -56,7 +65,12 @@ public class DaytimeListViewAdapter extends BaseAdapter { holder.user.setText(""); holder.arrow.setText("----进入夜战----"); holder.enemy.setText(""); + holder.userIcon.setVisibility(View.GONE); + holder.enemyIcon.setVisibility(View.GONE); }else { + holder.userIcon.setVisibility(View.VISIBLE); + holder.enemyIcon.setVisibility(View.VISIBLE); + holder.user.setText(warData.getUserName()); holder.arrow.setText("--" + warData.getAttackModel() + "-->"); String[] enemyName = warData.getEnemy(); @@ -66,7 +80,13 @@ public class DaytimeListViewAdapter extends BaseAdapter { } name=name.substring(0,name.length()-1); holder.enemy.setText(name); + if(JianRUtils.jianCidToid(warData.getCid()+"")==0){ + imageLoader.displayImage(JianRUtils.getEnemyShipImageByCid(warData.getCid()),holder.userIcon); + }else + imageLoader.displayImage(JianRUtils.getShipImageByCid(warData.getCid(),true),holder.userIcon); + imageLoader.displayImage(JianRUtils.getEnemyShipImageByCid(Long.parseLong(warData.getEnemyCid()[0])),holder.enemyIcon); } + return view; } @@ -82,6 +102,7 @@ public class DaytimeListViewAdapter extends BaseAdapter { } private class ViewHolder { + ImageView userIcon,enemyIcon; TextView user, arrow, enemy; } } diff --git a/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/WarLogFragments/WarData.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/WarLogFragments/WarData.java index efb089c..3c5fee8 100644 --- a/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/WarLogFragments/WarData.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/WarLogFragments/WarData.java @@ -3,6 +3,7 @@ package com.yutou.jianr_mg.Fragments.GameDataFragments.WarLogFragments; import com.umeng.commonsdk.debug.W; import org.json.JSONArray; +import org.json.JSONException; import org.json.JSONObject; import java.util.Arrays; @@ -22,6 +23,7 @@ public class WarData { private long cid; private int fromIndex; private String[] enemy; + private String[] enemyCid; private int[] damage; private boolean userAttack; private int attackModel; @@ -114,6 +116,14 @@ public class WarData { this.enemy = enemy; } + public String[] getEnemyCid() { + return enemyCid; + } + + public void setEnemyCid(String[] enemyCid) { + this.enemyCid = enemyCid; + } + public int[] getDamage() { return damage; } @@ -136,11 +146,14 @@ public class WarData { } warData.setDamage(damages); String[] enemyNames = new String[json.getJSONArray("targetIndex").length()]; + String[] enemyCids = new String[json.getJSONArray("targetIndex").length()]; array = !warData.isUserAttack() ? warReport.getJSONArray("selfShips") : warReport.getJSONArray("enemyShips"); for (int i = 0; i < json.getJSONArray("targetIndex").length(); i++) { enemyNames[i] = array.getJSONObject(json.getJSONArray("targetIndex").getInt(i)).getString("title"); + enemyCids[i] = array.getJSONObject(json.getJSONArray("targetIndex").getInt(i)).getString("shipCid"); } warData.setEnemy(enemyNames); + warData.setEnemyCid(enemyCids); warData.setAttackModel(attackModel); } catch (Exception e) { e.printStackTrace(); diff --git a/app/src/main/java/com/yutou/jianr_mg/LoadingActivity.java b/app/src/main/java/com/yutou/jianr_mg/LoadingActivity.java index e6c6760..8cbc4cd 100644 --- a/app/src/main/java/com/yutou/jianr_mg/LoadingActivity.java +++ b/app/src/main/java/com/yutou/jianr_mg/LoadingActivity.java @@ -93,9 +93,7 @@ public class LoadingActivity extends AppCompatActivity { initViews(); initData(); initAd(); - /*JianRUtils.reloadShipType(); - MapView mapView=new MapView(this); - setContentView(mapView.getView());*/ + JianRUtils.reloadShipType(); } private void login(String name, String pass) { diff --git a/app/src/main/java/com/yutou/jianr_mg/Tools/JianRUtils.java b/app/src/main/java/com/yutou/jianr_mg/Tools/JianRUtils.java index 66dcca5..9a3994b 100644 --- a/app/src/main/java/com/yutou/jianr_mg/Tools/JianRUtils.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/JianRUtils.java @@ -35,18 +35,18 @@ public class JianRUtils { public static int jianCidToid(String cid) { if (cid.substring(1, 2).equals("1")) { - int con = Integer.valueOf(cid.substring(2, cid.length() - 2)); + int con = Integer.parseInt(cid.substring(2, cid.length() - 2)); return 1000 + con; } else { - return Integer.valueOf(cid.substring(2, cid.length() - 2)); + return Integer.parseInt(cid.substring(2, cid.length() - 2)); } } public static int equipCidToid(String cid) { - return Integer.valueOf(cid.substring(2)) / 100; + return Integer.parseInt(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); @@ -96,7 +96,7 @@ public class JianRUtils { 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.setImageUrl("http://jianr.jianrmod.cn/jianr/moeassisstant/zjsnr/illustration/ships/S/NORMAL/S_NORMAL_" + JianRUtils.jianCidToid(js.get("shipCid").toString()) + ".png"); team.setType(js.getInt("type")); JSONArray array = js.getJSONArray("equipment"); List list = new ArrayList<>(); @@ -105,10 +105,10 @@ public class JianRUtils { } 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"); + team.setItem1Url("http://jianr.jianrmod.cn/jianr/moeassisstant/zjsnr/illustration/equipments/equip_L_" + JianRUtils.equipCidToid(array.get(0).toString()) + ".png"); + team.setItem2Url("http://jianr.jianrmod.cn/jianr/moeassisstant/zjsnr/illustration/equipments/equip_L_" + JianRUtils.equipCidToid(array.get(1).toString()) + ".png"); + team.setItem3Url("http://jianr.jianrmod.cn/jianr/moeassisstant/zjsnr/illustration/equipments/equip_L_" + JianRUtils.equipCidToid(array.get(2).toString()) + ".png"); + team.setItem4Url("http://jianr.jianrmod.cn/jianr/moeassisstant/zjsnr/illustration/equipments/equip_L_" + JianRUtils.equipCidToid(array.get(3).toString()) + ".png"); } catch (Exception ignored) { } @@ -175,7 +175,7 @@ public class JianRUtils { 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.setImageUrl("http://jianr.jianrmod.cn/jianr/moeassisstant/zjsnr/illustration/ships/S/NORMAL/S_NORMAL_" + JianRUtils.enemyShipCardId(js.get("shipCid").toString()) + ".png"); team.setUser(false); team.setSrc(json); data.add(team); @@ -187,13 +187,16 @@ public class JianRUtils { return data; } - public static String getShipImageByCid(int cid,boolean ship){ + public static String getShipImageByCid(long cid,boolean ship){ if(ship) - return "http://jianr.jianrmod.cn/jianr/ship/S_NORMAL_"+jianCidToid(cid+"")+".png"; + return "http://jianr.jianrmod.cn/jianr/moeassisstant/zjsnr/illustration/ships/S/NORMAL/S_NORMAL_"+jianCidToid(cid+"")+".png"; else{ - return "http://jianr.jianrmod.cn/jianr/equipment/equip_L_"+equipCidToid(cid+"")+".png"; + return "http://jianr.jianrmod.cn/jianr/moeassisstant/zjsnr/illustration/equipments/equip_L_"+equipCidToid(cid+"")+".png"; } } + public static String getEnemyShipImageByCid(long cid){ + return "http://jianr.jianrmod.cn/jianr/moeassisstant/zjsnr/illustration/ships/S/NORMAL/S_NORMAL_"+enemyShipCardId(cid+"")+".png"; + } private static List jianNiangs=new ArrayList<>(); private static List equipmnts=new ArrayList<>(); @@ -323,7 +326,7 @@ public class JianRUtils { return; } } - HttpUtils.downloadFile("http://version.jr.moepoint.tw/index/getInitConfigs", Utils.getAppPath() + "/", new DownloadFileInerface() { + HttpUtils.downloadFile("http://version.jr.moefantasy.com/index/getInitConfigs", Utils.getAppPath() + "/", new DownloadFileInerface() { @Override public boolean downloading(String fileName, int current, long length) { return true; diff --git a/app/src/main/java/com/yutou/jianr_mg/Tools/ZipUtils.java b/app/src/main/java/com/yutou/jianr_mg/Tools/ZipUtils.java index 9cd7a41..1396702 100644 --- a/app/src/main/java/com/yutou/jianr_mg/Tools/ZipUtils.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/ZipUtils.java @@ -3,10 +3,11 @@ 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.ZipFile; import net.lingala.zip4j.exception.ZipException; import java.io.File; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; @@ -22,7 +23,8 @@ public class ZipUtils { System.out.println("文件:" + zipFile.exists()); try { ZipFile _zipFile = new ZipFile(zipFile); - _zipFile.setFileNameCharset("GBK"); //设置编码格式(支持中文) + //_zipFile.setFileNameCharset("GBK"); //设置编码格式(支持中文) + _zipFile.setCharset(Charset.forName("GBK")); if (!_zipFile.isValidZipFile()) { //检查输入的zip文件是否是有效的zip文件 throw new ZipException("压缩文件不合法,可能被损坏."); } diff --git a/app/src/main/java/com/yutou/jianr_mg/views/MapStrategyActivity.java b/app/src/main/java/com/yutou/jianr_mg/views/MapStrategyActivity.java new file mode 100644 index 0000000..5e7b9a4 --- /dev/null +++ b/app/src/main/java/com/yutou/jianr_mg/views/MapStrategyActivity.java @@ -0,0 +1,15 @@ +package com.yutou.jianr_mg.views; + +import android.os.Bundle; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +public class MapStrategyActivity extends AppCompatActivity { + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + MapView mapView=new MapView(this); + setContentView(mapView.getView()); + } +} diff --git a/app/src/main/java/com/yutou/jianr_mg/views/MapTopActivity.java b/app/src/main/java/com/yutou/jianr_mg/views/MapTopActivity.java index 6fb1679..67eae1b 100644 --- a/app/src/main/java/com/yutou/jianr_mg/views/MapTopActivity.java +++ b/app/src/main/java/com/yutou/jianr_mg/views/MapTopActivity.java @@ -16,6 +16,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.constraintlayout.widget.ConstraintLayout; import com.alibaba.fastjson.JSON; +import com.kaopiz.kprogresshud.KProgressHUD; import com.yutou.jianr_mg.Data.GameInfoLog; import com.yutou.jianr_mg.Data.MapNode; import com.yutou.jianr_mg.Data.TeamData; @@ -25,6 +26,7 @@ import com.yutou.jianr_mg.Network.HttpApi; import com.yutou.jianr_mg.Network.HttpUtils; import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.Tools.JianRUtils; +import com.yutou.jianr_mg.Tools.Utils; import org.json.JSONArray; import org.json.JSONException; @@ -51,6 +53,7 @@ public class MapTopActivity extends AppCompatActivity { private List logs; private int model = -1; private MapNode mapNode; + private KProgressHUD hud; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -59,6 +62,7 @@ public class MapTopActivity extends AppCompatActivity { level_name = getIntent().getStringExtra("level_name"); chapterName = getIntent().getStringExtra("chapterName"); model = getIntent().getIntExtra("data", -1); + hud=new KProgressHUD(this); initView(); switch (model) { case 0: @@ -126,6 +130,7 @@ public class MapTopActivity extends AppCompatActivity { url = HttpApi.MAPTOP_MAP_DATA; json.put("chapterName", chapterName); } + hud.show(); HttpUtils.post(HttpApi.HOME_URL + url, json, new HttpInterface() { @Override public void httpGetData(String string, int code) { @@ -147,6 +152,7 @@ public class MapTopActivity extends AppCompatActivity { } } handler.post(() -> { + hud.dismiss(); adapter = new ArrayAdapter<>(MapTopActivity.this, android.R.layout.simple_list_item_1, nodes); listView.setAdapter(adapter); }); @@ -157,7 +163,10 @@ public class MapTopActivity extends AppCompatActivity { @Override public void httpError(Exception e) { - + handler.post(()->{ + hud.dismiss(); + Utils.toast(MapTopActivity.this,"加载失败"); + }); } }); } catch (Exception e) { @@ -172,6 +181,7 @@ public class MapTopActivity extends AppCompatActivity { JSONObject json = new JSONObject(); json.put("node", mapNode.getId()); json.put("limit", limit); + hud.show(); HttpUtils.post(HttpApi.HOME_URL + HttpApi.MAPTOP_USER_TEAM, json, new HttpInterface() { @Override public void httpGetData(String string, int code) { @@ -210,11 +220,17 @@ public class MapTopActivity extends AppCompatActivity { e.printStackTrace(); System.out.println(string); } + handler.post(()->{ + hud.dismiss(); + }); } @Override public void httpError(Exception e) { - + handler.post(()->{ + hud.dismiss(); + Utils.toast(MapTopActivity.this,"加载失败:"+e.getMessage()); + }); } }); } catch (Exception e) { diff --git a/app/src/main/java/com/yutou/jianr_mg/views/MapUserTeamActivity.java b/app/src/main/java/com/yutou/jianr_mg/views/MapUserTeamActivity.java index ee88555..ad1e5f6 100644 --- a/app/src/main/java/com/yutou/jianr_mg/views/MapUserTeamActivity.java +++ b/app/src/main/java/com/yutou/jianr_mg/views/MapUserTeamActivity.java @@ -1,37 +1,33 @@ package com.yutou.jianr_mg.views; import android.os.Bundle; -import android.widget.Toast; +import android.widget.ListView; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; -import androidx.recyclerview.widget.LinearLayoutManager; import com.alibaba.fastjson.JSON; -import com.yutou.jianr_mg.Adapters.MapUserTeamRecyclierAdapter; +import com.yutou.jianr_mg.Adapters.MagicTeamDataAdapter; import com.yutou.jianr_mg.Data.GameInfoLog; -import com.yutou.jianr_mg.Data.MapNode; -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.Data.TeamData; +import com.yutou.jianr_mg.Tools.JianRUtils; import com.yutou.jianr_mg.Tools.Utils; +import org.json.JSONException; import org.json.JSONObject; -import cn.lemon.view.RefreshRecyclerView; +import java.util.List; public class MapUserTeamActivity extends AppCompatActivity { - private RefreshRecyclerView recyclerView; - private MapUserTeamRecyclierAdapter adapter; private GameInfoLog mapNode; - private int limit=0; + private ListView listView; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_favorite); - recyclerView = findViewById(R.id.recyclerView); + // setContentView(R.layout.activity_favorite); + listView=new ListView(this); + setContentView(listView); try { mapNode= JSON.parseObject(getIntent().getStringExtra("data"), GameInfoLog.class); }catch (Exception e){ @@ -40,17 +36,17 @@ public class MapUserTeamActivity extends AppCompatActivity { finish(); return; } - initView(); initData(); } - - void initView() { - adapter=new MapUserTeamRecyclierAdapter(this); - recyclerView.setSwipeRefreshColors(0xFF437845, 0xFFE44F98, 0xFF2FAC21); - recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); - recyclerView.setAdapter(adapter); - } void initData(){ + try { + JSONObject message=new JSONObject(mapNode.getMessage()); + List list=JianRUtils.getUserTeam(message); + MagicTeamDataAdapter adapter=new MagicTeamDataAdapter(list,this,true); + listView.setAdapter(adapter); + } catch (JSONException e) { + e.printStackTrace(); + } } } diff --git a/app/src/main/java/com/yutou/jianr_mg/views/MapView.java b/app/src/main/java/com/yutou/jianr_mg/views/MapView.java index 2a44db8..92f7220 100644 --- a/app/src/main/java/com/yutou/jianr_mg/views/MapView.java +++ b/app/src/main/java/com/yutou/jianr_mg/views/MapView.java @@ -9,6 +9,7 @@ import android.widget.LinearLayout; import androidx.recyclerview.widget.LinearLayoutManager; import com.alibaba.fastjson.JSON; +import com.kaopiz.kprogresshud.KProgressHUD; import com.yutou.jianr_mg.Adapters.MapRecyclierAdapter; import com.yutou.jianr_mg.Data.MapTop; import com.yutou.jianr_mg.Interfaces.HttpInterface; @@ -34,10 +35,12 @@ public class MapView { private MapRecyclierAdapter adapter; private int limit = 0; private Handler handler; + private KProgressHUD hud; public MapView(Context context) { this.context = context; handler=new Handler(); + hud=new KProgressHUD(context); initView(); initData(true); } @@ -60,7 +63,6 @@ public class MapView { recyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); recyclerView.setAdapter(adapter); - mainLayout.addView(search); mainLayout.addView(recyclerView); recyclerView.addRefreshAction(() -> { diff --git a/app/src/main/res/layout/item_team.xml b/app/src/main/res/layout/item_team.xml index 8f06794..6a2d12e 100644 --- a/app/src/main/res/layout/item_team.xml +++ b/app/src/main/res/layout/item_team.xml @@ -27,6 +27,7 @@ android:layout_height="50dp" android:layout_gravity="center" android:layout_weight="1" + android:scaleType="center" app:srcCompat="@mipmap/icon_logo" /> diff --git a/app/src/main/res/layout/item_war.xml b/app/src/main/res/layout/item_war.xml index 443296e..cc16c14 100644 --- a/app/src/main/res/layout/item_war.xml +++ b/app/src/main/res/layout/item_war.xml @@ -1,21 +1,41 @@ + + + + + app:layout_constraintEnd_toEndOf="@+id/userIcon" + app:layout_constraintStart_toStartOf="@+id/userIcon" + app:layout_constraintTop_toBottomOf="@+id/userIcon" /> + app:layout_constraintEnd_toEndOf="@+id/enemyIcon" + app:layout_constraintStart_toStartOf="@+id/enemyIcon" + app:layout_constraintTop_toBottomOf="@+id/enemyIcon" /> \ No newline at end of file