Avanzando en primer ejercicio
This commit is contained in:
parent
35a4bb1547
commit
42e2855620
|
|
@ -49,12 +49,12 @@ android {
|
|||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.9.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.0'
|
||||
implementation 'androidx.activity:activity-compose:1.6.1'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
|
||||
implementation 'androidx.activity:activity-compose:1.7.0'
|
||||
implementation "androidx.compose.ui:ui:$compose_ui_version"
|
||||
implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
|
||||
implementation 'androidx.compose.material:material:1.3.1'
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.0"
|
||||
implementation 'androidx.compose.material:material:1.4.0'
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1"
|
||||
implementation "androidx.navigation:navigation-compose:2.5.3"
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
|
|
|
|||
|
|
@ -1,9 +1,60 @@
|
|||
package ies.teis.genol_salatiel_ex2tdist.ui.exerciseOne
|
||||
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun ExerciseOneCompose() {
|
||||
Text(text = "1")
|
||||
val viewModel: ExerciseOneViewModel = viewModel()
|
||||
|
||||
Scaffold(topBar = {
|
||||
TopAppBar(title = {
|
||||
Text(text = "Contadores", modifier = Modifier.padding(horizontal = 10.dp))
|
||||
})
|
||||
}) {
|
||||
if (!viewModel.showLazy) {
|
||||
InputCount(Modifier.padding(paddingValues = it))
|
||||
} else {
|
||||
ButtonsCounter()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun InputCount(modifier: Modifier = Modifier) {
|
||||
var inputState by remember { mutableStateOf("") }
|
||||
|
||||
Column(
|
||||
Modifier
|
||||
.padding(top = 45.dp)
|
||||
.fillMaxSize(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
OutlinedTextField(
|
||||
value = inputState,
|
||||
onValueChange = { inputState = it },
|
||||
placeholder = { Text(text = "Número de contadores:")},
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number)
|
||||
)
|
||||
Button(onClick = { /*TODO*/ }) {
|
||||
Text(text = "Mostrar")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ButtonsCounter() {
|
||||
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@ class LauncherActivity : ComponentActivity() {
|
|||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colors.background
|
||||
) {
|
||||
/* Los colores de los botones cambian intencionadamente */
|
||||
LauncherNavController()
|
||||
}
|
||||
}
|
||||
|
|
@ -81,14 +82,14 @@ fun ExerciseList(navController: NavController) {
|
|||
label = stringResource(R.string.launcher_button_two),
|
||||
{ navController.navigate(route = LauncherModel.ExerciseTwo.path) }
|
||||
)
|
||||
LauncherButton(
|
||||
/* LauncherButton(
|
||||
label = stringResource(R.string.launcher_button_three),
|
||||
{ navController.navigate(route = LauncherModel.ExerciseThree.path) }
|
||||
)
|
||||
LauncherButton(
|
||||
label = stringResource(R.string.launcher_button_four),
|
||||
{ navController.navigate(route = LauncherModel.ExerciseFour.path) }
|
||||
)
|
||||
)*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue