回归为完整APP,ROOT安装和免ROOT安装没问题

This commit is contained in:
2018-05-08 16:55:17 +08:00
parent 6194d1c46f
commit 98d876bfe7
203 changed files with 1401 additions and 3318 deletions

View File

@@ -0,0 +1,56 @@
package com.yutou.jianrmg_v2.Adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.yutou.jianrmg_v2.R;
import java.util.List;
public class DownloadItemAdapter extends BaseAdapter {
private Context context;
private List<?> list;
public DownloadItemAdapter(Context context, List<?> list) {
this.context = context;
this.list = list;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int i) {
return list.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
Items items;
if(view==null){
view= LayoutInflater.from(context).inflate(R.layout.item_download,null);
items=new Items();
view.setTag(items);
}else{
items= (Items) view.getTag();
}
return view;
}
private class Items{
ImageView icon;
TextView title;
}
}

View File

@@ -1,19 +1,19 @@
package com.yutou.jianrmg_v2.Adapters;
import android.app.Activity;
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.Data.MAppHome;
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 com.yutou.jianrmg_v2.Tools.Log;
import com.yutou.jianrmg_v2.Tools.Utils;
import com.yutou.jianrmg_v2.views.WebActivity;
import cn.lemon.view.adapter.BaseViewHolder;
@@ -27,16 +27,16 @@ import cn.lemon.view.adapter.RecyclerAdapter;
public class HomeRecyclerAdapter extends RecyclerAdapter<MAppHome> {
private ImageLoader imageLoader;
private Activity activity;
public HomeRecyclerAdapter(Context context) {
super(context);
this.activity= (Activity) 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);
}
@@ -45,8 +45,8 @@ public class HomeRecyclerAdapter extends RecyclerAdapter<MAppHome> {
private TextView name;
public CardRecordHolder(ViewGroup view,int layoutId) {
super(view,layoutId);
public CardRecordHolder(ViewGroup parent, int layoutId) {
super(parent, layoutId);
icon = findViewById(R.id.image);
name = findViewById(R.id.title);
@@ -66,7 +66,7 @@ public class HomeRecyclerAdapter extends RecyclerAdapter<MAppHome> {
public void onItemViewClick(MAppHome data) {
super.onItemViewClick(data);
if (data.getUrl() != null && data.getUrl().contains("webhttp")) {
Intent intent = new Intent(getContext(),WebActivity.class);
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"));

View File

@@ -0,0 +1,74 @@
package com.yutou.jianrmg_v2.Adapters;
import android.content.Context;
import android.content.Intent;
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.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 cn.lemon.view.adapter.BaseViewHolder;
import cn.lemon.view.adapter.RecyclerAdapter;
/**
* Created by 58381 on 2018/1/20.
*/
public class ModListRecyclerAdapter extends RecyclerAdapter<MAppMg> {
private ImageLoader imageLoader;
public ModListRecyclerAdapter(Context context) {
super(context);
imageLoader = Utils.initImageLoader(getContext());
}
@Override
public BaseViewHolder onCreateBaseViewHolder(ViewGroup parent, int viewType) {
return new CardRecordHolder(parent, R.layout.item_home);
}
private class CardRecordHolder extends BaseViewHolder<MAppMg> {
private ImageView icon;
private TextView name;
public CardRecordHolder(ViewGroup parent, int layoutId) {
super(parent, layoutId);
icon = findViewById(R.id.image);
name = findViewById(R.id.title);
}
@Override
public void setData(MAppMg data) {
super.setData(data);
if (data.getIcon() != null && "null".equals(data.getIcon()))
imageLoader.displayImage(AppData.appConfig.getDownloadhome() + data.getIcon(), icon);
name.setText(data.getName());
}
@Override
public void onItemViewClick(MAppMg data) {
super.onItemViewClick(data);
if (data.getUrl() != null) {
Intent intent = new Intent(getContext(), BaseActivity.class);
intent.putExtra("jar", data.getUrl().split("/")[data.getUrl().split("/").length - 1]);
intent.putExtra("activityName", data.getMainFunction());
getContext().startActivity(intent);
return;
}
Intent intent = new Intent(getContext(), ModListActivity.class);
intent.putExtra("mg", JSON.toJSONString(data));
getContext().startActivity(intent);
}
}
}

View File

@@ -0,0 +1,86 @@
package com.yutou.jianrmg_v2.Adapters;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.PopupMenu;
import android.view.MenuItem;
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.Data.AppData;
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 cn.lemon.view.adapter.BaseViewHolder;
import cn.lemon.view.adapter.RecyclerAdapter;
/**
* Created by 58381 on 2018/1/20.
*/
public class ModRecyclerAdapter extends RecyclerAdapter<TMod> {
private ImageLoader imageLoader;
public ModRecyclerAdapter(Context context) {
super(context);
imageLoader = Utils.initImageLoader(getContext());
}
@Override
public BaseViewHolder onCreateBaseViewHolder(ViewGroup parent, int viewType) {
return new CardRecordHolder(parent, R.layout.item_mod_item);
}
private class CardRecordHolder extends BaseViewHolder<TMod> {
private ImageView icon,select;
private TextView title;
private PopupMenu menu;
public CardRecordHolder(ViewGroup parent, int layoutId) {
super(parent, layoutId);
icon = findViewById(R.id.icon);
title = findViewById(R.id.title);
select=findViewById(R.id.select);
menu=new PopupMenu(getContext(),select);
menu.inflate(R.menu.mod_menu);
menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if(item.getSubMenu()!=null){
menu.show();
}
return true;
}
});
select.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
menu.show();
}
});
}
@Override
public void setData(TMod data) {
super.setData(data);
imageLoader.displayImage( AppData.appConfig.getDownloadhome()+data.getIcon(),icon);
title.setText(data.getTitle());
}
@Override
public void onItemViewClick(TMod data) {
super.onItemViewClick(data);
Intent intent=new Intent(getContext(), ModActivity.class);
intent.putExtra("mod", JSON.toJSONString(data));
getContext().startActivity(intent);
}
}
}

View File

@@ -0,0 +1,99 @@
package com.yutou.jianrmg_v2.Adapters;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.yutou.jianrmg_v2.R;
import com.yutou.jianrmg_v2.Tools.Log;
import com.yutou.jianrmg_v2.views.DownloadListActivity;
import java.util.List;
public class MyItemGridViewAdapter extends BaseAdapter {
public static class ItemData{
private String title;
private int imageUrl=-1;
public ItemData(int imageUrl, String title) {
this.imageUrl = imageUrl;
this.title = title;
}
public int getImageUrl() {
return imageUrl;
}
public String getTitle() {
return title;
}
}
private List<ItemData> list;
private Context context;
public MyItemGridViewAdapter(List<ItemData> list, Context context) {
this.list = list;
this.context = context;
Log.i("List Size",""+list.size());
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int i) {
return list.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(final int i, View view, ViewGroup viewGroup) {
Item item=null;
if(view==null){
item=new Item();
view= LayoutInflater.from(context).inflate(R.layout.item_my_gridview,null);
item.imageView=view.findViewById(R.id.image);
item.title=view.findViewById(R.id.title);
view.setTag(item);
}else{
item= (Item) view.getTag();
}
if(list.get(i).imageUrl!=-1){
item.imageView.setImageResource(list.get(i).getImageUrl());
}
item.title.setText(list.get(i).title);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.i("点击"+list.get(i).getTitle());
Intent intent=null;
switch (i){
case 0:
intent=new Intent(context, DownloadListActivity.class);
break;
}
if(intent!=null)
context.startActivity(intent);
}
});
return view;
}
private class Item{
private ImageView imageView;
private TextView title;
}
}

View File

@@ -0,0 +1,83 @@
package com.yutou.jianrmg_v2.Adapters;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.alibaba.fastjson.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 java.util.List;
/**
* Created by 58381 on 2018/2/14.
*/
public class ReModListAdapter extends BaseAdapter {
private Context context;
private ImageLoader imageLoader;
private List<TMod> list;
public ReModListAdapter(Context context,List<TMod> list) {
this.list = list;
this.context=context;
imageLoader= Utils.initImageLoader(context);
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int i) {
return list.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(final int i, View view, ViewGroup viewGroup) {
Items items;
if(view==null){
view= LayoutInflater.from(context).inflate(R.layout.item_remod,null);
items=new Items();
items.title=view.findViewById(R.id.title);
items.info=view.findViewById(R.id.info);
items.icon=view.findViewById(R.id.icon);
view.setTag(items);
}else{
items= (Items) view.getTag();
}
items.title.setText(list.get(i).getTitle());
items.info.setText(list.get(i).getOverview());
imageLoader.displayImage(list.get(i).getIcon(),items.icon);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(context, ModActivity.class);
intent.putExtra("mod", JSON.toJSONString(list.get(i)));
context.startActivity(intent);
}
});
return view;
}
private class Items{
private ImageView icon;
private TextView title,info;
}
}

View File

@@ -0,0 +1,30 @@
package com.yutou.jianrmg_v2.Adapters;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import java.util.List;
/**
* Created by 58381 on 2018/1/20.
*/
public class ViewPagerAdapter extends FragmentPagerAdapter {
private List<Fragment> mlist;
public ViewPagerAdapter(FragmentManager fm,List<Fragment> list) {
super(fm);
this.mlist = list;
}
@Override
public Fragment getItem(int position) {
return mlist.get(position);
}
@Override
public int getCount() {
return mlist.size();
}
}

View File

@@ -0,0 +1,93 @@
package com.yutou.jianrmg_v2;
import android.app.Activity;
import android.os.Bundle;
import com.yutou.jianrmg_v2.Data.AppData;
import com.yutou.jianrmg_v2.Data.User;
import com.yutou.jianrmg_v2.Tools.ActivitysManager;
import com.yutou.jianrmg_v2.Tools.ConfigUtils;
import com.yutou.jianrmg_v2.Tools.Log;
import com.yutou.jianrmg_v2.Tools.Utils;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import dalvik.system.DexClassLoader;
/**
* Created by 58381 on 2018/1/20.
*/
public class Application extends android.app.Application {
@Override
public void onCreate() {
super.onCreate();
init();
// initPlugsin();
regActivity();
}
private void initPlugsin(){
Map<String,DexClassLoader> plugsin=new HashMap<>();
File path=new File(Utils.getAppPath()+"/plugin/");
for (File file : path.listFiles()) {
if(file.getName().contains(".jar")){
DexClassLoader dexClassLoader=new DexClassLoader(file.getAbsolutePath(),"/data/data/"+getPackageName()+"/",null,getClassLoader());
plugsin.put(file.getName(),dexClassLoader);
}
}
AppData.plugsin=plugsin;
}
private void init(){
AppData.Token= (String) ConfigUtils.init().load("token");
AppData.user=new User();
try {
AppData.user.setId((Integer) ConfigUtils.init().load("uid"));
}catch (Exception e){
AppData.user.setId(-1);
}
}
private void regActivity(){
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
@Override
public void onActivityCreated(Activity activity, Bundle bundle) {
Log.i("Appliction","创建:"+activity.getClass().getName());
ActivitysManager.addActivity(activity);
}
@Override
public void onActivityStarted(Activity activity) {
}
@Override
public void onActivityResumed(Activity activity) {
}
@Override
public void onActivityPaused(Activity activity) {
}
@Override
public void onActivityStopped(Activity activity) {
}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
}
@Override
public void onActivityDestroyed(Activity activity) {
Log.i("Appliction","销毁:"+activity.getClass().getName());
ActivitysManager.finishActivity(activity);
}
});
}
}

View File

@@ -0,0 +1,21 @@
package com.yutou.jianrmg_v2.Data;
import java.util.List;
import java.util.Map;
import dalvik.system.DexClassLoader;
/**
* Created by 58381 on 2018/2/2.
*/
public class AppData {
public static List<MGamePackname> packnames;
public static Map<String,DexClassLoader> plugsin;
public static SConfig appConfig;
public static User user;
public static UUserdata userdata;
public static String Token="";
public static boolean RxDeBug=true;
}

View File

