Added strings to strings.xml, Added a TextView to the layout.xml and changed the color of the button on press.

This commit is contained in:
Chris 2019-06-24 15:15:50 -04:00
parent 48dd1af703
commit 786d33697b
3 changed files with 26 additions and 2 deletions

View File

@ -30,6 +30,8 @@ public class MainActivity extends AppCompatActivity {
start_button.setOnClickListener(new View.OnClickListener() { start_button.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { 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) if (hasPermissions)
{ {
boolean foundGame; boolean foundGame;
@ -39,9 +41,14 @@ public class MainActivity extends AppCompatActivity {
foundGame = apkExtractor.extractAPK(getApplicationContext()); foundGame = apkExtractor.extractAPK(getApplicationContext());
if(foundGame) if(foundGame)
{
backgroundTask.execute(); backgroundTask.execute();
}
else else
{
DialogFrag.showDialog(MainActivity.this, R.string.cant_find, 1); DialogFrag.showDialog(MainActivity.this, R.string.cant_find, 1);
start_button.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
}
} }
else else
@ -74,7 +81,7 @@ public class MainActivity extends AppCompatActivity {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)
{ {
hasPermissions = true; hasPermissions = true;
Toast.makeText(this, "Permission Granted :)", Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.permission, Toast.LENGTH_SHORT).show();
} }
break; break;
} }

View File

@ -13,14 +13,29 @@
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:layout_marginBottom="8dp"
android:layout_marginBottom="8dp"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
android:text="Install" android:text="Install"
android:textColor="@android:color/white" android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent" 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" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="64dp"
android:layout_marginEnd="8dp"
android:text="Notes: Game version 1.25 is required"
android:textColor="@android:color/black"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>

View File

@ -4,4 +4,6 @@
<string name="modify_apk">Modifying the Apk…this might take some time. Please keep the screen on.</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!</string>
<string name="install">Error in opening file!</string> <string name="install">Error in opening file!</string>
<string name="start_install">Starting Install</string>
<string name="permission">Permission Granted</string>
</resources> </resources>