Apis apus pitur
This commit is contained in:
parent
8d03328ec2
commit
a142b4a942
3
.idea/deploymentTargetSelector.xml
generated
3
.idea/deploymentTargetSelector.xml
generated
@ -5,9 +5,6 @@
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
</SelectionState>
|
||||
<SelectionState runConfigName="Notebook">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
</project>
|
||||
@ -51,11 +51,12 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun NotebookApp() {
|
||||
var selectedTabIndex by remember { mutableStateOf(0) }
|
||||
val tabs = listOf("Sources", "Chat", "Studio")
|
||||
val tabs = listOf("Studio", "Chat", "Sources")
|
||||
var showGoogleAppsMenu by remember { mutableStateOf(false) }
|
||||
var showSettingsMenu by remember { mutableStateOf(false) }
|
||||
var showAccountScreen by remember { mutableStateOf(false) }
|
||||
@ -67,11 +68,9 @@ fun NotebookApp() {
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text("Apis Notepad") },
|
||||
title = { Text("NoteBook") },
|
||||
actions = {
|
||||
IconButton(onClick = { /* do something */ }) {
|
||||
Icon(Icons.Filled.Share, contentDescription = "Share")
|
||||
}
|
||||
// [DIHAPUS] Tombol Share
|
||||
Box {
|
||||
IconButton(onClick = { showSettingsMenu = true }) {
|
||||
Icon(Icons.Filled.Settings, contentDescription = "Settings")
|
||||
@ -108,9 +107,9 @@ fun NotebookApp() {
|
||||
}
|
||||
}
|
||||
when (selectedTabIndex) {
|
||||
0 -> SourcesScreen()
|
||||
0 -> StudioScreen()
|
||||
1 -> ChatScreen()
|
||||
2 -> StudioScreen()
|
||||
2 -> SourcesScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -318,14 +317,10 @@ fun GoogleAppsMenu(expanded: Boolean, onDismiss: () -> Unit) {
|
||||
@Composable
|
||||
fun SourcesScreen() {
|
||||
var showAddSourcesSheet by remember { mutableStateOf(false) }
|
||||
var showDiscoverDialog by remember { mutableStateOf(false) }
|
||||
|
||||
if (showAddSourcesSheet) {
|
||||
AddSourcesSheet(onDismiss = { showAddSourcesSheet = false })
|
||||
}
|
||||
if (showDiscoverDialog) {
|
||||
DiscoverSourcesDialog(onDismiss = { showDiscoverDialog = false })
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
@ -335,18 +330,13 @@ fun SourcesScreen() {
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||
horizontalArrangement = Arrangement.Center
|
||||
) {
|
||||
Button(onClick = { showAddSourcesSheet = true }, modifier = Modifier.weight(1f)) {
|
||||
Button(onClick = { showAddSourcesSheet = true }) {
|
||||
Icon(Icons.Filled.Add, contentDescription = "Add")
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
Text("Add")
|
||||
}
|
||||
Button(onClick = { showDiscoverDialog = true }, modifier = Modifier.weight(1f)) {
|
||||
Icon(Icons.Filled.Search, contentDescription = "Discover")
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
Text("Discover")
|
||||
}
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
@ -367,98 +357,6 @@ fun SourcesScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun DiscoverSourcesDialog(onDismiss: () -> Unit) {
|
||||
var description by remember { mutableStateOf("") }
|
||||
val findFromOptions = listOf("Web", "Google Drive")
|
||||
var selectedOption by remember { mutableStateOf(findFromOptions[0]) }
|
||||
|
||||
Dialog(onDismissRequest = onDismiss, properties = DialogProperties(usePlatformDefaultWidth = false)) {
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text("Discover sources") },
|
||||
actions = {
|
||||
IconButton(onClick = onDismiss) {
|
||||
Icon(Icons.Default.Close, contentDescription = "Close")
|
||||
}
|
||||
}
|
||||
)
|
||||
},
|
||||
bottomBar = {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth().padding(16.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
Button(
|
||||
onClick = { /* TODO */ },
|
||||
modifier = Modifier.weight(1f)
|
||||
) {
|
||||
Icon(Icons.Default.Celebration, contentDescription = null)
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
Text("I'm feeling curious")
|
||||
}
|
||||
Button(
|
||||
onClick = { /* TODO */ },
|
||||
modifier = Modifier.weight(1f),
|
||||
enabled = description.isNotBlank()
|
||||
) {
|
||||
Text("Submit")
|
||||
}
|
||||
}
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(paddingValues)
|
||||
.padding(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.TravelExplore,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(48.dp)
|
||||
)
|
||||
Text("What are you interested in?", style = MaterialTheme.typography.titleLarge)
|
||||
OutlinedTextField(
|
||||
value = description,
|
||||
onValueChange = { description = it },
|
||||
placeholder = { Text("Describe something you'd like to learn about or click \"I'm feeling curious\" to explore a new topic.") },
|
||||
modifier = Modifier.fillMaxWidth().height(150.dp)
|
||||
)
|
||||
Column(modifier = Modifier.fillMaxWidth()) {
|
||||
Text("Find sources from:", style = MaterialTheme.typography.titleMedium)
|
||||
findFromOptions.forEach { text ->
|
||||
Row(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.selectable(
|
||||
selected = (text == selectedOption),
|
||||
onClick = { selectedOption = text }
|
||||
)
|
||||
.padding(vertical = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
RadioButton(
|
||||
selected = (text == selectedOption),
|
||||
onClick = { selectedOption = text }
|
||||
)
|
||||
Text(
|
||||
text = text,
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
modifier = Modifier.padding(start = 8.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun AddSourcesSheet(onDismiss: () -> Unit) {
|
||||
@ -497,11 +395,6 @@ fun AddSourcesSheet(onDismiss: () -> Unit) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text("Add sources", style = MaterialTheme.typography.titleLarge)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Button(onClick = { /*TODO*/ }) {
|
||||
Icon(Icons.Default.Search, contentDescription = null)
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
Text("Discover sources")
|
||||
}
|
||||
}
|
||||
Text("Get started by selecting sources", style = MaterialTheme.typography.bodyMedium, color = Color.Gray)
|
||||
|
||||
@ -547,15 +440,15 @@ fun AddSourcesSheet(onDismiss: () -> Unit) {
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text("Pilih File") },
|
||||
onClick = {
|
||||
onClick = {
|
||||
filePickerLauncher.launch("*/*")
|
||||
showUploadMenu = false
|
||||
showUploadMenu = false
|
||||
},
|
||||
leadingIcon = { Icon(Icons.Default.Folder, contentDescription = null) }
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text("Google Drive") },
|
||||
onClick = {
|
||||
onClick = {
|
||||
filePickerLauncher.launch("*/*")
|
||||
showUploadMenu = false
|
||||
},
|
||||
@ -568,40 +461,17 @@ fun AddSourcesSheet(onDismiss: () -> Unit) {
|
||||
Card(modifier = Modifier.fillMaxWidth()) {
|
||||
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(Icons.Default.CorporateFare, contentDescription = null)
|
||||
Icon(Icons.Default.CorporateFare, contentDescription = null)
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Text("Google Workspace", fontWeight = FontWeight.Bold)
|
||||
}
|
||||
Button(onClick = { /*TODO*/ }) {
|
||||
Icon(Icons.Default.Cloud, contentDescription = null)
|
||||
Icon(Icons.Default.Cloud, contentDescription = null)
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
Text("Google Drive")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Link card
|
||||
Card(modifier = Modifier.fillMaxWidth()) {
|
||||
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(Icons.Default.Link, contentDescription = null)
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Text("Link", fontWeight = FontWeight.Bold)
|
||||
}
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Button(onClick = { /*TODO*/ }) {
|
||||
Icon(Icons.Default.Language, contentDescription = null)
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
Text("Website")
|
||||
}
|
||||
Button(onClick = { /*TODO*/ }) {
|
||||
Icon(Icons.Default.PlayCircle, contentDescription = null)
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
Text("YouTube")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -658,78 +528,93 @@ fun ChatScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun StudioScreen() {
|
||||
val studioActions = listOf(
|
||||
"Audio Overview" to Icons.Default.GraphicEq,
|
||||
"Video Overview" to Icons.Default.OndemandVideo,
|
||||
"Mind Map" to Icons.Default.AccountTree,
|
||||
"Reports" to Icons.Default.Assessment,
|
||||
"Flashcards" to Icons.Default.Style,
|
||||
"Quiz" to Icons.Default.Quiz
|
||||
// State untuk dropdown menu
|
||||
var showUploadMenu by remember { mutableStateOf(false) }
|
||||
|
||||
// Launcher untuk mengambil media
|
||||
val photoPickerLauncher = rememberLauncherForActivityResult(
|
||||
contract = ActivityResultContracts.PickVisualMedia(),
|
||||
onResult = { uri -> /* Handle URI */ }
|
||||
)
|
||||
val filePickerLauncher = rememberLauncherForActivityResult(
|
||||
contract = ActivityResultContracts.GetContent(),
|
||||
onResult = { uri -> /* Handle URI */ }
|
||||
)
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
LazyVerticalGrid(
|
||||
columns = GridCells.Fixed(2),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
items(studioActions) { (title, icon) ->
|
||||
StudioActionCard(title = title, icon = icon)
|
||||
}
|
||||
}
|
||||
Column(modifier = Modifier.fillMaxSize().background(Color.White).padding(16.dp)) {
|
||||
Text("Notebook terbaru", style = MaterialTheme.typography.titleLarge, fontWeight = FontWeight.Bold, color = Color.Black)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Icon(Icons.Default.AutoAwesome, contentDescription = null, tint = Color.Gray)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text("Studio output will be saved here.", style = MaterialTheme.typography.titleMedium)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = "After adding sources, click to add Audio Overview, Study Guide, Mind Map, and more!",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
textAlign = TextAlign.Center,
|
||||
color = Color.Gray
|
||||
)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Button(onClick = { /*TODO*/ }) {
|
||||
Icon(Icons.Default.NoteAdd, contentDescription = null)
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
Text("Add note")
|
||||
// Box untuk menjadi anchor bagi DropdownMenu
|
||||
Box {
|
||||
NewNotebookCard(onClick = { showUploadMenu = true })
|
||||
|
||||
DropdownMenu(
|
||||
expanded = showUploadMenu,
|
||||
onDismissRequest = { showUploadMenu = false }
|
||||
) {
|
||||
DropdownMenuItem(
|
||||
text = { Text("Perpustakaan Foto") },
|
||||
onClick = {
|
||||
photoPickerLauncher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageAndVideo))
|
||||
showUploadMenu = false
|
||||
},
|
||||
leadingIcon = { Icon(Icons.Default.PhotoLibrary, contentDescription = null) }
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text("Ambil Video") },
|
||||
onClick = { /* TODO: Implement Camera Launcher */ showUploadMenu = false },
|
||||
leadingIcon = { Icon(Icons.Default.PhotoCamera, contentDescription = null) }
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text("Pilih File") },
|
||||
onClick = {
|
||||
filePickerLauncher.launch("*/*")
|
||||
showUploadMenu = false
|
||||
},
|
||||
leadingIcon = { Icon(Icons.Default.Folder, contentDescription = null) }
|
||||
)
|
||||
DropdownMenuItem(
|
||||
text = { Text("Google Drive") },
|
||||
onClick = {
|
||||
filePickerLauncher.launch("*/*")
|
||||
showUploadMenu = false
|
||||
},
|
||||
leadingIcon = { Icon(Icons.Default.Cloud, contentDescription = null) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun StudioActionCard(title: String, icon: ImageVector) {
|
||||
fun NewNotebookCard(onClick: () -> Unit) {
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
shape = MaterialTheme.shapes.medium
|
||||
modifier = Modifier
|
||||
.size(width = 180.dp, height = 150.dp)
|
||||
.clickable(onClick = onClick),
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = Color(0xFFF0F4F7))
|
||||
) {
|
||||
Box(modifier = Modifier.padding(12.dp)) {
|
||||
Column(horizontalAlignment = Alignment.Start) {
|
||||
Icon(icon, contentDescription = null, modifier = Modifier.size(24.dp))
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(title, style = MaterialTheme.typography.bodyLarge)
|
||||
}
|
||||
Icon(
|
||||
Icons.Default.Edit,
|
||||
contentDescription = "Edit",
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
.size(18.dp),
|
||||
tint = Color.Gray
|
||||
)
|
||||
.size(40.dp)
|
||||
.clip(CircleShape)
|
||||
.background(Color(0xFFE1E3E6)),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(Icons.Default.Add, contentDescription = "Buat notebook baru", tint = Color.Black)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text("Buat notebook baru", color = Color.Black)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -738,6 +623,6 @@ fun StudioActionCard(title: String, icon: ImageVector) {
|
||||
@Composable
|
||||
fun DefaultPreview() {
|
||||
NotebookTheme {
|
||||
NotebookApp()
|
||||
StudioScreen()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user