Goldenboy update
This commit is contained in:
parent
4b6a44f3b1
commit
a3337622c5
@ -41,12 +41,18 @@ class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
NotebookTheme {
|
||||
var isDarkMode by remember { mutableStateOf(false) }
|
||||
|
||||
NotebookTheme(darkTheme = isDarkMode) {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
NotebookApp(viewModel = viewModel)
|
||||
NotebookApp(
|
||||
viewModel = viewModel,
|
||||
isDarkMode = isDarkMode,
|
||||
onThemeChange = { isDarkMode = it }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -55,10 +61,13 @@ class MainActivity : ComponentActivity() {
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun NotebookApp(viewModel: NotebookViewModel) {
|
||||
fun NotebookApp(
|
||||
viewModel: NotebookViewModel,
|
||||
isDarkMode: Boolean,
|
||||
onThemeChange: (Boolean) -> Unit
|
||||
) {
|
||||
var selectedTabIndex by remember { mutableIntStateOf(0) }
|
||||
val tabs = listOf("Studio", "Chat", "Sources")
|
||||
var showGoogleAppsMenu by remember { mutableStateOf(false) }
|
||||
var showSettingsMenu by remember { mutableStateOf(false) }
|
||||
var showAccountScreen by remember { mutableStateOf(false) }
|
||||
var chatInput by remember { mutableStateOf("") }
|
||||
@ -87,14 +96,14 @@ fun NotebookApp(viewModel: NotebookViewModel) {
|
||||
IconButton(onClick = { showSettingsMenu = true }) {
|
||||
Icon(Icons.Filled.Settings, contentDescription = "Settings")
|
||||
}
|
||||
SettingsMenu(expanded = showSettingsMenu, onDismiss = { showSettingsMenu = false })
|
||||
}
|
||||
Box {
|
||||
IconButton(onClick = { showGoogleAppsMenu = true }) {
|
||||
Icon(Icons.Filled.Apps, contentDescription = "Google Apps")
|
||||
}
|
||||
GoogleAppsMenu(expanded = showGoogleAppsMenu, onDismiss = { showGoogleAppsMenu = false })
|
||||
SettingsMenu(
|
||||
expanded = showSettingsMenu,
|
||||
onDismiss = { showSettingsMenu = false },
|
||||
isDarkMode = isDarkMode,
|
||||
onThemeChange = onThemeChange
|
||||
)
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(32.dp)
|
||||
@ -176,14 +185,14 @@ fun StudioScreen(viewModel: NotebookViewModel) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(Color.White)
|
||||
.background(MaterialTheme.colorScheme.background)
|
||||
.padding(16.dp)
|
||||
) {
|
||||
Text(
|
||||
"Notebook terbaru",
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color.Black
|
||||
color = MaterialTheme.colorScheme.onBackground
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
@ -215,7 +224,9 @@ fun NewNotebookCard(onClick: () -> Unit) {
|
||||
.height(120.dp)
|
||||
.clickable(onClick = onClick),
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = Color(0xFFF0F4F7))
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surfaceVariant
|
||||
)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
@ -226,13 +237,20 @@ fun NewNotebookCard(onClick: () -> Unit) {
|
||||
modifier = Modifier
|
||||
.size(40.dp)
|
||||
.clip(CircleShape)
|
||||
.background(Color(0xFFE1E3E6)),
|
||||
.background(MaterialTheme.colorScheme.secondaryContainer),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(Icons.Default.Add, contentDescription = "Buat notebook baru", tint = Color.Black)
|
||||
Icon(
|
||||
Icons.Default.Add,
|
||||
contentDescription = "Buat notebook baru",
|
||||
tint = MaterialTheme.colorScheme.onSecondaryContainer
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text("Buat notebook baru", color = Color.Black)
|
||||
Text(
|
||||
"Buat notebook baru",
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -250,7 +268,9 @@ fun NotebookCard(
|
||||
.fillMaxWidth()
|
||||
.clickable(onClick = onClick),
|
||||
shape = RoundedCornerShape(12.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = Color(0xFFF8F9FA))
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface
|
||||
)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
@ -263,13 +283,13 @@ fun NotebookCard(
|
||||
modifier = Modifier
|
||||
.size(48.dp)
|
||||
.clip(RoundedCornerShape(8.dp))
|
||||
.background(Color(0xFFE8EAF6)),
|
||||
.background(MaterialTheme.colorScheme.primaryContainer),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(
|
||||
Icons.Default.Description,
|
||||
contentDescription = null,
|
||||
tint = Color(0xFF5C6BC0)
|
||||
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
|
||||
@ -282,14 +302,15 @@ fun NotebookCard(
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
fontWeight = FontWeight.Bold,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Text(
|
||||
text = if (notebook.description.isNotBlank()) notebook.description
|
||||
else "Belum ada deskripsi",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = Color.Gray,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
@ -297,7 +318,7 @@ fun NotebookCard(
|
||||
Text(
|
||||
text = dateFormat.format(Date(notebook.updatedAt)),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = Color.Gray
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
|
||||
@ -306,7 +327,7 @@ fun NotebookCard(
|
||||
Icon(
|
||||
Icons.Default.Delete,
|
||||
contentDescription = "Hapus",
|
||||
tint = Color.Gray
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -384,7 +405,7 @@ fun SourcesScreen(viewModel: NotebookViewModel) {
|
||||
}
|
||||
}
|
||||
|
||||
// === MENU COMPONENTS (Tetap sama) ===
|
||||
// === MENU COMPONENTS ===
|
||||
@Composable
|
||||
fun AccountScreen(onDismiss: () -> Unit) {
|
||||
Dialog(
|
||||
@ -435,8 +456,40 @@ fun AccountScreen(onDismiss: () -> Unit) {
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SettingsMenu(expanded: Boolean, onDismiss: () -> Unit) {
|
||||
fun SettingsMenu(
|
||||
expanded: Boolean,
|
||||
onDismiss: () -> Unit,
|
||||
isDarkMode: Boolean,
|
||||
onThemeChange: (Boolean) -> Unit
|
||||
) {
|
||||
DropdownMenu(expanded = expanded, onDismissRequest = onDismiss) {
|
||||
// Dark Mode Toggle
|
||||
DropdownMenuItem(
|
||||
text = {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(
|
||||
if (isDarkMode) Icons.Default.DarkMode else Icons.Default.LightMode,
|
||||
contentDescription = null
|
||||
)
|
||||
Spacer(modifier = Modifier.width(12.dp))
|
||||
Text(if (isDarkMode) "Mode Gelap" else "Mode Terang")
|
||||
}
|
||||
Switch(
|
||||
checked = isDarkMode,
|
||||
onCheckedChange = onThemeChange
|
||||
)
|
||||
}
|
||||
},
|
||||
onClick = { onThemeChange(!isDarkMode) }
|
||||
)
|
||||
|
||||
Divider()
|
||||
|
||||
DropdownMenuItem(
|
||||
text = { Text("NotebookLM Help") },
|
||||
onClick = { },
|
||||
@ -445,20 +498,3 @@ fun SettingsMenu(expanded: Boolean, onDismiss: () -> Unit) {
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun GoogleAppsMenu(expanded: Boolean, onDismiss: () -> Unit) {
|
||||
val apps = listOf(
|
||||
"Account" to Icons.Default.AccountCircle,
|
||||
"Gmail" to Icons.Default.Mail,
|
||||
"Drive" to Icons.Default.Cloud
|
||||
)
|
||||
DropdownMenu(expanded = expanded, onDismissRequest = onDismiss) {
|
||||
apps.forEach { (name, icon) ->
|
||||
DropdownMenuItem(
|
||||
text = { Text(name) },
|
||||
onClick = { },
|
||||
leadingIcon = { Icon(icon, contentDescription = name) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user