diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..39233c6 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,72 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 26 + defaultConfig { + applicationId "com.yutou.jianrmg_v2" + minSdkVersion 21 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(include: ['*.jar'], dir: 'libs') + //noinspection GradleCompatible + implementation 'com.android.support:appcompat-v7:26.1.0' + implementation 'com.android.support.constraint:constraint-layout:1.0.2' + implementation 'com.android.support:design:26.1.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.1' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + //okhttp + implementation 'com.squareup.okhttp3:okhttp:3.9.1' + //FastJson + implementation 'com.alibaba:fastjson:1.2.41' + //轮播图 + implementation 'com.bigkoo:convenientbanner:2.0.5' + //图片流缓存 + implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' + //圆形图片 + implementation 'com.github.siyamed:android-shape-imageview:0.9.+@aar' + //滑动Tabs + implementation 'com.ogaclejapan.smarttablayout:library:1.6.1@aar' + implementation 'com.ogaclejapan.smarttablayout:utils-v13:1.6.1@aar' + //MD 对话框 + implementation 'me.drakeet.materialdialog:library:1.3.1' + //载入界面 + implementation 'com.kaopiz:kprogresshud:1.1.0' + //富文本编辑器 + implementation 'com.github.louisgeek:LouisMultiLineEditText:v1.0.0' + //文件选择器 + implementation 'com.leon:lfilepickerlibrary:1.4.0' + //富文本 + implementation 'com.github.limedroid:XRichText:v1.0.0' + //底端对话框 + implementation 'com.orhanobut:dialogplus:1.11@aar' + //二维码扫描 + implementation 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.3' + //底端菜单 + implementation 'me.majiajie:pager-bottom-tab-strip:2.2.5' + //刷新载入 + implementation project(path: ':RefreshRecyclerView') + //图片形状 + implementation 'com.github.siyamed:android-shape-imageview:0.9.+@aar' + //毛玻璃 + implementation 'jp.wasabeef:glide-transformations:3.0.0' + // + compile project(path: ':BaseModel') + implementation project(path: ':GameDataModel') + implementation project(path: ':AppHome') + implementation project(path: ':MgListModel') + implementation project(path: ':ResModl') + +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..594e9ea --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/aidl/com/bigzhao/jianrmagicbox/aidl/IMagicBoxBinder.aidl b/app/src/main/aidl/com/bigzhao/jianrmagicbox/aidl/IMagicBoxBinder.aidl new file mode 100644 index 0000000..dccdc22 --- /dev/null +++ b/app/src/main/aidl/com/bigzhao/jianrmagicbox/aidl/IMagicBoxBinder.aidl @@ -0,0 +1,14 @@ +// IMagicBoxBinder.aidl +package com.bigzhao.jianrmagicbox.aidl; + +// Declare any non-default types here with import statements + +interface IMagicBoxBinder { + /** + * Demonstrates some basic types that you can use as parameters + * and return values in AIDL. + */ + + int getVersion(); + String action_remote(in String action,in String[] args); +} diff --git a/app/src/main/java/Interfaces/BaseActivityInterface.java b/app/src/main/java/Interfaces/BaseActivityInterface.java new file mode 100644 index 0000000..bbfc063 --- /dev/null +++ b/app/src/main/java/Interfaces/BaseActivityInterface.java @@ -0,0 +1,31 @@ +package Interfaces; + +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.widget.LinearLayout; + + +/** + * Created by 58381 on 2018/2/27. + */ + +public interface BaseActivityInterface { + void onCreate(Bundle savedInstanceState, LinearLayout layout, Context context, Intent intent); + void onRestart(); + void onResume(); + void onPause(); + void onDestroy(); + void getIntent(Intent intent); + boolean onKeyDown(int keyCode, KeyEvent event); + boolean onKeyUp(int keyCode, KeyEvent event); + boolean onTouchEvent(MotionEvent event); + Data getData(); + class Data{ + private String type; + private String url; + + } +} diff --git a/app/src/main/java/Interfaces/BaseFragmeneInerface.java b/app/src/main/java/Interfaces/BaseFragmeneInerface.java new file mode 100644 index 0000000..65e2eee --- /dev/null +++ b/app/src/main/java/Interfaces/BaseFragmeneInerface.java @@ -0,0 +1,15 @@ +package Interfaces; + +import android.content.Context; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +public interface BaseFragmeneInerface { + void init(Context context); + View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState); + void setIntent(); + +} diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Adapters/HomeRecyclerAdapter.java b/app/src/main/java/com/yutou/jianrmg_v2/Adapters/HomeRecyclerAdapter.java new file mode 100644 index 0000000..f41df33 --- /dev/null +++ b/app/src/main/java/com/yutou/jianrmg_v2/Adapters/HomeRecyclerAdapter.java @@ -0,0 +1,77 @@ +package com.yutou.jianrmg_v2.Adapters; + +import android.content.Context; +import android.content.Intent; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import com.alibaba.fastjson.JSON; +import com.nostra13.universalimageloader.core.ImageLoader; +import com.yutou.jianrmg_v2.R; +import com.yutou.jianrmg_v2.basemodel.Data.MAppHome; +import com.yutou.jianrmg_v2.basemodel.Tools.Log; +import com.yutou.jianrmg_v2.basemodel.Tools.Utils; +import com.yutou.jianrmg_v2.basemodel.views.WebActivity; + + +import cn.lemon.view.adapter.BaseViewHolder; +import cn.lemon.view.adapter.RecyclerAdapter; + +; + +/** + * Created by 58381 on 2018/1/23. + */ + +public class HomeRecyclerAdapter extends RecyclerAdapter { + private ImageLoader imageLoader; + + public HomeRecyclerAdapter(Context context) { + super(context); + imageLoader = Utils.initImageLoader(context); + } + + @Override + public BaseViewHolder onCreateBaseViewHolder(ViewGroup parent, int viewType) { + View view=new View(getContext()); + Log.i("首页数据",getData().size()+""); + return new CardRecordHolder(parent, R.layout.item_home); + } + + private class CardRecordHolder extends BaseViewHolder { + private ImageView icon; + private TextView name; + + + public CardRecordHolder(ViewGroup view,int layoutId) { + super(view,layoutId); + icon = findViewById(R.id.image); + name = findViewById(R.id.title); + + + } + + @Override + public void setData(MAppHome data) { + super.setData(data); + Log.i("首页收据", JSON.toJSONString(data)); + if (data.getIcon() != null && "null".equals(data.getIcon())) + imageLoader.displayImage(data.getIcon(), icon); + name.setText(data.getName() + ""); + } + + @Override + public void onItemViewClick(MAppHome data) { + super.onItemViewClick(data); + if (data.getUrl() != null && data.getUrl().contains("webhttp")) { + Intent intent = new Intent(getContext(),WebActivity.class); + // intent.setAction(Intent.ACTION_VIEW); + // intent.setData(Uri.parse(data.getUrl())); + intent.putExtra("url", data.getUrl().replace("webhttp", "http")); + getContext().startActivity(intent); + } + } + } +} diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/GameData.java b/app/src/main/java/com/yutou/jianrmg_v2/Fragments/GameData.java new file mode 100644 index 0000000..9519693 --- /dev/null +++ b/app/src/main/java/com/yutou/jianrmg_v2/Fragments/GameData.java @@ -0,0 +1,65 @@ +package com.yutou.jianrmg_v2.Fragments; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TextView; + +import com.yutou.jianrmg_v2.basemodel.Data.AppData; +import com.yutou.jianrmg_v2.basemodel.Tools.Log; +import com.yutou.jianrmg_v2.basemodel.services.DownloadService; +import com.yutou.jianrmg_v2.gamedatamodel.MainFragmene; + +import Interfaces.BaseFragmeneInerface; + + +/** + * Created by 58381 on 2018/1/21. + */ + +public class GameData extends Fragment { + private static GameData gameData; + private DownloadService service; + private Activity activity; + private BaseFragmeneInerface baseFragmene; + + public static GameData init(Activity activity){ + if(gameData==null){ + gameData=new GameData(); + gameData.baseFragmene.init(activity); + } + return gameData; + } + public GameData(){ + try { + baseFragmene= (BaseFragmeneInerface) AppData.plugsin.get("rx.jar").loadClass("com.yutou.jianrmg_v2.gamedatamodel.MainFragmene").newInstance(); + } catch (Exception e) { + //e.printStackTrace(); + Log.i("加载数据模块失败"); + baseFragmene=new MainFragmene(); + } + } + + private void setActivity(Activity activity) { + this.activity = activity; + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + /*ViewGroup.LayoutParams params=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + TextView textView=new TextView(getContext()); + textView.setLayoutParams(params); + textView.setGravity(Gravity.CENTER); + textView.setText("Hello World"); + return textView;*/ + return baseFragmene.onCreateView(inflater, container, savedInstanceState); + } +} diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/Home.java b/app/src/main/java/com/yutou/jianrmg_v2/Fragments/Home.java new file mode 100644 index 0000000..ba400de --- /dev/null +++ b/app/src/main/java/com/yutou/jianrmg_v2/Fragments/Home.java @@ -0,0 +1,61 @@ +package com.yutou.jianrmg_v2.Fragments; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TextView; +import android.widget.Toast; + + +import com.yutou.jianrmg_v2.basemodel.Data.AppData; +import com.yutou.jianrmg_v2.basemodel.Tools.Log; +import com.yutou.jianrmg_v2.apphome.MainFragmene; + +import Interfaces.BaseFragmeneInerface; + +/** + * Created by 58381 on 2018/1/20. + */ + +public class Home extends Fragment { + private static Home home; + + + private BaseFragmeneInerface baseFragmene; + + public static Home init(Activity activity){ + Toast.makeText(activity,"默认主页",Toast.LENGTH_LONG).show(); + if(home==null){ + home=new Home(); + home.baseFragmene.init(activity); + } + return home; + } + + + + public Home(){ + try { + baseFragmene= (BaseFragmeneInerface) AppData.plugsin.get("home.jar").loadClass("com.yutou.jianrmg_v2.apphome.MainFragmene").newInstance(); + } catch (Exception e) { + e.printStackTrace(); + Log.i("热插件加载失败,启用默认"); + baseFragmene=new MainFragmene(); + } + baseFragmene.init(getContext()); + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return baseFragmene.onCreateView(inflater, container, savedInstanceState); + } + +} diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/MGList.java b/app/src/main/java/com/yutou/jianrmg_v2/Fragments/MGList.java new file mode 100644 index 0000000..c441afd --- /dev/null +++ b/app/src/main/java/com/yutou/jianrmg_v2/Fragments/MGList.java @@ -0,0 +1,53 @@ +package com.yutou.jianrmg_v2.Fragments; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TextView; + +import com.yutou.jianrmg_v2.basemodel.Data.AppData; +import com.yutou.jianrmg_v2.basemodel.Tools.Log; +import com.yutou.jianrmg_v2.mglistmodel.MainFragments; + +import Interfaces.BaseFragmeneInerface; + + +/** + * Created by 58381 on 2018/1/23. + */ + +public class MGList extends Fragment { + private static MGList modView; + private BaseFragmeneInerface baseFragmeneInerface; + + public static MGList init(Activity activity) { + if (modView == null) { + modView = new MGList(); + modView.baseFragmeneInerface.init(activity); + } + return modView; + } + + public MGList() { + try { + this.baseFragmeneInerface = (BaseFragmeneInerface) AppData.plugsin.get("mglist.jar").loadClass("com.yutou.jianrmg_v2.mglistmodel.MainFragments").newInstance(); + } catch (Exception e) { + // e.printStackTrace(); + Log.i("魔改列表插件加载失败"); + baseFragmeneInerface = new MainFragments(); + } + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return baseFragmeneInerface.onCreateView(inflater, container, savedInstanceState); + } +} diff --git a/app/src/main/java/com/yutou/jianrmg_v2/Fragments/My.java b/app/src/main/java/com/yutou/jianrmg_v2/Fragments/My.java new file mode 100644 index 0000000..3750164 --- /dev/null +++ b/app/src/main/java/com/yutou/jianrmg_v2/Fragments/My.java @@ -0,0 +1,101 @@ +package com.yutou.jianrmg_v2.Fragments; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; + +import com.bumptech.glide.Glide; +import com.nostra13.universalimageloader.core.ImageLoader; +import com.yutou.jianrmg_v2.basemodel.Adapters.MyItemGridViewAdapter; +import com.yutou.jianrmg_v2.basemodel.Data.AppData; +import com.yutou.jianrmg_v2.basemodel.Data.UUserdata; +import com.yutou.jianrmg_v2.basemodel.Data.User; +import com.yutou.jianrmg_v2.basemodel.R; +import com.yutou.jianrmg_v2.basemodel.Tools.Utils; + +import java.util.ArrayList; +import java.util.List; + +import jp.wasabeef.glide.transformations.BlurTransformation; + +import static com.bumptech.glide.request.RequestOptions.bitmapTransform; + + +/** + * Created by 58381 on 2018/2/22. + */ + +public class My extends Fragment { + public static My my; + public static My init(){ + if(my==null){ + my=new My(); + } + return my; + } + private View view; + private User user; + private UUserdata udata; + private ImageLoader imageLoader; + + private TextView uname,item_title; + private ImageView icon,item_icon,image_top; + // private LinearLayout items; + private ListView myItems; + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + if(view==null){ + view=LayoutInflater.from(getContext()).inflate(R.layout.fragment_my,null); + uname=view.findViewById(R.id.uname); + icon=view.findViewById(R.id.icon); + item_title=view.findViewById(R.id.item_title); + item_icon=view.findViewById(R.id.item_icon); + image_top=view.findViewById(R.id.image_top); + // items=view.findViewById(R.id.items); + myItems=view.findViewById(R.id._my_items); + } + imageLoader= Utils.initImageLoader(getContext()); + initData(); + return view; + } + private void initData(){ + user= AppData.user; + udata=AppData.userdata; + if(udata==null) + udata=new UUserdata(); + udata.setImage("https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=1209476926,1108056910&fm=58"); + if(user==null||user.getId()<1){ + uname.setText("未登录"); + icon.setImageResource(R.mipmap.ic_launcher); + return; + } + try { + uname.setText(user.getName()); + imageLoader.displayImage(udata.getImage(),icon); + Glide.with(this).load(udata.getImage()).apply(bitmapTransform(new BlurTransformation(25))).into(image_top); + }catch (Exception e){ + e.printStackTrace(); + } + myItems.setAdapter(new MyItemGridViewAdapter(getItemData(),getContext())); + } + private List getItemData(){ + List list=new ArrayList<>(); + list.add(new MyItemGridViewAdapter.ItemData(-1,"下载中心")); + list.add(new MyItemGridViewAdapter.ItemData(-1,"收藏夹")); + list.add(new MyItemGridViewAdapter.ItemData(-1,"问题/建议")); + list.add(new MyItemGridViewAdapter.ItemData(-1,"设置")); + /* list.add(new MyItemGridViewAdapter.ItemData(-1,"")); + list.add(new MyItemGridViewAdapter.ItemData(-1,"")); + list.add(new MyItemGridViewAdapter.ItemData(-1,"")); + list.add(new MyItemGridViewAdapter.ItemData(-1,""));*/ + return list; + } +} diff --git a/app/src/main/java/com/yutou/jianrmg_v2/LoadingActivity.java b/app/src/main/java/com/yutou/jianrmg_v2/LoadingActivity.java new file mode 100644 index 0000000..fe77294 --- /dev/null +++ b/app/src/main/java/com/yutou/jianrmg_v2/LoadingActivity.java @@ -0,0 +1,261 @@ +package com.yutou.jianrmg_v2; + + +import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.support.annotation.Nullable; +import android.support.v7.app.AppCompatActivity; +import android.view.View; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RemoteViews; +import android.widget.TextView; + +import com.alibaba.fastjson.JSON; +import com.yutou.jianrmg_v2.basemodel.Data.AppData; +import com.yutou.jianrmg_v2.basemodel.Data.MGamePackname; +import com.yutou.jianrmg_v2.basemodel.Data.SConfig; +import com.yutou.jianrmg_v2.basemodel.Data.User; +import com.yutou.jianrmg_v2.basemodel.Interfaces.HttpInterface; +import com.yutou.jianrmg_v2.basemodel.Network.HttpApi; +import com.yutou.jianrmg_v2.basemodel.Network.HttpUtils; +import com.yutou.jianrmg_v2.basemodel.R; +import com.yutou.jianrmg_v2.basemodel.Tools.ConfigUtils; +import com.yutou.jianrmg_v2.basemodel.Tools.Log; +import com.yutou.jianrmg_v2.basemodel.Tools.Utils; + + +import org.json.JSONObject; + +/** + * Created by 58381 on 2018/1/18. + */ + +public class LoadingActivity extends AppCompatActivity { + private LinearLayout loginLayout; + private Button login,reg; + private TextView notlogin,uname,password; + private ImageView icon; + private Handler handler; + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_loading); + Utils.setImmersion(this); + handler=new Handler(); + initViews(); + initData(); + } + private void login(String name, String pass){ + try{ + JSONObject json=new JSONObject(); + json.put("uname",name); + json.put("pass",pass); + HttpUtils.post(HttpApi.HOME_URL + HttpApi.USER_LOGIN, json, new HttpInterface() { + @Override + public void httpGetData(String string, int code) { + try{ + JSONObject json=new JSONObject(string); + if(json.getInt("code")==100){ + AppData.user=JSON.parseObject(json.getJSONObject("data").toString(),User.class); + AppData.Token=json.getString("token"); + ConfigUtils.init().save(ConfigUtils.token,AppData.Token); + ConfigUtils.init().save(ConfigUtils.uid,AppData.user.getId()); + start(); + } + }catch (Exception e){ + + } + + } + + @Override + public void httpError(Exception e) { + + } + }); + }catch (Exception e){ + + } + } + private void initData(){ + /* if(RootUtils.su()) { + RootUtils root = RootUtils.init(this); + root.exec("cp /sdcard/jianRMG/1/aaa.txt /data/data/com.huanmeng.zhanjian2/"); + root.exec("cp /sdcard/jianRMG/1/aaa.txt /data/data/com.huanmeng.zhanjian2/files/"); + root.exec("mkdir /data/data/com.huanmeng.zhanjian2/files/bbb/"); + }else{ + Log.i("获取ROOT失败"); + }*/ + + initGamePackName(); + initConfig(); + initUser(); + + } + private void initConfig(){ + try{ + HttpUtils.get(HttpApi.HOME_URL + HttpApi.MG_CONFIG, new HttpInterface() { + @Override + public void httpGetData(String string, int code) { + try { + JSONObject json=new JSONObject(string); + if(json!=null&&json.getInt("code")==100){ + AppData.appConfig=JSON.parseObject(json.getJSONObject("data").toString(), SConfig.class); + } + ready(1); + }catch (Exception e){ + + } + } + + @Override + public void httpError(Exception e) { + + } + }); + }catch (Exception e){ + + } + } + private void initGamePackName(){ + try{ + HttpUtils.get(HttpApi.HOME_URL + HttpApi.MOD_GAME_PACKNAME, new HttpInterface() { + @Override + public void httpGetData(String string, int code) { + try { + Log.i(HttpApi.MOD_GAME_PACKNAME,string); + JSONObject json=new JSONObject(string); + AppData.packnames= JSON.parseArray(json.getJSONArray("data").toString(), MGamePackname.class); + ready(1); + }catch (Exception e){ + e.printStackTrace(); + } + } + + @Override + public void httpError(Exception e) { + + } + }); + }catch (Exception e){ + + } + } + private void initUser(){ + try { + JSONObject json=new JSONObject(); + json.put("token",AppData.Token); + json.put("uid",AppData.user.getId()); + HttpUtils.post(HttpApi.HOME_URL + HttpApi.USER_TEST, json, new HttpInterface() { + @Override + public void httpGetData(String string, int code) { + try{ + JSONObject json=new JSONObject(string); + if(json.getInt("code")==100){ + JSONObject data=json.getJSONObject("data").getJSONObject("data"); + AppData.user=JSON.parseObject(data.getJSONObject("user").toString(),User.class); + ConfigUtils.init().save(ConfigUtils.collection,data.getJSONArray("collection")); + } + }catch (Exception e){ + + } + ready(1); + } + + @Override + public void httpError(Exception e) { + ready(1); + } + }); + }catch (Exception e){ + + } + + } + private void initViews(){ + loginLayout=findViewById(R.id.loginLayout); + login=findViewById(R.id.login); + notlogin=findViewById(R.id.notlogin); + icon=findViewById(R.id.icon); + uname=findViewById(R.id.uname); + password=findViewById(R.id.password); + + notlogin.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + start(); + } + }); + login.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + String name=uname.getText().toString(); + String pass=password.getText().toString(); + if(Utils.testStringIsNull(name,pass)){ + Utils.toast(LoadingActivity.this,"账号/密码 不能为空"); + return; + } + login(name,pass); + } + }); + } + public void start(){ + Intent intent=new Intent(LoadingActivity.this,MainActivity.class); + startActivity(intent); + } + private void showLogin(){ + Animation iconAnim= AnimationUtils.loadAnimation(this,R.anim.loading_icon); + Animation loginAnim=AnimationUtils.loadAnimation(this,R.anim.loading_login); + iconAnim.setAnimationListener(new MyAnimListener()); + loginAnim.setAnimationListener(new MyAnimListener()); + icon.startAnimation(iconAnim); + loginLayout.setAlpha(0f); + loginLayout.setVisibility(View.VISIBLE); + loginLayout.startAnimation(loginAnim); + + } + private class MyAnimListener implements Animation.AnimationListener{ + + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + loginLayout.setAlpha(1f); + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + } + private int readys=0; + private void ready(int i){ + readys+=i; + if(readys==3){ + handler.postDelayed(new Runnable() { + @Override + public void run() { + if(Utils.testStringIsNull(AppData.Token)){ + showLogin(); + }else{ + start(); + } + + } + },0); + } + } +} diff --git a/app/src/main/java/com/yutou/jianrmg_v2/MainActivity.java b/app/src/main/java/com/yutou/jianrmg_v2/MainActivity.java new file mode 100644 index 0000000..72458a6 --- /dev/null +++ b/app/src/main/java/com/yutou/jianrmg_v2/MainActivity.java @@ -0,0 +1,73 @@ +package com.yutou.jianrmg_v2; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; + +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.basemodel.Adapters.ViewPagerAdapter; +import com.yutou.jianrmg_v2.resmodl.R; +import com.yutou.jianrmg_v2.basemodel.Tools.ActivitysManager; +import com.yutou.jianrmg_v2.basemodel.views.LoadingActivity; + +import java.util.ArrayList; +import java.util.List; + +import me.majiajie.pagerbottomtabstrip.NavigationController; +import me.majiajie.pagerbottomtabstrip.PageNavigationView; +import me.majiajie.pagerbottomtabstrip.listener.OnTabItemSelectedListener; + +public class MainActivity extends AppCompatActivity { + + private PageNavigationView tab; + private ViewPager viewPager; + private NavigationController navigationController; + private List list; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + ActivitysManager.finishActivity(LoadingActivity.class); + initViews(); + } + + private void initViews() { + tab = findViewById(R.id.tab); + viewPager = findViewById(R.id.pager); + list=new ArrayList<>(); + list.add(Home.init(this)); + list.add(GameData.init(this)); + list.add(MGList.init(this)); + list.add(My.init()); + + ViewPagerAdapter adapter=new ViewPagerAdapter(getSupportFragmentManager(),list); + viewPager.setAdapter(adapter); + viewPager.setCurrentItem(0); + navigationController = tab.material() + .addItem(R.drawable.icon_home, R.drawable.icon_home_select, "主页") + .addItem(R.drawable.icon_data, R.drawable.icon_data_select, "数据") + .addItem(R.drawable.icon_mg, R.drawable.icon_mg_select, "魔改") + .addItem(R.drawable.icon_my, R.drawable.icon_my_select, "个人中心") + .build(); + navigationController.addTabItemSelectedListener(new OnTabItemSelectedListener() { + @Override + public void onSelected(int index, int old) { + switch (index) { + } + viewPager.setCurrentItem(index); + } + + @Override + public void onRepeat(int index) { + + } + }); + navigationController.setupWithViewPager(viewPager); + navigationController.setSelect(0); + + } +} diff --git a/app/src/main/res/menu/mod_menu.xml b/app/src/main/res/menu/mod_menu.xml new file mode 100644 index 0000000..143b354 --- /dev/null +++ b/app/src/main/res/menu/mod_menu.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..eca70cf --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a2f5908 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..1b52399 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..ff10afd Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..115a4c7 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..dcd3cd8 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..459ca60 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..8ca12fe Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..8e19b41 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..b824ebd Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..4c19a13 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values-za-rCN/strings.xml b/app/src/main/res/values-za-rCN/strings.xml new file mode 100644 index 0000000..f631277 --- /dev/null +++ b/app/src/main/res/values-za-rCN/strings.xml @@ -0,0 +1,4 @@ + + + 魔改宝盒 + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..607204a --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,8 @@ + + + #3F51B5 + #303F9F + #FF4081 + #f0f0f0 + #FFFFFF + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..59a0b0c --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,3 @@ + + 16dp + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..517620a --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + 魔改宝盒 + BaseActivity + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..2b3d463 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,21 @@ + + + + + + + +