Skip to content

Commit

Permalink
Merge pull request #935 from rahulpower2012/feature-context-menu-option
Browse files Browse the repository at this point in the history
Added context menu option when text is selected.
  • Loading branch information
federicoiosue authored Sep 12, 2023
2 parents bcf1669 + 8cc8c3b commit fc59fd4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
8 changes: 8 additions & 0 deletions omniNotes/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@
<data android:scheme="hashtag" />
</intent-filter>

<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>

<!-- Gallery -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ private void handleIntents() {

// Handles third party apps requests of sharing
if (IntentChecker
.checkAction(i, Intent.ACTION_SEND, Intent.ACTION_SEND_MULTIPLE, INTENT_GOOGLE_NOW)
.checkAction(i, Intent.ACTION_SEND, Intent.ACTION_SEND_MULTIPLE, Intent.ACTION_PROCESS_TEXT, INTENT_GOOGLE_NOW)
&& i.getType() != null) {

afterSavedReturnsToList = false;
Expand All @@ -537,7 +537,13 @@ private void handleIntents() {
}

// Text content
String content = i.getStringExtra(Intent.EXTRA_TEXT);
String content = null;
if (Intent.ACTION_PROCESS_TEXT.equals(i.getAction())){
content = i.getStringExtra(Intent.EXTRA_PROCESS_TEXT).toString();
} else {
content = i.getStringExtra(Intent.EXTRA_TEXT);
}

if (content != null) {
noteTmp.setContent(content);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ private boolean receivedIntent(Intent i) {
|| ACTION_WIDGET_TAKE_PHOTO.equals(i.getAction())
|| ((Intent.ACTION_SEND.equals(i.getAction())
|| Intent.ACTION_SEND_MULTIPLE.equals(i.getAction())
|| INTENT_GOOGLE_NOW.equals(i.getAction()))
|| INTENT_GOOGLE_NOW.equals(i.getAction())
|| Intent.ACTION_PROCESS_TEXT.equals(i.getAction()))
&& i.getType() != null)
|| i.getAction().contains(ACTION_NOTIFICATION_CLICK);
}
Expand Down

0 comments on commit fc59fd4

Please sign in to comment.