commit ffb742192a525a72eda276ba273b86538d909fd9 Author: 202310715211 SYAHRIL ACHMAD FAHREZI <202310715211@mhs.ubharajaya.ac.id> Date: Fri Nov 7 16:28:23 2025 +0700 Tugas - HelloWord diff --git a/HelloWord/MainActivity.kt b/HelloWord/MainActivity.kt new file mode 100644 index 0000000..19a8336 --- /dev/null +++ b/HelloWord/MainActivity.kt @@ -0,0 +1,49 @@ +package com.example.helloword + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import com.example.helloword.ui.theme.HellowordTheme + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + HellowordTheme { + Surface( + modifier = Modifier.fillMaxSize(), + color = MaterialTheme.colorScheme.background + ) { + HelloWorldScreen() + } + } + } + } +} + +@Composable +fun HelloWorldScreen() { + Box( + modifier = Modifier.fillMaxSize(), + contentAlignment = Alignment.Center + ) { + Text(text = "Hello World!") + } +} + +@Preview(showBackground = true) +@Composable +fun PreviewHelloWorld() { + HellowordTheme { + HelloWorldScreen() + } +}