File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
app/src/main/kotlin/com/google/ai/sample Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11package com.google.ai.sample
22
3+ import android.content.Intent
4+ import android.net.Uri
35import androidx.compose.foundation.layout.*
46import androidx.compose.foundation.lazy.LazyColumn
57import androidx.compose.foundation.lazy.itemsIndexed
68import androidx.compose.material3.*
79import androidx.compose.runtime.*
810import androidx.compose.ui.Alignment
911import androidx.compose.ui.Modifier
12+ import androidx.compose.ui.platform.LocalContext
1013import androidx.compose.ui.text.style.TextAlign
1114import androidx.compose.ui.unit.dp
1215import androidx.compose.ui.window.Dialog
@@ -24,6 +27,7 @@ fun ApiKeyDialog(
2427 var errorMessage by remember { mutableStateOf(" " ) }
2528 val apiKeys = remember { mutableStateListOf<String >() }
2629 var selectedKeyIndex by remember { mutableStateOf(apiKeyManager.getCurrentKeyIndex()) }
30+ val context = LocalContext .current
2731
2832 // Load existing keys
2933 LaunchedEffect (Unit ) {
@@ -63,6 +67,19 @@ fun ApiKeyDialog(
6367 )
6468 }
6569
70+ // Get API Key button
71+ Button (
72+ onClick = {
73+ val intent = Intent (Intent .ACTION_VIEW , Uri .parse(" https://aistudio.google.com/u/0/apikey" ))
74+ context.startActivity(intent)
75+ },
76+ modifier = Modifier
77+ .fillMaxWidth()
78+ .padding(bottom = 16 .dp)
79+ ) {
80+ Text (" Get API Key" )
81+ }
82+
6683 // Input field for new API key
6784 OutlinedTextField (
6885 value = apiKeyInput,
You can’t perform that action at this time.
0 commit comments