Skip to content

Commit 770b1f7

Browse files
Add files via upload (#8)
1 parent 9dbc281 commit 770b1f7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

app/src/main/kotlin/com/google/ai/sample/ApiKeyDialog.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package com.google.ai.sample
22

3+
import android.content.Intent
4+
import android.net.Uri
35
import androidx.compose.foundation.layout.*
46
import androidx.compose.foundation.lazy.LazyColumn
57
import androidx.compose.foundation.lazy.itemsIndexed
68
import androidx.compose.material3.*
79
import androidx.compose.runtime.*
810
import androidx.compose.ui.Alignment
911
import androidx.compose.ui.Modifier
12+
import androidx.compose.ui.platform.LocalContext
1013
import androidx.compose.ui.text.style.TextAlign
1114
import androidx.compose.ui.unit.dp
1215
import 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,

0 commit comments

Comments
 (0)