Add open action for android

Open games from file explorer directly.
This commit is contained in:
xiushu committed 2016-02-20 19:23:32 +08:00
1 parent 5f0553955c
commit 2ba902368e
2 files changed
+69 -2

No files matched your search

+57
View File
@@ -47,6 +47,63 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.iso"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.bin"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.cso"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.isz"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.elf"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.ISO"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.BIN"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.CSO"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.ISZ"
android:scheme="file" />
<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\\.ELF"
android:scheme="file" />
</intent-filter>
</activity>
<meta-data android:name="isGame" android:value="true" />
<activity
@@ -1,10 +1,12 @@
package org.ppsspp.ppsspp;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.util.Log;
import android.widget.Toast;
public class PpssppActivity extends NativeActivity {
private static final String TAG = "PpssppActivity";
@@ -67,8 +69,16 @@ public class PpssppActivity extends NativeActivity {
// In case app launched from homescreen shortcut, get shortcut parameter
// using Intent extra string. Intent extra will be null if launch normal
// (from app drawer).
super.setShortcutParam(getIntent().getStringExtra(SHORTCUT_EXTRA_KEY));
// (from app drawer or file explorer).
Intent intent = getIntent();
String action = intent.getAction();
if(intent.ACTION_VIEW.equals(action))
{
String path = intent.getData().getPath();
super.setShortcutParam(path);
Toast.makeText(getApplicationContext(), path, Toast.LENGTH_SHORT).show();
}
else super.setShortcutParam(getIntent().getStringExtra(SHORTCUT_EXTRA_KEY));
super.onCreate(savedInstanceState);
}