feature/ai-assistant #2

Merged
anas merged 6 commits from feature/ai-assistant into main 2026-10-04 17:16:54 +00:00
3 changed files with 14 additions and 5 deletions
Showing only changes of commit 90b527522b - Show all commits

View File

@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.automirrored.filled.Send
import androidx.compose.material.icons.filled.Share
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
@ -30,6 +29,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
@ -165,7 +165,7 @@ private fun SelectionScreen(selected: String, action: SelectionAction, onClose:
actions = {
// The dictionary knows single words; a whole line is better asked about.
IconButton(onClick = { context.shareText("$prompt\n\n$selected") }) {
Icon(Icons.AutoMirrored.Filled.Send, stringResource(R.string.assistant_ask))
Icon(painterResource(R.drawable.ic_ask), stringResource(R.string.assistant_ask))
}
IconButton(onClick = { context.shareText(selected) }) {
Icon(Icons.Default.Share, stringResource(R.string.share))

View File

@ -26,6 +26,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.ganjoor.android.R
@ -67,6 +68,11 @@ fun AssistantAction(prompt: String, text: String, label: Int, instruction: Int)
TextButton(onClick = {
if (assistant.serverReady) open = true else context.shareText("$ask\n\n$text")
}) {
Icon(
painter = painterResource(R.drawable.ic_ask),
contentDescription = null,
modifier = Modifier.size(18.dp).padding(end = 4.dp),
)
Text(stringResource(label))
}
if (open) AssistantResultSheet(prompt = prompt, text = text, onDismiss = { open = false })

View File

@ -1,12 +1,15 @@
<!-- Material "send": the question is handed to another app, not answered here. -->
<!--
Material "auto_awesome" — the sparkle that has become the generic sign for an AI action, the
same shape Gemini and the rest use. Theirs is a trademark; this is Material's own, under the
Apache licence already covering the icons the app ships.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:autoMirrored="true"
android:tint="?android:attr/textColorPrimary">
<path
android:fillColor="@android:color/white"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" />
android:pathData="M19,9l1.25,-2.75L23,5l-2.75,-1.25L19,1l-1.25,2.75L15,5l2.75,1.25L19,9zM11.5,9.5L9,4 6.5,9.5 1,12l5.5,2.5L9,20l2.5,-5.5L17,12l-5.5,-2.5zM19,15l-1.25,2.75L15,19l2.75,1.25L19,23l1.25,-2.75L23,19l-2.75,-1.25L19,15z" />
</vector>