document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package com.example.tugasppb2
  2. import android.os.Bundle
  3. import androidx.activity.ComponentActivity
  4. import androidx.activity.compose.setContent
  5. import androidx.compose.foundation.layout.*
  6. import androidx.compose.material3.MaterialTheme
  7. import androidx.compose.material3.Surface
  8. import androidx.compose.material3.Text
  9. import androidx.compose.runtime.Composable
  10. import androidx.compose.ui.Alignment
  11. import androidx.compose.ui.Modifier
  12. import androidx.compose.ui.text.style.TextAlign
  13. import androidx.compose.ui.unit.dp
  14. import com.example.tugasppb2.ui.theme.TugasPPB2Theme
  15.  
  16. data class Profile(
  17.   val name: String,
  18.   val email: String,
  19.   val phone: String,
  20.     val hobby : String,
  21.   val skills: List,
  22. )
  23.  
  24. val profile = Profile(
  25.   name = "Samuel Berkat Hulu",
  26.   email = "samuelberkahulu@gmail.com",
  27.   phone = "082189767651"
  28.     hobby = "Volly"
  29.   skills = listOf("Python", "SQL", "C++")
  30. )
  31.  
  32. class MainActivity : ComponentActivity() {
  33.   override fun onCreate(savedInstanceState: Bundle?) {
  34.     super.onCreate(savedInstanceState)
  35.     setContent {
  36.       TugasPPB2Theme {
  37.         Surface(
  38.           modifier = Modifier.fillMaxSize(),
  39.           color = MaterialTheme.colorScheme.background
  40.         ) {
  41.           ProfileSection(profile)
  42.           HeaderSection()
  43.         }
  44.       }
  45.     }
  46.   }
  47. }
  48.  
  49. @Composable
  50. fun HeaderSection(){
  51.   Text(
  52.     text = "Hello World",
  53.     style = MaterialTheme.typography.headlineMedium,
  54.     textAlign = TextAlign.Center,
  55.     modifier = Modifier.padding(8.dp)
  56.   )
  57. }
  58.  
  59. @Composable
  60. fun ProfileSection(profile: Profile) {
  61.   Column(
  62.     modifier = Modifier.fillMaxSize(),
  63.     verticalArrangement = Arrangement.Center,
  64.     horizontalAlignment = Alignment.CenterHorizontally
  65.   ) {
  66.     Text(
  67.       text = "Name: " + profile.name,
  68.       style = MaterialTheme.typography.bodyMedium,
  69.       modifier = Modifier.padding(8.dp)
  70.     )
  71.     Text(
  72.       text = "Email: " + profile.email,
  73.       style = MaterialTheme.typography.bodyMedium,
  74.       modifier = Modifier.padding(8.dp)
  75.     )
  76.     Text(
  77.       text = "Phone: " + profile.phone,
  78.       style = MaterialTheme.typography.bodyMedium,
  79.       modifier = Modifier.padding(8.dp)
  80.     )
  81.     Text(
  82.       text = "Skills: " + profile.skills.joinToString(", "),
  83.       style = MaterialTheme.typography.bodyMedium,
  84.       modifier = Modifier.padding(8.dp)
  85.     )
  86.         Text(
  87.       text = "hobby : " + profile.hobby,
  88.       style = MaterialTheme.typography.bodyMedium,
  89.       modifier = Modifier.padding(8.dp).
  90.   }
  91. }
');