mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-11-24 19:29:46 +01:00
parent
269c3cafb0
commit
fd13f3f98d
6 changed files with 66 additions and 19 deletions
|
|
@ -21,6 +21,7 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class TermuxFileReceiverActivity extends Activity {
|
||||
|
||||
|
|
@ -36,6 +37,11 @@ public class TermuxFileReceiverActivity extends Activity {
|
|||
*/
|
||||
boolean mFinishOnDismissNameDialog = true;
|
||||
|
||||
static boolean isSharedTextAnUrl(String sharedText) {
|
||||
return Patterns.WEB_URL.matcher(sharedText).matches()
|
||||
|| Pattern.matches("magnet:\\?xt=urn:btih:.*?", sharedText);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
|
@ -50,7 +56,7 @@ public class TermuxFileReceiverActivity extends Activity {
|
|||
final Uri sharedUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
|
||||
if (sharedText != null) {
|
||||
if (Patterns.WEB_URL.matcher(sharedText).matches()) {
|
||||
if (isSharedTextAnUrl(sharedText)) {
|
||||
handleUrlAndFinish(sharedText);
|
||||
} else {
|
||||
String subject = intent.getStringExtra(Intent.EXTRA_SUBJECT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue