From 786d33697bfedf9c3d2a586b4d282f44aabe1bfe Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 24 Jun 2019 15:15:50 -0400 Subject: [PATCH] Added strings to strings.xml, Added a TextView to the layout.xml and changed the color of the button on press. --- .../smapiandroidinstaller/MainActivity.java | 9 ++++++++- app/src/main/res/layout/activity_main.xml | 17 ++++++++++++++++- app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java b/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java index d65b8e8..f3caf3c 100644 --- a/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java +++ b/app/src/main/java/com/MartyrPher/smapiandroidinstaller/MainActivity.java @@ -30,6 +30,8 @@ public class MainActivity extends AppCompatActivity { start_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + start_button.setBackgroundColor(getResources().getColor(R.color.colorAccent)); + Toast.makeText(MainActivity.this, R.string.start_install, Toast.LENGTH_SHORT).show(); if (hasPermissions) { boolean foundGame; @@ -39,9 +41,14 @@ public class MainActivity extends AppCompatActivity { foundGame = apkExtractor.extractAPK(getApplicationContext()); if(foundGame) + { backgroundTask.execute(); + } else + { DialogFrag.showDialog(MainActivity.this, R.string.cant_find, 1); + start_button.setBackgroundColor(getResources().getColor(R.color.colorPrimary)); + } } else @@ -74,7 +81,7 @@ public class MainActivity extends AppCompatActivity { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { hasPermissions = true; - Toast.makeText(this, "Permission Granted :)", Toast.LENGTH_SHORT).show(); + Toast.makeText(this, R.string.permission, Toast.LENGTH_SHORT).show(); } break; } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 96bcdd8..700d70a 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -13,14 +13,29 @@ android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" - android:layout_marginBottom="8dp" + 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_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/textView" /> + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 58f093c..c4a80bf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,4 +4,6 @@ Modifying the Apkā€¦this might take some time. Please keep the screen on. Finished! Error in opening file! + Starting Install + Permission Granted