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">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
</SelectionState>
|
</SelectionState>
|
||||||
<SelectionState runConfigName="Notebook">
|
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
|
||||||
</SelectionState>
|
|
||||||
</selectionStates>
|
</selectionStates>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@ -51,11 +51,12 @@ class MainActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun NotebookApp() {
|
fun NotebookApp() {
|
||||||
var selectedTabIndex by remember { mutableStateOf(0) }
|
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 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) }
|
||||||
@ -67,11 +68,9 @@ fun NotebookApp() {
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text("Apis Notepad") },
|
title = { Text("NoteBook") },
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(onClick = { /* do something */ }) {
|
// [DIHAPUS] Tombol Share
|
||||||
Icon(Icons.Filled.Share, contentDescription = "Share")
|
|
||||||
}
|
|
||||||
Box {
|
Box {
|
||||||
IconButton(onClick = { showSettingsMenu = true }) {
|
IconButton(onClick = { showSettingsMenu = true }) {
|
||||||
Icon(Icons.Filled.Settings, contentDescription = "Settings")
|
Icon(Icons.Filled.Settings, contentDescription = "Settings")
|
||||||
@ -108,9 +107,9 @@ fun NotebookApp() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
when (selectedTabIndex) {
|
when (selectedTabIndex) {
|
||||||
0 -> SourcesScreen()
|
0 -> StudioScreen()
|
||||||
1 -> ChatScreen()
|
1 -> ChatScreen()
|
||||||
2 -> StudioScreen()
|
2 -> SourcesScreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,14 +317,10 @@ fun GoogleAppsMenu(expanded: Boolean, onDismiss: () -> Unit) {
|
|||||||
@Composable
|
@Composable
|
||||||
fun SourcesScreen() {
|
fun SourcesScreen() {
|
||||||
var showAddSourcesSheet by remember { mutableStateOf(false) }
|
var showAddSourcesSheet by remember { mutableStateOf(false) }
|
||||||
var showDiscoverDialog by remember { mutableStateOf(false) }
|
|
||||||
|
|
||||||
if (showAddSourcesSheet) {
|
if (showAddSourcesSheet) {
|
||||||
AddSourcesSheet(onDismiss = { showAddSourcesSheet = false })
|
AddSourcesSheet(onDismiss = { showAddSourcesSheet = false })
|
||||||
}
|
}
|
||||||
if (showDiscoverDialog) {
|
|
||||||
DiscoverSourcesDialog(onDismiss = { showDiscoverDialog = false })
|
|
||||||
}
|
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -335,18 +330,13 @@ fun SourcesScreen() {
|
|||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
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")
|
Icon(Icons.Filled.Add, contentDescription = "Add")
|
||||||
Spacer(modifier = Modifier.width(4.dp))
|
Spacer(modifier = Modifier.width(4.dp))
|
||||||
Text("Add")
|
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(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
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)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun AddSourcesSheet(onDismiss: () -> Unit) {
|
fun AddSourcesSheet(onDismiss: () -> Unit) {
|
||||||
@ -497,11 +395,6 @@ fun AddSourcesSheet(onDismiss: () -> Unit) {
|
|||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
Text("Add sources", style = MaterialTheme.typography.titleLarge)
|
Text("Add sources", style = MaterialTheme.typography.titleLarge)
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
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)
|
Text("Get started by selecting sources", style = MaterialTheme.typography.bodyMedium, color = Color.Gray)
|
||||||
|
|
||||||
@ -547,15 +440,15 @@ fun AddSourcesSheet(onDismiss: () -> Unit) {
|
|||||||
)
|
)
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text("Pilih File") },
|
text = { Text("Pilih File") },
|
||||||
onClick = {
|
onClick = {
|
||||||
filePickerLauncher.launch("*/*")
|
filePickerLauncher.launch("*/*")
|
||||||
showUploadMenu = false
|
showUploadMenu = false
|
||||||
},
|
},
|
||||||
leadingIcon = { Icon(Icons.Default.Folder, contentDescription = null) }
|
leadingIcon = { Icon(Icons.Default.Folder, contentDescription = null) }
|
||||||
)
|
)
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text("Google Drive") },
|
text = { Text("Google Drive") },
|
||||||
onClick = {
|
onClick = {
|
||||||
filePickerLauncher.launch("*/*")
|
filePickerLauncher.launch("*/*")
|
||||||
showUploadMenu = false
|
showUploadMenu = false
|
||||||
},
|
},
|
||||||
@ -568,40 +461,17 @@ fun AddSourcesSheet(onDismiss: () -> Unit) {
|
|||||||
Card(modifier = Modifier.fillMaxWidth()) {
|
Card(modifier = Modifier.fillMaxWidth()) {
|
||||||
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
Icon(Icons.Default.CorporateFare, contentDescription = null)
|
Icon(Icons.Default.CorporateFare, contentDescription = null)
|
||||||
Spacer(modifier = Modifier.width(8.dp))
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
Text("Google Workspace", fontWeight = FontWeight.Bold)
|
Text("Google Workspace", fontWeight = FontWeight.Bold)
|
||||||
}
|
}
|
||||||
Button(onClick = { /*TODO*/ }) {
|
Button(onClick = { /*TODO*/ }) {
|
||||||
Icon(Icons.Default.Cloud, contentDescription = null)
|
Icon(Icons.Default.Cloud, contentDescription = null)
|
||||||
Spacer(modifier = Modifier.width(4.dp))
|
Spacer(modifier = Modifier.width(4.dp))
|
||||||
Text("Google Drive")
|
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
|
@Composable
|
||||||
fun StudioScreen() {
|
fun StudioScreen() {
|
||||||
val studioActions = listOf(
|
// State untuk dropdown menu
|
||||||
"Audio Overview" to Icons.Default.GraphicEq,
|
var showUploadMenu by remember { mutableStateOf(false) }
|
||||||
"Video Overview" to Icons.Default.OndemandVideo,
|
|
||||||
"Mind Map" to Icons.Default.AccountTree,
|
// Launcher untuk mengambil media
|
||||||
"Reports" to Icons.Default.Assessment,
|
val photoPickerLauncher = rememberLauncherForActivityResult(
|
||||||
"Flashcards" to Icons.Default.Style,
|
contract = ActivityResultContracts.PickVisualMedia(),
|
||||||
"Quiz" to Icons.Default.Quiz
|
onResult = { uri -> /* Handle URI */ }
|
||||||
|
)
|
||||||
|
val filePickerLauncher = rememberLauncherForActivityResult(
|
||||||
|
contract = ActivityResultContracts.GetContent(),
|
||||||
|
onResult = { uri -> /* Handle URI */ }
|
||||||
)
|
)
|
||||||
|
|
||||||
Column(
|
Column(modifier = Modifier.fillMaxSize().background(Color.White).padding(16.dp)) {
|
||||||
modifier = Modifier
|
Text("Notebook terbaru", style = MaterialTheme.typography.titleLarge, fontWeight = FontWeight.Bold, color = Color.Black)
|
||||||
.fillMaxSize()
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
.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(
|
// Box untuk menjadi anchor bagi DropdownMenu
|
||||||
modifier = Modifier.fillMaxSize(),
|
Box {
|
||||||
verticalArrangement = Arrangement.Center,
|
NewNotebookCard(onClick = { showUploadMenu = true })
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
|
||||||
) {
|
DropdownMenu(
|
||||||
Icon(Icons.Default.AutoAwesome, contentDescription = null, tint = Color.Gray)
|
expanded = showUploadMenu,
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
onDismissRequest = { showUploadMenu = false }
|
||||||
Text("Studio output will be saved here.", style = MaterialTheme.typography.titleMedium)
|
) {
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
DropdownMenuItem(
|
||||||
Text(
|
text = { Text("Perpustakaan Foto") },
|
||||||
text = "After adding sources, click to add Audio Overview, Study Guide, Mind Map, and more!",
|
onClick = {
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
photoPickerLauncher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageAndVideo))
|
||||||
textAlign = TextAlign.Center,
|
showUploadMenu = false
|
||||||
color = Color.Gray
|
},
|
||||||
)
|
leadingIcon = { Icon(Icons.Default.PhotoLibrary, contentDescription = null) }
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
)
|
||||||
Button(onClick = { /*TODO*/ }) {
|
DropdownMenuItem(
|
||||||
Icon(Icons.Default.NoteAdd, contentDescription = null)
|
text = { Text("Ambil Video") },
|
||||||
Spacer(modifier = Modifier.width(4.dp))
|
onClick = { /* TODO: Implement Camera Launcher */ showUploadMenu = false },
|
||||||
Text("Add note")
|
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
|
@Composable
|
||||||
fun StudioActionCard(title: String, icon: ImageVector) {
|
fun NewNotebookCard(onClick: () -> Unit) {
|
||||||
Card(
|
Card(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier
|
||||||
shape = MaterialTheme.shapes.medium
|
.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(
|
||||||
Column(horizontalAlignment = Alignment.Start) {
|
modifier = Modifier.fillMaxSize(),
|
||||||
Icon(icon, contentDescription = null, modifier = Modifier.size(24.dp))
|
verticalArrangement = Arrangement.Center,
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
Text(title, style = MaterialTheme.typography.bodyLarge)
|
) {
|
||||||
}
|
Box(
|
||||||
Icon(
|
|
||||||
Icons.Default.Edit,
|
|
||||||
contentDescription = "Edit",
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.TopEnd)
|
.size(40.dp)
|
||||||
.size(18.dp),
|
.clip(CircleShape)
|
||||||
tint = Color.Gray
|
.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
|
@Composable
|
||||||
fun DefaultPreview() {
|
fun DefaultPreview() {
|
||||||
NotebookTheme {
|
NotebookTheme {
|
||||||
NotebookApp()
|
StudioScreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user