From 8858168a27b13a62e240878f234687131752088e Mon Sep 17 00:00:00 2001 From: 202310715105 YOSEP GAMALIEL MULIA <202310715105@mhs.ubharajaya.ac.id> Date: Thu, 16 Oct 2025 11:56:05 +0700 Subject: [PATCH] Upload files to "Tugas-1_Hello-World" --- Tugas-1_Hello-World/MainActivity.kt | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Tugas-1_Hello-World/MainActivity.kt diff --git a/Tugas-1_Hello-World/MainActivity.kt b/Tugas-1_Hello-World/MainActivity.kt new file mode 100644 index 0000000..1f0a18d --- /dev/null +++ b/Tugas-1_Hello-World/MainActivity.kt @@ -0,0 +1,46 @@ +package com.example.helloworld + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import com.example.helloworld.ui.theme.HelloWorldTheme +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContent { + HelloWorldTheme { + Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> + Greeting( + name = "Yosep", + modifier = Modifier.padding(innerPadding) + ) + } + } + } + } +} + +@Composable +fun Greeting(name: String, modifier: Modifier = Modifier) { + Text( + text = "Hello $name!", + modifier = modifier + ) +} + +@Preview(showBackground = true) +@Composable +fun GreetingPreview() { + HelloWorldTheme { + Greeting("World") + } +} \ No newline at end of file