|
1 | 1 | package com.trianguloy.urlchecker.dialogs;
|
2 | 2 |
|
| 3 | +import static com.trianguloy.urlchecker.activities.SettingsActivity.SYNC_PROCESSTEXT_PREF; |
3 | 4 | import static com.trianguloy.urlchecker.activities.SettingsActivity.WIDTH_PREF;
|
4 | 5 |
|
5 | 6 | import android.animation.ObjectAnimator;
|
6 | 7 | import android.animation.ValueAnimator;
|
7 | 8 | import android.app.Activity;
|
8 | 9 | import android.app.AlertDialog;
|
9 | 10 | import android.content.Intent;
|
| 11 | +import android.os.Build; |
10 | 12 | import android.os.Bundle;
|
11 | 13 | import android.util.ArrayMap;
|
12 | 14 | import android.view.View;
|
@@ -183,6 +185,13 @@ public void onNewUrl(UrlData newUrlData) {
|
183 | 185 | break;
|
184 | 186 | }
|
185 | 187 |
|
| 188 | + // if in text_process mode, update text unless disabled |
| 189 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M |
| 190 | + && SYNC_PROCESSTEXT_PREF(this).get() |
| 191 | + && !getIntent().getBooleanExtra(Intent.EXTRA_PROCESS_TEXT_READONLY, true)) { |
| 192 | + setResult(RESULT_OK, new Intent().putExtra(Intent.EXTRA_PROCESS_TEXT, urlData.url)); |
| 193 | + } |
| 194 | + |
186 | 195 | // end, reset
|
187 | 196 | updating = 0;
|
188 | 197 | }
|
@@ -381,6 +390,10 @@ private Set<String> getOpenUrl() {
|
381 | 390 | var links = AndroidUtils.getLinksFromText(sharedText);
|
382 | 391 | if (links.isEmpty()) links.add(sharedText.trim()); // no links? just use the whole text, the user requested the app so...
|
383 | 392 | return links;
|
| 393 | + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Intent.ACTION_PROCESS_TEXT.equals(action)) { |
| 394 | + // process text |
| 395 | + var text = getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT); |
| 396 | + return text == null ? Collections.emptySet() : Set.of(text.toString()); |
384 | 397 | } else {
|
385 | 398 | // other, check data
|
386 | 399 | var uri = intent.getData();
|
|
0 commit comments