diff --git a/app/src/main/java/eu/m724/vastapp/activity/dashboard/screen/Help.kt b/app/src/main/java/eu/m724/vastapp/activity/dashboard/screen/Help.kt
index 7417fba..778486e 100644
--- a/app/src/main/java/eu/m724/vastapp/activity/dashboard/screen/Help.kt
+++ b/app/src/main/java/eu/m724/vastapp/activity/dashboard/screen/Help.kt
@@ -12,7 +12,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.sp
+import eu.m724.vastapp.R
import eu.m724.vastapp.activity.Opener
import eu.m724.vastapp.activity.dashboard.DashboardViewModel
@@ -30,6 +32,6 @@ fun HelpScreen(dashboardViewModel: DashboardViewModel) { // TODO make this a web
}) {
Text(text = "https://vast.ai/docs")
}
- Text(text = "(this will be a webview)", fontSize = 12.sp)
+ Text(text = stringResource(id = R.string.webview_todo), fontSize = 12.sp)
}
}
\ No newline at end of file
diff --git a/app/src/main/java/eu/m724/vastapp/activity/termux/TermuxSshActivity.kt b/app/src/main/java/eu/m724/vastapp/activity/termux/TermuxSshActivity.kt
index 27d027e..1f4c554 100644
--- a/app/src/main/java/eu/m724/vastapp/activity/termux/TermuxSshActivity.kt
+++ b/app/src/main/java/eu/m724/vastapp/activity/termux/TermuxSshActivity.kt
@@ -32,6 +32,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import eu.m724.vastapp.R
@@ -46,24 +47,13 @@ class TermuxSshActivity : ComponentActivity() {
val exitCode = termuxResult!!.getInt("exitCode")
val internalErrorCode = termuxResult.getInt("err")
val stdout = termuxResult.getString("stdout", "")
- println(exitCode)
- println("C" + termuxResult.getString("stdout"))
- println(termuxResult.getInt("err"))
var msg = stdout
if (internalErrorCode == -1) {
if (exitCode == 0) {
- if (stdout.isEmpty()) {
- Toast.makeText(
- applicationContext,
- getString(R.string.termux_no_ssh),
- Toast.LENGTH_SHORT
- ).show()
- }
-
finish()
- }
+ } // TODO handle other errors like 255 is connection refused
} else {
msg = termuxResult.getString("errmsg")
}
@@ -105,7 +95,7 @@ class TermuxSshActivity : ComponentActivity() {
@Composable
fun UnexpectedError(msg: String) {
- Text("An error occured:")
+ Text(stringResource(id = R.string.termux_error))
Card(
modifier = Modifier.padding(16.dp)
) {
@@ -118,8 +108,8 @@ fun UnexpectedError(msg: String) {
@Composable
fun SshNotInstalled(onCopyButtonClick: (String) -> Unit, onOpenTermuxButton: () -> Unit) {
- Text("No SSH client installed.")
- Text("Install Dropbear with:")
+ Text(stringResource(id = R.string.termux_no_ssh))
+ Text(stringResource(id = R.string.termux_install_dropbear))
Spacer(modifier = Modifier.height(16.dp))
Card {
@@ -146,15 +136,15 @@ fun SshNotInstalled(onCopyButtonClick: (String) -> Unit, onOpenTermuxButton: ()
Spacer(modifier = Modifier.height(16.dp))
FilledTonalButton(onClick = onOpenTermuxButton) {
- Text("Open Termux")
+ Text(stringResource(id = R.string.open_termux))
}
}
@Composable
fun TermuxSetupGuide(onUrlButtonClick: (String) -> Unit) {
- Text("Termux is not configured for usage with other apps.")
+ Text(stringResource(id = R.string.termux_not_configured))
Spacer(modifier = Modifier.height(16.dp))
FilledTonalButton(onClick = { onUrlButtonClick("https://github.com/termux/termux-app/wiki/RUN_COMMAND-Intent#Setup-Instructions") }) {
- Text("Open instructions on github.com")
+ Text(stringResource(id = R.string.termux_open_instructions))
}
}
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9b48c7f..6adf639 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -25,4 +25,10 @@
TermuxSshActivity
No ssh client on termux, install dropbear or openssh package
Copied command to clipboard
+ Install Dropbear with:
+ Open Termux
+ Termux is not configured for usage with other apps.
+ Open instructions on github.com
+ An error occured:
+ (this will be a webview)
\ No newline at end of file