From acc26cc3dc14a28b188cdd6a5e109cb53b170c4b Mon Sep 17 00:00:00 2001 From: Muhamad Rajwa Athoriq Date: Thu, 9 Jan 2025 22:46:29 +0700 Subject: [PATCH] bagas commit --- app/src/main/AndroidManifest.xml | 3 + .../java/com/example/siamobile/KHSActivity.kt | 3 +- .../com/example/siamobile/Mhs202210715292.kt | 178 ++++++++++++++++++ 3 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/com/example/siamobile/Mhs202210715292.kt diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1ef0045..841b750 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,6 +15,9 @@ + diff --git a/app/src/main/java/com/example/siamobile/KHSActivity.kt b/app/src/main/java/com/example/siamobile/KHSActivity.kt index fc67e11..4cfb74f 100644 --- a/app/src/main/java/com/example/siamobile/KHSActivity.kt +++ b/app/src/main/java/com/example/siamobile/KHSActivity.kt @@ -106,7 +106,8 @@ fun KHSItem(mahasiswaName: String) { val context = LocalContext.current val mahasiswaActivityMap = mapOf( "000000000000 EXAMPLE" to Mhs000000000000::class.java, - "202210715136 MUHAMAD RAJWA ATHORIQ" to Mhs202210715136::class.java + "202210715136 MUHAMAD RAJWA ATHORIQ" to Mhs202210715136::class.java, + "202210715292 BAGAS WAHYU PERMANA" to Mhs202210715292::class.java //"202210715185 AHMAD DIMAS RAMADHAN" to Mhs202210715185::class.java, // silahkan ditambahkan di sini untuk NPM yang lain ) diff --git a/app/src/main/java/com/example/siamobile/Mhs202210715292.kt b/app/src/main/java/com/example/siamobile/Mhs202210715292.kt new file mode 100644 index 0000000..ea7d8ee --- /dev/null +++ b/app/src/main/java/com/example/siamobile/Mhs202210715292.kt @@ -0,0 +1,178 @@ +package com.example.siamobile + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import androidx.compose.animation.animateContentSize +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.example.siamobile.ui.theme.SIAMobileTheme + +class Mhs202210715292 : ComponentActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val mahasiswaName = intent.getStringExtra("mahasiswaName") ?: "NPM: 202210715292 Nama: Bagas Wahyu Permana" + setContent { + SIAMobileTheme { + DetailMahasiswaScreenBagas(mahasiswaName) // Pastikan nama fungsi ini sesuai + } + } + } +} + +@Composable +fun DetailMahasiswaScreenBagas(mahasiswaName: String) { // Fungsi yang dipanggil di atas + val context = LocalContext.current + val matakuliahList = listOf( + Triple(1, "Bahasa Indonesia", 2), + Triple(2, "Agama", 2), + Triple(3, "Kalkulus 2", 2), + Triple(4, "Logika Matematika", 2), + Triple(5, "Matematika Diskrit", 2), + Triple(6, "Desain Analisis", 2), + Triple(7, "Sistem Basis Data", 2) + ) + + Column( + modifier = Modifier + .fillMaxSize() + .padding(16.dp), + verticalArrangement = Arrangement.SpaceBetween + ) { + Column { + Text( + text = "KHS Mahasiswa", + style = MaterialTheme.typography.headlineMedium, + fontWeight = FontWeight.Bold + ) + Spacer(modifier = Modifier.height(8.dp)) + Text( + text = mahasiswaName, + style = MaterialTheme.typography.bodyLarge, + fontWeight = FontWeight.Medium + ) + Spacer(modifier = Modifier.height(16.dp)) + + // Table Header + Row( + modifier = Modifier + .fillMaxWidth() + .background(MaterialTheme.colorScheme.primaryContainer, RoundedCornerShape(8.dp)) + .padding(vertical = 8.dp, horizontal = 16.dp), + horizontalArrangement = Arrangement.SpaceBetween + ) { + Text( + text = "No", + style = MaterialTheme.typography.bodyMedium.copy( + fontWeight = FontWeight.Bold, + color = MaterialTheme.colorScheme.onPrimaryContainer + ), + modifier = Modifier.weight(0.2f) + ) + Text( + text = "Mata Kuliah", + style = MaterialTheme.typography.bodyMedium.copy( + fontWeight = FontWeight.Bold, + color = MaterialTheme.colorScheme.onPrimaryContainer + ), + modifier = Modifier.weight(0.6f) + ) + Text( + text = "Sem.", + style = MaterialTheme.typography.bodyMedium.copy( + fontWeight = FontWeight.Bold, + color = MaterialTheme.colorScheme.onPrimaryContainer + ), + modifier = Modifier.weight(0.2f) + ) + } + Spacer(modifier = Modifier.height(8.dp)) + + // Table Rows + LazyColumn( + modifier = Modifier.fillMaxWidth() + ) { + items(matakuliahList) { (no, course, semester) -> + var isSelected by remember { mutableStateOf(false) } + + Row( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 4.dp) + .clickable { + isSelected = !isSelected + } + .background( + if (isSelected) MaterialTheme.colorScheme.secondaryContainer + else Color.Transparent, + RoundedCornerShape(8.dp) + ) + .padding(vertical = 12.dp, horizontal = 16.dp) + .animateContentSize(), + horizontalArrangement = Arrangement.SpaceBetween + ) { + Text( + text = no.toString(), + style = MaterialTheme.typography.bodyMedium, + fontSize = 16.sp, + modifier = Modifier.weight(0.2f) + ) + Text( + text = course, + style = MaterialTheme.typography.bodyMedium, + fontSize = 16.sp, + modifier = Modifier.weight(0.6f) + ) + Text( + text = semester.toString(), + style = MaterialTheme.typography.bodyMedium, + fontSize = 16.sp, + modifier = Modifier.weight(0.2f) + ) + } + } + } + } + + // Interactive Back Button with visual feedback + Button( + onClick = { (context as? ComponentActivity)?.finish() }, + modifier = Modifier + .align(Alignment.CenterHorizontally) + .padding(top = 16.dp), + colors = ButtonDefaults.buttonColors( + containerColor = MaterialTheme.colorScheme.primary, + contentColor = MaterialTheme.colorScheme.onPrimary + ) + ) { + Text(text = "Kembali") + } + } +}