From aedfa185c7a848935018fd09e7028364a369993e Mon Sep 17 00:00:00 2001 From: kichikuou Date: Thu, 10 Apr 2025 09:44:58 +0900 Subject: [PATCH] Android: Move "Install from ZIP" to options menu and add help message For consistency with xsystem4-android. --- .../io/github/kichikuou/system3/Launcher.kt | 1 + .../kichikuou/system3/LauncherActivity.kt | 36 +++++++++++-------- android/app/src/main/res/layout/launcher.xml | 8 +++++ .../app/src/main/res/menu/launcher_menu.xml | 6 ++++ .../app/src/main/res/values-ja/strings.xml | 20 ++++++++++- android/app/src/main/res/values/strings.xml | 20 ++++++++++- 6 files changed, 74 insertions(+), 17 deletions(-) diff --git a/android/app/src/main/java/io/github/kichikuou/system3/Launcher.kt b/android/app/src/main/java/io/github/kichikuou/system3/Launcher.kt index 27caab6..7c6deea 100644 --- a/android/app/src/main/java/io/github/kichikuou/system3/Launcher.kt +++ b/android/app/src/main/java/io/github/kichikuou/system3/Launcher.kt @@ -128,6 +128,7 @@ class Launcher private constructor(private val rootDir: File) { if (!saveDirFound) { saveDir.mkdir() } + observer?.onGameListChange() } private fun createDirForGame(): File { diff --git a/android/app/src/main/java/io/github/kichikuou/system3/LauncherActivity.kt b/android/app/src/main/java/io/github/kichikuou/system3/LauncherActivity.kt index 7c0adac..e4c286c 100644 --- a/android/app/src/main/java/io/github/kichikuou/system3/LauncherActivity.kt +++ b/android/app/src/main/java/io/github/kichikuou/system3/LauncherActivity.kt @@ -20,6 +20,7 @@ package io.github.kichikuou.system3 import android.app.* import android.content.Intent import android.os.Bundle +import android.text.Html import android.util.Log import android.view.Menu import android.view.MenuItem @@ -51,6 +52,8 @@ class LauncherActivity : Activity(), LauncherObserver { onGameListChange() val listView = findViewById(R.id.list) + listView.emptyView = findViewById(R.id.empty) + findViewById(R.id.usage).text = Html.fromHtml(getString(R.string.usage)) listView.setOnItemClickListener { _, _, position, _ -> onListItemClick(position) } @@ -73,23 +76,15 @@ class LauncherActivity : Activity(), LauncherObserver { } private fun onListItemClick(position: Int) { - if (position < launcher.games.size) { - startGame(launcher.games[position].path) - } else { - val i = Intent(Intent.ACTION_GET_CONTENT) - i.type = CONTENT_TYPE_ZIP - startActivityForResult(Intent.createChooser(i, getString(R.string.choose_a_file)), INSTALL_REQUEST) - } + startGame(launcher.games[position].path) } private fun onItemLongClick(position: Int): Boolean { - if (position < launcher.games.size) { - AlertDialog.Builder(this).setTitle(R.string.uninstall_dialog_title) - .setMessage(getString(R.string.uninstall_dialog_message, launcher.games[position].title)) - .setPositiveButton(R.string.ok) {_, _ -> uninstall(position)} - .setNegativeButton(R.string.cancel) {_, _ -> } - .show() - } + AlertDialog.Builder(this).setTitle(R.string.uninstall_dialog_title) + .setMessage(getString(R.string.uninstall_dialog_message, launcher.games[position].title)) + .setPositiveButton(R.string.ok) {_, _ -> uninstall(position)} + .setNegativeButton(R.string.cancel) {_, _ -> } + .show() return true } @@ -100,6 +95,12 @@ class LauncherActivity : Activity(), LauncherObserver { override fun onOptionsItemSelected(item: MenuItem): Boolean { return when (item.itemId) { + R.id.install_from_zip -> { + val i = Intent(Intent.ACTION_GET_CONTENT) + i.type = CONTENT_TYPE_ZIP + startActivityForResult(Intent.createChooser(i, getString(R.string.choose_a_file)), INSTALL_REQUEST) + true + } R.id.export_savedata -> { val i = Intent(Intent.ACTION_CREATE_DOCUMENT) i.type = CONTENT_TYPE_ZIP @@ -114,6 +115,12 @@ class LauncherActivity : Activity(), LauncherObserver { SAVEDATA_IMPORT_REQUEST) true } + R.id.help -> { + AlertDialog.Builder(this) + .setMessage(Html.fromHtml(getString(R.string.usage))) + .show() + true + } R.id.licenses -> { val intent = Intent(this, LicensesMenuActivity::class.java) startActivity(intent) @@ -155,7 +162,6 @@ class LauncherActivity : Activity(), LauncherObserver { override fun onGameListChange() { val items = launcher.titles.toMutableList() - items.add(getString(R.string.install_from_zip)) val listView = findViewById(R.id.list) listView.adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, items) } diff --git a/android/app/src/main/res/layout/launcher.xml b/android/app/src/main/res/layout/launcher.xml index 18ef6a0..ad2b3bb 100644 --- a/android/app/src/main/res/layout/launcher.xml +++ b/android/app/src/main/res/layout/launcher.xml @@ -6,4 +6,12 @@ + + + \ No newline at end of file diff --git a/android/app/src/main/res/menu/launcher_menu.xml b/android/app/src/main/res/menu/launcher_menu.xml index 194085b..684b112 100644 --- a/android/app/src/main/res/menu/launcher_menu.xml +++ b/android/app/src/main/res/menu/launcher_menu.xml @@ -1,11 +1,17 @@ + + diff --git a/android/app/src/main/res/values-ja/strings.xml b/android/app/src/main/res/values-ja/strings.xml index 3b596a0..a4f802f 100644 --- a/android/app/src/main/res/values-ja/strings.xml +++ b/android/app/src/main/res/values-ja/strings.xml @@ -2,7 +2,9 @@ System3 セーブデータをエクスポート + 使い方 セーブデータをインポート + ZIPからインストール オープンソースライセンス キャンセル System3 のファイル (*.dat) が見つかりません。 @@ -10,7 +12,6 @@ エラー 文字列を入力してください(最大%d文字) インストール中… - ZIP からインストール %s を展開中 ZIP アーカイブ中に save/ フォルダが見つかりません。 セーブデータのエクスポートに失敗しました。 @@ -20,4 +21,21 @@ 確認 この形式の ZIP はサポートしていません。 ZIP の展開に失敗しました。 + + ゲームのインストール方法 +

1. PC上で、ゲームのファイルが入ったZIPを用意します。例えば以下のようなファイルを含めます:

+
+ ・ACG.DAT
+ ・ADISK.DAT
+ ・AMUS.DAT
+ ・AG00.DAT
+ ・02.mp3
+ ・03.mp3
+ ・…
+
+

2. ZIPファイルを (例えばUSB経由で) PCからデバイスに転送します。

+

3. この画面の右上のメニューボタンをタップして「ZIPからインストール」を選択し、転送したZIPを選びます。

+ ]]> +
\ No newline at end of file diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 4387b3e..1f01410 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,7 +1,9 @@ System3 Export Save Files + Help Import Save Files + Install from ZIP Open source licenses Cancel Cannot find System3 game files (*.dat). @@ -9,7 +11,6 @@ Error Enter a string (up to %d characters) Installing… - Install from ZIP Extracting %s No save/ folder in the ZIP archive. OK @@ -20,4 +21,21 @@ Confirm This type of ZIP is not supported. Failed to extract ZIP. + + How to install a game +

1. On your PC, prepare a ZIP containing the game files. For example, it should contain the following files:

+
+ * ACG.DAT
+ * ADISK.DAT
+ * AMUS.DAT
+ * AG00.DAT
+ * 02.mp3
+ * 03.mp3
+ * …
+
+

2. Transfer the ZIP file from your PC to the device (e.g. via USB).

+

3. Tap the menu button at the upper-right of this screen, select "Install from ZIP," and choose the ZIP you transferred.

+ ]]> +