上线专用客户端修复工具
This commit is contained in:
parent
825b3d820f
commit
d18de231d0
@ -10,6 +10,7 @@ import android.view.MotionEvent;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -30,6 +31,7 @@ public class MainActivity implements BaseActivityInterface {
|
|||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
private KProgressHUD hud;
|
private KProgressHUD hud;
|
||||||
|
|
||||||
public MainActivity() {
|
public MainActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,14 +39,13 @@ public class MainActivity implements BaseActivityInterface {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState, LinearLayout layout, final Context context, Intent intent) {
|
public void onCreate(Bundle savedInstanceState, LinearLayout layout, final Context context, Intent intent) {
|
||||||
layout.setOrientation(LinearLayout.VERTICAL);
|
layout.setOrientation(LinearLayout.VERTICAL);
|
||||||
this.context=context;
|
this.context = context;
|
||||||
Utils.handler=new Handler(Looper.getMainLooper());
|
Utils.handler = new Handler(Looper.getMainLooper());
|
||||||
hud=Utils.showLoading(context,null,"解压中...");
|
hud = Utils.showLoading(context, null, "解压中...");
|
||||||
layout.addView(getView());
|
layout.addView(getView());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRestart() {
|
public void onRestart() {
|
||||||
|
|
||||||
@ -90,19 +91,29 @@ public class MainActivity implements BaseActivityInterface {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ViewGroup getView(){
|
private ViewGroup getView() {
|
||||||
LinearLayout linearLayout=new LinearLayout(context);
|
LinearLayout linearLayout = new LinearLayout(context);
|
||||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||||
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);
|
||||||
final Switch siwtch=new Switch(context);
|
final Switch siwtch = new Switch(context);
|
||||||
siwtch.setTextOn("覆盖版");
|
siwtch.setText("共存版");
|
||||||
siwtch.setTextOff("共存版");
|
text1.setText("请将proj.manifest、Cocos2dxPrefsFile.xml和压缩包放到jianRMG/harmony/文件夹中");
|
||||||
text1.setText("请将proj.manifest、Cocos2dxPrefsFile.xml和压缩包放到jianRMG/harmony/文件夹中\n压缩包请重命名为data.zip");
|
|
||||||
button.setText("创建harmony文件夹");
|
button.setText("创建harmony文件夹");
|
||||||
button2.setText("开始");
|
button2.setText("开始");
|
||||||
|
|
||||||
|
siwtch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
if(isChecked){
|
||||||
|
siwtch.setText("覆盖版");
|
||||||
|
}else{
|
||||||
|
siwtch.setText("共存版");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
linearLayout.addView(text1);
|
linearLayout.addView(text1);
|
||||||
linearLayout.addView(button);
|
linearLayout.addView(button);
|
||||||
linearLayout.addView(button2);
|
linearLayout.addView(button2);
|
||||||
@ -111,10 +122,10 @@ public class MainActivity implements BaseActivityInterface {
|
|||||||
button.setOnClickListener(new View.OnClickListener() {
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
File file=new File(Utils.getAppPath()+"/harmony/");
|
File file = new File(Utils.getAppPath() + "/harmony/");
|
||||||
if(file.exists()){
|
if (file.exists()) {
|
||||||
Utils.toast(context,"文件夹已存在");
|
Utils.toast(context, "文件夹已存在");
|
||||||
}else {
|
} else {
|
||||||
file.mkdirs();
|
file.mkdirs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,46 +134,35 @@ public class MainActivity implements BaseActivityInterface {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
hud.show();
|
hud.show();
|
||||||
new Thread(new Runnable() {
|
final File file = new File(Utils.getAppPath() + "/harmony/");
|
||||||
@Override
|
if (file.listFiles().length == 0) {
|
||||||
public void run() {
|
Utils.toast(context, "文件夹内为空,请放入harmony文件夹中");
|
||||||
File file=new File(Utils.getAppPath()+"/harmony/");
|
|
||||||
if(file.listFiles().length==0){
|
|
||||||
Utils.toast(context,"文件夹内为空,请放入harmony文件夹中");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
File xml = new File(file.getAbsolutePath() + "/Cocos2dxPrefsFile.xml");
|
||||||
|
System.out.println(xml.getAbsoluteFile());
|
||||||
|
if (xml.exists()) {
|
||||||
|
ClientUttls.install(context, xml, "../shared_prefs/", new ModInterface() {
|
||||||
|
@Override
|
||||||
|
public void onAction(boolean flag, int type) {
|
||||||
|
System.out.println("处理xml:" + flag);
|
||||||
|
if (flag) {
|
||||||
for (File listFile : file.listFiles()) {
|
for (File listFile : file.listFiles()) {
|
||||||
System.out.println("处理文件:"+listFile.getAbsolutePath());
|
System.out.println("处理文件:" + listFile.getAbsolutePath());
|
||||||
switch (listFile.getName()){
|
if (listFile.getName().contains(".zip")) {
|
||||||
case "proj.manifest":
|
|
||||||
|
|
||||||
ClientUttls.install(context, listFile, "/files/", new ModInterface() {
|
|
||||||
@Override
|
|
||||||
public void onAction(boolean flag, int type) {
|
|
||||||
System.out.println("操作manifest文件:"+flag);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "Cocos2dxPrefsFile.xml":
|
|
||||||
ClientUttls.install(context, listFile, "../shared_prefs/", new ModInterface() {
|
|
||||||
@Override
|
|
||||||
public void onAction(boolean flag, int type) {
|
|
||||||
System.out.println("处理xml:"+flag);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "data.zip":
|
|
||||||
File path;
|
File path;
|
||||||
if(siwtch.isChecked()){
|
if (siwtch.isChecked()) {
|
||||||
path=new File(Utils.getSDCardPath()+"/Android/data/com.huanmeng.zhanjian2/files/res_default/10/");
|
path = new File(Utils.getSDCardPath() + "/Android/data/com.huanmeng.zhanjian2/files/res_default/10/");
|
||||||
}else {
|
System.out.println("操作对象:覆盖版");
|
||||||
path=new File(Utils.getSDCardPath()+"/Android/data/com.bigzhao.jianrmagicbox/files/res_default/10/");
|
} else {
|
||||||
|
path = new File(Utils.getSDCardPath() + "/Android/data/com.bigzhao.jianrmagicbox/files/res_default/10/");
|
||||||
|
System.out.println("操作对象:共存版");
|
||||||
}
|
}
|
||||||
if(!path.exists()){
|
if (!path.exists()) {
|
||||||
path.mkdirs();
|
path.mkdirs();
|
||||||
}
|
}
|
||||||
System.out.println("准备处理zip");
|
System.out.println("准备处理zip");
|
||||||
ZipUtils.unzip(listFile,path.getAbsolutePath(),hud);
|
ZipUtils.unzip(listFile, path.getAbsolutePath(), hud);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,9 +172,17 @@ public class MainActivity implements BaseActivityInterface {
|
|||||||
hud.dismiss();
|
hud.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Utils.toast(context,"操作完成");
|
Utils.toast(context, "操作完成");
|
||||||
|
}else{
|
||||||
|
Utils.toast(context, "Cocos2dxPrefsFile.xml处理失败");
|
||||||
|
hud.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Utils.toast(context, "Cocos2dxPrefsFile.xml文件不存在!");
|
||||||
|
hud.dismiss();
|
||||||
}
|
}
|
||||||
}).start();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user