init
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
72
app/build.gradle
Normal file
@ -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')
|
||||
|
||||
}
|
21
app/proguard-rules.pro
vendored
Normal file
@ -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
|
55
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.yutou.jianrmg_v2">
|
||||
|
||||
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
|
||||
|
||||
<application
|
||||
android:name=".basemodel.Application"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<!--<activity
|
||||
android:name=".basemodel.views.LoadingActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>-->
|
||||
<activity
|
||||
android:name=".LoadingActivity"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".basemodel.views.MainActivity" />
|
||||
<activity android:name=".MainActivity" />
|
||||
<activity android:name="views.Test"/>
|
||||
|
||||
<service
|
||||
android:name=".basemodel.services.DownloadService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
|
||||
<activity
|
||||
android:name=".basemodel.views.BaseActivity"></activity>
|
||||
<activity
|
||||
android:name=".basemodel.views.WebActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -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);
|
||||
}
|
31
app/src/main/java/Interfaces/BaseActivityInterface.java
Normal file
@ -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;
|
||||
|
||||
}
|
||||
}
|
15
app/src/main/java/Interfaces/BaseFragmeneInerface.java
Normal file
@ -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();
|
||||
|
||||
}
|
@ -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<MAppHome> {
|
||||
private ImageLoader imageLoader;
|
||||
|
||||
public HomeRecyclerAdapter(Context context) {
|
||||
super(context);
|
||||
imageLoader = Utils.initImageLoader(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseViewHolder<MAppHome> 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<MAppHome> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
61
app/src/main/java/com/yutou/jianrmg_v2/Fragments/Home.java
Normal file
@ -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);
|
||||
}
|
||||
|
||||
}
|
53
app/src/main/java/com/yutou/jianrmg_v2/Fragments/MGList.java
Normal file
@ -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);
|
||||
}
|
||||
}
|
101
app/src/main/java/com/yutou/jianrmg_v2/Fragments/My.java
Normal file
@ -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<MyItemGridViewAdapter.ItemData> getItemData(){
|
||||
List<MyItemGridViewAdapter.ItemData> 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;
|
||||
}
|
||||
}
|
261
app/src/main/java/com/yutou/jianrmg_v2/LoadingActivity.java
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
73
app/src/main/java/com/yutou/jianrmg_v2/MainActivity.java
Normal file
@ -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<Fragment> 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);
|
||||
|
||||
}
|
||||
}
|
34
app/src/main/res/menu/mod_menu.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/admin"
|
||||
android:title="管理员">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/audit"
|
||||
android:title="审核">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/audit_ok"
|
||||
android:title="通过" />
|
||||
<item
|
||||
android:id="@+id/audit_no"
|
||||
android:title="不通过" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/move"
|
||||
android:title="移动到.." />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/collection"
|
||||
android:title="收藏" />
|
||||
<item
|
||||
android:id="@+id/download"
|
||||
android:title="下载" />
|
||||
</menu>
|
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 15 KiB |
4
app/src/main/res/values-za-rCN/strings.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">魔改宝盒</string>
|
||||
</resources>
|
8
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="colorAictvictBack">#f0f0f0</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
</resources>
|
3
app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
</resources>
|
4
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">魔改宝盒</string>
|
||||
<string name="title_activity_base">BaseActivity</string>
|
||||
</resources>
|
21
app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="android:windowBackground">@color/colorAictvictBack</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
</resources>
|