Latest Files and Updates

This commit is contained in:
Chris 2019-06-10 14:23:36 -04:00
parent 99fccf0b3e
commit 42aba8210e
29 changed files with 42 additions and 24 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -10,7 +10,7 @@ import java.io.File;
public class BackgroundTask extends AsyncTask<Void, Integer, Boolean> { public class BackgroundTask extends AsyncTask<Void, Integer, Boolean> {
private static final String TAG = "BackgroundTask"; 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; private Context contextActivity;
public BackgroundTask(Context context) public BackgroundTask(Context context)
@ -32,13 +32,30 @@ public class BackgroundTask extends AsyncTask<Void, Integer, Boolean> {
try 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); publishProgress(1);
writeApk.addFilesToApk(new File(Environment.getExternalStorageDirectory() + "/SMAPI Installer/base.apk"), moddingAPI, "assemblies/", false, 0); 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"), File[] resources = {new File(DIR_APK_FILES + "AndroidManifest.xml"),
new File(Environment.getExternalStorageDirectory() + DIR_APK_FILES + "classes.dex")}; new File( DIR_APK_FILES + "classes.dex")};
writeApk.addFilesToApk(new File(Environment.getExternalStorageDirectory() + "/SMAPI Installer/base.apk_patched0.apk"), resources, "", true, 1); writeApk.addFilesToApk(new File(Environment.getExternalStorageDirectory() + "/SMAPI Installer/base.apk_patched0.apk"), resources, "", true, 1);
signApk.commitSignApk(); 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; return true;
} }
catch(Exception e) catch(Exception e)

View File

@ -26,8 +26,12 @@ public class MainActivity extends AppCompatActivity {
private static final String ASSET_APK_FILES = "SMAPI/"; private static final String ASSET_APK_FILES = "SMAPI/";
private static final String ASSET_STARDEW_FILES = "Stardew/"; 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_APK_FILES = "/SMAPI Installer/ApkFiles/";
private static final String DIR_STARDEW_FILES = "/StardewValley/smapi-internal/"; 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 String TAG = "MainActivity";
private static final int UNINSTALL_REQUEST_CODE = 0; 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_APK_FILES, DIR_APK_FILES);
copyAssets(ASSET_STARDEW_FILES, DIR_STARDEW_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(); backgroundTask.execute();
} }
@ -125,7 +131,7 @@ public class MainActivity extends AppCompatActivity {
try { try {
files = assetManager.list(asset); files = assetManager.list(asset);
} catch (IOException e) { } 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) { if (files != null) for (String filename : files) {
InputStream in = null; InputStream in = null;
@ -136,7 +142,7 @@ public class MainActivity extends AppCompatActivity {
out = new FileOutputStream(outFile); out = new FileOutputStream(outFile);
copyFile(in, out); copyFile(in, out);
} catch(IOException e) { } catch(IOException e) {
Log.e("tag", "Failed to copy asset file: " + filename, e); Log.e(TAG, "Failed to copy asset file: " + filename, e);
} }
finally { finally {
if (in != null) { if (in != null) {

View File

@ -6,16 +6,6 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity"> tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button <Button
android:id="@+id/start_button" android:id="@+id/start_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -23,9 +13,14 @@
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:text="Button" android:layout_marginBottom="8dp"
android:background="@color/colorPrimary"
android:text="Install"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" /> app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" /> <background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon> </adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" /> <background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon> </adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -1,6 +1,6 @@
<resources> <resources>
<string name="app_name">SMAPI Android Installer</string> <string name="app_name">SMAPI Android Installer</string>
<string name="cant_find">Could not find the Stardew Valley Apk. Is the game installed?</string> <string name="cant_find">Could not find the Stardew Valley Apk. Is the game installed?</string>
<string name="modify_apk">Modifying the Apk…this might take some time fucker.</string> <string name="modify_apk">Modifying the Apk…this might take some time. Please keep the screen on.</string>
<string name="finished">Finished!</string> <string name="finished">Finished! The modified apk can be found here: /SMAPI Installer/base_signed.apk. You have to Uninstall the original game first.</string>
</resources> </resources>