diff --git a/android/app/src/main/java/io/github/kichikuou/xsystem35/Launcher.kt b/android/app/src/main/java/io/github/kichikuou/xsystem35/Launcher.kt index d040cb2..4cafee9 100644 --- a/android/app/src/main/java/io/github/kichikuou/xsystem35/Launcher.kt +++ b/android/app/src/main/java/io/github/kichikuou/xsystem35/Launcher.kt @@ -127,6 +127,7 @@ class Launcher private constructor(private val rootDir: File) { if (!saveDirFound) { File(rootDir, SAVE_DIR).mkdir() } + observer?.onGameListChange() } private fun createDirForGame(): File { diff --git a/android/app/src/main/java/io/github/kichikuou/xsystem35/LauncherActivity.kt b/android/app/src/main/java/io/github/kichikuou/xsystem35/LauncherActivity.kt index e128ff8..8d66738 100644 --- a/android/app/src/main/java/io/github/kichikuou/xsystem35/LauncherActivity.kt +++ b/android/app/src/main/java/io/github/kichikuou/xsystem35/LauncherActivity.kt @@ -22,6 +22,7 @@ import android.content.Intent import android.net.Uri import android.os.Bundle import android.provider.OpenableColumns +import android.text.Html import android.util.Log import android.view.Menu import android.view.MenuItem @@ -53,6 +54,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) } @@ -75,23 +78,15 @@ class LauncherActivity : Activity(), LauncherObserver { } private fun onListItemClick(position: Int) { - if (position < launcher.games.size) { - startGame(launcher.games[position].path, null) - } 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, null) } 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 } @@ -102,6 +97,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 @@ -116,6 +117,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) @@ -157,7 +164,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 ae22c52..0a9fb42 100644 --- a/android/app/src/main/res/values-ja/strings.xml +++ b/android/app/src/main/res/values-ja/strings.xml @@ -2,14 +2,15 @@ xsystem35 セーブデータをエクスポート + 使い方 セーブデータをインポート + ZIPからインストール オープンソースライセンス キャンセル System 3.x のファイル (*.ald) が見つかりません。 ファイルを選択 エラー インストール中… - ZIP からインストール %s を展開中 ZIP アーカイブ中に save/ フォルダが見つかりません。 セーブデータのエクスポートに失敗しました。 @@ -19,4 +20,21 @@ 確認 この形式の ZIP はサポートしていません。 ZIP の展開に失敗しました。 + + ゲームのインストール方法 +

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

+
+ ・鬼畜王SA.ALD
+ ・鬼畜王GA.ALD
+ ・鬼畜王GB.ALD
+ ・鬼畜王WA.ALD
+ ・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 9113823..a0bb677 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,14 +1,15 @@ xsystem35 Export Save Files + Help Import Save Files + Install from ZIP Open source licenses Cancel Cannot find System 3.x game files (*.ald). Choose a file Error Installing… - Install from ZIP Extracting %s No save/ folder in the ZIP archive. OK @@ -19,4 +20,22 @@ 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:

+
+ * KICHIKUSA.ALD
+ * KICHIKUGA.ALD
+ * KICHIKUGB.ALD
+ * KICHIKUWA.ALD
+ * System39.ain
+ * 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.

+ ]]> +