Share verses and poems, and reach the dictionary from any app

Selected text now gets three entries in the system selection menu — look up,
ask an assistant, and share — and the poem screen gains a share action of its
own, next to the per-couplet save and copy.

Compose 1.10 stopped routing SelectionContainer through LocalTextToolbar, so a
custom entry cannot be added to that menu from inside the reader.
ACTION_PROCESS_TEXT goes round it: the system builds part of the menu from
installed activities handling that intent, so these appear here and in every
other app. Three activity-aliases rather than one Ganjoor entry, because the
menu is a place for verbs: a reader who means "look this up" should not have to
pick an app first and then say what they wanted.

"Ask an assistant" cannot name Claude or Gemini — only those apps can put their
own name in that menu. It opens the share chooser with the question already
written, which lists whichever assistant is installed. That hand-off is also
what keeps this acceptable under F-Droid's rules: no vendor SDK, no API key,
nothing but an intent the reader confirms.

The activity is opaque and themed rather than a transparent one hosting a
sheet. PROCESS_TEXT starts it in its own task, so the app the text came from is
not behind this window, and a scrim over nothing is just a grey screen.

WordLookup and AssistantAnswer are split out of their sheets so the same code
serves as a sheet in the reader and a screen here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Anas RashidandClaude Opus 5 committed 2026-10-04 18:45:13 +02:00
1 parent 9445f44759
commit 3d4f7aae3a
16 files changed
+957 -10

No files matched your search

+52 -1
View File
@@ -12,7 +12,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="false"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/Theme.Ganjoorappandroid">
<activity
android:name=".MainActivity"
@@ -26,6 +26,57 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
The selection menu entries, one per action. Android builds part of that menu from
installed ACTION_PROCESS_TEXT activities, so these appear in this app and in every other
one. Three aliases rather than a single Ganjoor entry: the menu is a place for verbs, and
a reader who means "look this up" should not have to pick the app first.
"Ask an assistant" cannot be an entry per assistant — only Claude or Gemini can put their
own name in this menu. It opens the share chooser instead, which lists whichever of them
is installed, with the question already written.
-->
<activity
android:name=".ProcessTextActivity"
android:exported="false"
android:theme="@style/Theme.Ganjoorappandroid" />
<activity-alias
android:name=".LookUpText"
android:targetActivity=".ProcessTextActivity"
android:exported="true"
android:label="@string/look_up">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".AskAssistantText"
android:targetActivity=".ProcessTextActivity"
android:exported="true"
android:label="@string/assistant_ask">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity-alias>
<activity-alias
android:name=".ShareText"
android:targetActivity=".ProcessTextActivity"
android:exported="true"
android:label="@string/share">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity-alias>
</application>
</manifest>