Compare commits

...

2 Commits
v0.31 ... v0.32

Author SHA1 Message Date
Fredrik Fornwall
d69485b70b Match less files for file receiving (fixes #66) 2016-03-25 00:22:49 +01:00
Fredrik Fornwall
421dfcca39 Do not fail with NPE when scheme is null
Also remove some debug logging left by mistake.
2016-03-23 18:31:03 +01:00
3 changed files with 12 additions and 17 deletions

View File

@@ -18,8 +18,8 @@ android {
applicationId "com.termux" applicationId "com.termux"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 23 targetSdkVersion 23
versionCode 31 versionCode 32
versionName "0.31" versionName "0.32"
} }
buildTypes { buildTypes {

View File

@@ -51,10 +51,15 @@
android:noHistory="true"> android:noHistory="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.SEND"/> <action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" /> <data android:mimeType="application/*" />
<data android:mimeType="audio/*" />
<data android:mimeType="image/*" />
<data android:mimeType="message/*" />
<data android:mimeType="multipart/*" />
<data android:mimeType="text/*" />
<data android:mimeType="video/*" />
</intent-filter> </intent-filter>
</activity> </activity>

View File

@@ -46,16 +46,6 @@ public class TermuxFileReceiverActivity extends Activity {
final String type = intent.getType(); final String type = intent.getType();
final String scheme = intent.getScheme(); final String scheme = intent.getScheme();
if (intent.getExtras() == null) {
Log.e("termux", "NULL EXTRAS");
} else {
for (String key : intent.getExtras().keySet()) {
Object value = intent.getExtras().get(key);
Log.d("termux", String.format("Extra %s %s (%s)", key,
value.toString(), value.getClass().getName()));
}
}
if (Intent.ACTION_SEND.equals(action) && type != null) { if (Intent.ACTION_SEND.equals(action) && type != null) {
final String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT); final String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
final Uri sharedUri = intent.getParcelableExtra(Intent.EXTRA_STREAM); final Uri sharedUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
@@ -74,9 +64,9 @@ public class TermuxFileReceiverActivity extends Activity {
} else { } else {
showErrorDialogAndQuit("Send action without content - nothing to save."); showErrorDialogAndQuit("Send action without content - nothing to save.");
} }
} else if (scheme.equals("content")) { } else if ("content".equals(scheme)) {
handleContentUri(intent.getData(), intent.getStringExtra(Intent.EXTRA_TITLE)); handleContentUri(intent.getData(), intent.getStringExtra(Intent.EXTRA_TITLE));
} else if (scheme.equals("file")) { } else if ("file".equals(scheme)) {
// When e.g. clicking on a downloaded apk: // When e.g. clicking on a downloaded apk:
String path = intent.getData().getPath(); String path = intent.getData().getPath();
File file = new File(path); File file = new File(path);
@@ -87,7 +77,7 @@ public class TermuxFileReceiverActivity extends Activity {
showErrorDialogAndQuit("Cannot open file: " + e.getMessage() + "."); showErrorDialogAndQuit("Cannot open file: " + e.getMessage() + ".");
} }
} else { } else {
showErrorDialogAndQuit("Unhandled scheme: " + intent.getScheme() + "."); showErrorDialogAndQuit("Unable to receive any file or URL.");
} }
} }