This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <resources> | |
| <string name="personality">Personality</string> | |
| <string name="sex">Sex</string> | |
| <string name="age">Age</string> | |
| </resources> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| private fun ProfileContent(puppy: Puppy, containerHeight: Dp) { | |
| Column { | |
| Title(puppy) | |
| ProfileProperty(stringResource(R.string.sex), puppy.sex) | |
| ProfileProperty(stringResource(R.string.age), puppy.age.toString()) | |
| ProfileProperty(stringResource(R.string.personality), puppy.description) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| private fun Title( | |
| puppy: Puppy | |
| ) { | |
| Column(modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 16.dp, top = 16.dp)) { | |
| Text( | |
| text = puppy.title, | |
| style = MaterialTheme.typography.h5, | |
| fontWeight = FontWeight.Bold | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun ProfileScreen(puppy: Puppy) { | |
| val scrollState = rememberScrollState() | |
| Column(modifier = Modifier.fillMaxSize()) { | |
| BoxWithConstraints { | |
| Surface { | |
| Column( | |
| modifier = Modifier | |
| .fillMaxSize() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| private fun ProfileHeader( | |
| puppy: Puppy, | |
| containerHeight: Dp | |
| ) { | |
| Image( | |
| modifier = Modifier | |
| .heightIn(max = containerHeight / 2) | |
| .fillMaxWidth(), | |
| painter = painterResource(id = puppy.puppyImageId), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContent { | |
| BarkTheme { | |
| ProfileScreen(puppy = puppy) | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Composable | |
| fun ProfileScreen(puppy: Puppy) { | |
| val scrollState = rememberScrollState() | |
| Column(modifier = Modifier.fillMaxSize()) { | |
| BoxWithConstraints { | |
| Surface { | |
| Column( | |
| modifier = Modifier | |
| .fillMaxSize() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| startActivity(ProfileActivity.newIntent(this, it)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Text(text = "Hello ${puppy.title}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private val puppy: Puppy by lazy { | |
| intent?.getSerializableExtra(PUPPY_ID) as Puppy | |
| } |