commit 9ceaf74ad53d246857d910e35b713c9e4b3d71b5 equwal <truex@equwal.com> 2026-09-21 16:32:26 -0700 Point the user to the SubRead app, not the website The last button of the screen opens the SubRead app when it is installed. When it is not, the button opens the release page of the app on GitHub. The app makes the .srt on the device, so the website is not needed.
app/src/main/AndroidManifest.xml | 3 ++- app/src/main/kotlin/space/subread/overlay/MainActivity.kt | 11 +++++++++-- app/src/main/res/values/strings.xml | 5 +++-- 3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3634582..5f8f6f6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,8 +4,9 @@ <!-- The subtitle line is drawn over the media player. No network permission: nothing leaves the device. --> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> - <!-- The apps that can take a word: dictionaries, translators, flash card apps. --> + <!-- The apps that can take a word: dictionaries, translators, flash card apps. And the SubRead app, to open it when it is installed. --> <queries> + <package android:name="space.subread.app" /> <intent> <action android:name="android.intent.action.PROCESS_TEXT" /> <data android:mimeType="text/plain" /> diff --git a/app/src/main/kotlin/space/subread/overlay/MainActivity.kt b/app/src/main/kotlin/space/subread/overlay/MainActivity.kt index 4141711..148e2f1 100644 --- a/app/src/main/kotlin/space/subread/overlay/MainActivity.kt +++ b/app/src/main/kotlin/space/subread/overlay/MainActivity.kt @@ -82,7 +82,12 @@ class MainActivity : Activity() { }, wide(top = 24)) note(getString(R.string.make_subtitles), top = 32) - content.addView(button(getString(R.string.make_subtitles_action)) { open(SUBREAD) }, wide()) + val subread = packageManager.getLaunchIntentForPackage(SUBREAD_PACKAGE) + if (subread != null) { + content.addView(button(getString(R.string.open_subread)) { runCatching { startActivity(subread) } }, wide()) + } else { + content.addView(button(getString(R.string.install_subread)) { open(SUBREAD_INSTALL) }, wide()) + } if (BuildConfig.DONATE_LINK) content.addView(button(getString(R.string.donate)) { open(KOFI) }, wide()) } @@ -198,7 +203,9 @@ class MainActivity : Activity() { private companion object { const val PICK_SUBTITLES = 1 - const val SUBREAD = "https://subread.space/?utm_source=overlay_app" + const val SUBREAD_PACKAGE = "space.subread.app" + // The release page of the SubRead app. Each release has the APK as SubRead.apk. + const val SUBREAD_INSTALL = "https://github.com/equwal/subread-android/releases/latest" const val KOFI = "https://ko-fi.com/truex" } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c4cbfd4..cae45af 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -34,7 +34,8 @@ <string name="status_before_first_line">Before the first line.</string> <string name="no_dictionary">No app took the word.</string> - <string name="make_subtitles">No .srt for your audiobook? SubRead makes it from the audiobook and its ebook.</string> - <string name="make_subtitles_action">Open subread.space</string> + <string name="make_subtitles">No .srt for your audiobook? The SubRead app makes it from the audiobook and its ebook, on this device.</string> + <string name="open_subread">Open SubRead</string> + <string name="install_subread">Install SubRead</string> <string name="donate">Support the work on Ko-fi</string> </resources>