From ad63827dcc686a230a98ec09ca8ba52a9e0ce238 Mon Sep 17 00:00:00 2001 From: 202310715066 NABILA SUWANDIRA <202310715066@mhs.ubharajaya.ac.id> Date: Thu, 16 Oct 2025 16:22:58 +0700 Subject: [PATCH] Delete MainActivity.kt --- MainActivity.kt | 62 ------------------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 MainActivity.kt diff --git a/MainActivity.kt b/MainActivity.kt deleted file mode 100644 index 8974c3b..0000000 --- a/MainActivity.kt +++ /dev/null @@ -1,62 +0,0 @@ -package com.example.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.material3.MaterialTheme -import androidx.compose.material3.Surface -import androidx.compose.material3.Text -import androidx.compose.runtime.* -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import com.example.sorting.ui.theme.SortingTheme - -class MainActivity : ComponentActivity() { - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - enableEdgeToEdge() - setContent { - SortingTheme { - Surface( - modifier = Modifier.fillMaxSize(), - color = MaterialTheme.colorScheme.background - ) { - SortIntarray() - } - } - } - } -} - -@Composable -fun SortIntarray() { - // Angka yang mau diurutkan - val numbers = listOf(1, 7, 99, 46, 90, 600, 98, 76, 52) - - // State sebelum dan sesudah - var before by remember { mutableStateOf("") } - var after by remember { mutableStateOf("") } - - // Proses sortir - LaunchedEffect(Unit) { - before = numbers.joinToString(", ") - val sorted = numbers.sorted() - after = sorted.joinToString(", ") - } - - Column { - Text(text = "Sebelum diurutkan: $before") - Text(text = "Sesudah diurutkan: $after") - } -} - -@Preview(showBackground = true) -@Composable -fun PreviewSortIntarray() { - SortingTheme { - SortIntarray() - } -}