make more things translatable
This commit is contained in:
parent
3829e9ce3f
commit
f33bc55f68
3 changed files with 17 additions and 19 deletions
|
@ -12,7 +12,9 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
import eu.m724.vastapp.R
|
||||||
import eu.m724.vastapp.activity.Opener
|
import eu.m724.vastapp.activity.Opener
|
||||||
import eu.m724.vastapp.activity.dashboard.DashboardViewModel
|
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 = "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)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -32,6 +32,7 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import eu.m724.vastapp.R
|
import eu.m724.vastapp.R
|
||||||
|
@ -46,24 +47,13 @@ class TermuxSshActivity : ComponentActivity() {
|
||||||
val exitCode = termuxResult!!.getInt("exitCode")
|
val exitCode = termuxResult!!.getInt("exitCode")
|
||||||
val internalErrorCode = termuxResult.getInt("err")
|
val internalErrorCode = termuxResult.getInt("err")
|
||||||
val stdout = termuxResult.getString("stdout", "")
|
val stdout = termuxResult.getString("stdout", "")
|
||||||
println(exitCode)
|
|
||||||
println("C" + termuxResult.getString("stdout"))
|
|
||||||
println(termuxResult.getInt("err"))
|
|
||||||
|
|
||||||
var msg = stdout
|
var msg = stdout
|
||||||
|
|
||||||
if (internalErrorCode == -1) {
|
if (internalErrorCode == -1) {
|
||||||
if (exitCode == 0) {
|
if (exitCode == 0) {
|
||||||
if (stdout.isEmpty()) {
|
|
||||||
Toast.makeText(
|
|
||||||
applicationContext,
|
|
||||||
getString(R.string.termux_no_ssh),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
finish()
|
finish()
|
||||||
}
|
} // TODO handle other errors like 255 is connection refused
|
||||||
} else {
|
} else {
|
||||||
msg = termuxResult.getString("errmsg")
|
msg = termuxResult.getString("errmsg")
|
||||||
}
|
}
|
||||||
|
@ -105,7 +95,7 @@ class TermuxSshActivity : ComponentActivity() {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun UnexpectedError(msg: String) {
|
fun UnexpectedError(msg: String) {
|
||||||
Text("An error occured:")
|
Text(stringResource(id = R.string.termux_error))
|
||||||
Card(
|
Card(
|
||||||
modifier = Modifier.padding(16.dp)
|
modifier = Modifier.padding(16.dp)
|
||||||
) {
|
) {
|
||||||
|
@ -118,8 +108,8 @@ fun UnexpectedError(msg: String) {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SshNotInstalled(onCopyButtonClick: (String) -> Unit, onOpenTermuxButton: () -> Unit) {
|
fun SshNotInstalled(onCopyButtonClick: (String) -> Unit, onOpenTermuxButton: () -> Unit) {
|
||||||
Text("No SSH client installed.")
|
Text(stringResource(id = R.string.termux_no_ssh))
|
||||||
Text("Install Dropbear with:")
|
Text(stringResource(id = R.string.termux_install_dropbear))
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
Card {
|
Card {
|
||||||
|
@ -146,15 +136,15 @@ fun SshNotInstalled(onCopyButtonClick: (String) -> Unit, onOpenTermuxButton: ()
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
FilledTonalButton(onClick = onOpenTermuxButton) {
|
FilledTonalButton(onClick = onOpenTermuxButton) {
|
||||||
Text("Open Termux")
|
Text(stringResource(id = R.string.open_termux))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TermuxSetupGuide(onUrlButtonClick: (String) -> Unit) {
|
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))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
FilledTonalButton(onClick = { onUrlButtonClick("https://github.com/termux/termux-app/wiki/RUN_COMMAND-Intent#Setup-Instructions") }) {
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,4 +25,10 @@
|
||||||
<string name="title_activity_termux_ssh">TermuxSshActivity</string>
|
<string name="title_activity_termux_ssh">TermuxSshActivity</string>
|
||||||
<string name="termux_no_ssh">No ssh client on termux, install dropbear or openssh package</string>
|
<string name="termux_no_ssh">No ssh client on termux, install dropbear or openssh package</string>
|
||||||
<string name="copied_to_clipboard">Copied command to clipboard</string>
|
<string name="copied_to_clipboard">Copied command to clipboard</string>
|
||||||
|
<string name="termux_install_dropbear">Install Dropbear with:</string>
|
||||||
|
<string name="open_termux">Open Termux</string>
|
||||||
|
<string name="termux_not_configured">Termux is not configured for usage with other apps.</string>
|
||||||
|
<string name="termux_open_instructions">Open instructions on github.com</string>
|
||||||
|
<string name="termux_error">An error occured:</string>
|
||||||
|
<string name="webview_todo">(this will be a webview)</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue