DroidFish: Add support for intent.action.SEND with mimeType application/x-chess-pgn. Suggested by Gerhard Kalab.

This commit is contained in:
Peter Osterlund 2012-12-28 14:45:25 +00:00
parent 25aa40a30f
commit 3fb9c1aca7
2 changed files with 11 additions and 2 deletions

View File

@ -27,7 +27,12 @@
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/x-chess-pgn" />
</intent-filter>
</activity>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/x-chess-pgn" />
</intent-filter>
</activity>
<activity android:name=".activities.Preferences"
android:label="@string/preferences">
</activity>

View File

@ -436,7 +436,11 @@ public class DroidFish extends Activity implements GUIInterface {
try {
Intent intent = getIntent();
Uri data = intent.getData();
if (data != null) {
if (data == null) {
if (Intent.ACTION_SEND.equals(intent.getAction()) &&
"application/x-chess-pgn".equals(intent.getType()))
pgn = intent.getStringExtra(Intent.EXTRA_TEXT);
} else {
String scheme = intent.getScheme();
if ("file".equals(scheme)) {
filename = data.getEncodedPath();