Skip to content

Commit

Permalink
Feature: share text
Browse files Browse the repository at this point in the history
cherrypicked from Neamar/KISS#2111
  • Loading branch information
TBog committed Apr 25, 2024
1 parent 28b1d21 commit f1c4a17
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity
android:name=".SettingsActivity"
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/rocks/tbog/tblauncher/Behaviour.java
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,17 @@ public void onNewIntent() {
ShortcutUtil.addShortcut(mTBLauncherActivity, intent);
return;
}
// Pasting shared text from Sharesheet via intent-filter into kiss search bar
if (Intent.ACTION_SEND.equals(action) && "text/plain".equals(intent.getType())) {
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
// making sure the shared text is not an empty string
if (sharedText != null && sharedText.trim().length() > 0) {
mSearchEditText.setText(sharedText);
return;
} else {
//Toast.makeText(this, R.string.shared_text_empty, Toast.LENGTH_SHORT).show();
}
}
}

executeButtonAction("button-home");
Expand Down

0 comments on commit f1c4a17

Please sign in to comment.