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() { 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(context) + "/harmony/");
if (file.exists()) { if (file.exists()) {
Utils.toast(context, "文件夹已存在"); Utils.toast(context, "文件夹已存在");
} else { } else {
@ -164,7 +164,7 @@ public class MainActivity implements BaseActivityInterface {
} }
System.out.println("httpData:"+httpData); System.out.println("httpData:"+httpData);
hud.show(); hud.show();
final File file = new File(Utils.getAppPath() + "/harmony/"); final File file = new File(Utils.getAppPath(context) + "/harmony/");
if(!file.exists()){ if(!file.exists()){
Utils.toast(context,"已创建harmony文件夹请将下载好的文件放入到harmony目录中"); Utils.toast(context,"已创建harmony文件夹请将下载好的文件放入到harmony目录中");
file.mkdirs(); file.mkdirs();
@ -187,10 +187,10 @@ public class MainActivity implements BaseActivityInterface {
if (listFile.getName().endsWith(".zip")) { if (listFile.getName().endsWith(".zip")) {
File path; File path;
if (siwtch.isChecked()) { 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("操作对象:覆盖版"); System.out.println("操作对象:覆盖版");
} else { } 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("操作对象:共存版"); System.out.println("操作对象:共存版");
} }
if (!path.exists()) { if (!path.exists()) {

View File

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

View File

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