diff --git a/harmony/src/main/java/com/jianrmod/plugins/harmony/Activitys/MainActivity.java b/harmony/src/main/java/com/jianrmod/plugins/harmony/Activitys/MainActivity.java index 3b7feff..9b930ae 100644 --- a/harmony/src/main/java/com/jianrmod/plugins/harmony/Activitys/MainActivity.java +++ b/harmony/src/main/java/com/jianrmod/plugins/harmony/Activitys/MainActivity.java @@ -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()) { diff --git a/harmony/src/main/java/com/jianrmod/plugins/harmony/Tools/Utils.java b/harmony/src/main/java/com/jianrmod/plugins/harmony/Tools/Utils.java index 420a97a..2cacb75 100644 --- a/harmony/src/main/java/com/jianrmod/plugins/harmony/Tools/Utils.java +++ b/harmony/src/main/java/com/jianrmod/plugins/harmony/Tools/Utils.java @@ -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; } diff --git a/settings.gradle b/settings.gradle index ab2c5da..3c8a906 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app', ':mylibrary', ':harmony', ":RefreshRecyclerView" +include ':app', ':harmony', ":RefreshRecyclerView"