init
This commit is contained in:
1
MgListModel/.gitignore
vendored
Normal file
1
MgListModel/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
52
MgListModel/build.gradle
Normal file
52
MgListModel/build.gradle
Normal file
@@ -0,0 +1,52 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
|
||||
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation 'com.android.support:appcompat-v7:26.1.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.1'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
|
||||
//图片流缓存
|
||||
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
|
||||
//FastJson
|
||||
implementation 'com.alibaba:fastjson:1.2.41'
|
||||
//滑动Tabs
|
||||
implementation 'com.ogaclejapan.smarttablayout:library:1.6.1@aar'
|
||||
implementation 'com.ogaclejapan.smarttablayout:utils-v13:1.6.1@aar'
|
||||
//底端菜单
|
||||
implementation 'me.majiajie:pager-bottom-tab-strip:2.2.5'
|
||||
//富文本编辑器
|
||||
implementation 'com.github.louisgeek:LouisMultiLineEditText:v1.0.0'
|
||||
//富文本
|
||||
implementation 'com.github.limedroid:XRichText:v1.0.0'
|
||||
//富文本
|
||||
implementation 'com.github.limedroid:XRichText:v1.0.0'
|
||||
compile project(path: ':BaseModel')
|
||||
compile project(path: ':ResModl')
|
||||
compile project(path: ':RefreshRecyclerView')
|
||||
}
|
||||
21
MgListModel/proguard-rules.pro
vendored
Normal file
21
MgListModel/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
6
MgListModel/src/main/AndroidManifest.xml
Normal file
6
MgListModel/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.yutou.jianrmg_v2.mglistmodel" >
|
||||
<application>
|
||||
<activity android:name="views.Test"/>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,31 @@
|
||||
package Interfaces;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
|
||||
/**
|
||||
* Created by 58381 on 2018/2/27.
|
||||
*/
|
||||
|
||||
public interface BaseActivityInterface {
|
||||
void onCreate(Bundle savedInstanceState, LinearLayout layout, Context context,Intent intent);
|
||||
void onRestart();
|
||||
void onResume();
|
||||
void onPause();
|
||||
void onDestroy();
|
||||
void getIntent(Intent intent);
|
||||
boolean onKeyDown(int keyCode, KeyEvent event);
|
||||
boolean onKeyUp(int keyCode, KeyEvent event);
|
||||
boolean onTouchEvent(MotionEvent event);
|
||||
Data getData();
|
||||
class Data{
|
||||
private String type;
|
||||
private String url;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package Interfaces;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
public interface BaseFragmeneInerface {
|
||||
void init(Context context);
|
||||
View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState);
|
||||
void setIntent();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.yutou.jianrmg_v2.mglistmodel.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.basemodel.Data.AppData;
|
||||
import com.yutou.jianrmg_v2.basemodel.Data.MAppMg;
|
||||
import com.yutou.jianrmg_v2.basemodel.views.BaseActivity;
|
||||
import com.yutou.jianrmg_v2.resmodl.R;
|
||||
import com.yutou.jianrmg_v2.basemodel.Tools.Utils;
|
||||
|
||||
|
||||
import cn.lemon.view.adapter.BaseViewHolder;
|
||||
import cn.lemon.view.adapter.RecyclerAdapter;
|
||||
import views.Test;
|
||||
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
if(!AppData.RxDeBug) {
|
||||
Intent intent = new Intent(getContext(), BaseActivity.class);
|
||||
intent.putExtra("jar", "mglist.jar");
|
||||
intent.putExtra("activityName", "com.yutou.jianrmg_v2.mglistmodel.ModListActivity");
|
||||
intent.putExtra("mg", JSON.toJSONString(data));
|
||||
getContext().startActivity(intent);
|
||||
}else{
|
||||
Intent intent = new Intent(getContext(), Test.class);
|
||||
intent.putExtra("activityName", "ModListActivity");
|
||||
intent.putExtra("mg", JSON.toJSONString(data));
|
||||
getContext().startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.yutou.jianrmg_v2.mglistmodel.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.basemodel.Data.AppData;
|
||||
import com.yutou.jianrmg_v2.basemodel.Data.TMod;
|
||||
import com.yutou.jianrmg_v2.resmodl.R;
|
||||
import com.yutou.jianrmg_v2.basemodel.Tools.Utils;
|
||||
import views.ModActivity;
|
||||
|
||||
import cn.lemon.view.adapter.BaseViewHolder;
|
||||
import cn.lemon.view.adapter.RecyclerAdapter;
|
||||
import views.Test;
|
||||
|
||||
|
||||
/**
|
||||
* 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(), Test.class);
|
||||
intent.putExtra("activityName","ModActivity");
|
||||
intent.putExtra("mod", JSON.toJSONString(data));
|
||||
getContext().startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.yutou.jianrmg_v2.mglistmodel.Fragments;
|
||||
|
||||
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.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yutou.jianrmg_v2.basemodel.Data.MAppMg;
|
||||
import com.yutou.jianrmg_v2.basemodel.Data.TMod;
|
||||
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.mglistmodel.Adapters.ModRecyclerAdapter;
|
||||
import com.yutou.jianrmg_v2.resmodl.R;
|
||||
import com.yutou.jianrmg_v2.basemodel.Tools.Log;
|
||||
import com.yutou.jianrmg_v2.basemodel.Tools.Utils;
|
||||
|
||||
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/25.
|
||||
*/
|
||||
|
||||
public class Mod extends Fragment {
|
||||
private static Mod mod;
|
||||
private MAppMg mgList;
|
||||
private RefreshRecyclerView recyclerView;
|
||||
private ModRecyclerAdapter adapter;
|
||||
private List<TMod> datas;
|
||||
private int min=0, max=10;
|
||||
private boolean isInit=true;
|
||||
private Handler handler;
|
||||
private View view;
|
||||
public static Mod init(MAppMg mgList){
|
||||
if(mod==null){
|
||||
mod=new Mod();
|
||||
}
|
||||
Log.i("mod",(mgList==null)+"");
|
||||
if(mgList!=null)
|
||||
Log.i("mod",mgList.getName());
|
||||
mod.setActivity(mgList);
|
||||
return mod;
|
||||
}
|
||||
private void setActivity(MAppMg mgList){
|
||||
this.mgList=mgList;
|
||||
}
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
view=inflater.inflate(R.layout.fragment_mg,null);
|
||||
handler=new Handler();
|
||||
initViews();
|
||||
return view;
|
||||
}
|
||||
public void initViews(){
|
||||
recyclerView=view.findViewById(R.id.recyclerView);
|
||||
recyclerView.setSwipeRefreshColors(0xFF437845,0xFFE44F98,0xFF2FAC21);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(getContext(),3));
|
||||
adapter=new ModRecyclerAdapter(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_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));
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.yutou.jianrmg_v2.mglistmodel.Fragments;
|
||||
|
||||
import android.app.Activity;
|
||||
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;
|
||||
|
||||
public class TestMod extends Fragment {
|
||||
private static TestMod test;
|
||||
private Activity activity;
|
||||
|
||||
public static TestMod init(Activity activity){
|
||||
if(test==null){
|
||||
test=new TestMod();
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.yutou.jianrmg_v2.mglistmodel;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.annotation.Nullable;
|
||||
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 android.widget.Toast;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
import com.yutou.jianrmg_v2.basemodel.Data.MAppMg;
|
||||
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.Tools.Log;
|
||||
import com.yutou.jianrmg_v2.basemodel.Tools.Utils;
|
||||
import com.yutou.jianrmg_v2.mglistmodel.Adapters.ModListRecyclerAdapter;
|
||||
import com.yutou.jianrmg_v2.resmodl.R;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import Interfaces.BaseFragmeneInerface;
|
||||
import cn.lemon.view.RefreshRecyclerView;
|
||||
import cn.lemon.view.adapter.Action;
|
||||
|
||||
public class MainFragments implements BaseFragmeneInerface {
|
||||
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;
|
||||
private Context context;
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
this.context=context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
if(view!=null)
|
||||
return view;
|
||||
view=inflater.inflate(R.layout.fragment_mg,null);
|
||||
handler=new Handler();
|
||||
initView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIntent() {
|
||||
|
||||
}
|
||||
private void initView(View view){
|
||||
recyclerView=view.findViewById(R.id.recyclerView);
|
||||
recyclerView.setSwipeRefreshColors(0xFF437845,0xFFE44F98,0xFF2FAC21);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(context,3));
|
||||
adapter=new ModListRecyclerAdapter(context);
|
||||
TextView endText=new TextView(context);
|
||||
endText.setLayoutParams(new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Utils.getPixelsFromDp(((Activity)context),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);
|
||||
}
|
||||
}
|
||||
}
|
||||
317
MgListModel/src/main/java/views/ModActivity.java
Normal file
317
MgListModel/src/main/java/views/ModActivity.java
Normal file
@@ -0,0 +1,317 @@
|
||||
package views;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
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.basemodel.Data.AppData;
|
||||
import com.yutou.jianrmg_v2.basemodel.Data.TMod;
|
||||
import com.yutou.jianrmg_v2.basemodel.Data.TModtag;
|
||||
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.resmodl.R;
|
||||
import com.yutou.jianrmg_v2.basemodel.Tools.Log;
|
||||
import com.yutou.jianrmg_v2.basemodel.Tools.ModUtils;
|
||||
import com.yutou.jianrmg_v2.basemodel.Tools.Utils;
|
||||
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
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 implements BaseActivityInterface {
|
||||
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 LinearLayout mainLayot;
|
||||
private Context context;
|
||||
private Intent intent;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState, LinearLayout layout, Context context,Intent intent) {
|
||||
layout.addView(LayoutInflater.from(context).inflate(R.layout.activity_mod, null));
|
||||
mainLayot = layout;
|
||||
this.context=context;
|
||||
tMod = JSON.parseObject(intent.getStringExtra("mod"), TMod.class);
|
||||
|
||||
imageLoader = Utils.initImageLoader(context);
|
||||
handler = new Handler();
|
||||
modUtils = ModUtils.init(context);
|
||||
modUtils.setMod(tMod);
|
||||
initViews();
|
||||
initData(tMod);
|
||||
initTags(tMod.getId());
|
||||
getRemod();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestart() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIntent(Intent intent) {
|
||||
this.intent=intent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Data getData() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
modImage = mainLayot.findViewById(R.id.ModImage);
|
||||
icon = mainLayot.findViewById(R.id.icon);
|
||||
collection_img = mainLayot.findViewById(R.id.collection_img);
|
||||
title = mainLayot.findViewById(R.id.title);
|
||||
by = mainLayot.findViewById(R.id.by);
|
||||
richText =mainLayot.findViewById(R.id.richText);
|
||||
tagsLayout = mainLayot.findViewById(R.id.tags);
|
||||
collection = mainLayot.findViewById(R.id.collection);
|
||||
share = mainLayot.findViewById(R.id.share);
|
||||
download = mainLayot.findViewById(R.id.download);
|
||||
downloadText = download.findViewById(R.id.downloadText);
|
||||
quote = mainLayot.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);
|
||||
break;
|
||||
case 0:
|
||||
case 2:
|
||||
modUtils.installMod(tMod);
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
136
MgListModel/src/main/java/views/ModListActivity.java
Normal file
136
MgListModel/src/main/java/views/ModListActivity.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yutou.jianrmg_v2.basemodel.Adapters.ViewPagerAdapter;
|
||||
import com.yutou.jianrmg_v2.basemodel.Data.MAppMg;
|
||||
import com.yutou.jianrmg_v2.mglistmodel.Fragments.Mod;
|
||||
import com.yutou.jianrmg_v2.mglistmodel.Fragments.TestMod;
|
||||
import com.yutou.jianrmg_v2.resmodl.R;
|
||||
import com.yutou.jianrmg_v2.basemodel.Tools.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import Interfaces.BaseActivityInterface;
|
||||
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 implements BaseActivityInterface {
|
||||
private PageNavigationView tab;
|
||||
private ViewPager viewPager;
|
||||
private NavigationController navigationController;
|
||||
private List<Fragment> list;
|
||||
private MAppMg appMg;
|
||||
private LinearLayout mainView;
|
||||
private Context context;
|
||||
private Intent intent;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState, LinearLayout layout, Context context,Intent intent) {
|
||||
layout.addView(LayoutInflater.from(context).inflate(R.layout.activity_mod_list,null));
|
||||
mainView=layout;
|
||||
this.context=context;
|
||||
appMg= JSON.parseObject(intent.getStringExtra("mg"),MAppMg.class);
|
||||
Log.i("接受到的魔改:"+appMg.toString());
|
||||
initViews();
|
||||
}
|
||||
private void initViews() {
|
||||
tab = mainView.findViewById(R.id.tab);
|
||||
viewPager = mainView.findViewById(R.id.pager);
|
||||
list=new ArrayList<>();
|
||||
list.add(Mod.init(appMg));
|
||||
list.add(new TestMod());
|
||||
list.add(new TestMod());
|
||||
ViewPagerAdapter adapter=new ViewPagerAdapter(((AppCompatActivity)context).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);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestart() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getIntent(Intent intent) {
|
||||
this.intent=intent;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Data getData() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
83
MgListModel/src/main/java/views/ReModListAdapter.java
Normal file
83
MgListModel/src/main/java/views/ReModListAdapter.java
Normal file
@@ -0,0 +1,83 @@
|
||||
package views;
|
||||
|
||||
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.basemodel.Data.TMod;
|
||||
import com.yutou.jianrmg_v2.resmodl.R;
|
||||
import com.yutou.jianrmg_v2.basemodel.Tools.Utils;
|
||||
|
||||
|
||||
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, Test.class);
|
||||
intent.putExtra("activityName","ModActivity");
|
||||
intent.putExtra("mod", JSON.toJSONString(list.get(i)));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
private class Items{
|
||||
private ImageView icon;
|
||||
private TextView title,info;
|
||||
}
|
||||
}
|
||||
92
MgListModel/src/main/java/views/Test.java
Normal file
92
MgListModel/src/main/java/views/Test.java
Normal file
@@ -0,0 +1,92 @@
|
||||
package views;
|
||||
|
||||
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.MotionEvent;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.yutou.jianrmg_v2.resmodl.R;
|
||||
|
||||
import Interfaces.BaseActivityInterface;
|
||||
|
||||
public class Test extends AppCompatActivity {
|
||||
private BaseActivityInterface activityInterface;
|
||||
private LinearLayout main_layut;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_base);
|
||||
main_layut = findViewById(R.id.main_layut);
|
||||
String baseActivityName=getIntent().getStringExtra("activityName");
|
||||
try {
|
||||
switch (baseActivityName){
|
||||
case "ModListActivity":
|
||||
activityInterface = new ModListActivity();
|
||||
break;
|
||||
case "ModActivity":
|
||||
activityInterface = new ModActivity();
|
||||
break;
|
||||
}
|
||||
|
||||
} 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();
|
||||
}
|
||||
|
||||
}
|
||||
3
MgListModel/src/main/res/values/strings.xml
Normal file
3
MgListModel/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">MgListModel</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user