正式上线2.2版本

This commit is contained in:
Yutousama 2019-06-12 11:40:44 +08:00
parent d18de231d0
commit f1bfc4e071
22 changed files with 383 additions and 105 deletions

View File

@ -8,7 +8,7 @@ android {
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 28 targetSdkVersion 28
versionCode 2 versionCode 2
versionName "2.1" versionName "2.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk { ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips" abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
@ -147,4 +147,6 @@ dependencies {
implementation 'com.qiniu:qiniu-android-sdk:7.3.15' implementation 'com.qiniu:qiniu-android-sdk:7.3.15'
//zip4j //zip4j
implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '1.3.3' implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '1.3.3'
//
// implementation 'com.github.markzhai:blockcanary-android:1.5.0'
} }

View File

@ -91,6 +91,7 @@
<activity android:name=".views.WarLogActivity" /> <activity android:name=".views.WarLogActivity" />
<activity android:name=".views.GameDataActivity" /> <activity android:name=".views.GameDataActivity" />
<activity android:name=".views.NativeAdActivity" /> <activity android:name=".views.NativeAdActivity" />
<activity android:name=".views.UserDataActivity" />
<provider <provider

View File

@ -104,16 +104,7 @@ public class WarAdapter extends RecyclerAdapter<List<Map<String, JSONObject>>> {
@Override @Override
public void onItemViewClick(List<Map<String, JSONObject>> data) { public void onItemViewClick(List<Map<String, JSONObject>> data) {
super.onItemViewClick(data); super.onItemViewClick(data);
// Utils.toast(getContext(),"详细内容正在咕,敬请期待"); Utils.toast(getContext(),"详细内容正在咕,敬请期待");
ModUtils utils= ModUtils.init(getContext());
utils.notRootInstall(new File(Utils.getAppPath()+"/harmony/Cocos2dxPrefsFile.xml"),"../shared_prefs/");
utils.notRootInstallStart(new ModInterface() {
@Override
public void onAction(boolean flag, int type) {
System.out.println("反和谐结果:"+flag);
}
},false);
/* JSONArray array=new JSONArray(); /* JSONArray array=new JSONArray();
for (Map<String, JSONObject> datum : data) { for (Map<String, JSONObject> datum : data) {
try { try {

View File

@ -43,6 +43,9 @@ public class MainUtilsAdapter extends RecyclerAdapter<MAppTools> {
@Override @Override
public void setData(MAppTools data) { public void setData(MAppTools data) {
super.setData(data); super.setData(data);
if (data.getImage().equals("#")) {
icon.setImageResource(R.mipmap.icon_logo);
} else
imageLoader.displayImage(data.getImage(), icon); imageLoader.displayImage(data.getImage(), icon);
name.setText(data.getName()); name.setText(data.getName());
} }
@ -56,7 +59,6 @@ public class MainUtilsAdapter extends RecyclerAdapter<MAppTools> {
String type = data.getMainFunction().split("#")[1]; String type = data.getMainFunction().split("#")[1];
String main = data.getMainFunction().split("#")[0]; String main = data.getMainFunction().split("#")[0];
try { try {
Intent intent = null; Intent intent = null;
@ -89,6 +91,7 @@ public class MainUtilsAdapter extends RecyclerAdapter<MAppTools> {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
Utils.toast(getContext(), "启动失败,请升级至最新版本或联系管理员");
} }
} }
} }

View File

@ -54,7 +54,13 @@ public class ModListRecyclerAdapter extends RecyclerAdapter<MAppMg> {
if (data.getIcon() != null && !"null".equals(data.getIcon())) { if (data.getIcon() != null && !"null".equals(data.getIcon())) {
String url=data.getIcon(); String url=data.getIcon();
if(!url.contains("http://")&&!url.contains("https://")){ if(!url.contains("http://")&&!url.contains("https://")){
try {
url=AppData.appConfig.getDownloadhome() + data.getIcon(); url=AppData.appConfig.getDownloadhome() + data.getIcon();
}catch (Exception e){
e.printStackTrace();
url="#";
}
} }
imageLoader.displayImage(url, icon); imageLoader.displayImage(url, icon);
}else{ }else{

View File

@ -50,16 +50,15 @@ public class Application extends android.app.Application {
public void onCreate() { public void onCreate() {
super.onCreate(); super.onCreate();
Application.application = this; Application.application = this;
// DoraemonKit.install(application); // BlockCanary.install(this, new AppBlockCanaryContext()).start();
//UMConfigure.setLogEnabled(true);
System.out.println("开始初始化"); System.out.println("开始初始化");
init(); init();
initPlugs(); initPlugs();
regActivity(); regActivity();
JianRUtils.initShipCardId(); JianRUtils.initShipCardId();
//initUmeng(); initUmeng();
// initTx(); initTx();
System.out.println("初始化结束"); System.out.println("初始化结束");
@ -121,8 +120,8 @@ public class Application extends android.app.Application {
try { try {
Map<String, DexClassLoader> plugsin = new HashMap<>(); Map<String, DexClassLoader> plugsin = new HashMap<>();
File path = new File(Utils.getAppPath() + "/plugin/"); File path = new File(Application.application.getFilesDir() + "/plugin/");
File dex = new File(Application.application.getFilesDir() + "/plugs/"); File dex = new File(Application.application.getFilesDir() + "/plugin/");
if (!dex.exists()) { if (!dex.exists()) {
dex.mkdirs(); dex.mkdirs();
} }
@ -132,7 +131,7 @@ public class Application extends android.app.Application {
DexClassLoader dexClassLoader = new DexClassLoader(file.getAbsolutePath(), dex.getAbsolutePath(), null, getClassLoader()); DexClassLoader dexClassLoader = new DexClassLoader(file.getAbsolutePath(), dex.getAbsolutePath(), null, getClassLoader());
plugsin.put(file.getName(), dexClassLoader); plugsin.put(file.getName(), dexClassLoader);
System.out.println("加载插件:"+file.getName()); System.out.println("加载插件:"+file.getName());
AppData.plugsin.put(file.getName(), dexClassLoader); // AppData.plugsin.put(file.getName(), dexClassLoader);
} }
} }
} else { } else {

View File

@ -14,6 +14,7 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import com.yutou.jianr_mg.Adapters.GameDataAdapters.DropAdapter; import com.yutou.jianr_mg.Adapters.GameDataAdapters.DropAdapter;
import com.yutou.jianr_mg.Data.AppData;
import com.yutou.jianr_mg.Databases.JianRDataDataBase; import com.yutou.jianr_mg.Databases.JianRDataDataBase;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.JianRUtils; import com.yutou.jianr_mg.Tools.JianRUtils;
@ -153,6 +154,8 @@ public class DropFragment extends Fragment {
if(srcTypes.size()==0){ if(srcTypes.size()==0){
return; return;
} }
new Thread(() -> {
try {
String name = database.getNames(srcTypes.get(src.getSelectedIndex())).get(i); String name = database.getNames(srcTypes.get(src.getSelectedIndex())).get(i);
List<JSONObject> list = database.getDrops(name); List<JSONObject> list = database.getDrops(name);
List<Map<String, String>> ldata = new ArrayList<>(); List<Map<String, String>> ldata = new ArrayList<>();
@ -169,10 +172,18 @@ public class DropFragment extends Fragment {
} }
Collections.reverse(ldata); Collections.reverse(ldata);
AppData.handler.post(() -> {
adapter.clear(); adapter.clear();
adapter.addAll(ldata); adapter.addAll(ldata);
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
recyclerView.showNoMore(); recyclerView.showNoMore();
});
}catch (Exception e){
e.printStackTrace();
}
}).start();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -14,6 +14,7 @@ import android.widget.ArrayAdapter;
import com.yutou.jianr_mg.Adapters.GameDataAdapters.DropAdapter; import com.yutou.jianr_mg.Adapters.GameDataAdapters.DropAdapter;
import com.yutou.jianr_mg.Adapters.GameDataAdapters.WarAdapter; import com.yutou.jianr_mg.Adapters.GameDataAdapters.WarAdapter;
import com.yutou.jianr_mg.Data.AppData;
import com.yutou.jianr_mg.Databases.JianRDataDataBase; import com.yutou.jianr_mg.Databases.JianRDataDataBase;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.Utils; import com.yutou.jianr_mg.Tools.Utils;
@ -58,7 +59,9 @@ public class WarFragment extends Fragment {
} }
view = inflater.inflate(R.layout.fragment_drop, null); view = inflater.inflate(R.layout.fragment_drop, null);
data = new ArrayList<>(); data = new ArrayList<>();
if(srcList==null){
srcList = new ArrayList<>();
}
System.out.println("当前模式下的战斗数据:" + srcList.size()); System.out.println("当前模式下的战斗数据:" + srcList.size());
initView(); initView();
return view; return view;
@ -146,6 +149,8 @@ public class WarFragment extends Fragment {
private void initData() { private void initData() {
try { try {
data.clear(); data.clear();
new Thread(() -> {
try {
srcList = database.getDataList(database.getTNameId((String) typeAdapter.getItem(type.getSelectedIndex()))); srcList = database.getDataList(database.getTNameId((String) typeAdapter.getItem(type.getSelectedIndex())));
for (int i = 0; i < srcList.size(); i++) { for (int i = 0; i < srcList.size(); i++) {
Map<String, JSONObject> maps = srcList.get(i); Map<String, JSONObject> maps = srcList.get(i);
@ -165,11 +170,19 @@ public class WarFragment extends Fragment {
} }
} }
} }
AppData.handler.post(() -> {
adapter.clear(); adapter.clear();
adapter.addAll(data); adapter.addAll(data);
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
recyclerView.dismissSwipeRefresh(); recyclerView.dismissSwipeRefresh();
recyclerView.showNoMore(); recyclerView.showNoMore();
});
}catch (Exception e){
e.printStackTrace();
}
}).start();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -2,6 +2,7 @@ package com.yutou.jianr_mg.Fragments;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -25,6 +26,7 @@ import com.yutou.jianr_mg.Network.HttpApi;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.Log; import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils; import com.yutou.jianr_mg.Tools.Utils;
import com.yutou.jianr_mg.views.UserDataActivity;
import java.util.ArrayList; import java.util.ArrayList;
@ -71,7 +73,7 @@ public class My extends Fragment {
credit=view.findViewById(R.id.credit); credit=view.findViewById(R.id.credit);
} }
icon.setOnClickListener(view->{ icon.setOnClickListener(view->{
Utils.toast(getContext(),"个人资料...咕了!诶嘿(<ゝω·)~☆kira"); startActivity(new Intent(getContext(), UserDataActivity.class));
}); });
image_top.setOnClickListener(view->Utils.toast(getContext(),"点这里不会有什么奇怪的东西啦")); image_top.setOnClickListener(view->Utils.toast(getContext(),"点这里不会有什么奇怪的东西啦"));
imageLoader= Utils.initImageLoader(getContext()); imageLoader= Utils.initImageLoader(getContext());

View File

@ -225,6 +225,7 @@ public class LoadingActivity extends AppCompatActivity {
public void httpGetData(String string, int code) { public void httpGetData(String string, int code) {
try { try {
JSONObject json = new JSONObject(string); JSONObject json = new JSONObject(string);
final String msg = json.getString("msg");
Log.i("LOGIN", "登录状态:" + string); Log.i("LOGIN", "登录状态:" + string);
if (json.getInt("code") == 100) { if (json.getInt("code") == 100) {
JSONObject data = json.getJSONObject("data").getJSONObject("data"); JSONObject data = json.getJSONObject("data").getJSONObject("data");
@ -233,6 +234,7 @@ public class LoadingActivity extends AppCompatActivity {
ConfigUtils.init().save(ConfigUtils.collection, data.getJSONArray("collection")); ConfigUtils.init().save(ConfigUtils.collection, data.getJSONArray("collection"));
isLogin = true; isLogin = true;
} else { } else {
handler.post(() -> Utils.toast(LoadingActivity.this, msg));
isLogin = false; isLogin = false;
} }
} catch (Exception e) { } catch (Exception e) {

View File

@ -38,6 +38,8 @@ public class HttpApi {
public static final String USER_RELOAD = "user/reload.do"; public static final String USER_RELOAD = "user/reload.do";
public static final String USER_LOGOUT = "user/logout.do"; public static final String USER_LOGOUT = "user/logout.do";
public static final String USER_TEST = "user/test.do"; public static final String USER_TEST = "user/test.do";
public static final String USER_UPIMG = "user/img.do";
public static final String USER_UPDATE = "user/update.do";
public static final String SYSTEM_UP_INFO = "system/addFeedBack.do"; public static final String SYSTEM_UP_INFO = "system/addFeedBack.do";
public static final String SYSTEM_LICENSE = "system/license.do"; public static final String SYSTEM_LICENSE = "system/license.do";

View File

@ -39,13 +39,14 @@ public class CDNTools {
uploadManager = new UploadManager(config); uploadManager = new UploadManager(config);
} }
public void upload(File file,String token){ public void upload(File file,String path,String token){
hud=Utils.showLoading(context,"正在上传","请稍后"); hud=Utils.showLoading(context,"正在上传","请稍后");
hud.show(); hud.show();
Map<String,String> map=new HashMap<>(); Map<String,String> map=new HashMap<>();
map.put("x:uToken",AppData.Token); map.put("x:uToken",AppData.Token);
map.put("x:uuid",AppData.user.getId()+""); map.put("x:uuid",AppData.user.getId()+"");
uploadManager.put(file, AppData.user.getId()+"/gamedata/"+file.getName(), token, (key, info, response) -> { map.put("x:qToken",token);
uploadManager.put(file, path, token, (key, info, response) -> {
if(info.isOK()){ if(info.isOK()){
Log.i(cdn.getClass().getName(),key+"上传成功"); Log.i(cdn.getClass().getName(),key+"上传成功");
Utils.toast(Application.application,"上传完成"); Utils.toast(Application.application,"上传完成");

View File

@ -179,7 +179,7 @@ public class JianRUtils {
} }
private static List<JianNiang> jianNiangs; private static List<JianNiang> jianNiangs;
private static List<ShipEquipmnt> equipmnts; private static List<ShipEquipmnt> equipmnts;
public static List<JianNiang> reloadJianNiang() { public static void reloadJianNiang() {
try { try {
if(jianNiangs==null){ if(jianNiangs==null){
jianNiangs=new ArrayList<>(); jianNiangs=new ArrayList<>();
@ -195,7 +195,6 @@ public class JianRUtils {
e.printStackTrace(); e.printStackTrace();
getInit(); getInit();
} }
return jianNiangs;
} }
public static List<ShipEquipmnt> reloadEquipmnts() { public static List<ShipEquipmnt> reloadEquipmnts() {
try { try {

View File

@ -15,6 +15,7 @@ import com.yutou.jianr_mg.Data.AppData;
import com.yutou.jianr_mg.Interfaces.DownloadFileInerface; import com.yutou.jianr_mg.Interfaces.DownloadFileInerface;
import com.yutou.jianr_mg.Network.HttpUtils; import com.yutou.jianr_mg.Network.HttpUtils;
import com.yutou.jianr_mg.R; import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils; import com.yutou.jianr_mg.Tools.Utils;
import Interfaces.BaseActivityInterface; import Interfaces.BaseActivityInterface;
@ -52,7 +53,8 @@ public class BaseActivity extends AppCompatActivity {
dialog.setMessage("这可能是一个插件,但您未安装该插件,请问是否进行下载安装操作?"); dialog.setMessage("这可能是一个插件,但您未安装该插件,请问是否进行下载安装操作?");
dialog.setNegativeButton("取消",view ->{dialog.dismiss();finish();}); dialog.setNegativeButton("取消",view ->{dialog.dismiss();finish();});
dialog.setPositiveButton("确定",view -> { dialog.setPositiveButton("确定",view -> {
HttpUtils.downloadFile(url, Utils.getAppPath() + "/plugin/", new DownloadFileInerface() { Log.i("插件管理","下载插件:"+url);
HttpUtils.downloadFile(url, Application.application.getFilesDir() + "/plugin/", new DownloadFileInerface() {
@Override @Override
public boolean downloading(String fileName, int current, long length) { public boolean downloading(String fileName, int current, long length) {
return true; return true;

View File

@ -34,7 +34,6 @@ public class ExcelActivity extends AppCompatActivity {
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_excel); setContentView(R.layout.activity_excel);
Intent intent = getIntent(); Intent intent = getIntent();
hud = Utils.showLoading(this, "请稍后", "文件正在下载中"); hud = Utils.showLoading(this, "请稍后", "文件正在下载中");

View File

@ -139,7 +139,8 @@ public class GameDataActivity extends AppCompatActivity implements View.OnClickL
upDialog.setTitle("上传数据"); upDialog.setTitle("上传数据");
upDialog.setMessage("本次预计消耗积分:" + credit); upDialog.setMessage("本次预计消耗积分:" + credit);
upDialog.setPositiveButton("确定", v1 -> { upDialog.setPositiveButton("确定", v1 -> {
CDNTools.getInstance(GameDataActivity.this).upload(new File("/data/data/" + getPackageName() + "/databases/game_data_db"), token); File file=new File("/data/data/" + getPackageName() + "/databases/game_data_db");
CDNTools.getInstance(GameDataActivity.this).upload(file, AppData.user.getId()+"/gamedata/"+file.getName(),token);
upDialog.dismiss(); upDialog.dismiss();
}); });
upDialog.setNegativeButton("取消", v1 -> { upDialog.setNegativeButton("取消", v1 -> {
@ -238,20 +239,4 @@ public class GameDataActivity extends AppCompatActivity implements View.OnClickL
break; break;
} }
} }
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == 100) {
//如果是文件选择模式需要获取选择的所有文件的路径集合
List<String> list = data.getStringArrayListExtra("paths");
Toast.makeText(getApplicationContext(), "选中了" + list.size() + "个文件", Toast.LENGTH_SHORT).show();
File file = new File(list.get(0));
if (file.exists() && !StringUtil.isEmpty(token)) {
CDNTools.getInstance(this).upload(file, token);
}
}
}
}
} }

View File

@ -0,0 +1,231 @@
package com.yutou.jianr_mg.views;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.InputType;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Toast;
import com.leon.lfilepickerlibrary.LFilePicker;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.yutou.jianr_mg.Data.AppData;
import com.yutou.jianr_mg.Interfaces.HttpInterface;
import com.yutou.jianr_mg.Network.HttpApi;
import com.yutou.jianr_mg.Network.HttpUtils;
import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.Tools.ActivitysManager;
import com.yutou.jianr_mg.Tools.CDNTools;
import com.yutou.jianr_mg.Tools.Utils;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import me.drakeet.materialdialog.MaterialDialog;
public class UserDataActivity extends AppCompatActivity {
private ListView listView;
private ArrayAdapter adapter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_userdata);
adapter=new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,getData());
listView=findViewById(R.id.list);
listView.setAdapter(adapter);
listView.setOnItemClickListener((parent, view, position, id) -> {
switch (position){
case 1:
upUname();
break;
case 2:
upEmail();
break;
case 3:
upImg();
break;
case 4:
logout();
break;
}
});
}
private List<String> getData(){
List<String> list=new ArrayList<>();
list.add("UID:"+ AppData.userdata.getUid());
list.add("昵称:"+AppData.user.getUname());
list.add("绑定邮箱:"+AppData.userdata.getEmail());
list.add("更换头像");
list.add("注销登录");
return list;
}
private void upUname(){
MaterialDialog dialog=new MaterialDialog(this);
dialog.setTitle("更换昵称");
EditText editText=new EditText(this);
editText.setHint("请输入昵称");
dialog.setContentView(editText);
dialog.setPositiveButton("提交",v -> {
String uname=editText.getText().toString();
if(!Utils.testStringIsNull(uname)){
try {
JSONObject json=new JSONObject();
json.put("uname",uname);
HttpUtils.post(HttpApi.HOME_URL+HttpApi.USER_UPDATE,json,null);
AppData.user.setUname(uname);
Utils.toast(UserDataActivity.this,"更新成功");
adapter.clear();
adapter.addAll(getData());
adapter.notifyDataSetChanged();
}catch (Exception e){
e.printStackTrace();
}
}
dialog.dismiss();
});
dialog.setNegativeButton("取消",v -> dialog.dismiss());
dialog.show();
}
private void upEmail(){
MaterialDialog dialog=new MaterialDialog(this);
dialog.setTitle("更换Email");
EditText editText=new EditText(this);
editText.setHint("请输入Email");
editText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
dialog.setContentView(editText);
dialog.setPositiveButton("提交",v -> {
String email=editText.getText().toString();
if(!Utils.testStringIsNull(email)){
try {
JSONObject json=new JSONObject();
json.put("email",email);
HttpUtils.post(HttpApi.HOME_URL+HttpApi.USER_UPDATE,json,null);
AppData.userdata.setEmail(email);
Utils.toast(UserDataActivity.this,"更新成功");
adapter.clear();
adapter.addAll(getData());
adapter.notifyDataSetChanged();
}catch (Exception e){
e.printStackTrace();
}
}
dialog.dismiss();
});
dialog.setNegativeButton("取消",v -> dialog.dismiss());
dialog.show();
}
private String token;
private void upImg(){
try{
JSONObject json=new JSONObject();
HttpUtils.post(HttpApi.HOME_URL + HttpApi.USER_UPIMG, json, new HttpInterface() {
@Override
public void httpGetData(String string, int code) {
try {
JSONObject json=new JSONObject(string);
token=json.optString("token");
AppData.handler.post(()->{
new LFilePicker()
.withActivity(UserDataActivity.this)
.withRequestCode(100)
.withStartPath(Environment.getExternalStorageDirectory().getPath()+"/jianRMG")//指定初始显示路径
.withIsGreater(false)//过滤文件大小 小于指定大小的文件
.withMutilyMode(false)
.withFileSize(5*1024*1024)//指定文件大小为500K
.start();
Utils.toast(UserDataActivity.this,"请选择头像");
});
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void httpError(Exception e) {
}
});
}catch (Exception e){
e.printStackTrace();
}
}
private void logout(){
MaterialDialog dialog=new MaterialDialog(this);
dialog.setTitle("退出?");
dialog.setMessage("注销账号并退出登录");
dialog.setPositiveButton("提交",v -> {
try {
JSONObject json=new JSONObject();
HttpUtils.post(HttpApi.HOME_URL + HttpApi.USER_LOGOUT, json, new HttpInterface() {
@Override
public void httpGetData(String string, int code) {
AppData.handler.post(()->{
ActivitysManager.finishAllActivity();
System.exit(0);
});
}
@Override
public void httpError(Exception e) {
}
});
}catch (Exception e){
e.printStackTrace();
}
dialog.dismiss();
});
dialog.setNegativeButton("取消",v -> dialog.dismiss());
dialog.show();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == 100) {
//如果是文件选择模式需要获取选择的所有文件的路径集合
List<String> list = data.getStringArrayListExtra("paths");
File file=new File(list.get(0));
if(file.exists()){
showImgDialog(file);
}
}
}
}
private void showImgDialog(File file){
MaterialDialog dialog=new MaterialDialog(this);
dialog.setTitle("更换头像");
ImageView imageView=new ImageView(this);
imageView.setImageURI(Uri.fromFile(file));
dialog.setContentView(imageView);
imageView.setOnClickListener(v -> {
dialog.dismiss();
upImg();
});
dialog.setPositiveButton("提交",v -> {
try {
CDNTools.getInstance(UserDataActivity.this)
.upload(file,AppData.user.getId()+"/img/"+file.getName(),token);
}catch (Exception e){
e.printStackTrace();
}
dialog.dismiss();
});
dialog.setNegativeButton("取消",v -> dialog.dismiss());
dialog.show();
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.constraint.ConstraintLayout>

View File

@ -34,6 +34,6 @@ dependencies {
implementation 'com.leon:lfilepickerlibrary:1.8.0' implementation 'com.leon:lfilepickerlibrary:1.8.0'
// //
implementation 'com.kaopiz:kprogresshud:1.1.0' implementation 'com.kaopiz:kprogresshud:1.1.0'
compile 'com.android.support:support-v4:28.0.0' implementation 'com.android.support:support-v4:28.0.0'
compile 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.android.support:recyclerview-v7:28.0.0'
} }

View File

@ -2,6 +2,7 @@ package com.jianrmod.plugins.harmony.Activitys;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
@ -97,11 +98,13 @@ public class MainActivity implements BaseActivityInterface {
TextView text1 = new TextView(context); TextView text1 = new TextView(context);
Button button = new Button(context); Button button = new Button(context);
Button button2 = new Button(context); Button button2 = new Button(context);
Button button3=new Button(context);
final Switch siwtch = new Switch(context); final Switch siwtch = new Switch(context);
siwtch.setText("共存版"); siwtch.setText("共存版");
text1.setText("请将proj.manifest、Cocos2dxPrefsFile.xml和压缩包放到jianRMG/harmony/文件夹中"); text1.setText("请将proj.manifest、Cocos2dxPrefsFile.xml和压缩包放到jianRMG/harmony/文件夹中");
button.setText("创建harmony文件夹"); button.setText("创建harmony文件夹");
button2.setText("开始"); button2.setText("开始");
button3.setText("不会用?点这里");
siwtch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { siwtch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
@ -118,6 +121,7 @@ public class MainActivity implements BaseActivityInterface {
linearLayout.addView(button); linearLayout.addView(button);
linearLayout.addView(button2); linearLayout.addView(button2);
linearLayout.addView(siwtch); linearLayout.addView(siwtch);
linearLayout.addView(button3);
button.setOnClickListener(new View.OnClickListener() { button.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -126,6 +130,7 @@ public class MainActivity implements BaseActivityInterface {
if (file.exists()) { if (file.exists()) {
Utils.toast(context, "文件夹已存在"); Utils.toast(context, "文件夹已存在");
} else { } else {
Utils.toast(context,"已创建harmony文件夹请将下载好的文件放入到harmony目录中");
file.mkdirs(); file.mkdirs();
} }
} }
@ -135,6 +140,11 @@ public class MainActivity implements BaseActivityInterface {
public void onClick(View v) { public void onClick(View v) {
hud.show(); hud.show();
final File file = new File(Utils.getAppPath() + "/harmony/"); final File file = new File(Utils.getAppPath() + "/harmony/");
if(!file.exists()){
Utils.toast(context,"已创建harmony文件夹请将下载好的文件放入到harmony目录中");
file.mkdirs();
return;
}
if (file.listFiles().length == 0) { if (file.listFiles().length == 0) {
Utils.toast(context, "文件夹内为空请放入harmony文件夹中"); Utils.toast(context, "文件夹内为空请放入harmony文件夹中");
return; return;
@ -186,6 +196,15 @@ public class MainActivity implements BaseActivityInterface {
} }
}); });
button3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://bbs.jianrmod.cn/forum.php?mod=viewthread&tid=186&extra="));
context.startActivity(intent);
}
});
return linearLayout; return linearLayout;
} }

View File

@ -5,8 +5,8 @@ public class Data {
public static String title="专用客户端解卡/反和谐"; public static String title="专用客户端解卡/反和谐";
public static String appId="48B9C440405E442EBE6F5512DE585DBB"; public static String appId="48B9C440405E442EBE6F5512DE585DBB";
public static String url="http://aaa/harmony.jar"; public static String url="http://aaa/harmony.jar";
public static String image="#"; public static String image="https://i.loli.net/2019/06/10/5cfe1f8f725b430506.png";
public static String mainFunction="com.jianrmod.plugins.harmony.Activitys.MainActivity#localActivity"; public static String mainFunction="com.jianrmod.plugins.harmony.Activitys.MainActivity#localActivity";
public static Integer permission=0; public static Integer permission=0;
public static String version="1.0"; public static String version="2.0";
} }