Game folder dialog.

This commit is contained in:
Miku AuahDark
2022-05-15 23:40:49 +08:00
parent 3a51afb798
commit 3379e4c1e9
2 changed files with 26 additions and 0 deletions
@@ -1,8 +1,10 @@
package org.love2d.android;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
@@ -32,6 +34,9 @@ public class MainActivity extends AppCompatActivity {
Intent intent = new Intent(this, GameActivity.class);
startActivity(intent);
return true;
} else if (itemId == R.id.optionItem2) {
getGameFolderDialog().show();
return true;
} else if (itemId == R.id.optionItem3) {
Intent intent = new Intent(this, AboutActivity.class);
startActivity(intent);
@@ -40,4 +45,21 @@ public class MainActivity extends AppCompatActivity {
return super.onOptionsItemSelected(item);
}
}
private AlertDialog getGameFolderDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.game_folder))
.setPositiveButton(R.string.ok, (dialog1, which) -> { });
StringBuilder message = new StringBuilder()
.append(getString(R.string.game_folder_location, getPackageName()))
.append("\n\n");
if (Build.VERSION.SDK_INT >= 30) {
message.append(getString(R.string.game_folder_inaccessible));
} else {
message.append(getString(R.string.game_folder_accessible));
}
return builder.setMessage(message.toString()).create();
}
}
+4
View File
@@ -8,4 +8,8 @@
<string name="launch_nogame">Launch No-Game</string>
<string name="game_folder">Game Folder</string>
<string name="about">About</string>
<string name="ok">OK</string>
<string name="game_folder_location">The game folder is located in your internal storage at Android/data/%1$s/files/games.</string>
<string name="game_folder_accessible">The folder should be accessible with your favorite file manager.</string>
<string name="game_folder_inaccessible">Unfortunately the folder is only accessible through MTP in PC.</string>
</resources>