# Conflicts:
#	.idea/inspectionProfiles/Project_Default.xml
#	app/src/main/AndroidManifest.xml
#	app/src/main/java/com/example/siamobile/KHSActivity.kt
#	app/src/main/java/com/example/siamobile/Mhs000000000000.kt
#	gradle/libs.versions.toml
This commit is contained in:
ismarauu 2025-01-09 23:14:09 +07:00
commit 66d26b009f
6 changed files with 215 additions and 2 deletions

BIN
UAS.zip Normal file

Binary file not shown.

View File

@ -40,7 +40,7 @@ android {
}
dependencies {
// Core dependencies
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
@ -53,11 +53,15 @@ dependencies {
implementation(libs.material)
implementation(libs.androidx.activity)
implementation(libs.androidx.constraintlayout)
// Test dependencies
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
// Debug dependencies
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}
}

View File

@ -0,0 +1,189 @@
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 Mhs202210715136 : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val mahasiswaName = intent.getStringExtra("mahasiswaName") ?: "NPM: 202210715136 Nama: Muhamad Rajwa Athoriq"
setContent {
SIAMobileTheme {
DetailMahasiswaScreen(mahasiswaName)
}
}
}
}
@Composable
fun DetailMahasiswaScreenOld(mahasiswaName: String) {
val context = LocalContext.current
val matakuliahList = listOf(
Triple(1, "Aljabar Linear", 1),
Triple(2, "Character Building", 1),
Triple(3, "Dasar Pemrograman", 1),
Triple(4, "Fisika", 1),
Triple(5, "Kalkulus 1", 1),
Triple(6, "Kewarganegaraan", 1),
Triple(7, "Pengantar Teknologi Informasi", 1),
Triple(8, "Struktur Data dan Algoritma", 1),
Triple(9, "Bahasa Indonesia", 2),
Triple(10, "Desain dan Analisis Algoritma", 2),
Triple(11, "Kalkulus II", 2),
Triple(12, "Logika Matematika", 2),
Triple(13, "Matematika Diskrit", 2),
Triple(14, "Pendidikan Agama", 2),
Triple(15, "Sistem Basis Data", 2),
Triple(16, "Analisa Numerik", 3)
)
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")
}
}
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Mhs202210715136">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Mhs202210715136">
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.