Compare commits
No commits in common. "72e0e2a912937f2c379bb3dcfa15565e2c32235f" and "ae4912fd29d17b32004c8d3d8f5da4713dd95a0c" have entirely different histories.
72e0e2a912
...
ae4912fd29
12 changed files with 228 additions and 70 deletions
|
@ -13,7 +13,7 @@ android {
|
||||||
minSdk = 29
|
minSdk = 29
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "0.0.0-SNAPSHOT"
|
versionName = "1.0"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
|
|
|
@ -17,8 +17,8 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import eu.m724.vastapp.R
|
import eu.m724.vastapp.R
|
||||||
import eu.m724.vastapp.activity.dashboard.DashboardActivity
|
import eu.m724.vastapp.activity.dashboard.DashboardActivity
|
||||||
|
import eu.m724.vastapp.activity.dashboard.loading.ui.theme.VastappTheme
|
||||||
import eu.m724.vastapp.activity.login.LoginActivity
|
import eu.m724.vastapp.activity.login.LoginActivity
|
||||||
import eu.m724.vastapp.ui.theme.VastappTheme
|
|
||||||
|
|
||||||
class LoadingActivity : ComponentActivity() {
|
class LoadingActivity : ComponentActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package eu.m724.vastapp.activity.dashboard.loading.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
val Purple80 = Color(0xFFD0BCFF)
|
||||||
|
val PurpleGrey80 = Color(0xFFCCC2DC)
|
||||||
|
val Pink80 = Color(0xFFEFB8C8)
|
||||||
|
|
||||||
|
val Purple40 = Color(0xFF6650a4)
|
||||||
|
val PurpleGrey40 = Color(0xFF625b71)
|
||||||
|
val Pink40 = Color(0xFF7D5260)
|
|
@ -0,0 +1,58 @@
|
||||||
|
package eu.m724.vastapp.activity.dashboard.loading.ui.theme
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.darkColorScheme
|
||||||
|
import androidx.compose.material3.dynamicDarkColorScheme
|
||||||
|
import androidx.compose.material3.dynamicLightColorScheme
|
||||||
|
import androidx.compose.material3.lightColorScheme
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
|
||||||
|
private val DarkColorScheme = darkColorScheme(
|
||||||
|
primary = Purple80,
|
||||||
|
secondary = PurpleGrey80,
|
||||||
|
tertiary = Pink80
|
||||||
|
)
|
||||||
|
|
||||||
|
private val LightColorScheme = lightColorScheme(
|
||||||
|
primary = Purple40,
|
||||||
|
secondary = PurpleGrey40,
|
||||||
|
tertiary = Pink40
|
||||||
|
|
||||||
|
/* Other default colors to override
|
||||||
|
background = Color(0xFFFFFBFE),
|
||||||
|
surface = Color(0xFFFFFBFE),
|
||||||
|
onPrimary = Color.White,
|
||||||
|
onSecondary = Color.White,
|
||||||
|
onTertiary = Color.White,
|
||||||
|
onBackground = Color(0xFF1C1B1F),
|
||||||
|
onSurface = Color(0xFF1C1B1F),
|
||||||
|
*/
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun VastappTheme(
|
||||||
|
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||||
|
// Dynamic color is available on Android 12+
|
||||||
|
dynamicColor: Boolean = true,
|
||||||
|
content: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
val colorScheme = when {
|
||||||
|
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||||
|
val context = LocalContext.current
|
||||||
|
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
darkTheme -> DarkColorScheme
|
||||||
|
else -> LightColorScheme
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialTheme(
|
||||||
|
colorScheme = colorScheme,
|
||||||
|
typography = Typography,
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package eu.m724.vastapp.activity.dashboard.loading.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.material3.Typography
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
// Set of Material typography styles to start with
|
||||||
|
val Typography = Typography(
|
||||||
|
bodyLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
lineHeight = 24.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
)
|
||||||
|
/* Other default text styles to override
|
||||||
|
titleLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 22.sp,
|
||||||
|
lineHeight = 28.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
labelSmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
lineHeight = 16.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
)
|
||||||
|
*/
|
||||||
|
)
|
|
@ -2,7 +2,6 @@ package eu.m724.vastapp.activity.dashboard.screen
|
||||||
|
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.ContextualFlowRow
|
import androidx.compose.foundation.layout.ContextualFlowRow
|
||||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||||
|
@ -31,7 +30,6 @@ 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.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import eu.m724.vastapp.R
|
import eu.m724.vastapp.R
|
||||||
|
@ -49,36 +47,23 @@ fun InstancesScreen(dashboardViewModel: DashboardViewModel) {
|
||||||
|
|
||||||
// TODO actually get instances
|
// TODO actually get instances
|
||||||
|
|
||||||
if (rentedInstances.size > 0) {
|
ContextualFlowRow(
|
||||||
ContextualFlowRow(
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.verticalScroll(rememberScrollState()),
|
||||||
|
itemCount = rentedInstances.size,
|
||||||
|
horizontalArrangement = Arrangement.Center
|
||||||
|
) { i ->
|
||||||
|
RentedInstanceCard(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.width(340.dp)
|
||||||
.verticalScroll(rememberScrollState()),
|
.padding(8.dp),
|
||||||
itemCount = rentedInstances.size,
|
rentedInstance = rentedInstances[i],
|
||||||
horizontalArrangement = Arrangement.Center
|
termuxAvailable = termuxAvailable,
|
||||||
) { i ->
|
sshButtonClick = {
|
||||||
RentedInstanceCard(
|
dashboardViewModel.sshButtonClick(activity, it)
|
||||||
modifier = Modifier
|
},
|
||||||
.width(340.dp)
|
)
|
||||||
.padding(8.dp),
|
|
||||||
rentedInstance = rentedInstances[i],
|
|
||||||
termuxAvailable = termuxAvailable,
|
|
||||||
sshButtonClick = {
|
|
||||||
dashboardViewModel.sshButtonClick(activity, it)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(100.dp),
|
|
||||||
contentAlignment = Alignment.Center
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = stringResource(id = R.string.no_instances)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import eu.m724.vastapp.R
|
import eu.m724.vastapp.R
|
||||||
import eu.m724.vastapp.activity.Opener
|
import eu.m724.vastapp.activity.Opener
|
||||||
import eu.m724.vastapp.ui.theme.VastappTheme
|
import eu.m724.vastapp.activity.termux.ui.theme.VastappTheme
|
||||||
|
|
||||||
class TermuxSshActivity : ComponentActivity() {
|
class TermuxSshActivity : ComponentActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package eu.m724.vastapp.activity.termux.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
val Purple80 = Color(0xFFD0BCFF)
|
||||||
|
val PurpleGrey80 = Color(0xFFCCC2DC)
|
||||||
|
val Pink80 = Color(0xFFEFB8C8)
|
||||||
|
|
||||||
|
val Purple40 = Color(0xFF6650a4)
|
||||||
|
val PurpleGrey40 = Color(0xFF625b71)
|
||||||
|
val Pink40 = Color(0xFF7D5260)
|
|
@ -0,0 +1,58 @@
|
||||||
|
package eu.m724.vastapp.activity.termux.ui.theme
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.darkColorScheme
|
||||||
|
import androidx.compose.material3.dynamicDarkColorScheme
|
||||||
|
import androidx.compose.material3.dynamicLightColorScheme
|
||||||
|
import androidx.compose.material3.lightColorScheme
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
|
||||||
|
private val DarkColorScheme = darkColorScheme(
|
||||||
|
primary = Purple80,
|
||||||
|
secondary = PurpleGrey80,
|
||||||
|
tertiary = Pink80
|
||||||
|
)
|
||||||
|
|
||||||
|
private val LightColorScheme = lightColorScheme(
|
||||||
|
primary = Purple40,
|
||||||
|
secondary = PurpleGrey40,
|
||||||
|
tertiary = Pink40
|
||||||
|
|
||||||
|
/* Other default colors to override
|
||||||
|
background = Color(0xFFFFFBFE),
|
||||||
|
surface = Color(0xFFFFFBFE),
|
||||||
|
onPrimary = Color.White,
|
||||||
|
onSecondary = Color.White,
|
||||||
|
onTertiary = Color.White,
|
||||||
|
onBackground = Color(0xFF1C1B1F),
|
||||||
|
onSurface = Color(0xFF1C1B1F),
|
||||||
|
*/
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun VastappTheme(
|
||||||
|
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||||
|
// Dynamic color is available on Android 12+
|
||||||
|
dynamicColor: Boolean = true,
|
||||||
|
content: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
val colorScheme = when {
|
||||||
|
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
|
||||||
|
val context = LocalContext.current
|
||||||
|
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
darkTheme -> DarkColorScheme
|
||||||
|
else -> LightColorScheme
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialTheme(
|
||||||
|
colorScheme = colorScheme,
|
||||||
|
typography = Typography,
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package eu.m724.vastapp.activity.termux.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.material3.Typography
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
// Set of Material typography styles to start with
|
||||||
|
val Typography = Typography(
|
||||||
|
bodyLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
lineHeight = 24.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
)
|
||||||
|
/* Other default text styles to override
|
||||||
|
titleLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 22.sp,
|
||||||
|
lineHeight = 28.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
labelSmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
lineHeight = 16.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
)
|
||||||
|
*/
|
||||||
|
)
|
|
@ -1,33 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="title_activity_dashboard">Kokpit</string>
|
|
||||||
<string name="title_activity_login">Logowanie</string>
|
|
||||||
<string name="nav_dashboard">Kokpit</string>
|
|
||||||
<string name="nav_billing">Płatności</string>
|
|
||||||
<string name="nav_instances">Maszyny</string>
|
|
||||||
<string name="nav_help">Pomoc</string>
|
|
||||||
<string name="balance">Bilans</string>
|
|
||||||
<string name="greeting">Witaj %1$s!</string>
|
|
||||||
<string name="time_left">Zostało czasu</string>
|
|
||||||
<string name="rented_instances">Wynajęte</string>
|
|
||||||
<string name="time_minutes_short">%1$.2fm</string>
|
|
||||||
<string name="time_hours_short">%1$.2fg</string>
|
|
||||||
<string name="time_days_short">%1$.2fd</string>
|
|
||||||
<string name="api_key">Klucz API</string>
|
|
||||||
<string name="advanced_options">Zaawansowane</string>
|
|
||||||
<string name="btn_login">Zaloguj się</string>
|
|
||||||
<string name="login_checkbox">checkbox dla ciebie</string>
|
|
||||||
<string name="login_checkbox_20">fajne?</string>
|
|
||||||
<string name="login_checkbox_angry">checkbox ma focha</string>
|
|
||||||
<string name="no_options">sory brak</string>
|
|
||||||
<string name="title_activity_termux_ssh">Błąd Termux</string>
|
|
||||||
<string name="copied_to_clipboard">Komendę skopiowano do schowka</string>
|
|
||||||
<string name="termux_install_dropbear">Zainstaluj Dropbear używając komendy:</string>
|
|
||||||
<string name="open_termux">Otwórz Termux</string>
|
|
||||||
<string name="termux_not_configured">Termux nie jest skonfigurowany pod działanie z innymi aplikacjami.</string>
|
|
||||||
<string name="termux_open_instructions">Otwórz instrukcje na github.com</string>
|
|
||||||
<string name="termux_error">Wystąpił błąd:</string>
|
|
||||||
<string name="no_instances">Nie wynajmujesz żadnych maszyn</string>
|
|
||||||
<string name="webview_todo">(kiedyś to będzie tutaj)</string>
|
|
||||||
<string name="termux_no_ssh">Brakuje klienta SSH na Termux</string>
|
|
||||||
</resources>
|
|
|
@ -21,14 +21,14 @@
|
||||||
<string name="login_checkbox_20">having fun?</string>
|
<string name="login_checkbox_20">having fun?</string>
|
||||||
<string name="login_checkbox_angry">checkbox is angry</string>
|
<string name="login_checkbox_angry">checkbox is angry</string>
|
||||||
<string name="no_options">none yet sorry</string>
|
<string name="no_options">none yet sorry</string>
|
||||||
|
<string name="command_permission_denied">If you change your mind, do so from settings</string>
|
||||||
<string name="title_activity_termux_ssh">Termux Error</string>
|
<string name="title_activity_termux_ssh">Termux Error</string>
|
||||||
<string name="copied_to_clipboard">Command copied to clipboard</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="termux_install_dropbear">Install Dropbear with:</string>
|
<string name="termux_install_dropbear">Install Dropbear with:</string>
|
||||||
<string name="open_termux">Open Termux</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_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_open_instructions">Open instructions on github.com</string>
|
||||||
<string name="termux_error">An error occurred:</string>
|
<string name="termux_error">An error occurred:</string>
|
||||||
<string name="webview_todo">(this will be a webview)</string>
|
<string name="webview_todo">(this will be a webview)</string>
|
||||||
<string name="no_instances">You are not renting any instances</string>
|
|
||||||
<string name="termux_no_ssh">Missing SSH client on Termux</string>
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in a new issue