@@ -0,0 +1,120 @@
package com.yutou.jianrmg_v2.Data;
public class MAppHome {
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_home.id
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
private Integer id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_home.name
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
private String name;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_home.icon
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
private String icon;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_home.url
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
private String url;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_home.isshow
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
private Integer isshow;
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_home.id
* @return the value of m_app_home.id
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_home.id
* @param id the value for m_app_home.id
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_home.name
* @return the value of m_app_home.name
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_home.name
* @param name the value for m_app_home.name
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
public void setName(String name) {
this.name = name;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_home.icon
* @return the value of m_app_home.icon
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
public String getIcon() {
return icon;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_home.icon
* @param icon the value for m_app_home.icon
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
public void setIcon(String icon) {
this.icon = icon;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_home.url
* @return the value of m_app_home.url
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
public String getUrl() {
return url;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_home.url
* @param url the value for m_app_home.url
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
public void setUrl(String url) {
this.url = url;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_home.isshow
* @return the value of m_app_home.isshow
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
public Integer getIsshow() {
return isshow;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_home.isshow
* @param isshow the value for m_app_home.isshow
* @mbg.generated Tue Jan 23 12:06:19 CST 2018
*/
public void setIsshow(Integer isshow) {
this.isshow = isshow;
}
}

View File

@@ -0,0 +1,213 @@
package com.yutou.jianrmg_v2.Data;
public class MAppMg{
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_mg.id
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
private Integer id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_mg.indexs
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
private Integer indexs;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_mg.name
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
private String name;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_mg.icon
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
private String icon;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_mg.mg_type
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
private String mgType;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_mg.isshow
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
private Integer isshow;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_mg.url
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
private String url;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_mg.version
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
private Integer version;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_app_mg.main_function
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
private String mainFunction;
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_mg.id
* @return the value of m_app_mg.id
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_mg.id
* @param id the value for m_app_mg.id
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_mg.indexs
* @return the value of m_app_mg.indexs
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public Integer getIndexs() {
return indexs;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_mg.indexs
* @param indexs the value for m_app_mg.indexs
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public void setIndexs(Integer indexs) {
this.indexs = indexs;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_mg.name
* @return the value of m_app_mg.name
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_mg.name
* @param name the value for m_app_mg.name
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public void setName(String name) {
this.name = name;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_mg.icon
* @return the value of m_app_mg.icon
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public String getIcon() {
return icon;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_mg.icon
* @param icon the value for m_app_mg.icon
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public void setIcon(String icon) {
this.icon = icon;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_mg.mg_type
* @return the value of m_app_mg.mg_type
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public String getMgType() {
return mgType;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_mg.mg_type
* @param mgType the value for m_app_mg.mg_type
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public void setMgType(String mgType) {
this.mgType = mgType;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_mg.isshow
* @return the value of m_app_mg.isshow
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public Integer getIsshow() {
return isshow;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_mg.isshow
* @param isshow the value for m_app_mg.isshow
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public void setIsshow(Integer isshow) {
this.isshow = isshow;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_mg.url
* @return the value of m_app_mg.url
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public String getUrl() {
return url;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_mg.url
* @param url the value for m_app_mg.url
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public void setUrl(String url) {
this.url = url;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_mg.version
* @return the value of m_app_mg.version
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public Integer getVersion() {
return version;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_mg.version
* @param version the value for m_app_mg.version
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public void setVersion(Integer version) {
this.version = version;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_app_mg.main_function
* @return the value of m_app_mg.main_function
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public String getMainFunction() {
return mainFunction;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_app_mg.main_function
* @param mainFunction the value for m_app_mg.main_function
* @mbg.generated Wed Feb 28 13:25:37 CST 2018
*/
public void setMainFunction(String mainFunction) {
this.mainFunction = mainFunction;
}
}

View File

@@ -0,0 +1,97 @@
package com.yutou.jianrmg_v2.Data;
public class MBanner {
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_banner.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private Integer id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_banner.url
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String url;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_banner.click
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String click;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_banner.isshow
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private Integer isshow;
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_banner.id
* @return the value of m_banner.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_banner.id
* @param id the value for m_banner.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_banner.url
* @return the value of m_banner.url
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getUrl() {
return url;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_banner.url
* @param url the value for m_banner.url
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setUrl(String url) {
this.url = url;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_banner.click
* @return the value of m_banner.click
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getClick() {
return click;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_banner.click
* @param click the value for m_banner.click
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setClick(String click) {
this.click = click;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_banner.isshow
* @return the value of m_banner.isshow
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public Integer getIsshow() {
return isshow;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_banner.isshow
* @param isshow the value for m_banner.isshow
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setIsshow(Integer isshow) {
this.isshow = isshow;
}
}

View File

@@ -0,0 +1,106 @@
package com.yutou.jianrmg_v2.Data;
public class MGamePackname {
private boolean isRoot;
public boolean isRoot() {
return isRoot;
}
public void setRoot(boolean root) {
isRoot = root;
}
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_game_packname.id
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private Integer id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_game_packname.packname
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private String packname;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_game_packname.zhname
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private String zhname;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column m_game_packname.isshow
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private Integer isshow;
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_game_packname.id
* @return the value of m_game_packname.id
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_game_packname.id
* @param id the value for m_game_packname.id
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_game_packname.packname
* @return the value of m_game_packname.packname
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public String getPackname() {
return packname;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_game_packname.packname
* @param packname the value for m_game_packname.packname
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setPackname(String packname) {
this.packname = packname;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_game_packname.zhname
* @return the value of m_game_packname.zhname
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public String getZhname() {
return zhname;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_game_packname.zhname
* @param zhname the value for m_game_packname.zhname
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setZhname(String zhname) {
this.zhname = zhname;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column m_game_packname.isshow
* @return the value of m_game_packname.isshow
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public Integer getIsshow() {
return isshow;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column m_game_packname.isshow
* @param isshow the value for m_game_packname.isshow
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setIsshow(Integer isshow) {
this.isshow = isshow;
}
}

View File

@@ -0,0 +1,168 @@
package com.yutou.jianrmg_v2.Data;
public class SConfig {
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column s_config.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private Integer id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column s_config.apk_version
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String apkVersion;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column s_config.msg_version
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String msgVersion;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column s_config.apk_url
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String apkUrl;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column s_config.msg_url
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String msgUrl;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column s_config.message
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String message;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column s_config.downloadHome
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String downloadhome;
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column s_config.id
* @return the value of s_config.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column s_config.id
* @param id the value for s_config.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column s_config.apk_version
* @return the value of s_config.apk_version
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getApkVersion() {
return apkVersion;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column s_config.apk_version
* @param apkVersion the value for s_config.apk_version
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setApkVersion(String apkVersion) {
this.apkVersion = apkVersion;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column s_config.msg_version
* @return the value of s_config.msg_version
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getMsgVersion() {
return msgVersion;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column s_config.msg_version
* @param msgVersion the value for s_config.msg_version
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setMsgVersion(String msgVersion) {
this.msgVersion = msgVersion;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column s_config.apk_url
* @return the value of s_config.apk_url
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getApkUrl() {
return apkUrl;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column s_config.apk_url
* @param apkUrl the value for s_config.apk_url
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setApkUrl(String apkUrl) {
this.apkUrl = apkUrl;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column s_config.msg_url
* @return the value of s_config.msg_url
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getMsgUrl() {
return msgUrl;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column s_config.msg_url
* @param msgUrl the value for s_config.msg_url
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setMsgUrl(String msgUrl) {
this.msgUrl = msgUrl;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column s_config.message
* @return the value of s_config.message
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getMessage() {
return message;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column s_config.message
* @param message the value for s_config.message
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setMessage(String message) {
this.message = message;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column s_config.downloadHome
* @return the value of s_config.downloadHome
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getDownloadhome() {
if(downloadhome!=null)
return downloadhome;
return "";
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column s_config.downloadHome
* @param downloadhome the value for s_config.downloadHome
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setDownloadhome(String downloadhome) {
this.downloadhome = downloadhome;
}
}

View File

@@ -0,0 +1,442 @@
package com.yutou.jianrmg_v2.Data;
import android.support.annotation.NonNull;
public class TMod implements Comparable<TMod>{
@Override
public String toString() {
return "TMod [id=" + id + ", modname=" + modname + ", title=" + title + ", modtype=" + modtype + ", jianrtype="
+ jianrtype + ", jianrId=" + jianrId + ", info=" + info + ", byid=" + byid + ", byuser=" + byuser
+ ", overview=" + overview + ", image=" + image + ", icon=" + icon + ", createtime=" + createtime
+ ", updatetime=" + updatetime + ", modversion=" + modversion + ", gameverid=" + gameverid + ", city="
+ city + "]";
}
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.id
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private Integer id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.modName
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private String modname;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.title
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private String title;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.modType
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private String modtype;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.jianrType
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private String jianrtype;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.jianr_id
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private Integer jianrId;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.info
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private String info;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.byId
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private Integer byid;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.byUser
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private String byuser;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.overview
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private String overview;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.image
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private String image;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.icon
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private String icon;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.createTime
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private Long createtime;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.updateTime
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private Long updatetime=-1l;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.modVersion
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private Integer modversion;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.gameVerId
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private Integer gameverid;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.city
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private Integer city;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_mod.reMod
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
private Integer remod;
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.id
* @return the value of t_mod.id
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.id
* @param id the value for t_mod.id
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.modName
* @return the value of t_mod.modName
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public String getModname() {
return modname;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.modName
* @param modname the value for t_mod.modName
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setModname(String modname) {
this.modname = modname;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.title
* @return the value of t_mod.title
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public String getTitle() {
return title;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.title
* @param title the value for t_mod.title
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setTitle(String title) {
this.title = title;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.modType
* @return the value of t_mod.modType
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public String getModtype() {
return modtype;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.modType
* @param modtype the value for t_mod.modType
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setModtype(String modtype) {
this.modtype = modtype;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.jianrType
* @return the value of t_mod.jianrType
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public String getJianrtype() {
return jianrtype;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.jianrType
* @param jianrtype the value for t_mod.jianrType
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setJianrtype(String jianrtype) {
this.jianrtype = jianrtype;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.jianr_id
* @return the value of t_mod.jianr_id
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public Integer getJianrId() {
return jianrId;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.jianr_id
* @param jianrId the value for t_mod.jianr_id
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setJianrId(Integer jianrId) {
this.jianrId = jianrId;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.info
* @return the value of t_mod.info
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public String getInfo() {
return info;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.info
* @param info the value for t_mod.info
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setInfo(String info) {
this.info = info;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.byId
* @return the value of t_mod.byId
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public Integer getByid() {
return byid;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.byId
* @param byid the value for t_mod.byId
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setByid(Integer byid) {
this.byid = byid;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.byUser
* @return the value of t_mod.byUser
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public String getByuser() {
return byuser;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.byUser
* @param byuser the value for t_mod.byUser
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setByuser(String byuser) {
this.byuser = byuser;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.overview
* @return the value of t_mod.overview
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public String getOverview() {
return overview;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.overview
* @param overview the value for t_mod.overview
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setOverview(String overview) {
this.overview = overview;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.image
* @return the value of t_mod.image
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public String getImage() {
return image;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.image
* @param image the value for t_mod.image
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setImage(String image) {
this.image = image;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.icon
* @return the value of t_mod.icon
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public String getIcon() {
return icon;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.icon
* @param icon the value for t_mod.icon
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setIcon(String icon) {
this.icon = icon;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.createTime
* @return the value of t_mod.createTime
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public Long getCreatetime() {
return createtime;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.createTime
* @param createtime the value for t_mod.createTime
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setCreatetime(Long createtime) {
this.createtime = createtime;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.updateTime
* @return the value of t_mod.updateTime
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public Long getUpdatetime() {
return updatetime;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.updateTime
* @param updatetime the value for t_mod.updateTime
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setUpdatetime(Long updatetime) {
this.updatetime = updatetime;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.modVersion
* @return the value of t_mod.modVersion
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public Integer getModversion() {
return modversion;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.modVersion
* @param modversion the value for t_mod.modVersion
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setModversion(Integer modversion) {
this.modversion = modversion;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.gameVerId
* @return the value of t_mod.gameVerId
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public Integer getGameverid() {
return gameverid;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.gameVerId
* @param gameverid the value for t_mod.gameVerId
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setGameverid(Integer gameverid) {
this.gameverid = gameverid;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.city
* @return the value of t_mod.city
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public Integer getCity() {
return city;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.city
* @param city the value for t_mod.city
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setCity(Integer city) {
this.city = city;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_mod.reMod
* @return the value of t_mod.reMod
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public Integer getRemod() {
return remod;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_mod.reMod
* @param remod the value for t_mod.reMod
* @mbg.generated Tue Feb 06 15:48:54 CST 2018
*/
public void setRemod(Integer remod) {
this.remod = remod;
}
@Override
public int compareTo(@NonNull TMod tMod) {
if(this.updatetime==-1&&tMod.updatetime==-1) {
return tMod.getCreatetime().compareTo(this.createtime);
}else if(this.updatetime==-1){
return tMod.updatetime.compareTo(this.createtime);
}else if(tMod.updatetime==-1){
return tMod.createtime.compareTo(this.updatetime);
}
return tMod.getUpdatetime().compareTo(this.updatetime);
}
}

View File

@@ -0,0 +1,166 @@
package com.yutou.jianrmg_v2.Data;
public class TModfile {
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_modfile.id
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
private Integer id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_modfile.mid
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
private Integer mid;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_modfile.fileName
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
private String filename;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_modfile.serviceUrl
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
private String serviceurl;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_modfile.installPathId
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
private String installpathid;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_modfile.createTime
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
private Long createtime;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_modfile.updateTime
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
private Long updatetime;
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_modfile.id
* @return the value of t_modfile.id
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_modfile.id
* @param id the value for t_modfile.id
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_modfile.mid
* @return the value of t_modfile.mid
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public Integer getMid() {
return mid;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_modfile.mid
* @param mid the value for t_modfile.mid
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public void setMid(Integer mid) {
this.mid = mid;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_modfile.fileName
* @return the value of t_modfile.fileName
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public String getFilename() {
return filename;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_modfile.fileName
* @param filename the value for t_modfile.fileName
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public void setFilename(String filename) {
this.filename = filename;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_modfile.serviceUrl
* @return the value of t_modfile.serviceUrl
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public String getServiceurl() {
return AppData.appConfig.getDownloadhome()+serviceurl;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_modfile.serviceUrl
* @param serviceurl the value for t_modfile.serviceUrl
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public void setServiceurl(String serviceurl) {
this.serviceurl = serviceurl;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_modfile.installPathId
* @return the value of t_modfile.installPathId
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public String getInstallpathid() {
return installpathid;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_modfile.installPathId
* @param installpathid the value for t_modfile.installPathId
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public void setInstallpathid(String installpathid) {
this.installpathid = installpathid;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_modfile.createTime
* @return the value of t_modfile.createTime
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public Long getCreatetime() {
return createtime;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_modfile.createTime
* @param createtime the value for t_modfile.createTime
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public void setCreatetime(Long createtime) {
this.createtime = createtime;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_modfile.updateTime
* @return the value of t_modfile.updateTime
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public Long getUpdatetime() {
return updatetime;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_modfile.updateTime
* @param updatetime the value for t_modfile.updateTime
* @mbg.generated Fri Feb 02 18:11:06 CST 2018
*/
public void setUpdatetime(Long updatetime) {
this.updatetime = updatetime;
}
}

View File

@@ -0,0 +1,74 @@
package com.yutou.jianrmg_v2.Data;
public class TModtag {
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_modtag.id
* @mbg.generated Sat Jan 27 12:36:26 CST 2018
*/
private Integer id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_modtag.mid
* @mbg.generated Sat Jan 27 12:36:26 CST 2018
*/
private Integer mid;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column t_modtag.tag
* @mbg.generated Sat Jan 27 12:36:26 CST 2018
*/
private String tag;
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_modtag.id
* @return the value of t_modtag.id
* @mbg.generated Sat Jan 27 12:36:26 CST 2018
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_modtag.id
* @param id the value for t_modtag.id
* @mbg.generated Sat Jan 27 12:36:26 CST 2018
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_modtag.mid
* @return the value of t_modtag.mid
* @mbg.generated Sat Jan 27 12:36:26 CST 2018
*/
public Integer getMid() {
return mid;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_modtag.mid
* @param mid the value for t_modtag.mid
* @mbg.generated Sat Jan 27 12:36:26 CST 2018
*/
public void setMid(Integer mid) {
this.mid = mid;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column t_modtag.tag
* @return the value of t_modtag.tag
* @mbg.generated Sat Jan 27 12:36:26 CST 2018
*/
public String getTag() {
return tag;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column t_modtag.tag
* @param tag the value for t_modtag.tag
* @mbg.generated Sat Jan 27 12:36:26 CST 2018
*/
public void setTag(String tag) {
this.tag = tag;
}
}

View File

@@ -0,0 +1,83 @@
package com.yutou.jianrmg_v2.Data;
public class UUsercollection {
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column u_usercollection.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private Integer id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column u_usercollection.uid
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private Integer uid;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column u_usercollection.mid
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private Integer mid;
private Long createtime;
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column u_usercollection.id
* @return the value of u_usercollection.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column u_usercollection.id
* @param id the value for u_usercollection.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column u_usercollection.uid
* @return the value of u_usercollection.uid
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public Integer getUid() {
return uid;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column u_usercollection.uid
* @param uid the value for u_usercollection.uid
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setUid(Integer uid) {
this.uid = uid;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column u_usercollection.mid
* @return the value of u_usercollection.mid
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public Integer getMid() {
return mid;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column u_usercollection.mid
* @param mid the value for u_usercollection.mid
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setMid(Integer mid) {
this.mid = mid;
}
public Long getCreatetime() {
return createtime;
}
public void setCreatetime(Long createtime) {
this.createtime = createtime;
}
}

View File

@@ -0,0 +1,106 @@
package com.yutou.jianrmg_v2.Data;
public class UUserdata {
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private Integer id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.uid
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private Integer uid;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.email
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String email;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column u_userdata.createTime
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private Long createtime;
private String image;
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.id
* @return the value of u_userdata.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.id
* @param id the value for u_userdata.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.uid
* @return the value of u_userdata.uid
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public Integer getUid() {
return uid;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.uid
* @param uid the value for u_userdata.uid
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setUid(Integer uid) {
this.uid = uid;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.email
* @return the value of u_userdata.email
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getEmail() {
return email;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.email
* @param email the value for u_userdata.email
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setEmail(String email) {
this.email = email;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column u_userdata.createTime
* @return the value of u_userdata.createTime
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public Long getCreatetime() {
return createtime;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column u_userdata.createTime
* @param createtime the value for u_userdata.createTime
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setCreatetime(Long createtime) {
this.createtime = createtime;
}
}

View File

@@ -0,0 +1,120 @@
package com.yutou.jianrmg_v2.Data;
public class User {
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column user.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private Integer id;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column user.name
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String name;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column user.pass
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String pass;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column user.IMEI
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private String imei;
/**
* This field was generated by MyBatis Generator. This field corresponds to the database column user.power
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
private Integer power;
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column user.id
* @return the value of user.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column user.id
* @param id the value for user.id
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column user.name
* @return the value of user.name
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column user.name
* @param name the value for user.name
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setName(String name) {
this.name = name;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column user.pass
* @return the value of user.pass
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getPass() {
return pass;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column user.pass
* @param pass the value for user.pass
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setPass(String pass) {
this.pass = pass;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column user.IMEI
* @return the value of user.IMEI
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public String getImei() {
return imei;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column user.IMEI
* @param imei the value for user.IMEI
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setImei(String imei) {
this.imei = imei;
}
/**
* This method was generated by MyBatis Generator. This method returns the value of the database column user.power
* @return the value of user.power
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public Integer getPower() {
return power;
}
/**
* This method was generated by MyBatis Generator. This method sets the value of the database column user.power
* @param power the value for user.power
* @mbg.generated Sun Jan 21 18:14:28 CST 2018
*/
public void setPower(Integer power) {
this.power = power;
}
}

View File

@@ -1,65 +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.basemodel.services.DownloadService;
import com.yutou.jianrmg_v2.gamedatamodel.MainFragmene;
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.R;
import java.util.ArrayList;
import java.util.List;
import Interfaces.BaseFragmeneInerface;
/**
* Created by 58381 on 2018/1/21.
*/
public class GameData extends Fragment {
private Context context;
private static GameData gameData;
private DownloadService service;
private Activity activity;
private BaseFragmeneInerface baseFragmene;
public static GameData init(Activity activity){
public static GameData init(){
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
private View view;
@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);
if(view!=null)
return view;
view=inflater.inflate(R.layout.fragment_game_data,null);
PieChart pieChart=view.findViewById(R.id.pieChart);
List<PieEntry> entries = new ArrayList<>();
entries.add(new PieEntry(120000, ""));
entries.add(new PieEntry(230000, ""));
entries.add(new PieEntry(50000, ""));
entries.add(new PieEntry(80000, ""));
PieDataSet set = new PieDataSet(entries, "当前资源");
PieData data = new PieData(set);
pieChart.setData(data);
pieChart.invalidate();
return view;
}
}

View File

@@ -1,24 +1,45 @@
package com.yutou.jianrmg_v2.Fragments;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutCompat;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.alibaba.fastjson.JSON;
import com.bigkoo.convenientbanner.ConvenientBanner;
import com.bigkoo.convenientbanner.holder.CBViewHolderCreator;
import com.bigkoo.convenientbanner.holder.Holder;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.yutou.jianrmg_v2.Adapters.HomeRecyclerAdapter;
import com.yutou.jianrmg_v2.Data.MAppHome;
import com.yutou.jianrmg_v2.Data.MBanner;
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 org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
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;
import cn.lemon.view.RefreshRecyclerView;
import cn.lemon.view.adapter.Action;
/**
* Created by 58381 on 2018/1/20.
@@ -26,36 +47,191 @@ import Interfaces.BaseFragmeneInerface;
public class Home extends Fragment {
private static Home home;
private ConvenientBanner banner;
private RefreshRecyclerView recyclerView;
private HomeRecyclerAdapter adapter;
private View view;
private List<MAppHome> datas;
private int min=0, max=10;
private boolean isInit=true;
private Handler handler;
private ImageLoader imageLoader;
private Context context;
private BaseFragmeneInerface baseFragmene;
public static Home init(Activity activity){
Toast.makeText(activity,"默认主页",Toast.LENGTH_LONG).show();
public static Home init(){
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);
if(view!=null)
return view;
view= inflater.inflate(R.layout.fragment_home,null);
imageLoader= Utils.initImageLoader(getContext());
handler=new Handler();
initBanner();
initView(view);
TextView textView=new TextView(getContext());
textView.setText("a");
return view;
}
private void initBanner(){
HttpUtils.get(HttpApi.HOME_URL + HttpApi.BANNER, new HttpInterface() {
@Override
public void httpError(Exception e) {
e.printStackTrace();
}
@Override
public void httpGetData(String string, int code) {
final List<MBanner> array;
try {
Log.i("banner",string);
JSONObject json=new JSONObject(string);
if(json.getInt("code")==100){
array= JSON.parseArray(json.getString("data"),MBanner.class);
}else{
array=new ArrayList<>();
}
Log.i(""+(handler==null));
handler.post(new Runnable() {
@Override
public void run() {
setBanner(array);
}
});
}catch (Exception e){
e.printStackTrace();
}
}
});
}
private void setBanner( List<MBanner> list){
banner.setCanLoop(true);
banner.startTurning(2000);
banner.setPages(new CBViewHolderCreator(){
@Override
public Object createHolder() {
return new Banner();
}
},list).setPageIndicatorAlign(ConvenientBanner.PageIndicatorAlign.ALIGN_PARENT_RIGHT);
}
private void initView(View view){
Log.i("初始化主页");
banner=new ConvenientBanner(getContext());
ViewGroup.LayoutParams params=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,400);
banner.setLayoutParams(params);
recyclerView=view.findViewById(R.id.recyclerView);
recyclerView.setSwipeRefreshColors(0xFF437845,0xFFE44F98,0xFF2FAC21);
recyclerView.setLayoutManager(new GridLayoutManager(getContext(),3));
adapter=new HomeRecyclerAdapter(getContext());
adapter.setHeader(banner);
TextView endText=new TextView(getContext());
endText.setLayoutParams(new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDp(getActivity(),48)));
endText.setTextSize(16);
endText.setGravity(Gravity.CENTER);
endText.setText(" --已经没有了--");
adapter.setFooter(endText);
recyclerView.setAdapter(adapter);
recyclerView.setRefreshAction(new Action() {
@Override
public void onAction() {
min=0;
max=10;
isInit=true;
initData();
}
});
recyclerView.setLoadMoreAction(new Action() {
@Override
public void onAction() {
if(isInit){
recyclerView.showNoMore();
}else {
min = max;
max += 10;
initData();
}
}
});
recyclerView.showSwipeRefresh();
initData();
}
private void initData(){
try {
datas=new ArrayList<>();
Log.i("载入数据");
JSONObject json=new JSONObject();
HttpUtils.post(HttpApi.HOME_URL + HttpApi.MG_HOME_LIST, json, new HttpInterface() {
@Override
public void httpError(Exception e) {
}
@Override
public void httpGetData(String string, int code) {
Log.i(HttpApi.MG_HOME_LIST,string);
try{
JSONObject json=new JSONObject(string);
if(json.getInt("code")==100){
datas= JSON.parseArray(json.getString("data"),MAppHome.class);
}
handler.post(new Runnable() {
@Override
public void run() {
setData();
}
});
}catch (Exception e){
e.printStackTrace();
}
}
});
}catch (Exception e){
e.printStackTrace();
}
}
private void setData(){
if(datas.size()>0){
adapter.clear();
adapter.addAll(datas);
recyclerView.dismissSwipeRefresh();
recyclerView.getRecyclerView().scrollToPosition(0);
}else{
adapter.addAll(datas);
}
}
private class Banner implements Holder<MBanner>{
private ImageView imageView;
@Override
public View createView(Context context) {
imageView = new ImageView(context);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
return imageView;
}
@Override
public void UpdateUI(Context context, int position,final MBanner data) {
imageLoader.displayImage(data.getUrl(),imageView);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(data.getClick()));
startActivity(intent);
}
});
}
}
}

View File

@@ -1,23 +1,34 @@
package com.yutou.jianrmg_v2.Fragments;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutCompat;
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 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 Interfaces.BaseFragmeneInerface;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import cn.lemon.view.RefreshRecyclerView;
import cn.lemon.view.adapter.Action;
/**
* Created by 58381 on 2018/1/23.
@@ -25,29 +36,109 @@ import Interfaces.BaseFragmeneInerface;
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);
private RefreshRecyclerView recyclerView;
private ModListRecyclerAdapter adapter;
private List<MAppMg> datas;
private int min=0, max=10;
private boolean isInit=true;
private Handler handler;
private View view;
public static MGList init(){
if(modView==null){
modView=new MGList();
}
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);
if(view!=null)
return view;
view=inflater.inflate(R.layout.fragment_mg,null);
handler=new Handler();
initView(view);
return view;
}
private void initView(View view){
recyclerView=view.findViewById(R.id.recyclerView);
recyclerView.setSwipeRefreshColors(0xFF437845,0xFFE44F98,0xFF2FAC21);
recyclerView.setLayoutManager(new GridLayoutManager(getContext(),3));
adapter=new ModListRecyclerAdapter(getContext());
TextView endText=new TextView(getContext());
endText.setLayoutParams(new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDp(getActivity(),48)));
endText.setTextSize(16);
endText.setGravity(Gravity.CENTER);
endText.setText(" --已经没有了--");
adapter.setFooter(endText);
recyclerView.setAdapter(adapter);
recyclerView.setRefreshAction(new Action() {
@Override
public void onAction() {
min=0;
max=10;
isInit=true;
initData();
}
});
recyclerView.setLoadMoreAction(new Action() {
@Override
public void onAction() {
if(isInit){
recyclerView.showNoMore();
}else {
min = max;
max += 10;
initData();
}
}
});
recyclerView.showSwipeRefresh();
initData();
}
private void initData(){
try {
datas=new ArrayList<>();
Log.i("载入数据");
JSONObject json=new JSONObject();
json.put("min",min);
json.put("max",max);
HttpUtils.post(HttpApi.HOME_URL + HttpApi.MG_MG_LIST, json, new HttpInterface() {
@Override
public void httpError(Exception e) {
}
@Override
public void httpGetData(String string, int code) {
Log.i(HttpApi.MG_MG_LIST,string);
try{
JSONObject json=new JSONObject(string);
if(json.getInt("code")==100){
datas= JSON.parseArray(json.getString("data"), MAppMg.class);
}
handler.post(new Runnable() {
@Override
public void run() {
setData();
}
});
}catch (Exception e){
e.printStackTrace();
}
}
});
}catch (Exception e){
e.printStackTrace();
}
}
private void setData(){
if(datas.size()>0){
adapter.clear();
adapter.addAll(datas);
recyclerView.dismissSwipeRefresh();
recyclerView.getRecyclerView().scrollToPosition(0);
}else{
adapter.addAll(datas);
}
}
}

View File

@@ -0,0 +1,161 @@
package com.yutou.jianrmg_v2.Fragments;
import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutCompat;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
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 org.json.JSONObject;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cn.lemon.view.RefreshRecyclerView;
import cn.lemon.view.adapter.Action;
public class ModListFragmentData {
private MAppMg mgList;
private RefreshRecyclerView recyclerView;
private ModRecyclerAdapter adapter;
private List<TMod> datas;
private int min=0, max=10,index=-1;
private boolean isInit=true;
private Handler handler;
private View view;
private Context context;
private Activity activity;
public View onCreateView(Context context,Activity activity,LayoutInflater inflater){
this.context=context;
this.activity=activity;
if(view!=null){
return view;
}
view=inflater.inflate(R.layout.fragment_mg,null);
handler=new Handler();
initViews();
return view;
}
public void setMgList(MAppMg mgList){
this.mgList=mgList;
}
public void setIndex(int index){
this.index=index;
}
public void initViews(){
recyclerView=view.findViewById(R.id.recyclerView);
recyclerView.setSwipeRefreshColors(0xFF437845,0xFFE44F98,0xFF2FAC21);
recyclerView.setLayoutManager(new GridLayoutManager(context,3));
adapter=new ModRecyclerAdapter(context);
TextView endText=new TextView(context);
endText.setLayoutParams(new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDp(activity,48)));
endText.setTextSize(16);
endText.setGravity(Gravity.CENTER);
endText.setText(" --已经没有了--");
adapter.setFooter(endText);
recyclerView.setAdapter(adapter);
recyclerView.setRefreshAction(new Action() {
@Override
public void onAction() {
min=0;
max=10;
isInit=true;
initData();
}
});
recyclerView.setLoadMoreAction(new Action() {
@Override
public void onAction() {
if(isInit){
recyclerView.showNoMore();
}else {
min = max;
max += 10;
initData();
}
}
});
recyclerView.showSwipeRefresh();
initData();
}
private void initData(){
try {
datas=new ArrayList<>();
Log.i("载入数据");
JSONObject json=new JSONObject();
json.put("min_str",min);
json.put("max_str",max);
if(mgList.getIndexs()>3)
json.put("jType",mgList.getIndexs());
else
json.put("mType",mgList.getIndexs());
final String url=mgList.getIndexs()==0? HttpApi.MOD_ALL: HttpApi.MOD_TYPE;
HttpUtils.post(HttpApi.HOME_URL + url, json, new HttpInterface() {
@Override
public void httpError(Exception e) {
}
@Override
public void httpGetData(String string, int code) {
Log.i(url,string);
try{
JSONObject json=new JSONObject(string);
if(json.getInt("code")==100){
datas= Utils.ListRemoveNull(JSON.parseArray(json.getString("data"), TMod.class));
Collections.sort(datas);
if(index!=-1) {
List<TMod> tmp = new ArrayList<>();
for (TMod data : datas) {
if (!data.getModtype().equals(index + "")) {
tmp.add(data);
}
}
datas.removeAll(tmp);
tmp.clear();
tmp = null;
}
}
handler.post(new Runnable() {
@Override
public void run() {
setData();
}
});
}catch (Exception e){
e.printStackTrace();
}
}
});
}catch (Exception e){
e.printStackTrace();
}
}
private void setData(){
if(isInit){
adapter.clear();
adapter.addAll(datas);
recyclerView.getRecyclerView().scrollToPosition(0);
}else{
adapter.addAll(datas);
}
recyclerView.dismissSwipeRefresh();
}
}

View File

@@ -0,0 +1,47 @@
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 com.yutou.jianrmg_v2.Data.MAppMg;
import com.yutou.jianrmg_v2.Tools.Log;
/**
* Created by 58381 on 2018/1/25.
*/
public class ModListFragment_0 extends Fragment {
private static ModListFragment_0 mod;
private ModListFragmentData modData;
private int index=-1;
public ModListFragment_0(){
this.modData=new ModListFragmentData();
}
public static ModListFragment_0 init(MAppMg mgList){
if(mod==null){
mod=new ModListFragment_0();
}
if(mgList!=null)
Log.i("mod",mgList.getName());
mod.setMgList(mgList);
mod.setIndex(mod.index);
return mod;
}
private void setIndex(int index){
modData.setIndex(index);
}
private void setMgList(MAppMg mgList){
modData.setMgList(mgList);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return modData.onCreateView(getContext(),getActivity(),inflater);
}
}

View File

@@ -0,0 +1,47 @@
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 com.yutou.jianrmg_v2.Data.MAppMg;
import com.yutou.jianrmg_v2.Tools.Log;
/**
* Created by 58381 on 2018/1/25.
*/
public class ModListFragment_1 extends Fragment {
private static ModListFragment_1 mod;
private ModListFragmentData modData;
private int index=1;
public ModListFragment_1(){
this.modData=new ModListFragmentData();
}
public static ModListFragment_1 init(MAppMg mgList){
if(mod==null){
mod=new ModListFragment_1();
}
if(mgList!=null)
Log.i("mod",mgList.getName());
mod.setMgList(mgList);
mod.setIndex(mod.index);
return mod;
}
private void setIndex(int index){
modData.setIndex(index);
}
private void setMgList(MAppMg mgList){
modData.setMgList(mgList);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return modData.onCreateView(getContext(),getActivity(),inflater);
}
}

View File

@@ -0,0 +1,47 @@
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 com.yutou.jianrmg_v2.Data.MAppMg;
import com.yutou.jianrmg_v2.Tools.Log;
/**
* Created by 58381 on 2018/1/25.
*/
public class ModListFragment_2 extends Fragment {
private static ModListFragment_2 mod;
private ModListFragmentData modData;
private int index=2;
public ModListFragment_2(){
this.modData=new ModListFragmentData();
}
public static ModListFragment_2 init(MAppMg mgList){
if(mod==null){
mod=new ModListFragment_2();
}
if(mgList!=null)
Log.i("mod",mgList.getName());
mod.setMgList(mgList);
mod.setIndex(mod.index);
return mod;
}
private void setIndex(int index){
modData.setIndex(index);
}
private void setMgList(MAppMg mgList){
modData.setMgList(mgList);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return modData.onCreateView(getContext(),getActivity(),inflater);
}
}

View File

@@ -16,13 +16,13 @@ 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.Log;
import com.yutou.jianrmg_v2.basemodel.Tools.Utils;
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.R;
import com.yutou.jianrmg_v2.Tools.Utils;
import java.util.ArrayList;
import java.util.List;
@@ -38,30 +38,70 @@ import static com.bumptech.glide.request.RequestOptions.bitmapTransform;
*/
public class My extends Fragment {
public static My my;
private BaseFragmeneInerface baseFragmeneInerface;
public static My init(Activity activity){
private ImageLoader imageLoader;
private View view;
private User user;
private UUserdata udata;
private TextView uname,item_title;
private ImageView icon,item_icon,image_top;
// private LinearLayout items;
private ListView myItems;
private static My my;
public static My init() {
if(my==null){
my=new My();
my.baseFragmeneInerface.init(activity);
}
return my;
}
public My(){
try {
this.baseFragmeneInerface = (BaseFragmeneInerface) AppData.plugsin.get("my.jar").loadClass("com.yutou.jianrmg_v2.mglistmodel.MainFragments").newInstance();
} catch (Exception e) {
e.printStackTrace();
Log.i("个人中心插件加载失败");
baseFragmeneInerface =new com.jianrmg_v2.usermodel.MainFragments();
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return baseFragmeneInerface.onCreateView(inflater, container, 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(getContext()).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;
}
}

View File

@@ -0,0 +1,53 @@
package com.yutou.jianrmg_v2.Fragments;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.PopupMenu;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
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;
/**
* Created by 58381 on 2018/1/21.
*/
public class Test extends Fragment {
private static Test test;
private DownloadService service;
private Activity activity;
public static Test init(Activity activity){
if(test==null){
test=new Test();
}
return test;
}
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;
}
}

View File

@@ -0,0 +1,10 @@
package com.yutou.jianrmg_v2.Interfaces;
/**
* Created by 58381 on 2018/2/5.
*/
public interface DownloadFileInerface {
boolean downloading(String fileName, int current, long length);
void over(boolean isOver);
}

View File

@@ -0,0 +1,17 @@
package com.yutou.jianrmg_v2.Interfaces;
import com.yutou.jianrmg_v2.Data.TModfile;
/**
* Created by 58381 on 2018/2/2.
*/
public interface DownloadInterface {
void getDownloadList(int size);
void getDownloadFile(TModfile modfile);
void getDownloadFileSize(int size);
void getCurrent(int current);
void over();
void start();
}

View File

@@ -0,0 +1,12 @@
package com.yutou.jianrmg_v2.Interfaces;
/**
* Created by 58381 on 2018/1/20.
*/
public interface HttpInterface {
void httpGetData(String string, int code);
void httpError(Exception e);
}

View File

@@ -0,0 +1,5 @@
package com.yutou.jianrmg_v2.Interfaces;
public interface ModInterface {
void onAction(boolean flag,int type);
}

View File

@@ -7,6 +7,8 @@ import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
@@ -19,60 +21,67 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RemoteViews;
import android.widget.TextView;
import android.widget.Toast;
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 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.User;
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.ConfigUtils;
import com.yutou.jianrmg_v2.Tools.Log;
import com.yutou.jianrmg_v2.Tools.Utils;
import org.json.JSONObject;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* 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 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();
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);
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());
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){
} catch (Exception e) {
e.printStackTrace();
}
@@ -80,14 +89,15 @@ public class LoadingActivity extends AppCompatActivity {
@Override
public void httpError(Exception e) {
e.printStackTrace();
e.printStackTrace();
}
});
}catch (Exception e){
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
private void initData(){
private void initData() {
/* if(RootUtils.su()) {
RootUtils root = RootUtils.init(this);
root.exec("cp /sdcard/jianRMG/1/aaa.txt /data/data/com.huanmeng.zhanjian2/");
@@ -96,48 +106,49 @@ public class LoadingActivity extends AppCompatActivity {
}else{
Log.i("获取ROOT失败");
}*/
AssetManager manager = getResources().getAssets();
try {
String[] strs = manager.list("");
for (int i = 0; i < strs.length; i++) {
System.out.println(strs[i]);
}
String fileName;
switch (Build.CPU_ABI) {
case "armeabi-v7a":
fileName="busybox-armv7l";
break;
default: fileName="busybox-armv7l";
}
InputStream inputStream = manager.open(fileName);
//jar.createNewFile();
FileOutputStream outputStream = new FileOutputStream("/data/data/" + this.getPackageName() + "/files/busybox");
int len = 0;
byte[] bytes = new byte[inputStream.available()];
while ((len = inputStream.read(bytes)) != -1) {
outputStream.write(bytes, 0, len);
}
} catch (IOException e) {
e.printStackTrace();
}
Utils.toast(this, Build.CPU_ABI);
initGamePackName();
initConfig();
initUser();
}
private void initConfig(){
try{
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);
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){
e.printStackTrace();
}
}
@Override
public void httpError(Exception e) {
e.printStackTrace();
}
});
}catch (Exception e){
e.printStackTrace();
}
}
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){
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -147,26 +158,52 @@ public class LoadingActivity extends AppCompatActivity {
e.printStackTrace();
}
});
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
}
private void initUser(){
private void initGamePackName() {
try {
JSONObject json=new JSONObject();
json.put("token",AppData.Token);
json.put("uid",AppData.user.getId());
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) {
e.printStackTrace();
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
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"));
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){
} catch (Exception e) {
}
ready(1);
@@ -177,45 +214,48 @@ public class LoadingActivity extends AppCompatActivity {
ready(1);
}
});
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
}
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);
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();
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,"账号/密码 不能为空");
String name = uname.getText().toString();
String pass = password.getText().toString();
if (Utils.testStringIsNull(name, pass)) {
Utils.toast(LoadingActivity.this, "账号/密码 不能为空");
return;
}
login(name,pass);
login(name, pass);
}
});
}
public void start(){
Intent intent=new Intent(LoadingActivity.this,MainActivity.class);
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);
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);
@@ -224,7 +264,8 @@ public class LoadingActivity extends AppCompatActivity {
loginLayout.startAnimation(loginAnim);
}
private class MyAnimListener implements Animation.AnimationListener{
private class MyAnimListener implements Animation.AnimationListener {
@Override
public void onAnimationStart(Animation animation) {
@@ -241,22 +282,24 @@ public class LoadingActivity extends AppCompatActivity {
}
}
private int readys=0;
private void ready(int i){
readys+=i;
Log.i(readys+"");
if(readys==3){
private int readys = 0;
private synchronized void ready(int i) {
readys += i;
Log.i(readys + "");
if (readys == 3) {
handler.postDelayed(new Runnable() {
@Override
public void run() {
if(Utils.testStringIsNull(AppData.Token)){
if (Utils.testStringIsNull(AppData.Token)) {
showLogin();
}else{
} else {
start();
}
}
},0);
}, 0);
}
}
}

View File

@@ -9,10 +9,10 @@ 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 com.yutou.jianrmg_v2.Adapters.ViewPagerAdapter;
import com.yutou.jianrmg_v2.R;
import com.yutou.jianrmg_v2.Tools.ActivitysManager;
import com.yutou.jianrmg_v2.LoadingActivity;
import java.util.ArrayList;
import java.util.List;
@@ -39,10 +39,10 @@ public class MainActivity extends AppCompatActivity {
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(this));
list.add(Home.init());
list.add(GameData.init());
list.add(MGList.init());
list.add(My.init());
ViewPagerAdapter adapter=new ViewPagerAdapter(getSupportFragmentManager(),list);
viewPager.setAdapter(adapter);

View File

@@ -0,0 +1,33 @@
package com.yutou.jianrmg_v2.Network;
/**
* Created by 58381 on 2018/1/20.
*/
public class HttpApi {
// public static final String HOME_URL="http://192.168.31.240:8088/android/"; //zzz_gz wifi
public static final String HOME_URL="http://192.168.137.1:8088/android/"; //笔记本本身WIFI
// public static final String HOME_URL="http://game.yutou233.cn/android/"; //服务器
public static final String MOD_ALL="mod/all.do";
public static final String MOD_MODS="mod/getMods.do";
public static final String MOD_TYPE="mod/getType.do";
public static final String MOD_REMOD="mod/remod.do";
public static final String MOD_USER_LIST="mod/user.do";
public static final String MOD_TAG="mod/tags.do";
public static final String MOD_DOWNLOAD="mod/download.do";
public static final String MOD_GAME_PACKNAME="mod/packnames.do";
public static final String MOD_COLLCETION="mod/collection.do";
public static final String BANNER="banner/get.do";
public static final String MG_HOME_LIST="config/home.do";
public static final String MG_MG_LIST="config/mg.do";
public static final String MG_CONFIG="config/update.do";
public static final String USER_LOGIN="user/login.do";
public static final String USER_REG="user/reg.do";
public static final String USER_RELOAD="user/reload.do";
public static final String USER_LOGOUT="user/logout.do";
public static final String USER_TEST="user/test.do";
}

View File

@@ -0,0 +1,182 @@
package com.yutou.jianrmg_v2.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 org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.concurrent.TimeUnit;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
/**
* Created by 58381 on 2018/1/20.
*/
public class HttpUtils {
private static OkHttpClient client;
private static OkHttpClient getClient(){
return new OkHttpClient.Builder()
.connectTimeout(3000, TimeUnit.SECONDS)
.readTimeout(3000,TimeUnit.SECONDS).build();
}
public static void get(final String url, final HttpInterface httpInterface) {
if(client==null){
client=getClient();
}
Log.i("GET",url);
Request request = new Request.Builder().url(url).build();
Call call = client.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
httpInterface.httpError(e);
}
@Override
public void onResponse(Call call, Response response) {
try {
String http=response.body().string();
if(httpInterface!=null)
httpInterface.httpGetData(http, response.code());
Log.i(url,"接收:"+http);
}catch (Exception e){
e.printStackTrace();
}
}
});
}
public static void post(final String url, final JSONObject json, final HttpInterface httpInterface) {
if(client==null){
client=getClient();
}
Log.i("POST",url);
Request request = new Request.Builder().url(url).post(mapToBody(json)).removeHeader("User-Agent").build();
Call call = client.newCall(request);
try {
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
if(httpInterface!=null)
httpInterface.httpError(e);
e.printStackTrace();
}
@Override
public void onResponse(Call call, Response response) {
try {
String http=response.body().string();
if(httpInterface!=null)
httpInterface.httpGetData(http, response.code());
Log.i(url,"传参:"+json.toString()+" 接收:"+http);
}catch (Exception e){
e.printStackTrace();
}
}
});
}catch (Exception e){
e.printStackTrace();
}
}
public static void downloadFile(final String url, final String srcPath, final DownloadFileInerface downloadFileInerface){
if(client==null)
client=getClient();
File path=new File(srcPath);
if(!path.exists())
path.mkdirs();
Request request=new Request.Builder().url(url).build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
downloadFileInerface.over(false);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
InputStream is = null;
byte[] buf = new byte[2048];
int len = 0;
FileOutputStream fos = null;
try {
is = response.body().byteStream();
long total = response.body().contentLength();
File file = new File(srcPath, getNameFromUrl(url));
fos = new FileOutputStream(file);
long sum = 0;
while ((len = is.read(buf)) != -1) {
fos.write(buf, 0, len);
sum += len;
int progress = (int) (sum * 1.0f / total * 100);
// 下载中
/* while (!downloadFileInerface.downloading(getNameFromUrl(url),progress,total)){
Thread.sleep(10);
}*/
}
fos.flush();
// 下载完成
downloadFileInerface.over(true);
}catch (Exception e){
e.printStackTrace();
downloadFileInerface.over(false);
}
}
});
}
private static String getNameFromUrl(String url) {
return url.substring(url.lastIndexOf("/") + 1);
}
public static String getHtml(String url){
Log.i("获取网页源码:"+url);
if(client==null)
client=getClient();
Request request=new Request.Builder().url(url).build();
try {
Response response= client.newCall(request).execute();
return response.body().string();
} catch (IOException e) {
e.printStackTrace();
}
return "<html><body></body></html>";
}
private static FormBody mapToBody(JSONObject json) {
FormBody.Builder builder = new FormBody.Builder();
if (json == null) {
return builder.build();
}
Iterator<String> keys = json.keys();
while (keys.hasNext()) {
String key = keys.next();
try {
builder.add(key, json.get(key) + "");
} catch (JSONException e) {
e.printStackTrace();
}
}
builder.add("token", AppData.Token);
return builder.build();
}
}

View File

@@ -0,0 +1,88 @@
package com.yutou.jianrmg_v2.Tools;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import java.util.Stack;
/**
* Created by 58381 on 2018/1/20.
*/
public class ActivitysManager {
private static Stack<Activity> activityStack = new Stack<Activity>();
/**
* 添加Activity到堆栈
*/
public static void addActivity(Activity activity) {
activityStack.push(activity);
}
/**
* 获取当前Activity堆栈中最后一个压入的
*/
public static Activity currentActivity() {
return activityStack.lastElement();
}
/**
* 结束当前Activity堆栈中最后一个压入的
*/
public static void finishCurrentActivity() {
Activity activity = activityStack.pop();
activity.finish();
}
/**
* 结束指定的Activity
*/
public static void finishActivity(Activity activity) {
if (activity != null) {
activityStack.remove(activity);
if(!activity.isFinishing()) {
activity.finish();
}
}
}
/**
* 结束指定类名的Activity
*/
public static void finishActivity(Class<?> cls) {
for (Activity activity : activityStack) {
if (activity.getClass().equals(cls)) {
finishActivity(activity);
return;
}
}
}
/**
* 结束所有Activity
*/
public static void finishAllActivity() {
for (Activity activity : activityStack) {
if (activity != null) {
activity.finish();
}
}
activityStack.clear();
}
/**
* 退出应用程序
*/
public static void AppExit(Context context) {
try {
finishAllActivity();
ActivityManager manager = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
manager.killBackgroundProcesses(context.getPackageName());
System.exit(0);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,99 @@
package com.yutou.jianrmg_v2.Tools;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
/**
* Created by 58381 on 2018/2/18.
*/
public class ConfigUtils {
public static final String collection="collection";
public static final String token="token";
public static final String uid="uid";
public static final String user="user";
private static ConfigUtils config;
private static final String configPath="/data/data/com.yutou.jianrmg_v2/files/";
private JSONObject json;
public static ConfigUtils init(){
if(config==null){
config=new ConfigUtils();
}
return config;
}
public ConfigUtils() {
json=read();
}
private JSONObject read(){
File file=new File(configPath+"appConfig.json");
if(file.exists()){
try {
BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String tmp,str="";
while ((tmp=reader.readLine())!=null){
str+=tmp;
}
reader.close();
return new JSONObject(str);
} catch (Exception e) {
e.printStackTrace();
}
return initConfig();
}else{
try {
new File(configPath).mkdirs();
file.createNewFile();
} catch (Exception e) {
e.printStackTrace();
}
return initConfig();
}
}
private JSONObject initConfig(){
JSONObject json=new JSONObject();
try {
json.put("token","");
json.put("uid",0);
} catch (JSONException e) {
e.printStackTrace();
}
return json;
}
public boolean save(String key, Object value){
try {
File file=new File(configPath+"appConfig.json");
if(!file.exists()){
file.createNewFile();
}
json.put(key,value);
PrintWriter writer=new PrintWriter(file);
writer.println(json.toString());
writer.flush();
writer.close();
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
public Object load(String key){
try{
return json.get(key);
}catch (Exception e){
e.printStackTrace();
}
return null;
}
public void printConfig(){
Log.i("读取配置文件",json.toString());
}
}

View File

@@ -0,0 +1,61 @@
package com.yutou.jianrmg_v2.Tools;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* Created by 58381 on 2018/1/20.
*/
public class Log {
private static final boolean LOG=true;
/**
* 错误输出
* @param str 正文
*/
public static void e(String str) {
if(LOG)
System.err.println(str);
}
/**
* 普通输出
* @param str 正文
*/
public static void i(String str) {
if(LOG)
System.out.println(str);
}
/**
* 错误输出带标题
* @param title 标题
* @param str 正文
*/
public static void e(String title,String str) {
if(LOG)
System.err.println("["+title+"]"+str);
}
/**
* 普通输出带标题
* @param title 标题
* @param str 正文
*/
public static void i(String title,String str) {
if(LOG)
System.out.println("["+title+"]"+str);
}
/**
* 异常输出
* @param e 异常
* @param object 异常所在的类
* @return
*/
public static String printf_Error(Exception e,Object object) {
StringWriter writer=new StringWriter();
PrintWriter printWriter=new PrintWriter(writer);
e.printStackTrace(printWriter);
if(LOG)
System.err.println("["+object.getClass().getName()+"]"+writer.toString());
return "["+object.getClass().getName()+"]"+writer.toString();
}
}

View File

@@ -0,0 +1,443 @@
package com.yutou.jianrmg_v2.Tools;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Handler;
import android.os.IBinder;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
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.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 org.json.JSONObject;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import me.drakeet.materialdialog.MaterialDialog;
/**
* Created by 58381 on 2018/2/2.
*/
public class ModUtils {
public static final int MOD_INSTALL = 1;
public static final int MOD_BACKUP = 2;
public static final int MOD_UNINSTALL = 3;
private static final String TAG = "ModUtils";
private static ModUtils modUtils;
private Context context;
private Handler handler;
private List<TModfile> modfiles;
private KProgressHUD hud;
private TMod mod;
public static ModUtils init(Context context) {
if (modUtils == null) {
modUtils = new ModUtils();
}
modUtils.setContext(context);
return modUtils;
}
private void setContext(Context context) {
this.context = context;
hud = Utils.showLoading(context, "安装中", "请稍后");
}
private ModUtils() {
handler = new Handler();
}
public void setMod(TMod mod) {
this.mod = mod;
getModDownloadInfo();
}
public List<TModfile> getModfiles() {
return modfiles;
}
public void installMod(TMod mod, ModInterface modInterface) {
this.mod = mod;
if (modInterface == null) {
modInterface = new ModInterface() {
@Override
public void onAction(boolean flag, int type) {
}
};
}
install(modInterface);
}
private void install(ModInterface modInterface) {
if (modfiles == null) {
Toast.makeText(context, "正在加载数据,请稍后再试", Toast.LENGTH_LONG).show();
getModDownloadInfo();
return;
}
Log.i("安装mod", changeMod(mod, modfiles) + "");
if (!isInstallMod(mod) && changeMod(mod, modfiles)) {
install(mod, modInterface);
} else {
if (getModPath(mod).listFiles().length > 0 && !changeMod(mod, modfiles)) {
final MaterialDialog dialog = new MaterialDialog(context);
dialog.setTitle("mod已损失");
dialog.setMessage("当前mod文件有缺失是否重新下载");
dialog.setPositiveButton("确定", new View.OnClickListener() {
@Override
public void onClick(View view) {
downloadMod();
dialog.dismiss();
}
});
dialog.setNegativeButton("算了", new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.show();
} else {
downloadMod();
}
}
}
private void install(final TMod mod, final ModInterface modInterface) {
List<String> clientList = new ArrayList<>();
for (MGamePackname packname : AppData.packnames) {
clientList.add(packname.getZhname() + "(" + packname.getPackname() + ")");
}
final MaterialDialog dialog = new MaterialDialog(context);
dialog.setTitle("选择安装客户端");
ListView listView = new ListView(context);
listView.setAdapter(new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, clientList));
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
MGamePackname packname = AppData.packnames.get(i);
hud.show();
boolean isRoot = false;
for (TModfile modfile : modfiles) {
File file = getModPath(mod, modfile.getFilename());
if (packname.getZhname().contains("[ROOT]")) {
if (!RootUtils.su()) {
hud.dismiss();
final MaterialDialog dialog = new MaterialDialog(context);
dialog.setTitle("错误");
dialog.setMessage("未获取到ROOT权限\n提示魔改专用端可免ROOT使用魔改以及更多功能");
dialog.setPositiveButton("确定", new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.setNegativeButton("下载魔改专用客户端", new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.show();
modInterface.onAction(false, MOD_INSTALL);
return;
}
isRoot = true;
backupOrRoot(file, "/data/data/" + packname.getPackname() + modfile.getInstallpathid(), packname.getPackname(), mod);
rootInstall(file, "/data/data/" + packname.getPackname() + modfile.getInstallpathid());
} else {
isRoot = false;
Log.i(TAG, "免ROOT安装");
notRootInstall(file, Utils.getSDCardPath() + "Android/data/" + packname.getPackname() + modfile.getInstallpathid());
}
}
try {
new File(getModInstallPath(mod) + packname.getPackname() + ".lock").createNewFile();
JSONObject json = new JSONObject();
json.put("root", isRoot);
json.put("packname", packname.getPackname());
json.put("zhname", packname.getZhname());
Utils.writerFile(getModInstallPath(mod) + packname.getPackname() + ".lock", json.toString());
} catch (Exception e) {
e.printStackTrace();
}
hud.dismiss();
dialog.dismiss();
Toast.makeText(context, "安装成功,重启游戏生效", Toast.LENGTH_LONG).show();
modInterface.onAction(true, MOD_INSTALL);
}
});
dialog.setContentView(listView);
dialog.setPositiveButton("放弃", new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.show();
}
private boolean notRootInstall(File src, String path) {
if (src.exists()) {
boolean flag = Utils.copyFile(src.getAbsolutePath(), path, true);
return flag;
} else {
Log.i(TAG, "找不到文件:" + src.getAbsolutePath());
}
return false;
}
private boolean rootInstall(File src, String path) {
RootUtils root = RootUtils.init(context);
if (RootUtils.su()) {
File tmpFile=new File("/data/data/"+context.getPackageName()+"/mods/");
if(!tmpFile.getParentFile().exists())
tmpFile.getParentFile().mkdirs();
if(tmpFile.exists())
tmpFile.delete();
Utils.copyFile(src.getAbsolutePath(),tmpFile.getAbsolutePath(),true);
root.exec("mkdir -p "+path);
root.exec("cp -f " + tmpFile.getAbsolutePath()+"/"+src.getName() + " " + path);
root.exec("chmod 777 " + path + src.getName());
}
return true;
}
public void reBackMod(TMod tMod, final ModInterface modInterface) {
final MaterialDialog dialog = new MaterialDialog(context);
dialog.setTitle("将还原 " + tMod.getTitle());
final List<MGamePackname> clientList = getInstallClens();
List<String> titles = new ArrayList<>();
for (MGamePackname packname : clientList) {
titles.add("[" + (packname.isRoot() ? "ROOT" : "免ROOT") + "]" + packname.getZhname());
}
ListView listView = new ListView(context);
listView.setAdapter(new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, titles));
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
if (clientList.get(i).isRoot()) {
RootUtils root = RootUtils.init(context);
for (TModfile modfile : modfiles) {
if (getModPath(mod, "backup/" + clientList.get(i).getPackname() + "/" + modfile.getFilename()).exists()) {
root.exec("cp -f " + getModInstallPath(mod) + "backup/" + clientList.get(i).getPackname() + "/" + modfile.getFilename() + " " + "/data/data/" + clientList.get(i).getPackname() + modfile.getInstallpathid());
} else {
root.exec("rm -f " + "/data/data/" + clientList.get(i).getPackname() + modfile.getInstallpathid() + modfile.getFilename());
}
}
} else {
for (TModfile modfile : modfiles) {
String filePath = Utils.getSDCardPath() + "Android/data/" + clientList.get(i).getPackname() + modfile.getInstallpathid() + modfile.getFilename();
Log.i(TAG, "删除:" + filePath);
File file = new File(filePath);
if (file.exists()) {
file.delete();
}
}
}
new File(getModPath(mod).getAbsolutePath() + "/" + clientList.get(i).getPackname() + ".lock").delete();
if (modInterface != null)
modInterface.onAction(true, MOD_UNINSTALL);
dialog.dismiss();
}
});
dialog.setContentView(listView);
dialog.setNegativeButton("放弃", new View.OnClickListener() {
@Override
public void onClick(View view) {
if (modInterface != null)
modInterface.onAction(false, MOD_UNINSTALL);
dialog.dismiss();
;
}
});
dialog.show();
}
private void backupOrRoot(File srcFile, String srcPath, String backupClient, TMod mod) {
RootUtils root = RootUtils.init(context);
if (RootUtils.su()) {
File backup = getModPath(mod, "backup/" + backupClient);
File file = new File(backup.getAbsolutePath() + "/" + srcFile.getName());
if (file.exists()) {
return;
}
if (!backup.exists()) {
Log.i("获取ROOT", "2");
backup.mkdirs();
}
File tmpFile=new File("/data/data/"+context.getPackageName()+"/mods/"+srcFile.getName());
if(tmpFile.exists())
tmpFile.delete();
tmpFile.getParentFile().mkdirs();
root.exec("mkdir -p "+srcPath);
root.exec("chmod 7777 " + srcPath + srcFile.getName());
root.exec("cp -f " + srcPath + srcFile.getName() + " " + tmpFile);
root.println("cp -f "+tmpFile.getAbsolutePath()+" "+backup.getAbsolutePath());
} else {
}
}
private void downloadMod() {
Toast.makeText(context, "开始下载", Toast.LENGTH_LONG).show();
Intent intent = new Intent(context.getApplicationContext(), DownloadService.class);
intent.setPackage(context.getPackageName());
boolean isBindService = context.getApplicationContext().bindService(intent, new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
DownloadService.ServiceBinder binder = (DownloadService.ServiceBinder) iBinder;
DownloadService service = binder.getService(new DownloadInterface() {
@Override
public void getDownloadList(int size) {
}
@Override
public void getDownloadFile(TModfile modfile) {
}
@Override
public void getDownloadFileSize(int size) {
}
@Override
public void getCurrent(int current) {
}
@Override
public void over() {
}
@Override
public void start() {
}
});
service.start(modfiles);
}
@Override
public void onServiceDisconnected(ComponentName componentName) {
Log.i("下载服务", "绑定失败:" + componentName);
}
}, Context.BIND_AUTO_CREATE);
Log.i("绑定下载:", isBindService + "");
}
private void getModDownloadInfo() {
modfiles = null;
try {
JSONObject json = new JSONObject();
json.put("mid", mod.getId());
json.put("uid", AppData.user.getId());
HttpUtils.post(HttpApi.HOME_URL + HttpApi.MOD_DOWNLOAD, json, new HttpInterface() {
@Override
public void httpGetData(String string, int code) {
try {
JSONObject json = new JSONObject(string);
if (json.getInt("code") == 100) {
modfiles = JSON.parseArray(json.getJSONArray("data").toString(), TModfile.class);
}
} catch (Exception e) {
}
}
@Override
public void httpError(Exception e) {
}
});
} catch (Exception e) {
}
}
public static String getModInstallPath(TMod mod) {
return Utils.getAppPath() + "/" + mod.getId() + "/";
}
public static boolean isInstallMod(TMod mod) {
File modPath = new File(Utils.getAppPath() + "/" + mod.getId() + "/");
for (int i = 0; i < modPath.listFiles().length; i++) {
Log.i("检测mod是否安装", "位置:" + modPath.listFiles()[i].getAbsolutePath() + " exists:" + modPath.listFiles()[i].exists() + " .lock=" + (modPath.listFiles()[i].getName().contains(".lock")));
if (modPath.listFiles()[i].getName().contains(".lock")) {
return true;
}
}
return false;
}
public static boolean changeMod(TMod mod, List<TModfile> modfiles) {
for (TModfile modfile : modfiles) {
if (!new File(Utils.getAppPath() + "/" + mod.getId() + "/" + modfile.getFilename()).exists()) {
Log.i(TAG,"mod不完整:"+Utils.getAppPath() + "/" + mod.getId() + "/" + modfile.getFilename());
Log.i(TAG,JSON.toJSONString(modfile));
return false;
}
}
return true;
}
public static File getModPath(TMod mod) {
return getModPath(mod, "");
}
public static File getModPath(TMod mod, String name) {
File path = new File(Utils.getAppPath() + "/" + mod.getId() + "/" + name);
if (!path.exists()) {
path.mkdirs();
}
return path;
}
public List<MGamePackname> getInstallClens() {
List<MGamePackname> installClens = new ArrayList<>();
File modPath = getModPath(mod);
if (modPath.exists()) {
for (int i = 0; i < modPath.listFiles().length; i++) {
if (modPath.listFiles()[i].getName().contains(".lock")) {
Log.i(TAG, modPath.listFiles()[i].getName().split("\\.lock")[0]);
installClens.add(JSON.parseObject(Utils.readFile(modPath.listFiles()[i].getAbsolutePath()), MGamePackname.class));
}
}
}
return installClens;
}
}

View File

@@ -0,0 +1,117 @@
package com.yutou.jianrmg_v2.Tools;
import android.content.Context;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
/**
* Created by 58381 on 2018/2/6.
*/
public class RootUtils {
private Context context;
private static RootUtils rootUtils;
private Runtime localProcess;
private Process process;
private DataOutputStream stream;
private int exitValue;
public static RootUtils init(Context context){
if(rootUtils==null){
rootUtils=new RootUtils(context);
rootUtils.init();
rootUtils.println("chmod 7777 /data/data/com.yutou.jianrmg_v2/files/busybox");
}
return rootUtils;
}
private void init(){
try {
localProcess = Runtime.getRuntime();
process= localProcess.exec("su\n");
stream=new DataOutputStream(process.getOutputStream());
}catch (Exception e){
e.printStackTrace();
}
}
private RootUtils(Context context) {
this.context = context;
}
private static int isRoot=0;
public static boolean su(){
if(isRoot!=0){
if(isRoot==1){
return true;
}else{
return false;
}
}
try {
Process localProcess = Runtime.getRuntime().exec("su\n");
Object localObject = localProcess.getOutputStream();
DataOutputStream localDataOutputStream = new DataOutputStream(
(OutputStream) localObject);
localDataOutputStream.writeBytes("echo test\n");
localDataOutputStream.flush();
localDataOutputStream.writeBytes("exit\n");
localDataOutputStream.flush();
int result =localProcess.waitFor();
localDataOutputStream.close();
localProcess.exitValue();
if (result == 0) {
isRoot=1;
return true;
}
else {
isRoot=-1;
return false;
}
} catch (Exception e) {
e.printStackTrace();
}
isRoot=-1;
return false;
}
public boolean exec(String exec){
try {
exec="./data/data/"+context.getPackageName()+"/files/busybox "+exec;
Log.i("ROOT",exec);
stream.writeBytes(exec+"\n");
stream.flush();
}catch (Exception e) {
e.printStackTrace();;
return false;
}
return true;
}
public boolean println(String exec) {
try {
// exec="./data/data/"+context.getPackageName()+"/files/busybox-armv6l "+exec;
Log.i("ROOT",exec);
Process process=localProcess.exec(exec+"\n");
BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream()));
String str="",tmp;
List<String> list=new ArrayList<>();
while ((tmp=reader.readLine())!=null){
//str+=tmp;
list.add(tmp);
}
reader.close();
for (String string : list) {
Log.i("ROOT get",string);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}

View File

@@ -0,0 +1,220 @@
package com.yutou.jianrmg_v2.Tools;
import android.app.Activity;
import android.content.Context;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import android.widget.Toast;
import com.kaopiz.kprogresshud.KProgressHUD;
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.yutou.jianrmg_v2.R;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Created by 58381 on 2018/1/20.
*/
public class Utils {
private static final String TAG = "Utils";
public static int getPixelsFromDp(Activity activity, int size) {
DisplayMetrics metrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
return (size * metrics.densityDpi) / DisplayMetrics.DENSITY_DEFAULT;
}
public static void toast(Context context, String str) {
Toast.makeText(context, str, Toast.LENGTH_LONG).show();
}
public static void setImmersion(Activity activity) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
public static String getSDCardPath() {
String path = Environment.getExternalStorageDirectory().getPath() + "/";
return path;
}
public static String getAppPath() {
String path = Environment.getExternalStorageDirectory().getPath() + "/jianRMG";
return path;
}
private static DisplayImageOptions initDisplayOptions() {
DisplayImageOptions.Builder displayImageOptionsBuilder = new DisplayImageOptions.Builder();
displayImageOptionsBuilder.cacheInMemory(false);
displayImageOptionsBuilder.cacheOnDisk(true);
displayImageOptionsBuilder.showImageForEmptyUri(R.drawable.ic_launcher_background);
return displayImageOptionsBuilder.build();
}
public static ImageLoader initImageLoader(Context context) {
ImageLoader imageLoader = ImageLoader.getInstance();
ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(context);
File cachePath = new File(getAppPath() + "/cache/");
if (!cachePath.exists()) {
cachePath.exists();
}
//builder.memoryCache(new WeakMemoryCache());
builder.diskCache(new UnlimitedDiskCache(cachePath));
builder.defaultDisplayImageOptions(initDisplayOptions());
imageLoader.init(builder.build());
return imageLoader;
}
public static <T> List<T> ListRemoveNull(List<T> list) {
list.removeAll(Collections.singleton(null));
return list;
}
public static KProgressHUD showLoading(Context context, String title, String text) {
if (text == null) {
text = "载入中";
}
if (title == null) {
title = "请稍后";
}
KProgressHUD hud = KProgressHUD.create(context)
.setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)
.setLabel(title)
.setDetailsLabel(text)
.setCancellable(false)
.setAnimationSpeed(2)
.setDimAmount(0.5f);
return hud;
}
public static boolean testStringIsNull(String... strings) {
for (String string : strings) {
if (null == string || "".equals(string) || string.length() == 0) {
return true;
}
}
return false;
}
/**
* 复制单个文件
*
* @param srcFileName 待复制的文件名
* @param destFileName 目标文件名
* @param overlay 如果目标文件存在,是否覆盖
* @return 如果复制成功返回true否则返回false
*/
public static boolean copyFile(String srcFileName, String destFileName,
boolean overlay) {
File srcFile = new File(srcFileName);
String MESSAGE = "";
// 判断源文件是否存在
if (!srcFile.exists()) {
MESSAGE = "源文件:" + srcFileName + "不存在!";
Log.i(TAG, MESSAGE);
return false;
} else if (!srcFile.isFile()) {
MESSAGE = "复制文件失败,源文件:" + srcFileName + "不是一个文件!";
Log.i(TAG, MESSAGE);
return false;
}
// 判断目标文件是否存在
File destFile = new File(destFileName);
// 如果目标文件所在目录不存在,则创建目录
Log.i(TAG,"目标文件夹:"+destFileName+" exists:"+destFile.exists());
if (!destFile.exists()) {
// 目标文件所在目录不存在
Log.i(TAG,"目标文件所在目录不存在"+destFile.getAbsolutePath());
if (!destFile.mkdirs()) {
// 复制文件失败:创建目标文件所在目录失败
Log.i(TAG, " 复制文件失败:创建目标文件所在目录失败:" + destFileName);
return false;
}
}
// 复制文件
int byteread = 0; // 读取的字节数
InputStream in = null;
OutputStream out = null;
try {
in = new FileInputStream(srcFile);
out = new FileOutputStream(destFile+"/"+srcFile.getName());
byte[] buffer = new byte[1024];
while ((byteread = in.read(buffer)) != -1) {
out.write(buffer, 0, byteread);
}
return true;
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
} catch (IOException e) {
e.printStackTrace();
return false;
} finally {
try {
if (out != null)
out.close();
if (in != null)
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static boolean writerFile(String srcFile,String data){
File file=new File(srcFile);
if(!file.exists()){
return false;
}
try {
PrintWriter writer=new PrintWriter(file);
writer.write(data);
writer.flush();
writer.close();
return true;
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return false;
}
public static String readFile(String srcFile){
File file=new File(srcFile);
if(!file.exists()){
return null;
}
try {
BufferedReader reader=new BufferedReader(new FileReader(file));
String tmp,str="";
while ((tmp=reader.readLine())!=null){
str+=tmp;
}
return str;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@@ -0,0 +1,187 @@
package com.yutou.jianrmg_v2.services;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import android.widget.RemoteViews;
import android.widget.Toast;
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 java.util.ArrayList;
import java.util.List;
public class DownloadService extends Service {
private List<TModfile> list;
private DownloadInterface downloadInterface;
private NotificationManager notificationManager;
private String BUTTON_CLICK="com.yutou.jianrmg.download.notification.button";
private Download download;
private RemoteViews views;
private Notification notification;
private boolean puase=false;
public class ServiceBinder extends Binder{
public DownloadService getService(DownloadInterface downloadInterface){
DownloadService.this.downloadInterface=downloadInterface;
return DownloadService.this;
}
}
public DownloadService() {
list=new ArrayList<>();
}
private ServiceBinder binder=new ServiceBinder();
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
return binder;
}
public void setFiles(List<TModfile> list){
this.list=list;
}
public void setInterface(DownloadInterface downloadInterface){
this.downloadInterface=downloadInterface;
}
public int getDownloadList(){
return list.size();
}
public void start(List<TModfile> addList){
Log.i("启动下载服务");
puase=false;
list.addAll(addList);
downloadInterface.start();
startNotification();
download= new Download(this);
}
public void pause(){
puase=!puase;
}
private void startNotification(){
IntentFilter filter=new IntentFilter();
filter.addAction(BUTTON_CLICK);
registerReceiver(receiver,filter);
Intent intent=new Intent(BUTTON_CLICK);
PendingIntent buttonIntent=PendingIntent.getBroadcast(this,1,intent,PendingIntent.FLAG_UPDATE_CURRENT);
views=new RemoteViews(getPackageName(),R.layout.notification_download_layout);
views.setTextViewText(R.id.title,"开始下载");
views.setOnClickPendingIntent(R.id.button,buttonIntent);
views.setImageViewResource(R.id.imageView, R.mipmap.ic_launcher);
notificationManager= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification.Builder builder=new Notification.Builder(getApplicationContext());
builder.setTicker("开始下载");
builder.setContentTitle("正在下载");
builder.setContent(views);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder.setVisibility(Notification.VISIBILITY_PUBLIC);
}
//通知栏显示图标
builder.setSmallIcon(R.drawable.icon_download);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel=new NotificationChannel("channel_1","Message",NotificationManager.IMPORTANCE_HIGH);
builder.setChannelId(channel.getId());
notificationManager.createNotificationChannel(channel);
}
notification = builder.build();
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(1,notification);
Utils.toast(getApplicationContext(),"展示通知栏");
}
private BroadcastReceiver receiver=new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.i("点击按钮");
puase=!puase;
}
};
private class Download extends Thread{
private Download download;
private DownloadService service;
private boolean isAlive=false,downloading=false;
public Download(DownloadService service){
download=this;
download.init(service);
}
private void init(DownloadService service){
if(!download.isAlive||!download.isAlive()||!download.isInterrupted())
{
this.service=service;
start();
}
}
@Override
public void run() {
super.run();
isAlive=true;
Log.i("准备下载");
while (service.list.size()>0){
if(downloading){
continue;
}
Log.i("开始下载:"+(downloading));
downloading=true;
final TModfile modfile=service.list.get(service.list.size()-1);
service.downloadInterface.getDownloadList(service.list.size());
Log.i("下载地址",modfile.getServiceurl());
HttpUtils.downloadFile(modfile.getServiceurl(), Utils.getAppPath() + "/" + modfile.getMid() + "/", new DownloadFileInerface() {
@Override
public boolean downloading(String fileName, int current, long length) {
service.views.setTextViewText(R.id.title,"正在下载:"+modfile.getFilename()+"("+length/1024+"kb)");
service.views.setProgressBar(R.id.progressBar, 100,current,false);
if(service.puase){
service.views.setTextViewText(R.id.button,"下载");
}else{
service.views.setTextViewText(R.id.button,"暂停");
}
service.notificationManager.notify(1,service.notification);
if(service.puase){
return false;
}else{
return true;
}
}
@Override
public void over(boolean isOver) {
if(isOver){
service.list.remove(modfile);
}
downloading=false;
}
});
}
service.views.setTextViewText(R.id.title,"全部下载完成");
service.views.setProgressBar(R.id.progressBar,10,10,false);
service.notificationManager.notify(1,service.notification);
service.downloadInterface.over();
isAlive=false;
Log.i("下载结束");
}
}
}

View File

@@ -0,0 +1,86 @@
package com.yutou.jianrmg_v2.views;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.LinearLayout;
import com.yutou.jianrmg_v2.Data.AppData;
import com.yutou.jianrmg_v2.R;
import Interfaces.BaseActivityInterface;
import dalvik.system.DexClassLoader;
public class BaseActivity extends AppCompatActivity {
private BaseActivityInterface activityInterface;
private LinearLayout main_layut;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_base);
setTitle(R.string.app_name);
main_layut=findViewById(R.id.main_layut);
String baseActivityName=getIntent().getStringExtra("activityName");
String jar=getIntent().getStringExtra("jar");
DexClassLoader dexClassLoader= AppData.plugsin.get(jar);
try {
activityInterface= (BaseActivityInterface) dexClassLoader.loadClass(baseActivityName).newInstance();
} catch (Exception e) {
e.printStackTrace();
}
activityInterface.onCreate(savedInstanceState,main_layut,this,getIntent());
}
@Override
protected void onRestart() {
activityInterface.onRestart();
super.onRestart();
}
@Override
protected void onPause() {
activityInterface.onPause();
super.onPause();
}
@Override
protected void onResume() {
activityInterface.onResume();
super.onResume();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
boolean tmp=activityInterface.onKeyDown(keyCode,event);
if(tmp){
return tmp;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
boolean tmp=activityInterface.onKeyUp(keyCode, event);
if(tmp) {
return tmp;
}
return super.onKeyUp(keyCode,event);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean tmp=activityInterface.onTouchEvent(event);
if(tmp)
return tmp;
return super.onTouchEvent(event);
}
@Override
protected void onDestroy() {
activityInterface.onDestroy();
super.onDestroy();
}
}

View File

@@ -0,0 +1,85 @@
package com.yutou.jianrmg_v2.views;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
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.Utils;
import com.yutou.jianrmg_v2.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.Serializable;
import Interfaces.BaseActivityInterface;
public class DownloadListActivity extends AppCompatActivity {
private Context context;
private ListView listView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_download_list);
this.context = this;
getDownloadFileList();
initViews();
}
private void getDownloadFileList(){
JSONObject json=new JSONObject();
File rootPath=new File(Utils.getAppPath());
try{
JSONArray array=new JSONArray();
for (File path : rootPath.listFiles()) {
if (path.isDirectory()){
try {
array.put(Integer.valueOf(path.getName())+"");
}catch (Exception e){}
}
}
json.put("ids",array);
HttpUtils.post(HttpApi.HOME_URL + HttpApi.MOD_MODS, json, new HttpInterface() {
@Override
public void httpGetData(String string, int code) {
try {
JSONObject json=new JSONObject(string);
if(json.getInt("code")!=100){
return;
}
JSONArray dataList=json.getJSONArray("data");
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void httpError(Exception e) {
}
});
}catch (Exception e){}
return;
}
private void initViews(){
listView=findViewById(R.id.listView);
}
}

View File

@@ -0,0 +1,297 @@
package com.yutou.jianrmg_v2.views;
import android.app.Activity;
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.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.yutou.jianrmg_v2.Adapters.ReModListAdapter;
import com.yutou.jianrmg_v2.Data.AppData;
import com.yutou.jianrmg_v2.Data.TMod;
import com.yutou.jianrmg_v2.Data.TModtag;
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 org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import Interfaces.BaseActivityInterface;
import cn.droidlover.xrichtext.XRichText;
/**
* Created by 58381 on 2018/1/26.
*/
public class ModActivity extends AppCompatActivity{
private TMod tMod;
private ImageView modImage, icon, collection_img;
private TextView title, by, downloadText;
private XRichText richText;
private LinearLayout tagsLayout;
private FrameLayout collection, share, download;
private ListView quote;
private ImageLoader imageLoader;
private Handler handler;
private ModUtils modUtils;
private List<TMod> remods;
private Context context;
private Intent intent;
private static final String TAG="ModActivity";
public ModActivity(){
Log.i("初始化mod列表");
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mod);
intent=getIntent();
tMod = JSON.parseObject(intent.getStringExtra("mod"), TMod.class);
context=this;
imageLoader = Utils.initImageLoader(context);
handler = new Handler();
modUtils = ModUtils.init(context);
modUtils.setMod(tMod);
initViews();
initData(tMod);
initTags(tMod.getId());
getRemod();
}
private void initViews() {
modImage = findViewById(R.id.ModImage);
icon = findViewById(R.id.icon);
collection_img = findViewById(R.id.collection_img);
title = findViewById(R.id.title);
by = findViewById(R.id.by);
richText =findViewById(R.id.richText);
tagsLayout = findViewById(R.id.tags);
collection = findViewById(R.id.collection);
share = findViewById(R.id.share);
download = findViewById(R.id.download);
downloadText = download.findViewById(R.id.downloadText);
quote = findViewById(R.id.quote);
}
private void initData(final TMod tMod) {
imageLoader.displayImage(AppData.appConfig.getDownloadhome() + tMod.getImage(), modImage);
imageLoader.displayImage(AppData.appConfig.getDownloadhome() + tMod.getIcon(), icon);
title.setText(tMod.getTitle());
by.setText("@" + tMod.getByuser());
richText.text(tMod.getInfo());
downloadText.setTag(0);
if (ModUtils.getModPath(tMod).listFiles().length > 0) {
downloadText.setText("安装");
downloadText.setTag(2);
}
if(ModUtils.isInstallMod(tMod)){
downloadText.setText("还原");
downloadText.setTag(1);
}
download.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
downloadButtonClick();
}
});
collection.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Utils.testStringIsNull(AppData.Token)) {
Utils.toast(context, "登录状态未知,请登录哦");
return;
}
try {
JSONObject json = new JSONObject();
json.put("uid", AppData.user.getId());
json.put("mid", tMod.getId() + "");
HttpUtils.post(HttpApi.HOME_URL + HttpApi.MOD_COLLCETION, json, new HttpInterface() {
private String state = "收藏失败,未知错误";
@Override
public void httpGetData(String string, int code) {
try {
JSONObject json = new JSONObject(string);
if (json.getInt("code") == 100) {
switch (json.getInt("data")) {
case 0:
state = "收藏失败";
break;
case 1:
state = "收藏成功";
break;
case -1:
state = "提督您已经收藏过了哦";
break;
}
}
} catch (Exception e) {
}
handler.post(new Runnable() {
@Override
public void run() {
if (state.equals("收藏成功")) {
collection_img.setImageResource(R.drawable.icon_collection_ok);
}
Utils.toast(context, state);
}
});
}
@Override
public void httpError(Exception e) {
}
});
} catch (Exception e) {
}
}
});
}
private void getRemod() {
remods = new ArrayList<>();
try {
JSONObject json = new JSONObject();
json.put("mid", tMod.getId());
json.put("remid", tMod.getRemod());
HttpUtils.post(HttpApi.HOME_URL + HttpApi.MOD_REMOD, json, new HttpInterface() {
@Override
public void httpGetData(String string, int code) {
try {
JSONObject json = new JSONObject(string);
if (json.getInt("code") == 100) {
remods = JSON.parseArray(json.getJSONArray("data").toString(), TMod.class);
}
handler.post(new Runnable() {
@Override
public void run() {
ReModListAdapter adapter = new ReModListAdapter(context, remods);
quote.setAdapter(adapter);
}
});
} catch (Exception e) {
}
}
@Override
public void httpError(Exception e) {
}
});
} catch (Exception e) {
}
}
private void downloadButtonClick() {
switch (((int) downloadText.getTag())) {
case -1:
break;
case 1:
modUtils.reBackMod(tMod,new ModInterface(){
@Override
public void onAction(boolean flag, int type) {
Log.i(TAG,"还原mod"+flag);
}
});
break;
case 0:
case 2:
modUtils.installMod(tMod,new ModInterface(){
@Override
public void onAction(boolean flag, int type) {
Log.i(TAG,"安装mod:"+flag);
}
});
break;
}
}
private void initTags(int mid) {
try {
JSONObject json = new JSONObject();
json.put("mid", mid);
HttpUtils.post(HttpApi.HOME_URL + HttpApi.MOD_TAG, json, new HttpInterface() {
List<TModtag> tags;
@Override
public void httpGetData(String string, int code) {
Log.i(HttpApi.MOD_TAG, string);
try {
JSONObject json = new JSONObject(string);
if (json.getInt("code") == 100) {
tags = JSON.parseArray(json.getJSONArray("data").toString(), TModtag.class);
handler.post(new Runnable() {
@Override
public void run() {
for (TModtag tag : tags) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(Utils.getPixelsFromDp(((Activity)context), 50), Utils.getPixelsFromDp(((Activity)context), 15));
params.setMargins(Utils.getPixelsFromDp(((Activity)context), 10), 0, 0, 0);
Button button = new Button(context);
button.setText(tag.getTag());
button.setTextSize(8);
button.setBackgroundResource(R.drawable.frame_button);
button.setLayoutParams(params);
tagsLayout.addView(button);
}
}
});
}
} catch (Exception e) {
}
}
@Override
public void httpError(Exception e) {
}
});
} catch (Exception e) {
}
}
}

View File

@@ -0,0 +1,86 @@
package com.yutou.jianrmg_v2.views;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import com.alibaba.fastjson.JSON;
import com.yutou.jianrmg_v2.Adapters.ViewPagerAdapter;
import com.yutou.jianrmg_v2.Data.MAppMg;
import com.yutou.jianrmg_v2.Fragments.ModListFragment_0;
import com.yutou.jianrmg_v2.Fragments.ModListFragment_1;
import com.yutou.jianrmg_v2.Fragments.ModListFragment_2;
import com.yutou.jianrmg_v2.R;
import com.yutou.jianrmg_v2.Tools.Log;
import java.util.ArrayList;
import java.util.List;
import me.majiajie.pagerbottomtabstrip.NavigationController;
import me.majiajie.pagerbottomtabstrip.PageNavigationView;
import me.majiajie.pagerbottomtabstrip.listener.OnTabItemSelectedListener;
/**
* Created by 58381 on 2018/1/25.
*/
public class ModListActivity extends AppCompatActivity{
private PageNavigationView tab;
private ViewPager viewPager;
private NavigationController navigationController;
private List<Fragment> list;
private MAppMg appMg;
private Context context;
private Intent intent;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mod_list);
this.context = context;
intent=getIntent();
appMg = JSON.parseObject(intent.getStringExtra("mg"), MAppMg.class);
Log.i("接受到的魔改:" + appMg.toString());
initViews();
}
private void initViews() {
tab = findViewById(R.id.tab);
viewPager = findViewById(R.id.pager);
list=new ArrayList<>();
list.add(ModListFragment_0.init(appMg));
list.add(ModListFragment_1.init(appMg));
list.add(ModListFragment_2.init(appMg));
ViewPagerAdapter adapter=new ViewPagerAdapter(getSupportFragmentManager(),list);
viewPager.setAdapter(adapter);
viewPager.setCurrentItem(0);
navigationController = tab.material()
.addItem(R.drawable.icon_mod_new, "最新")
.addItem(R.drawable.icon_mod_lh,"仅立绘")
.addItem(R.drawable.icon_mod_q,"仅Q版")
.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);
}
}

View File

@@ -0,0 +1,71 @@
package com.yutou.jianrmg_v2.views;
import android.net.http.SslError;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.yutou.jianrmg_v2.R;
import com.yutou.jianrmg_v2.Tools.Log;
/**
* Created by 58381 on 2018/3/14.
*/
public class WebActivity extends AppCompatActivity{
private WebView webView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web);
initView();
initWeb();
String url=getIntent().getStringExtra("url");
if(url==null)
url="http://www.jianrmod.cn";
Log.i("网页URL",url);
webView.loadUrl(url);
}
private void initView(){
webView=findViewById(R.id.webView);
}
private void initWeb(){
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setUseWideViewPort(true);
settings.setAppCacheEnabled(true);
settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
super.onReceivedSslError(view, handler, error);
handler.proceed();
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
Log.i("加载完成",url);
WebActivity.this.setTitle(view.getTitle());
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
Log.i("即将打开1" + request.getUrl());
return super.shouldOverrideUrlLoading(view, request);
}
});
}
}