Use the AI sparkle for the assistant action
Material's auto_awesome, the shape that has come to mean "ask a model" — the same one Gemini and the rest use. Theirs are trademarks and have no place in an F-Droid build; this one ships under the Apache licence already covering the app's icons. It now marks the action everywhere it appears: the selection-menu entry, the lookup screen's top bar, and the translate and explain buttons in the reader, which were text alone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2f16b52c2c
commit
90b527522b
@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Close
|
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.material.icons.filled.Share
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
@ -30,6 +29,7 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
@ -165,7 +165,7 @@ private fun SelectionScreen(selected: String, action: SelectionAction, onClose:
|
|||||||
actions = {
|
actions = {
|
||||||
// The dictionary knows single words; a whole line is better asked about.
|
// The dictionary knows single words; a whole line is better asked about.
|
||||||
IconButton(onClick = { context.shareText("$prompt\n\n$selected") }) {
|
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) }) {
|
IconButton(onClick = { context.shareText(selected) }) {
|
||||||
Icon(Icons.Default.Share, stringResource(R.string.share))
|
Icon(Icons.Default.Share, stringResource(R.string.share))
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.ganjoor.android.R
|
import com.ganjoor.android.R
|
||||||
@ -67,6 +68,11 @@ fun AssistantAction(prompt: String, text: String, label: Int, instruction: Int)
|
|||||||
TextButton(onClick = {
|
TextButton(onClick = {
|
||||||
if (assistant.serverReady) open = true else context.shareText("$ask\n\n$text")
|
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))
|
Text(stringResource(label))
|
||||||
}
|
}
|
||||||
if (open) AssistantResultSheet(prompt = prompt, text = text, onDismiss = { open = false })
|
if (open) AssistantResultSheet(prompt = prompt, text = text, onDismiss = { open = false })
|
||||||
|
|||||||
@ -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"
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24"
|
android:viewportHeight="24"
|
||||||
android:autoMirrored="true"
|
|
||||||
android:tint="?android:attr/textColorPrimary">
|
android:tint="?android:attr/textColorPrimary">
|
||||||
<path
|
<path
|
||||||
android:fillColor="@android:color/white"
|
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>
|
</vector>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user