This commit is contained in:
Yutousama 2020-01-02 02:11:24 +08:00
parent 8bebd5ee2c
commit 66294e96ef
3 changed files with 9 additions and 9 deletions

View File

@ -146,7 +146,7 @@ public class MainActivity implements BaseActivityInterface {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
File file = new File(Utils.getAppPath() + "/harmony/");
File file = new File(Utils.getAppPath(context) + "/harmony/");
if (file.exists()) {
Utils.toast(context, "文件夹已存在");
} else {
@ -164,7 +164,7 @@ public class MainActivity implements BaseActivityInterface {
}
System.out.println("httpData:"+httpData);
hud.show();
final File file = new File(Utils.getAppPath() + "/harmony/");
final File file = new File(Utils.getAppPath(context) + "/harmony/");
if(!file.exists()){
Utils.toast(context,"已创建harmony文件夹请将下载好的文件放入到harmony目录中");
file.mkdirs();
@ -187,10 +187,10 @@ public class MainActivity implements BaseActivityInterface {
if (listFile.getName().endsWith(".zip")) {
File path;
if (siwtch.isChecked()) {
path = new File(Utils.getSDCardPath() + "/Android/data/com.huanmeng.zhanjian2/"+httpData);
path = new File(Utils.getSDCardPath(context) + "/Android/data/com.huanmeng.zhanjian2/"+httpData);
System.out.println("操作对象:覆盖版");
} else {
path = new File(Utils.getSDCardPath() + "/Android/data/com.bigzhao.jianrmagicbox/"+httpData);
path = new File(Utils.getSDCardPath(context) + "/Android/data/com.bigzhao.jianrmagicbox/"+httpData);
System.out.println("操作对象:共存版");
}
if (!path.exists()) {

View File

@ -64,13 +64,13 @@ public class Utils {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
public static String getSDCardPath() {
String path = Application.application.getFilesDir() + "/";
public static String getSDCardPath(Context context) {
String path =context.getFilesDir() + "/";
return path;
}
public static String getAppPath() {
String path = Application.application.getFilesDir() + "/jianRMG";
public static String getAppPath(Context context) {
String path =context.getFilesDir() + "/jianRMG";
return path;
}

View File

@ -1 +1 @@
include ':app', ':mylibrary', ':harmony', ":RefreshRecyclerView"
include ':app', ':harmony', ":RefreshRecyclerView"