|
|
|
@ -27,10 +27,7 @@ import com.gyf.csams.BuildConfig |
|
|
|
|
import com.gyf.csams.R |
|
|
|
|
import com.gyf.csams.account.model.AccountViewModel |
|
|
|
|
import com.gyf.csams.account.model.DialogMessage |
|
|
|
|
import com.gyf.lib.uikit.BaseTextField |
|
|
|
|
import com.gyf.lib.uikit.Body |
|
|
|
|
import com.gyf.lib.uikit.FormStatus |
|
|
|
|
import com.gyf.lib.uikit.ScaffoldModel |
|
|
|
|
import com.gyf.lib.uikit.* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum class AccountRoute { |
|
|
|
@ -43,12 +40,13 @@ class AccountActivity : ComponentActivity() { |
|
|
|
|
super.onCreate(savedInstanceState) |
|
|
|
|
|
|
|
|
|
setContent { |
|
|
|
|
Body { nav -> |
|
|
|
|
TestBody { nav, scaffoldState -> |
|
|
|
|
NavHost(navController = nav, startDestination = AccountRoute.Login.name) { |
|
|
|
|
composable(AccountRoute.Login.name) { |
|
|
|
|
Account( |
|
|
|
|
route = AccountRoute.Login |
|
|
|
|
) { isValidForm: Boolean, accountViewModel: AccountViewModel, scaffoldModel: ScaffoldModel -> |
|
|
|
|
|
|
|
|
|
Spacer(modifier = Modifier.height(10.dp)) |
|
|
|
|
OutlinedButton( |
|
|
|
|
onClick = { |
|
|
|
@ -70,15 +68,16 @@ class AccountActivity : ComponentActivity() { |
|
|
|
|
finish() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
OutlinedButton( |
|
|
|
|
onClick = { nav.navigate(AccountRoute.Register.name) }, |
|
|
|
|
modifier = Modifier.fillMaxWidth(), |
|
|
|
|
colors = ButtonDefaults.outlinedButtonColors( |
|
|
|
|
contentColor = MaterialTheme.colors.onBackground |
|
|
|
|
) |
|
|
|
|
) { |
|
|
|
|
Text(text = accountViewModel.goRegister) |
|
|
|
|
} |
|
|
|
|
OutlinedButton( |
|
|
|
|
onClick = { nav.navigate(AccountRoute.Register.name) }, |
|
|
|
|
modifier = Modifier.fillMaxWidth(), |
|
|
|
|
colors = ButtonDefaults.outlinedButtonColors( |
|
|
|
|
contentColor = MaterialTheme.colors.onBackground |
|
|
|
|
) |
|
|
|
|
) { |
|
|
|
|
Text(text = accountViewModel.goRegister) |
|
|
|
|
} |
|
|
|
|
ShowSnackbar(scaffoldState = scaffoldState) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -147,10 +146,10 @@ class AccountActivity : ComponentActivity() { |
|
|
|
|
append(accountViewModel.name.formValue.value ?: "") |
|
|
|
|
} |
|
|
|
|
withStyle(style = MaterialTheme.typography.subtitle1.toSpanStyle()) { |
|
|
|
|
append(stringResource(id = R.string.welcome_start)) |
|
|
|
|
append(accountViewModel.welcomeStart) |
|
|
|
|
} |
|
|
|
|
withStyle(style = MaterialTheme.typography.subtitle2.toSpanStyle()) { |
|
|
|
|
append(stringResource(id = R.string.welcome_end)) |
|
|
|
|
append(accountViewModel.welcomeEnd) |
|
|
|
|
} |
|
|
|
|
withStyle( |
|
|
|
|
style = MaterialTheme.typography.subtitle2.toSpanStyle() |
|
|
|
@ -160,7 +159,7 @@ class AccountActivity : ComponentActivity() { |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
StudentId(checkRepeat = route == AccountRoute.Register) |
|
|
|
|
StudentId() |
|
|
|
|
Spacer(modifier = Modifier.height(10.dp)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -184,7 +183,7 @@ class AccountActivity : ComponentActivity() { |
|
|
|
|
* @param accountViewModel |
|
|
|
|
*/ |
|
|
|
|
@Composable |
|
|
|
|
private fun StudentId(accountViewModel: AccountViewModel = viewModel(), checkRepeat: Boolean) { |
|
|
|
|
private fun StudentId(accountViewModel: AccountViewModel = viewModel()) { |
|
|
|
|
Column { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|