diff --git a/app/src/main/assets/SMAPI/StardewModdingAPI.dll b/app/src/main/assets/SMAPI/StardewModdingAPI.dll index 68e7cbe..42b4cab 100644 Binary files a/app/src/main/assets/SMAPI/StardewModdingAPI.dll and b/app/src/main/assets/SMAPI/StardewModdingAPI.dll differ diff --git a/app/src/main/assets/Stardew/StardewValley.dll b/app/src/main/assets/Stardew/StardewValley.dll index f0e2e27..0ba71b5 100644 Binary files a/app/src/main/assets/Stardew/StardewValley.dll and b/app/src/main/assets/Stardew/StardewValley.dll differ diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png new file mode 100644 index 0000000..0c645bd Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ diff --git a/app/src/main/java/com/MartyrPher/smapiandroidinstaller/BackgroundTask.java b/app/src/main/java/com/MartyrPher/smapiandroidinstaller/BackgroundTask.java index 7145252..03e1201 100644 --- a/app/src/main/java/com/MartyrPher/smapiandroidinstaller/BackgroundTask.java +++ b/app/src/main/java/com/MartyrPher/smapiandroidinstaller/BackgroundTask.java @@ -10,7 +10,7 @@ import java.io.File; public class BackgroundTask extends AsyncTask { private static final String TAG = "BackgroundTask"; - private static final String DIR_APK_FILES = "/SMAPI Installer/ApkFiles/"; + private static final String DIR_APK_FILES = Environment.getExternalStorageDirectory() + "/SMAPI Installer/ApkFiles/"; private Context contextActivity; public BackgroundTask(Context context) @@ -32,13 +32,30 @@ public class BackgroundTask extends AsyncTask { try { - File[] moddingAPI = {new File(Environment.getExternalStorageDirectory() + DIR_APK_FILES + "StardewModdingAPI.dll")}; + File[] moddingAPI = {new File( DIR_APK_FILES + "StardewModdingAPI.dll"), + new File(DIR_APK_FILES + "StardewModdingAPI.Toolkit.CoreInterfaces.dll"), + new File( DIR_APK_FILES + "StardewModdingAPI.Toolkit.dll"), + new File( DIR_APK_FILES + "Newtonsoft.json.dll"), + new File( DIR_APK_FILES + "System.Data.dll"), + new File( DIR_APK_FILES + "System.Numerics.dll")}; publishProgress(1); writeApk.addFilesToApk(new File(Environment.getExternalStorageDirectory() + "/SMAPI Installer/base.apk"), moddingAPI, "assemblies/", false, 0); - File[] resources = {new File(Environment.getExternalStorageDirectory() + DIR_APK_FILES + "AndroidManifest.xml"), - new File(Environment.getExternalStorageDirectory() + DIR_APK_FILES + "classes.dex")}; + File[] resources = {new File(DIR_APK_FILES + "AndroidManifest.xml"), + new File( DIR_APK_FILES + "classes.dex")}; writeApk.addFilesToApk(new File(Environment.getExternalStorageDirectory() + "/SMAPI Installer/base.apk_patched0.apk"), resources, "", true, 1); signApk.commitSignApk(); + File filesToDelete = new File(DIR_APK_FILES); + File deleteOldApk = new File(Environment.getExternalStorageDirectory() + "/SMAPI Installer/base.apk_patched0.apk_patched1.apk"); + deleteOldApk.delete(); + if (filesToDelete.isDirectory()) + { + String[] child = filesToDelete.list(); + for (int i = 0; i < child.length; i++) + { + new File(filesToDelete, child[i]).delete(); + } + filesToDelete.delete(); + } return true; } catch(Exception e) diff --git a/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java b/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java index 40af2d5..1d02c7b 100644 --- a/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java +++ b/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java @@ -26,8 +26,12 @@ public class MainActivity extends AppCompatActivity { private static final String ASSET_APK_FILES = "SMAPI/"; private static final String ASSET_STARDEW_FILES = "Stardew/"; + private static final String MOD_FILES_VK = "VirtualKeyboard/"; + private static final String MOD_FILES_VK_ASSET = "VirtualKeyboard/assets/"; private static final String DIR_APK_FILES = "/SMAPI Installer/ApkFiles/"; private static final String DIR_STARDEW_FILES = "/StardewValley/smapi-internal/"; + private static final String DIR_MODS_VK = "/StardewValley/Mods/VirtualKeyboard"; + private static final String DIR_MODS_VK_ASSET = "/StardewValley/Mods/VirtualKeyboard/assets"; private static final String TAG = "MainActivity"; private static final int UNINSTALL_REQUEST_CODE = 0; @@ -58,6 +62,8 @@ public class MainActivity extends AppCompatActivity { { copyAssets(ASSET_APK_FILES, DIR_APK_FILES); copyAssets(ASSET_STARDEW_FILES, DIR_STARDEW_FILES); + copyAssets(MOD_FILES_VK, DIR_MODS_VK); + copyAssets(MOD_FILES_VK_ASSET, DIR_MODS_VK_ASSET); backgroundTask.execute(); } @@ -125,7 +131,7 @@ public class MainActivity extends AppCompatActivity { try { files = assetManager.list(asset); } catch (IOException e) { - Log.e("tag", "Failed to get asset file list.", e); + Log.e(TAG, "Failed to get asset file list.", e); } if (files != null) for (String filename : files) { InputStream in = null; @@ -136,7 +142,7 @@ public class MainActivity extends AppCompatActivity { out = new FileOutputStream(outFile); copyFile(in, out); } catch(IOException e) { - Log.e("tag", "Failed to copy asset file: " + filename, e); + Log.e(TAG, "Failed to copy asset file: " + filename, e); } finally { if (in != null) { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 618ee71..96bcdd8 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -6,16 +6,6 @@ android:layout_height="match_parent" tools:context=".MainActivity"> - -