Skip to content

Commit 3a9ed5a

Browse files
author
River
committed
v1.1.0 for QAppPlayer
1 parent 00d367f commit 3a9ed5a

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
# project structure.
99

1010
# Project target.
11-
target=android-19
11+
target=android-20
1212
android.library.reference.1=../QBaselib
1313
android.library=true

src/com/googlecode/android_scripting/facade/FacadeConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public class FacadeConfiguration {
8484
sFacadeClassList.add(ActivityResultFacade.class);
8585
sFacadeClassList.add(MediaPlayerFacade.class);
8686
sFacadeClassList.add(PreferencesFacade.class);
87+
sFacadeClassList.add(QPyInterfaceFacade.class);
8788

8889
if (sSdkLevel >= 4) {
8990
sFacadeClassList.add(TextToSpeechFacade.class);
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package com.googlecode.android_scripting.facade;
2+
3+
import android.app.Service;
4+
import android.content.Context;
5+
import android.content.Intent;
6+
import android.net.wifi.ScanResult;
7+
import android.net.wifi.WifiInfo;
8+
import android.net.wifi.WifiManager;
9+
import android.net.wifi.WifiManager.WifiLock;
10+
import android.os.Bundle;
11+
12+
import com.googlecode.android_scripting.jsonrpc.RpcReceiver;
13+
import com.googlecode.android_scripting.jsonrpc.RpcReceiverManager;
14+
import com.googlecode.android_scripting.rpc.Rpc;
15+
import com.googlecode.android_scripting.rpc.RpcOptional;
16+
import com.googlecode.android_scripting.rpc.RpcParameter;
17+
import com.zuowuxuxi.util.NAction;
18+
import com.zuowuxuxi.util.NUtil;
19+
20+
import java.util.List;
21+
22+
/**
23+
* Wifi functions.
24+
*
25+
*/
26+
public class QPyInterfaceFacade extends RpcReceiver {
27+
private final Service mService;
28+
29+
public QPyInterfaceFacade(FacadeManager manager) {
30+
super(manager);
31+
mService = manager.getService();
32+
33+
}
34+
35+
@Override
36+
public void shutdown() {
37+
// TODO Auto-generated method stub
38+
}
39+
40+
@Rpc(description = "Execute QPython script throught SL4A", returns = "True if the operation succeeded.")
41+
public Boolean executeQPy(@RpcParameter(name = "QPython script path") @RpcOptional String path) {
42+
43+
String extPlgPlusName = com.zuowuxuxi.config.CONF.EXT_PLG_PLUS;
44+
45+
//if (NUtil.checkAppInstalledByName(mService.getApplicationContext(), extPlgPlusName)) {
46+
Intent intent = new Intent();
47+
intent.setClassName(extPlgPlusName, extPlgPlusName+".MPyApi");
48+
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
49+
intent.setAction(extPlgPlusName+".action.MPyApi");
50+
51+
Bundle mBundle = new Bundle();
52+
mBundle.putString("app", NAction.getCode(mService.getApplicationContext()));
53+
mBundle.putString("act", "onPyApi");
54+
mBundle.putString("flag", "SL4A");
55+
mBundle.putString("param", "fileapi");
56+
mBundle.putString("pyfile", path);
57+
58+
intent.putExtras(mBundle);
59+
60+
mService.getApplicationContext().startActivity(intent);
61+
62+
//}
63+
64+
return true;
65+
}
66+
67+
}

0 commit comments

Comments
 (0)