From c39b193f0877de15063725358ea70eb994437346 Mon Sep 17 00:00:00 2001 From: 202310715051 DENDI YOGIA PRATAMA <202310715051@mhs.ubharajaya.ac.id> Date: Thu, 9 Oct 2025 14:39:56 +0700 Subject: [PATCH] Upload files to "/" --- MainActivity.kt | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 MainActivity.kt diff --git a/MainActivity.kt b/MainActivity.kt new file mode 100644 index 0000000..a79cd3b --- /dev/null +++ b/MainActivity.kt @@ -0,0 +1,71 @@ +package com.example.dendiyogiapratama_sorting + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme +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 androidx.compose.ui.unit.dp +import com.example.dendiyogiapratama_sorting.ui.theme.DendiYogiaPratamaSortingTheme + +class MainActivity : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + enableEdgeToEdge() + setContent { + DendiYogiaPratamaSortingTheme { + Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> + Greeting( + name = "AndroidDen", + numbers = listOf(64, 34, 25, 12, 22, 11, 90), + modifier = Modifier.padding(innerPadding) + ) + } + } + } + } +} + +@Composable +fun Greeting(name: String, numbers: List, modifier: Modifier = Modifier) { + val sortedNumbers = numbers.sorted() + + Column(modifier = modifier.padding(16.dp)) { + Text( + text = "Hello $name!", + style = MaterialTheme.typography.headlineMedium, + modifier = Modifier.padding(bottom = 8.dp) + ) + + Text( + text = "Angka asli: ${numbers.joinToString(", ")}", + style = MaterialTheme.typography.bodyLarge, + modifier = Modifier.padding(bottom = 4.dp) + ) + + Text( + text = "Angka yang terurut: ${sortedNumbers.joinToString(", ")}", + style = MaterialTheme.typography.bodyLarge, + color = MaterialTheme.colorScheme.primary + ) + } +} + +@Preview(showBackground = true) +@Composable +fun GreetingPreview() { + DendiYogiaPratamaSortingTheme { + Greeting( + name = "Android", + numbers = listOf(64, 34, 25, 12, 22, 11, 90) + ) + } +} \ No newline at end of file