diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index a2fe219..919eae3 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/app/build.gradle b/app/build.gradle index bc9c491..ac05cf6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,12 +3,12 @@ apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { - applicationId "com.yutou.jianrmg_v2" - //applicationId "com.yutou.jianr_mg" + //applicationId "com.yutou.jianrmg_v2" + applicationId "com.yutou.jianr_mg" minSdkVersion 19 targetSdkVersion 28 - versionCode 1 - versionName "0.4α" + versionCode 2 + versionName "2.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" ndk { abiFilters "armeabi", "armeabi-v7a", "x86", "mips" @@ -77,8 +77,10 @@ dependencies { //图片流缓存 implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' + //圆形图片 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' @@ -121,6 +123,7 @@ dependencies { //Spinner implementation 'com.github.arcadefire:nice-spinner:1.3.4' + //glide implementation 'com.github.bumptech.glide:glide:4.9.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' @@ -134,10 +137,10 @@ dependencies { implementation 'com.umeng.umsdk:push:5.0.2' /* api project(path: ':BaseModel') - api project(path: ':GameDataModel') - api project(path: ':AppHome') - api project(path: ':MgListModel') - api project(path: ':ResModl') - api project(path: ':UserModel')*/ + api project(path: ':GameDataModel') + api project(path: ':AppHome') + api project(path: ':MgListModel') + api project(path: ':ResModl') + api project(path: ':UserModel')*/ implementation files('libs/tbs_sdk_thirdapp_v3.6.0.1371_43624_sharewithdownload_withoutGame_obfs_20181106_121046.jar') } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 91794f1..f69578c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ + package="com.yutou.jianr_mg"> @@ -17,7 +17,7 @@ + android:value="R" /> @@ -47,30 +47,30 @@ - + - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + > { loader.displayImage(data.get("icon"),icon); }else{ icon.setImageResource(R.mipmap.icon_logo); - } } } diff --git a/app/src/main/java/com/yutou/jianr_mg/Adapters/GameDataAdapters/WarAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Adapters/GameDataAdapters/WarAdapter.java new file mode 100644 index 0000000..c07ddf1 --- /dev/null +++ b/app/src/main/java/com/yutou/jianr_mg/Adapters/GameDataAdapters/WarAdapter.java @@ -0,0 +1,101 @@ +package com.yutou.jianr_mg.Adapters.GameDataAdapters; + +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.nostra13.universalimageloader.core.ImageLoader; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Utils; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import cn.lemon.view.adapter.BaseViewHolder; +import cn.lemon.view.adapter.RecyclerAdapter; + +public class WarAdapter extends RecyclerAdapter>> { + ImageLoader loader; + public WarAdapter(Context context) { + super(context); + loader= Utils.initImageLoader(context); + } + + @Override + public BaseViewHolder>> onCreateBaseViewHolder(ViewGroup parent, int viewType) { + return new MyHolder(parent, R.layout.item_team); + } + class MyHolder extends BaseViewHolder>>{ + private ImageView icon; + private LinearLayout layout,hpLayout; + private TextView name,time; + private ProgressBar itemHp; + public MyHolder(ViewGroup parent, int layoutId) { + super(parent, layoutId); + icon=findViewById(R.id.icon); + layout=findViewById(R.id.items); + hpLayout=findViewById(R.id.hpLayout); + name=findViewById(R.id.title); + itemHp=findViewById(R.id.itemHp); + layout.setVisibility(View.GONE); + itemHp.setVisibility(View.GONE); + hpLayout.removeAllViews(); + time=new TextView(getContext()); + hpLayout.addView(time); + } + + @Override + public void setData(List> data) { + super.setData(data); + if(data.size()==0){ + return; + } + try { + JSONObject warJson=new JSONObject(data.get(0).get("GetWarResult").getString("message")); + int level=warJson.getJSONObject("warResult").getInt("resultLevel"); + String lev=""; + switch (level){ + case 1: + lev="SS"; + break; + case 2: + lev="S"; + break; + case 3: + lev="A"; + break; + case 4: + lev="B"; + break; + case 5: + lev="C"; + break; + case 6: + lev="D"; + break; + } + JSONObject item=new JSONObject(data.get(0).get("DealNode").getString("message")); + name.setText("("+data.get(0).get("data").get("mapId")+")"+item.getJSONObject("warReport").getString("enemyName")+"("+lev+")"); + time.setText(SimpleDateFormat.getDateTimeInstance(DateFormat.YEAR_FIELD,DateFormat.SHORT).format(new Date(Long.valueOf(data.get(0).get("DealNode").getString("time"))))); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void onItemViewClick(List> data) { + super.onItemViewClick(data); + Utils.toast(getContext(),"详细内容正在咕,敬请期待"); + } + } +} diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/HomeRecyclerAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Adapters/HomeRecyclerAdapter.java similarity index 89% rename from app/src/main/java/com/yutou/jianrmg_v2/Adapters/HomeRecyclerAdapter.java rename to app/src/main/java/com/yutou/jianr_mg/Adapters/HomeRecyclerAdapter.java index d1411fc..4a2312e 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/HomeRecyclerAdapter.java +++ b/app/src/main/java/com/yutou/jianr_mg/Adapters/HomeRecyclerAdapter.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Adapters; +package com.yutou.jianr_mg.Adapters; import android.annotation.SuppressLint; import android.app.Activity; @@ -11,13 +11,13 @@ import android.widget.TextView; import com.alibaba.fastjson.JSON; import com.nostra13.universalimageloader.core.ImageLoader; -import com.yutou.jianrmg_v2.Model.HomeCard; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Log; -import com.yutou.jianrmg_v2.Tools.Utils; -import com.yutou.jianrmg_v2.views.HomeHeader; -import com.yutou.jianrmg_v2.views.ModActivity; -import com.yutou.jianrmg_v2.views.WebActivity; +import com.yutou.jianr_mg.Model.HomeCard; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Log; +import com.yutou.jianr_mg.Tools.Utils; +import com.yutou.jianr_mg.views.HomeHeader; +import com.yutou.jianr_mg.views.ModActivity; +import com.yutou.jianr_mg.views.WebActivity; import cn.lemon.view.adapter.BaseViewHolder; import cn.lemon.view.adapter.RecyclerAdapter; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/MagicTeamDataAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Adapters/MagicTeamDataAdapter.java similarity index 95% rename from app/src/main/java/com/yutou/jianrmg_v2/Adapters/MagicTeamDataAdapter.java rename to app/src/main/java/com/yutou/jianr_mg/Adapters/MagicTeamDataAdapter.java index a3550dd..e1ffbb3 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/MagicTeamDataAdapter.java +++ b/app/src/main/java/com/yutou/jianr_mg/Adapters/MagicTeamDataAdapter.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Adapters; +package com.yutou.jianr_mg.Adapters; import android.content.Context; import android.graphics.Bitmap; @@ -15,9 +15,9 @@ import android.widget.TextView; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.assist.FailReason; import com.nostra13.universalimageloader.core.listener.ImageLoadingListener; -import com.yutou.jianrmg_v2.Data.TeamData; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Utils; +import com.yutou.jianr_mg.Data.TeamData; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Utils; import java.util.List; @@ -136,7 +136,12 @@ public class MagicTeamDataAdapter extends BaseAdapter { } public void setData(List enemyTeam) { - this.list=enemyTeam; + this.list.clear(); + this.list.addAll(enemyTeam); + } + + public List getData() { + return this.list; } class ItemViews { diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/MainUtilsAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Adapters/MainUtilsAdapter.java similarity index 91% rename from app/src/main/java/com/yutou/jianrmg_v2/Adapters/MainUtilsAdapter.java rename to app/src/main/java/com/yutou/jianr_mg/Adapters/MainUtilsAdapter.java index bca87b0..3a83dee 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/MainUtilsAdapter.java +++ b/app/src/main/java/com/yutou/jianr_mg/Adapters/MainUtilsAdapter.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Adapters; +package com.yutou.jianr_mg.Adapters; import android.content.Context; import android.content.Intent; @@ -7,12 +7,12 @@ import android.widget.ImageView; import android.widget.TextView; import com.nostra13.universalimageloader.core.ImageLoader; -import com.yutou.jianrmg_v2.Application; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Data.MAppTools; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Utils; -import com.yutou.jianrmg_v2.views.BaseActivity; +import com.yutou.jianr_mg.Application; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Data.MAppTools; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Utils; +import com.yutou.jianr_mg.views.BaseActivity; import cn.lemon.view.adapter.BaseViewHolder; import cn.lemon.view.adapter.RecyclerAdapter; @@ -58,6 +58,7 @@ public class MainUtilsAdapter extends RecyclerAdapter { String main = data.getMainFunction().split("#")[0]; try { + Intent intent=null; if(!type.equals("localActivity")){ intent = new Intent(getContext(), Application.application.getClassLoader().loadClass(main)); diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/ModListRecyclerAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Adapters/ModListRecyclerAdapter.java similarity index 90% rename from app/src/main/java/com/yutou/jianrmg_v2/Adapters/ModListRecyclerAdapter.java rename to app/src/main/java/com/yutou/jianr_mg/Adapters/ModListRecyclerAdapter.java index ca55c8e..eb9464b 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/ModListRecyclerAdapter.java +++ b/app/src/main/java/com/yutou/jianr_mg/Adapters/ModListRecyclerAdapter.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Adapters; +package com.yutou.jianr_mg.Adapters; import android.app.Activity; import android.content.Context; @@ -9,12 +9,12 @@ import android.widget.TextView; import com.alibaba.fastjson.JSON; import com.nostra13.universalimageloader.core.ImageLoader; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Data.MAppMg; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Utils; -import com.yutou.jianrmg_v2.views.BaseActivity; -import com.yutou.jianrmg_v2.views.ModListActivity; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Data.MAppMg; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Utils; +import com.yutou.jianr_mg.views.BaseActivity; +import com.yutou.jianr_mg.views.ModListActivity; import cn.lemon.view.adapter.BaseViewHolder; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/ModRecyclerAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Adapters/ModRecyclerAdapter.java similarity index 93% rename from app/src/main/java/com/yutou/jianrmg_v2/Adapters/ModRecyclerAdapter.java rename to app/src/main/java/com/yutou/jianr_mg/Adapters/ModRecyclerAdapter.java index bcac5ff..2da7ed1 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/ModRecyclerAdapter.java +++ b/app/src/main/java/com/yutou/jianr_mg/Adapters/ModRecyclerAdapter.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Adapters; +package com.yutou.jianr_mg.Adapters; import android.content.Context; import android.content.Intent; @@ -11,19 +11,19 @@ import android.widget.TextView; import com.alibaba.fastjson.JSON; import com.nostra13.universalimageloader.core.ImageLoader; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Data.TMod; -import com.yutou.jianrmg_v2.Data.TModtype; -import com.yutou.jianrmg_v2.Data.ZsShipType; -import com.yutou.jianrmg_v2.Interfaces.HttpInterface; -import com.yutou.jianrmg_v2.Interfaces.ModInterface; -import com.yutou.jianrmg_v2.Network.HttpApi; -import com.yutou.jianrmg_v2.Network.HttpUtils; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Log; -import com.yutou.jianrmg_v2.Tools.ModUtils; -import com.yutou.jianrmg_v2.Tools.Utils; -import com.yutou.jianrmg_v2.views.ModActivity; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Data.TMod; +import com.yutou.jianr_mg.Data.TModtype; +import com.yutou.jianr_mg.Data.ZsShipType; +import com.yutou.jianr_mg.Interfaces.HttpInterface; +import com.yutou.jianr_mg.Interfaces.ModInterface; +import com.yutou.jianr_mg.Network.HttpApi; +import com.yutou.jianr_mg.Network.HttpUtils; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Log; +import com.yutou.jianr_mg.Tools.ModUtils; +import com.yutou.jianr_mg.Tools.Utils; +import com.yutou.jianr_mg.views.ModActivity; import org.angmarch.views.NiceSpinner; import org.json.JSONObject; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/MyItemGridViewAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Adapters/MyItemGridViewAdapter.java similarity index 90% rename from app/src/main/java/com/yutou/jianrmg_v2/Adapters/MyItemGridViewAdapter.java rename to app/src/main/java/com/yutou/jianr_mg/Adapters/MyItemGridViewAdapter.java index 099193f..d0e59ac 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/MyItemGridViewAdapter.java +++ b/app/src/main/java/com/yutou/jianr_mg/Adapters/MyItemGridViewAdapter.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Adapters; +package com.yutou.jianr_mg.Adapters; import android.app.Activity; import android.content.Context; @@ -12,13 +12,13 @@ import android.widget.LinearLayout; import android.widget.TextView; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Log; -import com.yutou.jianrmg_v2.Tools.Utils; -import com.yutou.jianrmg_v2.views.ConfigActivity; -import com.yutou.jianrmg_v2.views.DownloadListActivity; -import com.yutou.jianrmg_v2.views.FavoritesActivity; -import com.yutou.jianrmg_v2.views.UpFeedBack; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Log; +import com.yutou.jianr_mg.Tools.Utils; +import com.yutou.jianr_mg.views.ConfigActivity; +import com.yutou.jianr_mg.views.DownloadListActivity; +import com.yutou.jianr_mg.views.FavoritesActivity; +import com.yutou.jianr_mg.views.UpFeedBack; import java.util.List; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/ReModListAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Adapters/ReModListAdapter.java similarity index 91% rename from app/src/main/java/com/yutou/jianrmg_v2/Adapters/ReModListAdapter.java rename to app/src/main/java/com/yutou/jianr_mg/Adapters/ReModListAdapter.java index c723544..020c9fc 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/ReModListAdapter.java +++ b/app/src/main/java/com/yutou/jianr_mg/Adapters/ReModListAdapter.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Adapters; +package com.yutou.jianr_mg.Adapters; import android.content.Context; import android.content.Intent; @@ -11,10 +11,10 @@ import android.widget.TextView; import com.alibaba.fastjson.JSON; import com.nostra13.universalimageloader.core.ImageLoader; -import com.yutou.jianrmg_v2.Data.TMod; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Utils; -import com.yutou.jianrmg_v2.views.ModActivity; +import com.yutou.jianr_mg.Data.TMod; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Utils; +import com.yutou.jianr_mg.views.ModActivity; import java.util.List; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/ViewPagerAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Adapters/ViewPagerAdapter.java similarity index 93% rename from app/src/main/java/com/yutou/jianrmg_v2/Adapters/ViewPagerAdapter.java rename to app/src/main/java/com/yutou/jianr_mg/Adapters/ViewPagerAdapter.java index 485b956..0a0fe61 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/ViewPagerAdapter.java +++ b/app/src/main/java/com/yutou/jianr_mg/Adapters/ViewPagerAdapter.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Adapters; +package com.yutou.jianr_mg.Adapters; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; diff --git a/app/src/main/java/com/yutou/jianr_mg/Adapters/WarLogAdapter.java b/app/src/main/java/com/yutou/jianr_mg/Adapters/WarLogAdapter.java new file mode 100644 index 0000000..ad9f31b --- /dev/null +++ b/app/src/main/java/com/yutou/jianr_mg/Adapters/WarLogAdapter.java @@ -0,0 +1,58 @@ +package com.yutou.jianr_mg.Adapters; + +import android.content.Context; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.TextView; + +import com.nostra13.universalimageloader.core.ImageLoader; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Utils; + +import org.json.JSONObject; + +import java.util.Map; + +import cn.lemon.view.adapter.BaseViewHolder; +import cn.lemon.view.adapter.RecyclerAdapter; + +public class WarLogAdapter extends RecyclerAdapter { + private ImageLoader loader; + public WarLogAdapter(Context context) { + super(context); + loader= Utils.initImageLoader(context); + } + + @Override + public BaseViewHolder onCreateBaseViewHolder(ViewGroup parent, int viewType) { + return new MyHolder(parent, R.layout.item_team); + } + class MyHolder extends BaseViewHolder{ + TextView title, hp, hpMax; + ImageView icon, icon_, item1, item2, item3, item4; + ProgressBar hpBar; + LinearLayout hpLayout; + MyHolder(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); + } + + @Override + public void setData(Map data) { + super.setData(data); + JSONObject item= (JSONObject) data.get(""); + } + } +} diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Application.java b/app/src/main/java/com/yutou/jianr_mg/Application.java similarity index 68% rename from app/src/main/java/com/yutou/jianrmg_v2/Application.java rename to app/src/main/java/com/yutou/jianr_mg/Application.java index 6d8c001..9d7ec23 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Application.java +++ b/app/src/main/java/com/yutou/jianr_mg/Application.java @@ -1,26 +1,30 @@ -package com.yutou.jianrmg_v2; +package com.yutou.jianr_mg; import android.app.Activity; +import android.app.Notification; +import android.content.Context; import android.os.Bundle; import android.os.Handler; import com.tencent.smtt.sdk.QbSdk; import com.umeng.analytics.MobclickAgent; import com.umeng.commonsdk.UMConfigure; +import com.umeng.message.IUmengCallback; import com.umeng.message.IUmengRegisterCallback; import com.umeng.message.PushAgent; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Data.User; -import com.yutou.jianrmg_v2.Databases.UserDatabase; -import com.yutou.jianrmg_v2.Interfaces.HttpInterface; -import com.yutou.jianrmg_v2.Network.HttpApi; -import com.yutou.jianrmg_v2.Network.HttpUtils; -import com.yutou.jianrmg_v2.Tools.ActivitysManager; -import com.yutou.jianrmg_v2.Tools.JianRUtils; -import com.yutou.jianrmg_v2.Tools.Log; -import com.yutou.jianrmg_v2.Tools.Utils; -import com.zzhoujay.richtext.ext.MD5; +import com.umeng.message.UmengMessageHandler; +import com.umeng.message.entity.UMessage; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Data.User; +import com.yutou.jianr_mg.Databases.UserDatabase; +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.JianRUtils; +import com.yutou.jianr_mg.Tools.Log; +import com.yutou.jianr_mg.Tools.Utils; import org.json.JSONArray; import org.json.JSONObject; @@ -54,34 +58,63 @@ public class Application extends android.app.Application { regActivity(); JianRUtils.initShipCardId(); + initUmeng(); + initTx(); + - QbSdk.initX5Environment(this, new QbSdk.PreInitCallback() { - @Override - public void onCoreInitFinished() { - System.out.println("QDSDK初始化失败"); - } - @Override - public void onViewInitFinished(boolean b) { - Log.e("QDSDK","加载内核是否成功:"+b); - } - }); - UMConfigure.init(this, UMConfigure.DEVICE_TYPE_PHONE, "c5ec76e4a6ebb1516359792ffee09eb5"); - MobclickAgent.setScenarioType(this, MobclickAgent.EScenarioType.E_UM_NORMAL); - PushAgent.getInstance(this).register(new IUmengRegisterCallback() { - @Override - public void onSuccess(String s) { - System.out.println("友盟推送注册成功:"+s); - } - @Override - public void onFailure(String s, String s1) { - System.out.println("友盟推送注册失败:"+s+"("+s1+")"); - } - }); System.out.println("初始化结束"); } + 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() { + @Override + public void onSuccess(String s) { + System.out.println("友盟推送注册成功:" + s); + } + @Override + public void onFailure(String s, String s1) { + System.out.println("友盟推送注册失败:" + s + "(" + s1 + ")"); + } + }); + pushAgent.setMessageHandler(new UmengMessageHandler(){ + @Override + public Notification getNotification(Context context, UMessage uMessage) { + for (Map.Entry entry : uMessage.extra.entrySet()) { + if(entry.getKey().equals("url")){ + LoadingActivity.url=entry.getValue(); + } + + } + return super.getNotification(context, uMessage); + } + }); + }catch (Exception e){ + e.printStackTrace(); + } + } + private void initTx(){ + try { + QbSdk.initX5Environment(this, new QbSdk.PreInitCallback() { + @Override + public void onCoreInitFinished() { + System.out.println("QDSDK初始化失败"); + } + + @Override + public void onViewInitFinished(boolean b) { + Log.e("QDSDK","加载内核是否成功:"+b); + } + }); + }catch (Exception ignored){ + } + + } private void initPlugs() { new Thread(() -> { try { @@ -106,7 +139,7 @@ public class Application extends android.app.Application { if (!file.getName().contains(".jar")) { continue; } - String appid = (String) plugsin.get(file.getName()).loadClass("com.yutou.jianrmg_v2.plugins.Data").getField("appId").get(null); + String appid = (String) plugsin.get(file.getName()).loadClass("com.yutou.jianr_mg.plugins.Data").getField("appId").get(null); String md5 = Utils.getFileMD5(file); System.out.println("MD5:" + md5); JSONObject plugs = new JSONObject(); @@ -212,4 +245,5 @@ public class Application extends android.app.Application { } }); } + } diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/AppData.java b/app/src/main/java/com/yutou/jianr_mg/Data/AppData.java similarity index 95% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/AppData.java rename to app/src/main/java/com/yutou/jianr_mg/Data/AppData.java index 3645664..85ace93 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/AppData.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/AppData.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; import android.app.Activity; import android.os.Handler; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/MAppHome.java b/app/src/main/java/com/yutou/jianr_mg/Data/MAppHome.java similarity index 65% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/MAppHome.java rename to app/src/main/java/com/yutou/jianr_mg/Data/MAppHome.java index f55e380..6be6aa8 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/MAppHome.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/MAppHome.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class MAppHome { private int id; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/MAppHomeConfig.java b/app/src/main/java/com/yutou/jianr_mg/Data/MAppHomeConfig.java similarity index 99% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/MAppHomeConfig.java rename to app/src/main/java/com/yutou/jianr_mg/Data/MAppHomeConfig.java index f8c9738..ce233e5 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/MAppHomeConfig.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/MAppHomeConfig.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; import java.util.Date; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/MAppLicense.java b/app/src/main/java/com/yutou/jianr_mg/Data/MAppLicense.java similarity index 98% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/MAppLicense.java rename to app/src/main/java/com/yutou/jianr_mg/Data/MAppLicense.java index 556ca4b..1c766fe 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/MAppLicense.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/MAppLicense.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class MAppLicense { diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/MAppMg.java b/app/src/main/java/com/yutou/jianr_mg/Data/MAppMg.java similarity index 99% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/MAppMg.java rename to app/src/main/java/com/yutou/jianr_mg/Data/MAppMg.java index b40e83d..f52b811 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/MAppMg.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/MAppMg.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class MAppMg{ diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/MAppTools.java b/app/src/main/java/com/yutou/jianr_mg/Data/MAppTools.java similarity index 99% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/MAppTools.java rename to app/src/main/java/com/yutou/jianr_mg/Data/MAppTools.java index e5d197c..228ec28 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/MAppTools.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/MAppTools.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class MAppTools { private String pluginName; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/MBanner.java b/app/src/main/java/com/yutou/jianr_mg/Data/MBanner.java similarity index 98% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/MBanner.java rename to app/src/main/java/com/yutou/jianr_mg/Data/MBanner.java index b321f44..ca8970e 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/MBanner.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/MBanner.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class MBanner { diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/MGamePackname.java b/app/src/main/java/com/yutou/jianr_mg/Data/MGamePackname.java similarity index 99% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/MGamePackname.java rename to app/src/main/java/com/yutou/jianr_mg/Data/MGamePackname.java index d72d1e2..5d0f975 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/MGamePackname.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/MGamePackname.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class MGamePackname { private boolean isRoot; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/SConfig.java b/app/src/main/java/com/yutou/jianr_mg/Data/SConfig.java similarity index 99% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/SConfig.java rename to app/src/main/java/com/yutou/jianr_mg/Data/SConfig.java index 21ee4c7..56ae018 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/SConfig.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/SConfig.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class SConfig { diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/SystemData.java b/app/src/main/java/com/yutou/jianr_mg/Data/SystemData.java similarity index 95% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/SystemData.java rename to app/src/main/java/com/yutou/jianr_mg/Data/SystemData.java index 177eae1..169282e 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/SystemData.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/SystemData.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; import android.Manifest; import android.content.Context; @@ -7,9 +7,9 @@ import android.os.Build; import android.support.v4.app.ActivityCompat; import android.telephony.TelephonyManager; -import com.yutou.jianrmg_v2.Application; -import com.yutou.jianrmg_v2.Tools.RootUtils; -import com.yutou.jianrmg_v2.Tools.Utils; +import com.yutou.jianr_mg.Application; +import com.yutou.jianr_mg.Tools.RootUtils; +import com.yutou.jianr_mg.Tools.Utils; import java.io.File; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/TMod.java b/app/src/main/java/com/yutou/jianr_mg/Data/TMod.java similarity index 99% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/TMod.java rename to app/src/main/java/com/yutou/jianr_mg/Data/TMod.java index 7e5b2b6..9e7da42 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/TMod.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/TMod.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; import android.support.annotation.NonNull; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/TModfile.java b/app/src/main/java/com/yutou/jianr_mg/Data/TModfile.java similarity index 99% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/TModfile.java rename to app/src/main/java/com/yutou/jianr_mg/Data/TModfile.java index 7735297..52bbc72 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/TModfile.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/TModfile.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class TModfile { diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/TModfilePath.java b/app/src/main/java/com/yutou/jianr_mg/Data/TModfilePath.java similarity index 98% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/TModfilePath.java rename to app/src/main/java/com/yutou/jianr_mg/Data/TModfilePath.java index d911d50..ad6cc71 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/TModfilePath.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/TModfilePath.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class TModfilePath { diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/TModtag.java b/app/src/main/java/com/yutou/jianr_mg/Data/TModtag.java similarity index 98% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/TModtag.java rename to app/src/main/java/com/yutou/jianr_mg/Data/TModtag.java index 3715114..32c7861 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/TModtag.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/TModtag.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class TModtag { diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/TModtype.java b/app/src/main/java/com/yutou/jianr_mg/Data/TModtype.java similarity index 97% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/TModtype.java rename to app/src/main/java/com/yutou/jianr_mg/Data/TModtype.java index 26b6bb2..54cb84f 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/TModtype.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/TModtype.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/TeamData.java b/app/src/main/java/com/yutou/jianr_mg/Data/TeamData.java similarity index 98% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/TeamData.java rename to app/src/main/java/com/yutou/jianr_mg/Data/TeamData.java index f29ebb6..e46bc0a 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/TeamData.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/TeamData.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; import org.json.JSONException; import org.json.JSONObject; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/UUsercollection.java b/app/src/main/java/com/yutou/jianr_mg/Data/UUsercollection.java similarity index 98% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/UUsercollection.java rename to app/src/main/java/com/yutou/jianr_mg/Data/UUsercollection.java index 427cba2..0cc4090 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/UUsercollection.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/UUsercollection.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class UUsercollection { diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/UUserdata.java b/app/src/main/java/com/yutou/jianr_mg/Data/UUserdata.java similarity index 98% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/UUserdata.java rename to app/src/main/java/com/yutou/jianr_mg/Data/UUserdata.java index c1789cd..ef65926 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/UUserdata.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/UUserdata.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class UUserdata { diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/User.java b/app/src/main/java/com/yutou/jianr_mg/Data/User.java similarity index 99% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/User.java rename to app/src/main/java/com/yutou/jianr_mg/Data/User.java index 22e4009..9d5fc76 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/User.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/User.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; public class User { private String uname; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Data/ZsShipType.java b/app/src/main/java/com/yutou/jianr_mg/Data/ZsShipType.java similarity index 98% rename from app/src/main/java/com/yutou/jianrmg_v2/Data/ZsShipType.java rename to app/src/main/java/com/yutou/jianr_mg/Data/ZsShipType.java index 508aaa4..c0fcda6 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Data/ZsShipType.java +++ b/app/src/main/java/com/yutou/jianr_mg/Data/ZsShipType.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Data; +package com.yutou.jianr_mg.Data; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Databases/JianRDataDataBase.java b/app/src/main/java/com/yutou/jianr_mg/Databases/JianRDataDataBase.java similarity index 85% rename from app/src/main/java/com/yutou/jianrmg_v2/Databases/JianRDataDataBase.java rename to app/src/main/java/com/yutou/jianr_mg/Databases/JianRDataDataBase.java index 50f87b6..28e8d9e 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Databases/JianRDataDataBase.java +++ b/app/src/main/java/com/yutou/jianr_mg/Databases/JianRDataDataBase.java @@ -1,12 +1,12 @@ -package com.yutou.jianrmg_v2.Databases; +package com.yutou.jianr_mg.Databases; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; -import com.yutou.jianrmg_v2.Application; -import com.yutou.jianrmg_v2.Tools.Utils; +import com.yutou.jianr_mg.Application; +import com.yutou.jianr_mg.Tools.Utils; import org.json.JSONArray; import org.json.JSONObject; @@ -203,7 +203,13 @@ public class JianRDataDataBase extends SQLiteOpenHelper { writeDatabase.insert(TAB_DATA_NAME, null, values); } } - + public int getTNameId(String name){ + Cursor cursor=readDatabase.query(TAB_DATA_NAME,new String[]{"*"},"title=?",new String[]{name},null,null,null); + if(cursor.moveToNext()){ + return cursor.getInt(cursor.getColumnIndex("_id")); + } + return -1; + } public long addData(String title, JSONObject data) { if (queryDataName(title) && !queryGameData(Utils.getMD5(data.toString()))) { try { @@ -233,7 +239,7 @@ public class JianRDataDataBase extends SQLiteOpenHelper { } return -1; } - public List> getData(){ + public List> getDataList(){ List> list=new ArrayList<>(); try{ Cursor cursor=readDatabase.query(TAB_DATA_GAME,new String[]{"*"},"nodeType=?",new String[]{"DealNode"},null,null,"_id desc"); @@ -242,8 +248,41 @@ public class JianRDataDataBase extends SQLiteOpenHelper { String m=cursor.getString(cursor.getColumnIndex("m")); String a=cursor.getString(cursor.getColumnIndex("a")); String n=cursor.getString(cursor.getColumnIndex("mapId")); - map.put("DealNode",new JSONObject(cursor.getString(cursor.getColumnIndex("src")))); + JSONObject node=new JSONObject(cursor.getString(cursor.getColumnIndex("src"))); + node.put("_id",cursor.getInt(cursor.getColumnIndex("id"))); + node.put("time",cursor.getString(cursor.getColumnIndex("createTime"))); + node.put("type",cursor.getString(cursor.getColumnIndex("nodeType"))); + map.put("DealNode",node); map.put("GetWarResult",getWarResult(m,n,a)); + JSONObject j=new JSONObject(); + j.put("mapId",n); + map.put("data",j); + list.add(map); + } + cursor.close(); + }catch (Exception e){ + e.printStackTrace(); + } + return list; + } + public List> getDataList(int id){ + List> list=new ArrayList<>(); + try{ + Cursor cursor=readDatabase.rawQuery("select * from t_data_GAME game,t_data_name name,t_data_type type where name._id=? and type._id=name.typeId and game.nameId=name._id",new String[]{id+""}); + while (cursor.moveToNext()){ + Map map=new HashMap<>(); + String m=cursor.getString(cursor.getColumnIndex("m")); + String a=cursor.getString(cursor.getColumnIndex("a")); + String n=cursor.getString(cursor.getColumnIndex("mapId")); + JSONObject node=new JSONObject(cursor.getString(cursor.getColumnIndex("src"))); + node.put("_id",id); + node.put("time",cursor.getString(cursor.getColumnIndex("createTime"))); + node.put("type",cursor.getString(cursor.getColumnIndex("nodeType"))); + map.put("DealNode",node); + map.put("GetWarResult",getWarResult(m,n,a)); + JSONObject j=new JSONObject(); + j.put("mapId",n); + map.put("data",j); list.add(map); } cursor.close(); @@ -260,8 +299,12 @@ public class JianRDataDataBase extends SQLiteOpenHelper { String m=cursor.getString(cursor.getColumnIndex("m")); String a=cursor.getString(cursor.getColumnIndex("a")); String n=cursor.getString(cursor.getColumnIndex("mapId")); - map.put("DealNode",new JSONObject(cursor.getString(cursor.getColumnIndex("src")))); + JSONObject node=new JSONObject(cursor.getString(cursor.getColumnIndex("src"))); + node.put("_id",id); + node.put("time",cursor.getString(cursor.getColumnIndex("createTime"))); + map.put("DealNode",node); map.put("GetWarResult",getWarResult(m,n,a)); + node.put("type",cursor.getString(cursor.getColumnIndex("nodeType"))); JSONObject data=new JSONObject(); data.put("id",cursor.getInt(cursor.getColumnIndex("_id"))); data.put("nameId",cursor.getInt(cursor.getColumnIndex("nameId"))); @@ -282,6 +325,7 @@ public class JianRDataDataBase extends SQLiteOpenHelper { JSONObject json=null; try{ Cursor cursor=readDatabase.query(TAB_DATA_GAME,new String[]{"*"},"mapId=? and m=? and a=?",new String[]{n,m,a},null,null,null); + cursor.moveToNext(); if(cursor.moveToNext()){ json=new JSONObject(cursor.getString(cursor.getColumnIndex("src"))); } diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Databases/ModDatabase.java b/app/src/main/java/com/yutou/jianr_mg/Databases/ModDatabase.java similarity index 97% rename from app/src/main/java/com/yutou/jianrmg_v2/Databases/ModDatabase.java rename to app/src/main/java/com/yutou/jianr_mg/Databases/ModDatabase.java index cca8449..293499f 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Databases/ModDatabase.java +++ b/app/src/main/java/com/yutou/jianr_mg/Databases/ModDatabase.java @@ -1,13 +1,13 @@ -package com.yutou.jianrmg_v2.Databases; +package com.yutou.jianr_mg.Databases; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; -import com.yutou.jianrmg_v2.Application; -import com.yutou.jianrmg_v2.Data.MGamePackname; -import com.yutou.jianrmg_v2.Data.TMod; +import com.yutou.jianr_mg.Application; +import com.yutou.jianr_mg.Data.MGamePackname; +import com.yutou.jianr_mg.Data.TMod; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Databases/PlugDatabase.java b/app/src/main/java/com/yutou/jianr_mg/Databases/PlugDatabase.java similarity index 93% rename from app/src/main/java/com/yutou/jianrmg_v2/Databases/PlugDatabase.java rename to app/src/main/java/com/yutou/jianr_mg/Databases/PlugDatabase.java index 2aab0b6..e17c912 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Databases/PlugDatabase.java +++ b/app/src/main/java/com/yutou/jianr_mg/Databases/PlugDatabase.java @@ -1,10 +1,10 @@ -package com.yutou.jianrmg_v2.Databases; +package com.yutou.jianr_mg.Databases; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; -import com.yutou.jianrmg_v2.Application; +import com.yutou.jianr_mg.Application; public class PlugDatabase extends SQLiteOpenHelper { private static PlugDatabase database; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Databases/UserDatabase.java b/app/src/main/java/com/yutou/jianr_mg/Databases/UserDatabase.java similarity index 95% rename from app/src/main/java/com/yutou/jianrmg_v2/Databases/UserDatabase.java rename to app/src/main/java/com/yutou/jianr_mg/Databases/UserDatabase.java index b4635e4..cd47707 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Databases/UserDatabase.java +++ b/app/src/main/java/com/yutou/jianr_mg/Databases/UserDatabase.java @@ -1,12 +1,12 @@ -package com.yutou.jianrmg_v2.Databases; +package com.yutou.jianr_mg.Databases; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; -import com.yutou.jianrmg_v2.Application; -import com.yutou.jianrmg_v2.Data.User; +import com.yutou.jianr_mg.Application; +import com.yutou.jianr_mg.Data.User; public class UserDatabase extends SQLiteOpenHelper { private static UserDatabase database; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/GameData.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameData.java similarity index 90% rename from app/src/main/java/com/yutou/jianrmg_v2/Fragments/GameData.java rename to app/src/main/java/com/yutou/jianr_mg/Fragments/GameData.java index d36454a..f8fdf0a 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/GameData.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameData.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Fragments; +package com.yutou.jianr_mg.Fragments; import android.content.Context; import android.os.Bundle; @@ -15,10 +15,10 @@ import com.github.mikephil.charting.charts.PieChart; import com.github.mikephil.charting.data.PieData; import com.github.mikephil.charting.data.PieDataSet; import com.github.mikephil.charting.data.PieEntry; -import com.yutou.jianrmg_v2.Adapters.ViewPagerAdapter; -import com.yutou.jianrmg_v2.Fragments.GameDataFragments.DropFragment; -import com.yutou.jianrmg_v2.Fragments.GameDataFragments.WarFragment; -import com.yutou.jianrmg_v2.R; +import com.yutou.jianr_mg.Adapters.ViewPagerAdapter; +import com.yutou.jianr_mg.Fragments.GameDataFragments.DropFragment; +import com.yutou.jianr_mg.Fragments.GameDataFragments.WarFragment; +import com.yutou.jianr_mg.R; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/GameDataFragments/DropFragment.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/DropFragment.java similarity index 76% rename from app/src/main/java/com/yutou/jianrmg_v2/Fragments/GameDataFragments/DropFragment.java rename to app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/DropFragment.java index 9a04bed..03079d8 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/GameDataFragments/DropFragment.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/DropFragment.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Fragments.GameDataFragments; +package com.yutou.jianr_mg.Fragments.GameDataFragments; import android.os.Bundle; import android.os.Handler; @@ -13,19 +13,21 @@ import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; -import com.yutou.jianrmg_v2.Adapters.GameDataAdapters.DropAdapter; -import com.yutou.jianrmg_v2.Databases.JianRDataDataBase; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.JianRUtils; +import com.yutou.jianr_mg.Adapters.GameDataAdapters.DropAdapter; +import com.yutou.jianr_mg.Databases.JianRDataDataBase; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.JianRUtils; import org.angmarch.views.NiceSpinner; import org.json.JSONObject; +import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Timer; @@ -88,19 +90,28 @@ public class DropFragment extends Fragment { } private List srcTypes; + private ArrayAdapter srcAdapter,typeAdapter; private void initData() { try { srcTypes = database.getTypes(); if(srcTypes.size()==0){ srcTypes.add("无参数"); - } - src.setAdapter(new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, srcTypes)); + if(srcAdapter==null){ + srcAdapter=new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, srcTypes); + } + if(typeAdapter==null){ + typeAdapter=new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, database.getNames(srcTypes.get(0))); + } + src.setAdapter(srcAdapter); src.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView adapterView, View view, int i, long l) { - type.setAdapter(new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, database.getNames(srcTypes.get(i)))); + + typeAdapter.clear(); + typeAdapter.addAll(database.getNames(srcTypes.get(i))); + typeAdapter.notifyDataSetChanged(); getData(type.getSelectedIndex()); } @@ -114,7 +125,9 @@ public class DropFragment extends Fragment { if(types.size()==0){ types.add("无参数"); } - type.setAdapter(new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item,types)); + typeAdapter.clear(); + typeAdapter.addAll(types); + type.setAdapter(typeAdapter); type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView adapterView, View view, int i, long l) { @@ -126,6 +139,8 @@ public class DropFragment extends Fragment { } }); + type.setSelectedIndex(0); + typeAdapter.notifyDataSetChanged(); getData(0); } catch (Exception e) { @@ -135,6 +150,9 @@ public class DropFragment extends Fragment { private void getData(int i) { try { + if(srcTypes.size()==0){ + return; + } String name = database.getNames(srcTypes.get(src.getSelectedIndex())).get(i); List list = database.getDrops(name); List> ldata = new ArrayList<>(); @@ -144,9 +162,11 @@ public class DropFragment extends Fragment { String title = json.getString("title"); map.put("icon", "http://jianr.jianrmod.cn/jianr/ship/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"))))); + /* map.put("time", new SimpleDateFormat("yyyy年MM月dd HH:mm:ss") + .format(new Date(Long.valueOf(json.getJSONObject("data").getString("createTime")))));*/ + map.put("time",SimpleDateFormat.getDateTimeInstance(DateFormat.YEAR_FIELD,DateFormat.SHORT).format(new Date(Long.valueOf(json.getJSONObject("data").getString("createTime"))))); ldata.add(map); + } Collections.reverse(ldata); adapter.clear(); diff --git a/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/WarFragment.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/WarFragment.java new file mode 100644 index 0000000..c090739 --- /dev/null +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/GameDataFragments/WarFragment.java @@ -0,0 +1,208 @@ +package com.yutou.jianr_mg.Fragments.GameDataFragments; + +import android.os.Bundle; +import android.os.Handler; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.support.v7.widget.LinearLayoutManager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; + +import com.yutou.jianr_mg.Adapters.GameDataAdapters.DropAdapter; +import com.yutou.jianr_mg.Adapters.GameDataAdapters.WarAdapter; +import com.yutou.jianr_mg.Databases.JianRDataDataBase; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Utils; + +import org.angmarch.views.NiceSpinner; +import org.json.JSONObject; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import cn.lemon.view.RefreshRecyclerView; + +public class WarFragment extends Fragment { + private static WarFragment fragment; + private View view; + private NiceSpinner src, type; + private JianRDataDataBase database; + private RefreshRecyclerView recyclerView; + private WarAdapter adapter; + private List> srcList; + private List>> data; + private Map> map; + + public static WarFragment init() { + if (fragment == null) { + fragment = new WarFragment(); + fragment.map = new HashMap<>(); + fragment.srcList = new ArrayList<>(); + fragment.database = JianRDataDataBase.init(); + } + return fragment; + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + if (view != null) { + return view; + } + view = inflater.inflate(R.layout.fragment_drop, null); + data = new ArrayList<>(); + + System.out.println("当前模式下的战斗数据:" + srcList.size()); + initView(); + return view; + } + + public void initView() { + src = view.findViewById(R.id.src); + type = view.findViewById(R.id.type); + recyclerView = view.findViewById(R.id.recyclerView); + recyclerView.setSwipeRefreshColors(0xFF437845, 0xFFE44F98, 0xFF2FAC21); + recyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); + adapter = new WarAdapter(getContext()); + recyclerView.setAdapter(adapter); + recyclerView.dismissSwipeRefresh(); + recyclerView.addRefreshAction(() -> { + try { + src.setSelectedIndex(0); + type.setSelectedIndex(0); + initData(); + } catch (Exception e) { + e.printStackTrace(); + } + }); + initSpinner(); + + } + private List srcTypes; + private ArrayAdapter srcAdapter,typeAdapter; + private void initSpinner() { + try { + srcTypes = database.getTypes(); + if(srcTypes.size()==0){ + srcTypes.add("无参数"); + } + if(srcAdapter==null){ + srcAdapter=new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, srcTypes); + } + if(typeAdapter==null){ + typeAdapter=new ArrayAdapter(getContext(), android.R.layout.simple_spinner_item, database.getNames(srcTypes.get(0))); + } + src.setAdapter(srcAdapter); + src.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView adapterView, View view, int i, long l) { + typeAdapter.clear(); + typeAdapter.addAll(database.getNames(srcTypes.get(i))); + typeAdapter.notifyDataSetChanged(); + initData(); + } + + @Override + public void onNothingSelected(AdapterView adapterView) { + + } + }); + src.setSelectedIndex(0); + + List types=database.getNames(srcTypes.get(0)); + if(types.size()==0){ + types.add("无参数"); + } + typeAdapter.clear(); + typeAdapter.addAll(types); + type.setAdapter(typeAdapter); + type.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView adapterView, View view, int i, long l) { + initData(); + } + + @Override + public void onNothingSelected(AdapterView adapterView) { + + } + }); + typeAdapter.notifyDataSetChanged(); + type.setSelectedIndex(0); + + srcList = new ArrayList<>(); + initData(); + } catch (Exception e) { + e.printStackTrace(); + } + } + private void initData() { + try { + data.clear(); + srcList = database.getDataList(database.getTNameId((String) typeAdapter.getItem(type.getSelectedIndex()))); + for (int i = 0; i < srcList.size(); i++) { + Map maps = srcList.get(i); + JSONObject item = maps.get("data"); + if(maps.get("DealNode").getString("time").contains("2430")){ + System.out.println("此时正是430"); + } + if (item == null) { + return; + } + if(item.getInt("mapId")==999202){ + System.out.println("找到活动地图"); + } + if(Objects.requireNonNull(maps.get("DealNode")).getString("type").equals("DealNode")) { + if (item.getInt("mapId") % 10 == 2) { + getItem(i, srcList); + } + } + } + adapter.clear(); + adapter.addAll(data); + adapter.notifyDataSetChanged(); + recyclerView.dismissSwipeRefresh(); + recyclerView.showNoMore(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void getItem(int index, List> srcList) { + List> list = new ArrayList<>(); + try { + for (int i = index; i < srcList.size(); i++) { + Map maps = srcList.get(i); + JSONObject item = maps.get("data"); + if (item == null) { + return; + } + if (Objects.requireNonNull(maps.get("DealNode")).getString("type").equals("DealNode")) { + + if (item.getInt("mapId") % 10 == 2&&i>index) { + saveData(list); + return; + }else{ + list.add(srcList.get(i)); + } + } + + } + saveData(list); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void saveData(List> list) { + if (list.size() > 0) + data.add(list); + } +} diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/Home.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/Home.java similarity index 90% rename from app/src/main/java/com/yutou/jianrmg_v2/Fragments/Home.java rename to app/src/main/java/com/yutou/jianr_mg/Fragments/Home.java index d2bb305..e94462b 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/Home.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/Home.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Fragments; +package com.yutou.jianr_mg.Fragments; import android.os.Bundle; import android.os.Handler; @@ -14,15 +14,15 @@ import android.widget.TextView; import com.alibaba.fastjson.JSON; import com.nostra13.universalimageloader.core.ImageLoader; -import com.yutou.jianrmg_v2.Adapters.HomeRecyclerAdapter; -import com.yutou.jianrmg_v2.Interfaces.HttpInterface; -import com.yutou.jianrmg_v2.Model.HomeCard; -import com.yutou.jianrmg_v2.Network.HttpApi; -import com.yutou.jianrmg_v2.Network.HttpUtils; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Log; -import com.yutou.jianrmg_v2.Tools.Utils; -import com.yutou.jianrmg_v2.views.HomeHeader; +import com.yutou.jianr_mg.Adapters.HomeRecyclerAdapter; +import com.yutou.jianr_mg.Interfaces.HttpInterface; +import com.yutou.jianr_mg.Model.HomeCard; +import com.yutou.jianr_mg.Network.HttpApi; +import com.yutou.jianr_mg.Network.HttpUtils; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Log; +import com.yutou.jianr_mg.Tools.Utils; +import com.yutou.jianr_mg.views.HomeHeader; import org.json.JSONObject; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/MGList.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/MGList.java similarity index 90% rename from app/src/main/java/com/yutou/jianrmg_v2/Fragments/MGList.java rename to app/src/main/java/com/yutou/jianr_mg/Fragments/MGList.java index 56c4b66..fe27b80 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/MGList.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/MGList.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Fragments; +package com.yutou.jianr_mg.Fragments; import android.os.Bundle; import android.os.Handler; @@ -13,14 +13,14 @@ import android.view.ViewGroup; import android.widget.TextView; import com.alibaba.fastjson.JSON; -import com.yutou.jianrmg_v2.Adapters.ModListRecyclerAdapter; -import com.yutou.jianrmg_v2.Data.MAppMg; -import com.yutou.jianrmg_v2.Interfaces.HttpInterface; -import com.yutou.jianrmg_v2.Network.HttpApi; -import com.yutou.jianrmg_v2.Network.HttpUtils; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Log; -import com.yutou.jianrmg_v2.Tools.Utils; +import com.yutou.jianr_mg.Adapters.ModListRecyclerAdapter; +import com.yutou.jianr_mg.Data.MAppMg; +import com.yutou.jianr_mg.Interfaces.HttpInterface; +import com.yutou.jianr_mg.Network.HttpApi; +import com.yutou.jianr_mg.Network.HttpUtils; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Log; +import com.yutou.jianr_mg.Tools.Utils; import org.json.JSONObject; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragmentData.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragmentData.java similarity index 92% rename from app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragmentData.java rename to app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragmentData.java index d9122a7..1cf8d12 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragmentData.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragmentData.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Fragments; +package com.yutou.jianr_mg.Fragments; import android.app.Activity; import android.content.Context; @@ -12,15 +12,15 @@ import android.view.ViewGroup; import android.widget.TextView; import com.alibaba.fastjson.JSON; -import com.yutou.jianrmg_v2.Adapters.ModRecyclerAdapter; -import com.yutou.jianrmg_v2.Data.MAppMg; -import com.yutou.jianrmg_v2.Data.TMod; -import com.yutou.jianrmg_v2.Interfaces.HttpInterface; -import com.yutou.jianrmg_v2.Network.HttpApi; -import com.yutou.jianrmg_v2.Network.HttpUtils; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Log; -import com.yutou.jianrmg_v2.Tools.Utils; +import com.yutou.jianr_mg.Adapters.ModRecyclerAdapter; +import com.yutou.jianr_mg.Data.MAppMg; +import com.yutou.jianr_mg.Data.TMod; +import com.yutou.jianr_mg.Interfaces.HttpInterface; +import com.yutou.jianr_mg.Network.HttpApi; +import com.yutou.jianr_mg.Network.HttpUtils; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Log; +import com.yutou.jianr_mg.Tools.Utils; import org.json.JSONObject; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragment_0.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragment_0.java similarity index 90% rename from app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragment_0.java rename to app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragment_0.java index ccf6c40..4bd4a23 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragment_0.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragment_0.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Fragments; +package com.yutou.jianr_mg.Fragments; import android.os.Bundle; import android.support.annotation.Nullable; @@ -7,8 +7,8 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import com.yutou.jianrmg_v2.Data.MAppMg; -import com.yutou.jianrmg_v2.Tools.Log; +import com.yutou.jianr_mg.Data.MAppMg; +import com.yutou.jianr_mg.Tools.Log; /** * Created by 58381 on 2018/1/25. diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragment_1.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragment_1.java similarity index 90% rename from app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragment_1.java rename to app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragment_1.java index 0e6a8b8..bd878b6 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragment_1.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragment_1.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Fragments; +package com.yutou.jianr_mg.Fragments; import android.os.Bundle; import android.support.annotation.Nullable; @@ -7,8 +7,8 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import com.yutou.jianrmg_v2.Data.MAppMg; -import com.yutou.jianrmg_v2.Tools.Log; +import com.yutou.jianr_mg.Data.MAppMg; +import com.yutou.jianr_mg.Tools.Log; /** * Created by 58381 on 2018/1/25. diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragment_2.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragment_2.java similarity index 90% rename from app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragment_2.java rename to app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragment_2.java index f38b455..13b02e0 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/ModListFragment_2.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/ModListFragment_2.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Fragments; +package com.yutou.jianr_mg.Fragments; import android.os.Bundle; import android.support.annotation.Nullable; @@ -7,8 +7,8 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import com.yutou.jianrmg_v2.Data.MAppMg; -import com.yutou.jianrmg_v2.Tools.Log; +import com.yutou.jianr_mg.Data.MAppMg; +import com.yutou.jianr_mg.Tools.Log; /** * Created by 58381 on 2018/1/25. diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/My.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/My.java similarity index 91% rename from app/src/main/java/com/yutou/jianrmg_v2/Fragments/My.java rename to app/src/main/java/com/yutou/jianr_mg/Fragments/My.java index bbc4a57..eb78078 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/My.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/My.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Fragments; +package com.yutou.jianr_mg.Fragments; import android.app.Activity; import android.content.Context; @@ -17,14 +17,14 @@ import android.widget.Toast; import com.bumptech.glide.Glide; import com.nostra13.universalimageloader.core.ImageLoader; -import com.yutou.jianrmg_v2.Adapters.MyItemGridViewAdapter; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Data.UUserdata; -import com.yutou.jianrmg_v2.Data.User; -import com.yutou.jianrmg_v2.Network.HttpApi; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Log; -import com.yutou.jianrmg_v2.Tools.Utils; +import com.yutou.jianr_mg.Adapters.MyItemGridViewAdapter; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Data.UUserdata; +import com.yutou.jianr_mg.Data.User; +import com.yutou.jianr_mg.Network.HttpApi; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Log; +import com.yutou.jianr_mg.Tools.Utils; import java.util.ArrayList; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/Test.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/Test.java similarity index 92% rename from app/src/main/java/com/yutou/jianrmg_v2/Fragments/Test.java rename to app/src/main/java/com/yutou/jianr_mg/Fragments/Test.java index a0ff604..55e558d 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/Test.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/Test.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Fragments; +package com.yutou.jianr_mg.Fragments; import android.app.Activity; import android.content.ComponentName; @@ -17,8 +17,8 @@ import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.services.DownloadService; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.services.DownloadService; /** * Created by 58381 on 2018/1/21. diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/UtilsFragments.java b/app/src/main/java/com/yutou/jianr_mg/Fragments/UtilsFragments.java similarity index 92% rename from app/src/main/java/com/yutou/jianrmg_v2/Fragments/UtilsFragments.java rename to app/src/main/java/com/yutou/jianr_mg/Fragments/UtilsFragments.java index ea0a12a..a8a813c 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/UtilsFragments.java +++ b/app/src/main/java/com/yutou/jianr_mg/Fragments/UtilsFragments.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Fragments; +package com.yutou.jianr_mg.Fragments; import android.os.Bundle; @@ -12,13 +12,13 @@ import android.view.View; import android.view.ViewGroup; import com.alibaba.fastjson.JSON; -import com.yutou.jianrmg_v2.Adapters.MainUtilsAdapter; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Data.MAppTools; -import com.yutou.jianrmg_v2.Interfaces.HttpInterface; -import com.yutou.jianrmg_v2.Network.HttpApi; -import com.yutou.jianrmg_v2.Network.HttpUtils; -import com.yutou.jianrmg_v2.R; +import com.yutou.jianr_mg.Adapters.MainUtilsAdapter; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Data.MAppTools; +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 org.json.JSONObject; @@ -113,7 +113,7 @@ public class UtilsFragments extends Fragment { while (iterator.hasNext()){ String key= (String) iterator.next(); if(map.containsKey(key)){ - Class plugins=map.get(key).loadClass("com.yutou.jianrmg_v2.plugins.Data"); + Class plugins=map.get(key).loadClass("com.yutou.jianr_mg.plugins.Data"); MAppTools tools=new MAppTools(); tools.setName((String) plugins.getField("title").get(null)); tools.setPluginName((String) plugins.getField("name").get(null)); diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Interfaces/DownloadFileInerface.java b/app/src/main/java/com/yutou/jianr_mg/Interfaces/DownloadFileInerface.java similarity index 81% rename from app/src/main/java/com/yutou/jianrmg_v2/Interfaces/DownloadFileInerface.java rename to app/src/main/java/com/yutou/jianr_mg/Interfaces/DownloadFileInerface.java index 25e45fb..f08c1ea 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Interfaces/DownloadFileInerface.java +++ b/app/src/main/java/com/yutou/jianr_mg/Interfaces/DownloadFileInerface.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Interfaces; +package com.yutou.jianr_mg.Interfaces; /** * Created by 58381 on 2018/2/5. diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Interfaces/DownloadInterface.java b/app/src/main/java/com/yutou/jianr_mg/Interfaces/DownloadInterface.java similarity index 76% rename from app/src/main/java/com/yutou/jianrmg_v2/Interfaces/DownloadInterface.java rename to app/src/main/java/com/yutou/jianr_mg/Interfaces/DownloadInterface.java index c221a59..79cba96 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Interfaces/DownloadInterface.java +++ b/app/src/main/java/com/yutou/jianr_mg/Interfaces/DownloadInterface.java @@ -1,7 +1,7 @@ -package com.yutou.jianrmg_v2.Interfaces; +package com.yutou.jianr_mg.Interfaces; -import com.yutou.jianrmg_v2.Data.TModfile; +import com.yutou.jianr_mg.Data.TModfile; /** * Created by 58381 on 2018/2/2. diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Interfaces/HttpInterface.java b/app/src/main/java/com/yutou/jianr_mg/Interfaces/HttpInterface.java similarity index 79% rename from app/src/main/java/com/yutou/jianrmg_v2/Interfaces/HttpInterface.java rename to app/src/main/java/com/yutou/jianr_mg/Interfaces/HttpInterface.java index d6afa42..8587414 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Interfaces/HttpInterface.java +++ b/app/src/main/java/com/yutou/jianr_mg/Interfaces/HttpInterface.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Interfaces; +package com.yutou.jianr_mg.Interfaces; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Interfaces/ModInterface.java b/app/src/main/java/com/yutou/jianr_mg/Interfaces/ModInterface.java similarity index 65% rename from app/src/main/java/com/yutou/jianrmg_v2/Interfaces/ModInterface.java rename to app/src/main/java/com/yutou/jianr_mg/Interfaces/ModInterface.java index 51307c7..ceb10a3 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Interfaces/ModInterface.java +++ b/app/src/main/java/com/yutou/jianr_mg/Interfaces/ModInterface.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Interfaces; +package com.yutou.jianr_mg.Interfaces; public interface ModInterface { void onAction(boolean flag,int type); diff --git a/app/src/main/java/com/yutou/jianrmg_v2/LoadingActivity.java b/app/src/main/java/com/yutou/jianr_mg/LoadingActivity.java similarity index 91% rename from app/src/main/java/com/yutou/jianrmg_v2/LoadingActivity.java rename to app/src/main/java/com/yutou/jianr_mg/LoadingActivity.java index 458de26..5127f3d 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/LoadingActivity.java +++ b/app/src/main/java/com/yutou/jianr_mg/LoadingActivity.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2; +package com.yutou.jianr_mg; import android.content.Intent; @@ -29,22 +29,23 @@ import com.qq.e.ads.splash.SplashAD; import com.qq.e.ads.splash.SplashADListener; import com.qq.e.comm.util.AdError; import com.umeng.analytics.MobclickAgent; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Data.MGamePackname; -import com.yutou.jianrmg_v2.Data.SConfig; -import com.yutou.jianrmg_v2.Data.UUserdata; -import com.yutou.jianrmg_v2.Data.User; -import com.yutou.jianrmg_v2.Databases.UserDatabase; -import com.yutou.jianrmg_v2.Interfaces.HttpInterface; -import com.yutou.jianrmg_v2.Network.HttpApi; -import com.yutou.jianrmg_v2.Network.HttpUtils; -import com.yutou.jianrmg_v2.Tools.ActivitysManager; -import com.yutou.jianrmg_v2.Tools.AppPermissions; -import com.yutou.jianrmg_v2.Tools.ConfigUtils; -import com.yutou.jianrmg_v2.Tools.Log; -import com.yutou.jianrmg_v2.Tools.Utils; -import com.yutou.jianrmg_v2.views.RegisterActivity; -import com.yutou.jianrmg_v2.views.WebActivity; +import com.umeng.message.UmengMessageHandler; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Data.MGamePackname; +import com.yutou.jianr_mg.Data.SConfig; +import com.yutou.jianr_mg.Data.UUserdata; +import com.yutou.jianr_mg.Data.User; +import com.yutou.jianr_mg.Databases.UserDatabase; +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.AppPermissions; +import com.yutou.jianr_mg.Tools.ConfigUtils; +import com.yutou.jianr_mg.Tools.Log; +import com.yutou.jianr_mg.Tools.Utils; +import com.yutou.jianr_mg.views.RegisterActivity; +import com.yutou.jianr_mg.views.WebActivity; import org.json.JSONObject; @@ -58,8 +59,9 @@ import me.drakeet.materialdialog.MaterialDialog; */ public class LoadingActivity extends AppCompatActivity { - private static final String APPID = "1105364182"; - private static final String POSID = "4070960054673794"; + private static final String APPID = "1105310947"; + private static final String POSID = "7090537892072921"; + public static String url=null; private LinearLayout loginLayout,adLayout; private Button login, reg; @@ -67,6 +69,7 @@ public class LoadingActivity extends AppCompatActivity { private ImageView icon; private Handler handler; private boolean isLogin=false; + private Class clazz; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { @@ -75,10 +78,16 @@ public class LoadingActivity extends AppCompatActivity { WindowManager.LayoutParams. FLAG_FULLSCREEN); setContentView(R.layout.activity_loading); Utils.setImmersion(this); + if(url==null){ + clazz=MainActivity.class; + }else{ + clazz=WebActivity.class; + } handler = new Handler(); initViews(); initData(); startOpenAd(); + } private void login(String name, String pass) { @@ -212,6 +221,7 @@ public class LoadingActivity extends AppCompatActivity { public void httpGetData(String string, int code) { try { JSONObject json = new JSONObject(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); @@ -304,8 +314,12 @@ public class LoadingActivity extends AppCompatActivity { dialog.setNegativeButton("放弃",v -> { dialog.dismiss(); if(isLogin) { - Intent intent = new Intent(LoadingActivity.this, MainActivity.class); + Intent intent = new Intent(LoadingActivity.this, clazz); + if(url!=null){ + intent.putExtra("url",url); + } startActivity(intent); + finish(); }else{ Utils.toast(this,"未登录/登录信息失效"); showLogin(); @@ -323,8 +337,12 @@ public class LoadingActivity extends AppCompatActivity { }else{ if(isLogin) { - Intent intent = new Intent(LoadingActivity.this, MainActivity.class); + Intent intent = new Intent(LoadingActivity.this, clazz); + if(url!=null){ + intent.putExtra("url",url); + } startActivity(intent); + finish(); }else{ Utils.toast(this,"未登录/登录信息失效"); showLogin(); @@ -370,11 +388,7 @@ public class LoadingActivity extends AppCompatActivity { Log.i(readys + ""); if (readys == 4) { handler.postDelayed(() -> { - /*if (Utils.testStringIsNull(AppData.Token)) { - showLogin(); - } else { - start(); - }*/ + }, 0); } @@ -419,7 +433,7 @@ public class LoadingActivity extends AppCompatActivity { @Override public void onNoAD(AdError adError) { - start(); + handler.postDelayed(()->start(),3000); } @Override diff --git a/app/src/main/java/com/yutou/jianrmg_v2/MainActivity.java b/app/src/main/java/com/yutou/jianr_mg/MainActivity.java similarity index 88% rename from app/src/main/java/com/yutou/jianrmg_v2/MainActivity.java rename to app/src/main/java/com/yutou/jianr_mg/MainActivity.java index 098a21e..aafddf8 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/MainActivity.java +++ b/app/src/main/java/com/yutou/jianr_mg/MainActivity.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2; +package com.yutou.jianr_mg; import android.os.Bundle; import android.os.Handler; @@ -9,14 +9,14 @@ import android.view.KeyEvent; import android.widget.Toast; import com.umeng.analytics.MobclickAgent; -import com.yutou.jianrmg_v2.Adapters.ViewPagerAdapter; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Fragments.GameData; -import com.yutou.jianrmg_v2.Fragments.Home; -import com.yutou.jianrmg_v2.Fragments.MGList; -import com.yutou.jianrmg_v2.Fragments.My; -import com.yutou.jianrmg_v2.Fragments.UtilsFragments; -import com.yutou.jianrmg_v2.Tools.ActivitysManager; +import com.yutou.jianr_mg.Adapters.ViewPagerAdapter; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Fragments.GameData; +import com.yutou.jianr_mg.Fragments.Home; +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 java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Model/HomeCard.java b/app/src/main/java/com/yutou/jianr_mg/Model/HomeCard.java similarity index 98% rename from app/src/main/java/com/yutou/jianrmg_v2/Model/HomeCard.java rename to app/src/main/java/com/yutou/jianr_mg/Model/HomeCard.java index ddfae44..f797bc0 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Model/HomeCard.java +++ b/app/src/main/java/com/yutou/jianr_mg/Model/HomeCard.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Model; +package com.yutou.jianr_mg.Model; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Network/HttpApi.java b/app/src/main/java/com/yutou/jianr_mg/Network/HttpApi.java similarity index 95% rename from app/src/main/java/com/yutou/jianrmg_v2/Network/HttpApi.java rename to app/src/main/java/com/yutou/jianr_mg/Network/HttpApi.java index 620c2b5..a1ea002 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Network/HttpApi.java +++ b/app/src/main/java/com/yutou/jianr_mg/Network/HttpApi.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Network; +package com.yutou.jianr_mg.Network; /** * Created by 58381 on 2018/1/20. @@ -8,6 +8,7 @@ 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.137.1:8088/"; //笔记本本身WIFI + // 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"; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Network/HttpUtils.java b/app/src/main/java/com/yutou/jianr_mg/Network/HttpUtils.java similarity index 96% rename from app/src/main/java/com/yutou/jianrmg_v2/Network/HttpUtils.java rename to app/src/main/java/com/yutou/jianr_mg/Network/HttpUtils.java index a386e27..e41efcc 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Network/HttpUtils.java +++ b/app/src/main/java/com/yutou/jianr_mg/Network/HttpUtils.java @@ -1,11 +1,11 @@ -package com.yutou.jianrmg_v2.Network; +package com.yutou.jianr_mg.Network; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Interfaces.DownloadFileInerface; -import com.yutou.jianrmg_v2.Interfaces.HttpInterface; -import com.yutou.jianrmg_v2.Tools.Log; +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 org.json.JSONException; import org.json.JSONObject; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Tools/ActivitysManager.java b/app/src/main/java/com/yutou/jianr_mg/Tools/ActivitysManager.java similarity index 98% rename from app/src/main/java/com/yutou/jianrmg_v2/Tools/ActivitysManager.java rename to app/src/main/java/com/yutou/jianr_mg/Tools/ActivitysManager.java index 1480d64..f254036 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Tools/ActivitysManager.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/ActivitysManager.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Tools; +package com.yutou.jianr_mg.Tools; import android.app.Activity; import android.app.ActivityManager; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Tools/AppPermissions.java b/app/src/main/java/com/yutou/jianr_mg/Tools/AppPermissions.java similarity index 88% rename from app/src/main/java/com/yutou/jianrmg_v2/Tools/AppPermissions.java rename to app/src/main/java/com/yutou/jianr_mg/Tools/AppPermissions.java index 43913d6..0aaf256 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Tools/AppPermissions.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/AppPermissions.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Tools; +package com.yutou.jianr_mg.Tools; import android.Manifest; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Tools/ConfigUtils.java b/app/src/main/java/com/yutou/jianr_mg/Tools/ConfigUtils.java similarity index 97% rename from app/src/main/java/com/yutou/jianrmg_v2/Tools/ConfigUtils.java rename to app/src/main/java/com/yutou/jianr_mg/Tools/ConfigUtils.java index e4f6b6d..90dfaa1 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Tools/ConfigUtils.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/ConfigUtils.java @@ -1,6 +1,6 @@ -package com.yutou.jianrmg_v2.Tools; +package com.yutou.jianr_mg.Tools; -import com.yutou.jianrmg_v2.Application; +import com.yutou.jianr_mg.Application; import org.json.JSONException; import org.json.JSONObject; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Tools/ExcelUtils.java b/app/src/main/java/com/yutou/jianr_mg/Tools/ExcelUtils.java similarity index 96% rename from app/src/main/java/com/yutou/jianrmg_v2/Tools/ExcelUtils.java rename to app/src/main/java/com/yutou/jianr_mg/Tools/ExcelUtils.java index 917698f..77965d4 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Tools/ExcelUtils.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/ExcelUtils.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Tools; +package com.yutou.jianr_mg.Tools; import android.content.Context; import android.os.Bundle; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Tools/JianRUtils.java b/app/src/main/java/com/yutou/jianr_mg/Tools/JianRUtils.java similarity index 96% rename from app/src/main/java/com/yutou/jianrmg_v2/Tools/JianRUtils.java rename to app/src/main/java/com/yutou/jianr_mg/Tools/JianRUtils.java index fef9347..c6f7e9c 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Tools/JianRUtils.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/JianRUtils.java @@ -1,6 +1,6 @@ -package com.yutou.jianrmg_v2.Tools; +package com.yutou.jianr_mg.Tools; -import com.yutou.jianrmg_v2.Application; +import com.yutou.jianr_mg.Application; import org.json.JSONArray; import org.json.JSONObject; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Tools/Log.java b/app/src/main/java/com/yutou/jianr_mg/Tools/Log.java similarity index 97% rename from app/src/main/java/com/yutou/jianrmg_v2/Tools/Log.java rename to app/src/main/java/com/yutou/jianr_mg/Tools/Log.java index 6cffab2..d59a74e 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Tools/Log.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/Log.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Tools; +package com.yutou.jianr_mg.Tools; import java.io.PrintWriter; import java.io.StringWriter; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Tools/ModUtils.java b/app/src/main/java/com/yutou/jianr_mg/Tools/ModUtils.java similarity index 96% rename from app/src/main/java/com/yutou/jianrmg_v2/Tools/ModUtils.java rename to app/src/main/java/com/yutou/jianr_mg/Tools/ModUtils.java index d662c8b..5db5925 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Tools/ModUtils.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/ModUtils.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Tools; +package com.yutou.jianr_mg.Tools; import android.content.ComponentName; import android.content.Context; @@ -12,18 +12,18 @@ import android.widget.Toast; import com.alibaba.fastjson.JSON; import com.kaopiz.kprogresshud.KProgressHUD; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Data.MGamePackname; -import com.yutou.jianrmg_v2.Data.TMod; -import com.yutou.jianrmg_v2.Data.TModfile; -import com.yutou.jianrmg_v2.Databases.ModDatabase; -import com.yutou.jianrmg_v2.Interfaces.DownloadInterface; -import com.yutou.jianrmg_v2.Interfaces.HttpInterface; -import com.yutou.jianrmg_v2.Interfaces.ModInterface; -import com.yutou.jianrmg_v2.Network.HttpApi; -import com.yutou.jianrmg_v2.Network.HttpUtils; -import com.yutou.jianrmg_v2.services.DownloadService; -import com.yutou.jianrmg_v2.services.MagicBoxService; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Data.MGamePackname; +import com.yutou.jianr_mg.Data.TMod; +import com.yutou.jianr_mg.Data.TModfile; +import com.yutou.jianr_mg.Databases.ModDatabase; +import com.yutou.jianr_mg.Interfaces.DownloadInterface; +import com.yutou.jianr_mg.Interfaces.HttpInterface; +import com.yutou.jianr_mg.Interfaces.ModInterface; +import com.yutou.jianr_mg.Network.HttpApi; +import com.yutou.jianr_mg.Network.HttpUtils; +import com.yutou.jianr_mg.services.DownloadService; +import com.yutou.jianr_mg.services.MagicBoxService; import org.json.JSONArray; import org.json.JSONObject; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Tools/MyFileProvider.java b/app/src/main/java/com/yutou/jianr_mg/Tools/MyFileProvider.java similarity index 74% rename from app/src/main/java/com/yutou/jianrmg_v2/Tools/MyFileProvider.java rename to app/src/main/java/com/yutou/jianr_mg/Tools/MyFileProvider.java index 61f84ff..d0f33b9 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Tools/MyFileProvider.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/MyFileProvider.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Tools; +package com.yutou.jianr_mg.Tools; import android.support.v4.content.FileProvider; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Tools/RootUtils.java b/app/src/main/java/com/yutou/jianr_mg/Tools/RootUtils.java similarity index 97% rename from app/src/main/java/com/yutou/jianrmg_v2/Tools/RootUtils.java rename to app/src/main/java/com/yutou/jianr_mg/Tools/RootUtils.java index a058b06..472dab3 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Tools/RootUtils.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/RootUtils.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Tools; +package com.yutou.jianr_mg.Tools; import android.content.Context; import android.content.SharedPreferences; @@ -6,8 +6,8 @@ import android.view.View; import android.widget.RadioButton; import android.widget.RadioGroup; -import com.yutou.jianrmg_v2.Application; -import com.yutou.jianrmg_v2.Data.AppData; +import com.yutou.jianr_mg.Application; +import com.yutou.jianr_mg.Data.AppData; import java.io.BufferedReader; import java.io.DataOutputStream; @@ -36,7 +36,7 @@ public class RootUtils { if (rootUtils == null) { rootUtils = new RootUtils(context); rootUtils.init(); - rootUtils.println("chmod 7777 /data/data/com.yutou.jianrmg_v2/files/busybox"); + rootUtils.println("chmod 7777 /data/data/com.yutou.jianr_mg/files/busybox"); } return rootUtils; } diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Tools/Utils.java b/app/src/main/java/com/yutou/jianr_mg/Tools/Utils.java similarity index 96% rename from app/src/main/java/com/yutou/jianrmg_v2/Tools/Utils.java rename to app/src/main/java/com/yutou/jianr_mg/Tools/Utils.java index 8834655..8c79ded 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/Tools/Utils.java +++ b/app/src/main/java/com/yutou/jianr_mg/Tools/Utils.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.Tools; +package com.yutou.jianr_mg.Tools; import android.app.Activity; import android.content.Context; @@ -17,15 +17,15 @@ import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import com.nostra13.universalimageloader.core.assist.QueueProcessingType; -import com.yutou.jianrmg_v2.Application; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Data.MGamePackname; -import com.yutou.jianrmg_v2.Data.TModfilePath; -import com.yutou.jianrmg_v2.Interfaces.HttpInterface; -import com.yutou.jianrmg_v2.Network.HttpApi; -import com.yutou.jianrmg_v2.Network.HttpUtils; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.views.WebActivity; +import com.yutou.jianr_mg.Application; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Data.MGamePackname; +import com.yutou.jianr_mg.Data.TModfilePath; +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.views.WebActivity; import org.json.JSONObject; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/services/DownloadService.java b/app/src/main/java/com/yutou/jianr_mg/services/DownloadService.java similarity index 94% rename from app/src/main/java/com/yutou/jianrmg_v2/services/DownloadService.java rename to app/src/main/java/com/yutou/jianr_mg/services/DownloadService.java index f4ea7ae..e892f5d 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/services/DownloadService.java +++ b/app/src/main/java/com/yutou/jianr_mg/services/DownloadService.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.services; +package com.yutou.jianr_mg.services; import android.app.Notification; import android.app.NotificationChannel; @@ -14,14 +14,14 @@ import android.os.Build; import android.os.IBinder; import android.widget.RemoteViews; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Data.TModfile; -import com.yutou.jianrmg_v2.Interfaces.DownloadFileInerface; -import com.yutou.jianrmg_v2.Interfaces.DownloadInterface; -import com.yutou.jianrmg_v2.Network.HttpUtils; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.Log; -import com.yutou.jianrmg_v2.Tools.Utils; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Data.TModfile; +import com.yutou.jianr_mg.Interfaces.DownloadFileInerface; +import com.yutou.jianr_mg.Interfaces.DownloadInterface; +import com.yutou.jianr_mg.Network.HttpUtils; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.Log; +import com.yutou.jianr_mg.Tools.Utils; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/services/MagicBoxService.java b/app/src/main/java/com/yutou/jianr_mg/services/MagicBoxService.java similarity index 83% rename from app/src/main/java/com/yutou/jianrmg_v2/services/MagicBoxService.java rename to app/src/main/java/com/yutou/jianr_mg/services/MagicBoxService.java index 8c55110..8a49664 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/services/MagicBoxService.java +++ b/app/src/main/java/com/yutou/jianr_mg/services/MagicBoxService.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.services; +package com.yutou.jianr_mg.services; import android.content.ComponentName; import android.content.Intent; @@ -7,16 +7,18 @@ import android.os.IBinder; import com.alibaba.fastjson.JSON; import com.bigzhao.jianrmagicbox.aidl.IMagicBoxBinder; -import com.yutou.jianrmg_v2.Application; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.Databases.JianRDataDataBase; -import com.yutou.jianrmg_v2.Tools.Utils; -import com.yutou.jianrmg_v2.views.WarView; +import com.yutou.jianr_mg.Application; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.Databases.JianRDataDataBase; +import com.yutou.jianr_mg.Tools.Utils; +import com.yutou.jianr_mg.views.WarView; import org.json.JSONObject; import java.io.File; import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; import java.util.Timer; import java.util.TimerTask; @@ -121,17 +123,24 @@ public class MagicBoxService { e.printStackTrace(); } } + JSONObject json=new JSONObject(),json2=new JSONObject(); + if(str!=null){ + json=new JSONObject(str); + json.put("type","DealNode"); + + } + if(str2!=null){ + json2=new JSONObject(str2); + json2.put("type","GetWarResult"); + } if(listener!=null){ - JSONObject json; - if(str!=null){ - json=new JSONObject(str); - json.put("type","DealNode"); - listener.getData(json.toString()); - } - if(str2!=null){ - json=new JSONObject(str2); - json.put("type","GetWarResult"); - listener.getData(json.toString()); + listener.getData(json.toString()); + listener.getData(json2.toString()); + } + if(interfaces!=null){ + for (MagicBoxInterface boxInterface : interfaces) { + boxInterface.getData(json.toString()); + boxInterface.getData(json2.toString()); } } // System.out.println("str = "+str); @@ -177,6 +186,14 @@ public class MagicBoxService { this.order = order; this.magicBoxInterface = boxInterface; } + private List interfaces; + public void addInterface(MagicBoxInterface magicBoxInterface){ + if(interfaces==null){ + interfaces=new ArrayList<>(); + } + interfaces.add(magicBoxInterface); + + } public void clearOrder() { order = null; diff --git a/app/src/main/java/com/yutou/jianrmg_v2/services/WindowsService.java b/app/src/main/java/com/yutou/jianr_mg/services/WindowsService.java similarity index 90% rename from app/src/main/java/com/yutou/jianrmg_v2/services/WindowsService.java rename to app/src/main/java/com/yutou/jianr_mg/services/WindowsService.java index 5aaaeed..c81ca52 100644 --- a/app/src/main/java/com/yutou/jianrmg_v2/services/WindowsService.java +++ b/app/src/main/java/com/yutou/jianr_mg/services/WindowsService.java @@ -1,4 +1,4 @@ -package com.yutou.jianrmg_v2.services; +package com.yutou.jianr_mg.services; import android.annotation.SuppressLint; import android.app.AlertDialog; @@ -32,16 +32,17 @@ import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.SeekBar; +import android.widget.Toast; import com.tencent.smtt.sdk.TbsReaderView; -import com.yutou.jianrmg_v2.Data.AppData; -import com.yutou.jianrmg_v2.R; -import com.yutou.jianrmg_v2.Tools.ExcelUtils; -import com.yutou.jianrmg_v2.Tools.Log; -import com.yutou.jianrmg_v2.Tools.RootUtils; -import com.yutou.jianrmg_v2.Tools.Utils; -import com.yutou.jianrmg_v2.views.ExcelActivity; -import com.yutou.jianrmg_v2.views.WarView; +import com.yutou.jianr_mg.Data.AppData; +import com.yutou.jianr_mg.R; +import com.yutou.jianr_mg.Tools.ExcelUtils; +import com.yutou.jianr_mg.Tools.Log; +import com.yutou.jianr_mg.Tools.RootUtils; +import com.yutou.jianr_mg.Tools.Utils; +import com.yutou.jianr_mg.views.ExcelActivity; +import com.yutou.jianr_mg.views.WarView; import org.json.JSONObject; @@ -363,7 +364,7 @@ public class WindowsService extends Service { private List