Goldenboy update
This commit is contained in:
parent
4b6a44f3b1
commit
a3337622c5
@ -41,12 +41,18 @@ class MainActivity : ComponentActivity() {
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContent {
|
setContent {
|
||||||
NotebookTheme {
|
var isDarkMode by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
NotebookTheme(darkTheme = isDarkMode) {
|
||||||
Surface(
|
Surface(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
color = MaterialTheme.colorScheme.background
|
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)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun NotebookApp(viewModel: NotebookViewModel) {
|
fun NotebookApp(
|
||||||
|
viewModel: NotebookViewModel,
|
||||||
|
isDarkMode: Boolean,
|
||||||
|
onThemeChange: (Boolean) -> Unit
|
||||||
|
) {
|
||||||
var selectedTabIndex by remember { mutableIntStateOf(0) }
|
var selectedTabIndex by remember { mutableIntStateOf(0) }
|
||||||
val tabs = listOf("Studio", "Chat", "Sources")
|
val tabs = listOf("Studio", "Chat", "Sources")
|
||||||
var showGoogleAppsMenu by remember { mutableStateOf(false) }
|
|
||||||
var showSettingsMenu by remember { mutableStateOf(false) }
|
var showSettingsMenu by remember { mutableStateOf(false) }
|
||||||
var showAccountScreen by remember { mutableStateOf(false) }
|
var showAccountScreen by remember { mutableStateOf(false) }
|
||||||
var chatInput by remember { mutableStateOf("") }
|
var chatInput by remember { mutableStateOf("") }
|
||||||
@ -87,14 +96,14 @@ fun NotebookApp(viewModel: NotebookViewModel) {
|
|||||||
IconButton(onClick = { showSettingsMenu = true }) {
|
IconButton(onClick = { showSettingsMenu = true }) {
|
||||||
Icon(Icons.Filled.Settings, contentDescription = "Settings")
|
Icon(Icons.Filled.Settings, contentDescription = "Settings")
|
||||||
}
|
}
|
||||||
SettingsMenu(expanded = showSettingsMenu, onDismiss = { showSettingsMenu = false })
|
SettingsMenu(
|
||||||
}
|
expanded = showSettingsMenu,
|
||||||
Box {
|
onDismiss = { showSettingsMenu = false },
|
||||||
IconButton(onClick = { showGoogleAppsMenu = true }) {
|
isDarkMode = isDarkMode,
|
||||||
Icon(Icons.Filled.Apps, contentDescription = "Google Apps")
|
onThemeChange = onThemeChange
|
||||||
}
|
)
|
||||||
GoogleAppsMenu(expanded = showGoogleAppsMenu, onDismiss = { showGoogleAppsMenu = false })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(32.dp)
|
.size(32.dp)
|
||||||
@ -176,14 +185,14 @@ fun StudioScreen(viewModel: NotebookViewModel) {
|
|||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(Color.White)
|
.background(MaterialTheme.colorScheme.background)
|
||||||
.padding(16.dp)
|
.padding(16.dp)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
"Notebook terbaru",
|
"Notebook terbaru",
|
||||||
style = MaterialTheme.typography.titleLarge,
|
style = MaterialTheme.typography.titleLarge,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
color = Color.Black
|
color = MaterialTheme.colorScheme.onBackground
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
@ -215,7 +224,9 @@ fun NewNotebookCard(onClick: () -> Unit) {
|
|||||||
.height(120.dp)
|
.height(120.dp)
|
||||||
.clickable(onClick = onClick),
|
.clickable(onClick = onClick),
|
||||||
shape = RoundedCornerShape(16.dp),
|
shape = RoundedCornerShape(16.dp),
|
||||||
colors = CardDefaults.cardColors(containerColor = Color(0xFFF0F4F7))
|
colors = CardDefaults.cardColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.surfaceVariant
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
@ -226,13 +237,20 @@ fun NewNotebookCard(onClick: () -> Unit) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(40.dp)
|
.size(40.dp)
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.background(Color(0xFFE1E3E6)),
|
.background(MaterialTheme.colorScheme.secondaryContainer),
|
||||||
contentAlignment = Alignment.Center
|
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))
|
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()
|
.fillMaxWidth()
|
||||||
.clickable(onClick = onClick),
|
.clickable(onClick = onClick),
|
||||||
shape = RoundedCornerShape(12.dp),
|
shape = RoundedCornerShape(12.dp),
|
||||||
colors = CardDefaults.cardColors(containerColor = Color(0xFFF8F9FA))
|
colors = CardDefaults.cardColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.surface
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -263,13 +283,13 @@ fun NotebookCard(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(48.dp)
|
.size(48.dp)
|
||||||
.clip(RoundedCornerShape(8.dp))
|
.clip(RoundedCornerShape(8.dp))
|
||||||
.background(Color(0xFFE8EAF6)),
|
.background(MaterialTheme.colorScheme.primaryContainer),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Default.Description,
|
Icons.Default.Description,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = Color(0xFF5C6BC0)
|
tint = MaterialTheme.colorScheme.onPrimaryContainer
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,14 +302,15 @@ fun NotebookCard(
|
|||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(4.dp))
|
Spacer(modifier = Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = if (notebook.description.isNotBlank()) notebook.description
|
text = if (notebook.description.isNotBlank()) notebook.description
|
||||||
else "Belum ada deskripsi",
|
else "Belum ada deskripsi",
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = Color.Gray,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
@ -297,7 +318,7 @@ fun NotebookCard(
|
|||||||
Text(
|
Text(
|
||||||
text = dateFormat.format(Date(notebook.updatedAt)),
|
text = dateFormat.format(Date(notebook.updatedAt)),
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = Color.Gray
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +327,7 @@ fun NotebookCard(
|
|||||||
Icon(
|
Icon(
|
||||||
Icons.Default.Delete,
|
Icons.Default.Delete,
|
||||||
contentDescription = "Hapus",
|
contentDescription = "Hapus",
|
||||||
tint = Color.Gray
|
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -384,7 +405,7 @@ fun SourcesScreen(viewModel: NotebookViewModel) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// === MENU COMPONENTS (Tetap sama) ===
|
// === MENU COMPONENTS ===
|
||||||
@Composable
|
@Composable
|
||||||
fun AccountScreen(onDismiss: () -> Unit) {
|
fun AccountScreen(onDismiss: () -> Unit) {
|
||||||
Dialog(
|
Dialog(
|
||||||
@ -435,8 +456,40 @@ fun AccountScreen(onDismiss: () -> Unit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingsMenu(expanded: Boolean, onDismiss: () -> Unit) {
|
fun SettingsMenu(
|
||||||
|
expanded: Boolean,
|
||||||
|
onDismiss: () -> Unit,
|
||||||
|
isDarkMode: Boolean,
|
||||||
|
onThemeChange: (Boolean) -> Unit
|
||||||
|
) {
|
||||||
DropdownMenu(expanded = expanded, onDismissRequest = onDismiss) {
|
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(
|
DropdownMenuItem(
|
||||||
text = { Text("NotebookLM Help") },
|
text = { Text("NotebookLM Help") },
|
||||||
onClick = { },
|
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