├── .github
└── FUNDING.yml
├── src
└── main
│ ├── res
│ ├── drawable-xxhdpi
│ │ ├── img_home_logo.png
│ │ └── img_home_logo_3.png
│ ├── values
│ │ ├── strings.xml
│ │ ├── styles.xml
│ │ └── colors.xml
│ ├── drawable
│ │ └── toolbar_button_bg.xml
│ └── layout
│ │ ├── widget_run_control.xml
│ │ └── activity_run_splash.xml
│ ├── java
│ └── org
│ │ └── qpython
│ │ └── qsl4a
│ │ ├── qsl4a
│ │ ├── facade
│ │ │ ├── JpegProvider.java
│ │ │ ├── FacadeManagerFactory.java
│ │ │ ├── ui
│ │ │ │ ├── ProgressDialogTask.java
│ │ │ │ ├── DialogTask.java
│ │ │ │ ├── TimePickerDialogTask.java
│ │ │ │ └── DatePickerDialogTask.java
│ │ │ ├── EyesFreeFacade.java
│ │ │ ├── MjpegServer.java
│ │ │ ├── TextToSpeechFacade.java
│ │ │ ├── FacadeManager.java
│ │ │ ├── SignalStrengthFacade.java
│ │ │ ├── ToneGeneratorFacade.java
│ │ │ ├── ApplicationManagerFacade.java
│ │ │ ├── SpeechRecognitionFacade.java
│ │ │ ├── WifiFacade.java
│ │ │ ├── CommonIntentsFacade.java
│ │ │ ├── PreferencesFacade.java
│ │ │ ├── EventServer.java
│ │ │ └── WakeLockFacade.java
│ │ ├── interpreter
│ │ │ ├── InProcessInterpreter.java
│ │ │ ├── ExternalClassLoader.java
│ │ │ ├── InterpreterUtils.java
│ │ │ ├── MyInterpreter.java
│ │ │ ├── shell
│ │ │ │ └── ShellInterpreter.java
│ │ │ ├── InterpreterPropertyNames.java
│ │ │ ├── InterpreterConstants.java
│ │ │ ├── html
│ │ │ │ └── HtmlInterpreter.java
│ │ │ ├── InterpreterDescriptor.java
│ │ │ └── InterpreterProcess.java
│ │ ├── jsonrpc
│ │ │ ├── RpcReceiver.java
│ │ │ ├── RpcReceiverManagerFactory.java
│ │ │ ├── JsonRpcResult.java
│ │ │ ├── RpcReceiverManager.java
│ │ │ └── JsonRpcServer.java
│ │ ├── rpc
│ │ │ ├── RpcError.java
│ │ │ ├── Converter.java
│ │ │ ├── RpcMinSdk.java
│ │ │ ├── ParameterDescriptor.java
│ │ │ ├── RpcName.java
│ │ │ ├── RpcStartEvent.java
│ │ │ ├── RpcStopEvent.java
│ │ │ ├── RpcDeprecated.java
│ │ │ ├── RpcOptional.java
│ │ │ ├── RpcDefault.java
│ │ │ ├── RpcParameter.java
│ │ │ └── Rpc.java
│ │ ├── StringUtils.java
│ │ ├── language
│ │ │ ├── ShellLanguage.java
│ │ │ ├── LuaLanguage.java
│ │ │ ├── RubyLanguage.java
│ │ │ ├── JavaScriptLanguage.java
│ │ │ ├── SleepLanguage.java
│ │ │ ├── PerlLanguage.java
│ │ │ ├── PhpLanguage.java
│ │ │ ├── PythonLanguage.java
│ │ │ ├── SquirrelLanguage.java
│ │ │ ├── TclLanguage.java
│ │ │ ├── HtmlLanguage.java
│ │ │ ├── BeanShellLanguage.java
│ │ │ └── SupportedLanguages.java
│ │ ├── util
│ │ │ └── VisibleForTesting.java
│ │ ├── exception
│ │ │ └── Sl4aException.java
│ │ ├── SingleThreadExecutor.java
│ │ ├── NotificationIdFactory.java
│ │ ├── trigger
│ │ │ ├── ScriptTrigger.java
│ │ │ ├── Trigger.java
│ │ │ └── EventGenerationControllingObserver.java
│ │ ├── Version.java
│ │ ├── MainThread.java
│ │ ├── event
│ │ │ └── Event.java
│ │ ├── ScriptProcess.java
│ │ ├── BaseApplication.java
│ │ ├── IoUtils.java
│ │ ├── future
│ │ │ ├── FutureResult.java
│ │ │ └── FutureActivityTask.java
│ │ ├── FutureActivityTaskExecutor.java
│ │ ├── Exec.java
│ │ ├── Analytics.java
│ │ ├── AndroidProxy.java
│ │ ├── ForegroundService.java
│ │ ├── bluetooth
│ │ │ └── BluetoothDiscoveryHelper.java
│ │ ├── ScriptLauncher.java
│ │ ├── FeaturedInterpreters.java
│ │ ├── ScriptStorageAdapter.java
│ │ └── activity
│ │ │ └── FutureActivity.java
│ │ ├── QSL4AScript.java
│ │ ├── codec
│ │ ├── BinaryEncoder.java
│ │ ├── BinaryDecoder.java
│ │ ├── Encoder.java
│ │ ├── Decoder.java
│ │ ├── DecoderException.java
│ │ └── EncoderException.java
│ │ └── QSL4APP.java
│ └── AndroidManifest.xml
├── .gitignore
├── README.md
├── proguard-rules.pro
└── tests
└── AndroidFacade-Clipboard.md
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | patreon: riverfor
4 | custom: ["https://paypal.me/qpyriver"]
5 |
--------------------------------------------------------------------------------
/src/main/res/drawable-xxhdpi/img_home_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qpython-android/qpysl4a/HEAD/src/main/res/drawable-xxhdpi/img_home_logo.png
--------------------------------------------------------------------------------
/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | QSL4A
4 |
--------------------------------------------------------------------------------
/src/main/res/drawable-xxhdpi/img_home_logo_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/qpython-android/qpysl4a/HEAD/src/main/res/drawable-xxhdpi/img_home_logo_3.png
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/facade/JpegProvider.java:
--------------------------------------------------------------------------------
1 | package org.qpython.qsl4a.qsl4a.facade;
2 |
3 | interface JpegProvider {
4 | public byte[] getJpeg();
5 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | build
4 | __MACOSX
5 | .idea
6 | keystore
7 | .DS_Store
8 | local.properties
9 | *.apk
10 | qbaselib.iml
11 | .*
12 | !/.gitignore
13 | gradle-wrapper.properties
14 | Android.mk
15 | qpython/src/main/jni/python/libpython2.7.b
16 | qpysdk/src/main/obj
17 | values-fr
18 | values-tr
19 | build.gradle.new
20 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/interpreter/InProcessInterpreter.java:
--------------------------------------------------------------------------------
1 | package org.qpython.qsl4a.qsl4a.interpreter;
2 |
3 | import java.io.FileDescriptor;
4 |
5 | public interface InProcessInterpreter {
6 | public FileDescriptor getStdOut();
7 |
8 | public FileDescriptor getStdIn();
9 |
10 | public boolean runInteractive();
11 |
12 | public void runScript(String filename);
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/main/res/drawable/toolbar_button_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF4A4A4A
4 | #FF363636
5 | #FF4BAC07
6 | #ffffff
7 | #FF9B9B9B
8 |
9 | #CACCCB
10 | #333333
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/jsonrpc/RpcReceiver.java:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Google Inc. All Rights Reserved.
2 |
3 | package org.qpython.qsl4a.qsl4a.jsonrpc;
4 |
5 | public abstract class RpcReceiver {
6 |
7 | protected final RpcReceiverManager mManager;
8 |
9 | public RpcReceiver(RpcReceiverManager manager) {
10 | // To make reflection easier, we ensures that all the subclasses agree on this common
11 | // constructor.
12 | mManager = manager;
13 | }
14 |
15 | /** Invoked when the receiver is shut down. */
16 | public abstract void shutdown();
17 | }
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # About
2 | QPysl4a is forked from https://www.github.com/damonkohler/sl4a/, and it provides the Android Layer APIs for script engine.
3 |
4 | It is not a standalone project, it will be included by QPython / QPython3 as a submodule.
5 |
6 | # APIs Documentation
7 | If you are looking for a solution to drive Android with Python, then maybe QPysl4a is exactly what you need. With the help of QPysl4a, you could call many Android APIs with Python code.
8 |
9 | Here is what we have provided: [QPysl4a APIs](doc/en/APIs.rst), [Chinese version](doc/cn/APIs.rst)
10 |
11 |
12 | ## More information
13 | Please visit [QPython Project Readme](https://github.com/qpython-android/qpython/blob/master/README.md)
14 |
--------------------------------------------------------------------------------
/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Jay\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include mPath and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/tests/AndroidFacade-Clipboard.md:
--------------------------------------------------------------------------------
1 | # Testcase for setClipboard & getClipboard
2 |
3 | ## Test Result
4 |
5 | - √ setClipboard
6 | - √ getClipboard
7 |
8 | ## Test Script
9 | ```
10 | # Test Code for setClipboard & getClipboard
11 | # You can put some content into clipboard before running this test script and you will see the first makeToast shows the content
12 |
13 | from androidhelper import Android
14 | droid = Android()
15 |
16 | clipboard = droid.getClipboard().result
17 |
18 | droid.makeToast("clipboard: %s" % clipboard)
19 |
20 | input(">Enter 1 continue\n")
21 | #setClipboard
22 | droid.setClipboard("Hello World")
23 |
24 | #getClipboard
25 | clipboard = droid.getClipboard().result
26 |
27 | droid.makeToast("clipboard: %s" % clipboard)
28 | ```
29 |
30 | ## Test QrCode
31 |
32 | [Open QRCode to Scan](http://qr.qpython.com.cn/?p=f1c788ec-360e-11ea-a0b0-fa163e575766)
33 |
--------------------------------------------------------------------------------
/src/main/res/layout/widget_run_control.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
15 |
16 |
17 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/RpcError.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | @SuppressWarnings("serial")
20 | public class RpcError extends Exception {
21 |
22 | public RpcError(String message) {
23 | super(message);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/interpreter/ExternalClassLoader.java:
--------------------------------------------------------------------------------
1 | package org.qpython.qsl4a.qsl4a.interpreter;
2 |
3 | import org.qpython.qsl4a.qsl4a.StringUtils;
4 |
5 | import dalvik.system.DexClassLoader;
6 |
7 | import java.util.Collection;
8 |
9 | public class ExternalClassLoader {
10 |
11 | public Object load(Collection dexPaths, Collection nativePaths, String className)
12 | throws Exception {
13 | String dexOutputDir = "/sdcard/dexoutput";
14 | String joinedDexPaths = StringUtils.join(dexPaths, ":");
15 | String joinedNativeLibPaths = nativePaths != null ? StringUtils.join(nativePaths, ":") : null;
16 | DexClassLoader loader =
17 | new DexClassLoader(joinedDexPaths, dexOutputDir, joinedNativeLibPaths, this.getClass()
18 | .getClassLoader());
19 | Class> classToLoad = Class.forName(className, true, loader);
20 | return classToLoad.newInstance();
21 | }
22 | }
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/StringUtils.java:
--------------------------------------------------------------------------------
1 | package org.qpython.qsl4a.qsl4a;
2 |
3 | import java.util.Collection;
4 | import java.util.Iterator;
5 |
6 | public class StringUtils {
7 |
8 | private StringUtils() {
9 | // Utility class.
10 | }
11 | public static String addSlashes(String txt)
12 | {
13 | if (null != txt)
14 | {
15 | txt = txt.replace("\\", "\\\\") ;
16 | txt = txt.replace("\'", "\\\'") ;
17 | //txt = txt.replace(" ", "\\ ") ;
18 |
19 | }
20 |
21 | return txt ;
22 | }
23 |
24 | public static String join(Collection collection, String delimiter) {
25 | StringBuffer buffer = new StringBuffer();
26 | Iterator iter = collection.iterator();
27 | while (iter.hasNext()) {
28 | buffer.append(iter.next());
29 | if (iter.hasNext()) {
30 | buffer.append(delimiter);
31 | }
32 | }
33 | return buffer.toString();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/language/ShellLanguage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.language;
18 |
19 | /**
20 | * Represents the Shell programming language.
21 | *
22 | * @author igor.v.karp@gmail.com (Igor Karp)
23 | */
24 | public class ShellLanguage extends Language {
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/QSL4AScript.java:
--------------------------------------------------------------------------------
1 | package org.qpython.qsl4a;
2 |
3 | import android.content.Context;
4 |
5 | public class QSL4AScript {
6 |
7 | // public final static int ID = R.raw.pymain;
8 |
9 | public static String sFileName;
10 |
11 | public static String getFileName(Context context) {
12 | // if (sFileName == null) {
13 | // Resources resources = context.getResources();
14 | // String name = resources.getText(ID).toString();
15 | // sFileName = name.substring(name.lastIndexOf('/') + 1, name.length());
16 | // }
17 | sFileName = "main.py";
18 | return sFileName;
19 | }
20 |
21 | public static String getFileExtension(Context context) {
22 | if (sFileName == null) {
23 | getFileName(context);
24 | }
25 | int dotIndex = sFileName.lastIndexOf('.');
26 | if (dotIndex == -1) {
27 | return null;
28 | }
29 | return sFileName.substring(dotIndex);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/jsonrpc/RpcReceiverManagerFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.jsonrpc;
18 |
19 | import java.util.List;
20 |
21 | public interface RpcReceiverManagerFactory {
22 | public RpcReceiverManager create();
23 |
24 | public List getRpcReceiverManagers();
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/Converter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | /**
20 | * A converter can take a String and turn it into an instance of type T (the type parameter to the
21 | * converter).
22 | *
23 | * @author igor.v.karp@gmail.com (Igor Karp)
24 | */
25 | public interface Converter {
26 |
27 | /** Convert a string into type T. */
28 | T convert(String value);
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/util/VisibleForTesting.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.util;
18 |
19 | /**
20 | * An annotation that indicates that the visibility of a type or member has been relaxed from
21 | * private to package to make the code testable.
22 | *
23 | * @author igor.v.karp@gmail.com (Igor Karp)
24 | */
25 | // TODO(igor.v.karp): Consider replacing this annotation by one from Guava or GCL
26 | public @interface VisibleForTesting {
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/exception/Sl4aException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.exception;
18 |
19 | @SuppressWarnings("serial")
20 | public class Sl4aException extends Exception {
21 |
22 | public Sl4aException(Exception e) {
23 | super(e);
24 | }
25 |
26 | public Sl4aException(String message) {
27 | super(message);
28 | }
29 |
30 | public Sl4aException(String message, Exception e) {
31 | super(message, e);
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/RpcMinSdk.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 |
23 | /**
24 | * Use this annotation to specify minimum SDK level (if higher than 3).
25 | *
26 | */
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Documented
29 | public @interface RpcMinSdk {
30 | /** Minimum SDK Level. */
31 | public int value();
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/language/LuaLanguage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.language;
18 |
19 | /**
20 | * Represents the Lua programming language.
21 | *
22 | * @author igor.v.karp@gmail.com (Igor Karp)
23 | */
24 | public class LuaLanguage extends Language {
25 |
26 | @Override
27 | protected String getImportStatement() {
28 | return "require \"android\"\n";
29 | }
30 |
31 | @Override
32 | protected String getDefaultRpcReceiver() {
33 | return "android";
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/language/RubyLanguage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.language;
18 |
19 | /**
20 | * Represents the Ruby programming language.
21 | *
22 | * @author igor.v.karp@gmail.com (Igor Karp)
23 | */
24 | public class RubyLanguage extends Language {
25 |
26 | @Override
27 | protected String getImportStatement() {
28 | return "require \"android\";\n";
29 | }
30 |
31 | @Override
32 | protected String getRpcReceiverDeclaration(String rpcReceiver) {
33 | return rpcReceiver + " = Droid.new\n";
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/interpreter/InterpreterUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.interpreter;
18 |
19 | import android.content.Context;
20 |
21 | import java.io.File;
22 |
23 | public class InterpreterUtils {
24 |
25 | private InterpreterUtils() {
26 | // Utility class
27 | }
28 |
29 | public static File getInterpreterRoot(Context context) {
30 | return context.getFilesDir();
31 | }
32 |
33 | public static File getInterpreterRoot(Context context, String interpreterName) {
34 | return new File(getInterpreterRoot(context), interpreterName);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/SingleThreadExecutor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a;
18 |
19 | import java.util.concurrent.LinkedBlockingQueue;
20 | import java.util.concurrent.ThreadPoolExecutor;
21 | import java.util.concurrent.TimeUnit;
22 |
23 | public class SingleThreadExecutor extends ThreadPoolExecutor {
24 |
25 | public SingleThreadExecutor() {
26 | super(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
27 | }
28 |
29 | @Override
30 | protected void afterExecute(Runnable r, Throwable t) {
31 | if (t != null) {
32 | throw new RuntimeException(t);
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/ParameterDescriptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | import java.lang.reflect.Type;
20 |
21 | /**
22 | * RPC parameter description.
23 | *
24 | * @author igor.v.karp@gmail.com (Igor Karp)
25 | */
26 | public final class ParameterDescriptor {
27 | private final String value;
28 | private final Type type;
29 |
30 | public ParameterDescriptor(String value, Type type) {
31 | this.value = value;
32 | this.type = type;
33 | }
34 |
35 | public String getValue() {
36 | return value;
37 | }
38 |
39 | public Type getType() {
40 | return type;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/NotificationIdFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a;
18 |
19 | import java.util.concurrent.atomic.AtomicInteger;
20 |
21 | /**
22 | * Creates unique ids to identify the notifications created by the android scripting service and the
23 | * trigger service.
24 | *
25 | * @author Felix Arends (felix.arends@gmail.com)
26 | *
27 | */
28 | public final class NotificationIdFactory {
29 | private static final AtomicInteger mNextId = new AtomicInteger(0);
30 |
31 | public static int create() {
32 | return mNextId.incrementAndGet();
33 | }
34 |
35 | private NotificationIdFactory() {
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/language/JavaScriptLanguage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.language;
18 |
19 | /**
20 | * Represents the JavaScript programming language.
21 | *
22 | * @author igor.v.karp@gmail.com (Igor Karp)
23 | */
24 | public class JavaScriptLanguage extends Language {
25 |
26 | @Override
27 | protected String getImportStatement() {
28 | // FIXME(igor.v.karp): this is interpreter specific
29 | return "load(\"file:///android_asset/android.js\");\n";
30 | }
31 |
32 | @Override
33 | protected String getRpcReceiverDeclaration(String rpcReceiver) {
34 | return "var " + rpcReceiver + " = Android();\n";
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/language/SleepLanguage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.language;
18 |
19 | /**
20 | * Represents the Sleep programming language.
21 | *
22 | * @author tomcatalbino@gmail.com
23 | */
24 | public class SleepLanguage extends Language {
25 |
26 | @Override
27 | protected String getImportStatement() {
28 | return "import com.googlecode.rpc.*;\n";
29 | }
30 |
31 | @Override
32 | protected String getRpcReceiverDeclaration(String rpcReceiver) {
33 | return rpcReceiver + " = [new Android];\n";
34 | }
35 |
36 | @Override
37 | protected String getDefaultRpcReceiver() {
38 | return "$droid";
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/trigger/ScriptTrigger.java:
--------------------------------------------------------------------------------
1 | package org.qpython.qsl4a.qsl4a.trigger;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 |
6 | import org.qpython.qsl4a.qsl4a.IntentBuilders;
7 | import org.qpython.qsl4a.qsl4a.event.Event;
8 |
9 | import java.io.File;
10 |
11 | /**
12 | * A trigger implementation that launches a given script when the event occurs.
13 | *
14 | * @author Felix Arends (felix.arends@gmail.com)
15 | */
16 | public class ScriptTrigger implements Trigger {
17 | private static final long serialVersionUID = 1804599219214041409L;
18 | private final File mScript;
19 | private final String mEventName;
20 |
21 | public ScriptTrigger(String eventName, File script) {
22 | mEventName = eventName;
23 | mScript = script;
24 | }
25 |
26 | @Override
27 | public void handleEvent(Event event, Context context) {
28 | Intent intent = IntentBuilders.buildStartInBackgroundIntent(mScript);
29 | // This is required since the script is being started from the TriggerService.
30 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
31 | context.startActivity(intent);
32 | }
33 |
34 | @Override
35 | public String getEventName() {
36 | return mEventName;
37 | }
38 |
39 | public File getScript() {
40 | return mScript;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/RpcName.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Use this annotation to mark an RPC parameter that have a default value.
27 | *
28 | * @author igor.v.karp@gmail.com (Igor Karp)
29 | */
30 | @Retention(RetentionPolicy.RUNTIME)
31 | @Target(ElementType.METHOD)
32 | @Documented
33 | public @interface RpcName {
34 | /** The default value of the RPC parameter. */
35 | public String name();
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/Version.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a;
18 |
19 | import android.content.Context;
20 | import android.content.pm.PackageInfo;
21 | import android.content.pm.PackageManager;
22 |
23 | public class Version {
24 |
25 | private Version() {
26 | // Utility class.
27 | }
28 |
29 | public static String getVersion(Context context) {
30 | try {
31 | PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
32 | return info.versionName;
33 | } catch (PackageManager.NameNotFoundException e) {
34 | LogUtil.e("Package name not found", e);
35 | }
36 | return "?";
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/interpreter/MyInterpreter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.interpreter;
18 |
19 | import java.util.List;
20 |
21 | /**
22 | * Wrapper for the Interpreter class.
23 | *
24 | * Workaround for the default access modifier on the getArguments() method
25 | * in the Interpreter class
26 | */
27 | public class MyInterpreter {
28 | private Interpreter interpreter;
29 |
30 | public MyInterpreter(Interpreter interpreter){
31 | this.interpreter = interpreter;
32 | }
33 |
34 | public Interpreter getInterpreter() {
35 | return this.interpreter;
36 | }
37 |
38 | public List getArguments() {
39 | return interpreter.getArguments();
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/RpcStartEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Use this annotation to mark an RPC as one that starts generating events.
27 | *
28 | * @author damonkohler@gmail.com (Damon Kohler)
29 | */
30 | @Retention(RetentionPolicy.RUNTIME)
31 | @Target(ElementType.METHOD)
32 | @Documented
33 | public @interface RpcStartEvent {
34 | /** The name of the event that is generated. */
35 | public String value();
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/RpcStopEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Use this annotation to mark an RPC as one that stops generating events.
27 | *
28 | * @author damonkohler@gmail.com (Damon Kohler)
29 | */
30 | @Retention(RetentionPolicy.RUNTIME)
31 | @Target(ElementType.METHOD)
32 | @Documented
33 | public @interface RpcStopEvent {
34 | /** The name of the event that stops being generated. */
35 | public String value();
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/RpcDeprecated.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Use this annotation to mark RPC method as deprecated.
27 | */
28 | @Retention(RetentionPolicy.RUNTIME)
29 | @Target(ElementType.METHOD)
30 | @Documented
31 | public @interface RpcDeprecated {
32 | /** The method that replaced this one. */
33 | public String value();
34 |
35 | /** Release of SL4A when deprecation occurred. */
36 | public String release() default "r4";
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/RpcOptional.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Use this annotation to mark RPC parameter as optional.
27 | *
28 | *
29 | * The parameter marked as optional has no explicit default value. {@code null} is used as default
30 | * value.
31 | *
32 | * @author igor.v.karp@gmail.com (Igor Karp)
33 | */
34 | @Retention(RetentionPolicy.RUNTIME)
35 | @Target(ElementType.PARAMETER)
36 | @Documented
37 | public @interface RpcOptional {
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/res/layout/activity_run_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
17 |
18 |
23 |
24 |
25 |
30 |
31 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/language/PerlLanguage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.language;
18 |
19 | /**
20 | * Represents the Perl programming language.
21 | *
22 | * @author igor.v.karp@gmail.com (Igor Karp)
23 | */
24 | public class PerlLanguage extends Language {
25 |
26 | @Override
27 | protected String getImportStatement() {
28 | return "use Android;\n";
29 | }
30 |
31 | @Override
32 | protected String getRpcReceiverDeclaration(String rpcReceiver) {
33 | return "my " + rpcReceiver + " = Android->new();\n";
34 | }
35 |
36 | @Override
37 | protected String getDefaultRpcReceiver() {
38 | return "$droid";
39 | }
40 |
41 | @Override
42 | protected String getApplyOperatorText() {
43 | return "->";
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/RpcDefault.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * Use this annotation to mark an RPC parameter that have a default value.
27 | *
28 | * @author igor.v.karp@gmail.com (Igor Karp)
29 | */
30 | @Retention(RetentionPolicy.RUNTIME)
31 | @Target(ElementType.PARAMETER)
32 | @Documented
33 | public @interface RpcDefault {
34 | /** The default value of the RPC parameter. */
35 | public String value();
36 |
37 | @SuppressWarnings("rawtypes")
38 | public Class extends Converter> converter() default Converter.class;
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/facade/FacadeManagerFactory.java:
--------------------------------------------------------------------------------
1 | package org.qpython.qsl4a.qsl4a.facade;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 |
6 |
7 | import org.qpython.qsl4a.qsl4a.jsonrpc.RpcReceiver;
8 | import org.qpython.qsl4a.qsl4a.jsonrpc.RpcReceiverManager;
9 | import org.qpython.qsl4a.qsl4a.jsonrpc.RpcReceiverManagerFactory;
10 |
11 | import java.util.ArrayList;
12 | import java.util.Collection;
13 | import java.util.List;
14 |
15 | public class FacadeManagerFactory implements RpcReceiverManagerFactory {
16 |
17 | private final int mSdkLevel;
18 | private final Service mService;
19 | private final Intent mIntent;
20 | private final Collection> mClassList;
21 | private final List mFacadeManagers;
22 |
23 | public FacadeManagerFactory(int sdkLevel, Service service, Intent intent,
24 | Collection> classList) {
25 | mSdkLevel = sdkLevel;
26 | mService = service;
27 | mIntent = intent;
28 | mClassList = classList;
29 | mFacadeManagers = new ArrayList();
30 | }
31 |
32 | public FacadeManager create() {
33 | FacadeManager facadeManager = new FacadeManager(mSdkLevel, mService, mIntent, mClassList);
34 | mFacadeManagers.add(facadeManager);
35 | return facadeManager;
36 | }
37 |
38 | @Override
39 | public List getRpcReceiverManagers() {
40 | return mFacadeManagers;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/language/PhpLanguage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Irontec SL
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.language;
18 |
19 | /**
20 | * Represents the PHP programming language.
21 | *
22 | * @author ivan@irontec.com (Ivan Mosquera Paulo)
23 | */
24 | public class PhpLanguage extends Language {
25 |
26 | @Override
27 | protected String getImportStatement() {
28 | return "";
45 | }
46 |
47 | @Override
48 | protected String getQuote() {
49 | return "'";
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/MainThread.java:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Google Inc. All Rights Reserved.
2 |
3 | package org.qpython.qsl4a.qsl4a;
4 |
5 | import android.content.Context;
6 | import android.os.Handler;
7 |
8 |
9 | import org.qpython.qsl4a.qsl4a.future.FutureResult;
10 |
11 | import java.util.concurrent.Callable;
12 |
13 | public class MainThread {
14 |
15 | private MainThread() {
16 | // Utility class.
17 | }
18 |
19 | /**
20 | * Executed in the main thread, returns the result of an execution. Anything that runs here should
21 | * finish quickly to avoid hanging the UI thread.
22 | */
23 | public static T run(Context context, final Callable task) {
24 | final FutureResult result = new FutureResult();
25 | Handler handler = new Handler(context.getMainLooper());
26 | handler.post(new Runnable() {
27 | @Override
28 | public void run() {
29 | try {
30 | result.set(task.call());
31 | } catch (Exception e) {
32 | LogUtil.e(e);
33 | result.set(null);
34 | }
35 | }
36 | });
37 | try {
38 | return result.get();
39 | } catch (InterruptedException e) {
40 | LogUtil.e(e);
41 | }
42 | return null;
43 | }
44 |
45 | public static void run(Context context, final Runnable task) {
46 | Handler handler = new Handler(context.getMainLooper());
47 | handler.post(new Runnable() {
48 | @Override
49 | public void run() {
50 | task.run();
51 | }
52 | });
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/language/PythonLanguage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.language;
18 |
19 | /**
20 | * Represents the Python programming language.
21 | *
22 | * @author igor.v.karp@gmail.com (Igor Karp)
23 | */
24 | public class PythonLanguage extends Language {
25 |
26 | @Override
27 | protected String getImportStatement() {
28 | return "import android\n";
29 | }
30 |
31 | @Override
32 | protected String getRpcReceiverDeclaration(String rpcReceiver) {
33 | return rpcReceiver + " = android.Android()\n";
34 | }
35 |
36 | @Override
37 | protected String getQuote() {
38 | return "'";
39 | }
40 |
41 | @Override
42 | protected String getNull() {
43 | return "None";
44 | }
45 |
46 | @Override
47 | protected String getTrue() {
48 | return "True";
49 | }
50 |
51 | @Override
52 | protected String getFalse() {
53 | return "False";
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/event/Event.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.event;
18 |
19 | import com.google.common.base.Preconditions;
20 |
21 | public class Event {
22 |
23 | private String mName;
24 | private Object mData;
25 | private double mCreationTime;
26 |
27 | public Event(String name, Object data) {
28 | Preconditions.checkNotNull(name);
29 | setName(name);
30 | setData(data);
31 | mCreationTime = System.currentTimeMillis() * 1000;
32 | }
33 |
34 | public void setName(String name) {
35 | mName = name;
36 | }
37 |
38 | public String getName() {
39 | return mName;
40 | }
41 |
42 | public void setData(Object data) {
43 | mData = data;
44 | }
45 |
46 | public Object getData() {
47 | return mData;
48 | }
49 |
50 | public double getCreationTime() {
51 | return mCreationTime;
52 | }
53 |
54 | public boolean nameEquals(String name) {
55 | return mName.equals(name);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/RpcParameter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * An annotation that is used to document the parameters of an RPC.
27 | *
28 | * @author Felix Arends (felix.arends@gmail.com)
29 | *
30 | */
31 | @Retention(RetentionPolicy.RUNTIME)
32 | @Target(ElementType.PARAMETER)
33 | @Documented
34 | public @interface RpcParameter {
35 | /**
36 | * The name of the formal parameter. This should be in agreement with the java code.
37 | */
38 | public String name();
39 |
40 | /**
41 | * Description of the RPC. This should be a short descriptive statement without a full stop, such
42 | * as 'disables the WiFi mode'.
43 | */
44 | public String description() default "";
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/ScriptProcess.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a;
18 |
19 | import org.qpython.qsl4a.qsl4a.interpreter.Interpreter;
20 | import org.qpython.qsl4a.qsl4a.interpreter.InterpreterConfiguration;
21 | import org.qpython.qsl4a.qsl4a.interpreter.InterpreterProcess;
22 |
23 | import java.io.File;
24 |
25 | public class ScriptProcess extends InterpreterProcess {
26 |
27 | private final File mScript;
28 |
29 | public ScriptProcess(File script, InterpreterConfiguration configuration, AndroidProxy proxy) {
30 | super(configuration.getInterpreterForScript(script.getName()), proxy);
31 | mScript = script;
32 | String scriptName = script.getName();
33 | setName(scriptName);
34 | Interpreter interpreter = configuration.getInterpreterForScript(scriptName);
35 | setCommand(String.format(interpreter.getScriptCommand(), script.getAbsolutePath()));
36 | }
37 |
38 | public String getPath() {
39 | return mScript.getPath();
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/rpc/Rpc.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.rpc;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 | /**
26 | * The {@link Rpc} annotation is used to annotate server-side implementations of RPCs. It describes
27 | * meta-information (currently a brief documentation of the function), and marks a function as the
28 | * implementation of an RPC.
29 | */
30 | @Retention(RetentionPolicy.RUNTIME)
31 | @Target(ElementType.METHOD)
32 | @Documented
33 | public @interface Rpc {
34 | /**
35 | * Returns brief description of the function. Should be limited to one or two sentences.
36 | */
37 | String description();
38 |
39 | /**
40 | * Gives a brief description of the functions return value (and the underlying data structure).
41 | */
42 | String returns() default "";
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/trigger/Trigger.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.trigger;
18 |
19 | import android.content.Context;
20 |
21 |
22 | import org.qpython.qsl4a.qsl4a.event.Event;
23 |
24 | import java.io.Serializable;
25 |
26 | /**
27 | * Interface implemented by objects listening to events on the event queue inside of the
28 | * {@link SerivceManager}.
29 | *
30 | * @author Felix Arends (felix.arends@gmail.com)
31 | */
32 | public interface Trigger extends Serializable {
33 | /**
34 | * Handles an event from the event queue.
35 | *
36 | * @param event
37 | * Event to handle
38 | * @param context
39 | * TODO
40 | */
41 | void handleEvent(Event event, Context context);
42 |
43 | /**
44 | * Returns the event name that this {@link Trigger} is interested in.
45 | */
46 | // TODO(damonkohler): This could be removed by maintaining a reverse mapping from Trigger to event
47 | // name in the TriggerRespository.
48 | String getEventName();
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/language/SquirrelLanguage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.language;
18 |
19 | /**
20 | * Represents the Squirrel programming language, by Alberto Demichelis
21 | * this file adapted by Andy Tai, atai@atai.org
22 | * based on the Python version by
23 | * @author igor.v.karp@gmail.com (Igor Karp)
24 | */
25 | public class SquirrelLanguage extends Language {
26 |
27 | @Override
28 | protected String getImportStatement() {
29 | /* initialization code */
30 | return "";
31 | }
32 |
33 | @Override
34 | protected String getRpcReceiverDeclaration(String rpcReceiver) {
35 | return rpcReceiver + " <- Android();\n";
36 | }
37 |
38 | @Override
39 | protected String getQuote() {
40 | return "\"";
41 | }
42 |
43 | @Override
44 | protected String getNull() {
45 | return "null";
46 | }
47 |
48 | @Override
49 | protected String getTrue() {
50 | return "true";
51 | }
52 |
53 | @Override
54 | protected String getFalse() {
55 | return "false";
56 | }
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/codec/BinaryEncoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.qpython.qsl4a.codec;
19 |
20 | /**
21 | * Defines common encoding methods for byte array encoders.
22 | *
23 | * @author Apache Software Foundation
24 | * @version $Id: BinaryEncoder.java 651573 2008-04-25 11:11:21Z niallp $
25 | */
26 | public interface BinaryEncoder extends Encoder {
27 |
28 | /**
29 | * Encodes a byte array and return the encoded data
30 | * as a byte array.
31 | *
32 | * @param pArray Data to be encoded
33 | *
34 | * @return A byte array containing the encoded data
35 | *
36 | * @throws EncoderException thrown if the Encoder
37 | * encounters a failure condition during the
38 | * encoding process.
39 | */
40 | byte[] encode(byte[] pArray) throws EncoderException;
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/language/TclLanguage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.language;
18 |
19 | /**
20 | * Represents the Tcl programming language.
21 | *
22 | * @author igor.v.karp@gmail.com (Igor Karp)
23 | */
24 | public class TclLanguage extends Language {
25 |
26 | @Override
27 | protected String getImportStatement() {
28 | return "package require android\n";
29 | }
30 |
31 | @Override
32 | protected String getRpcReceiverDeclaration(String rpcReceiver) {
33 | return "set " + rpcReceiver + " [android new]\n";
34 | }
35 |
36 | @Override
37 | protected String getApplyReceiverText(String receiver) {
38 | return "$" + receiver;
39 | }
40 |
41 | @Override
42 | protected String getApplyOperatorText() {
43 | return " ";
44 | }
45 |
46 | @Override
47 | protected String getLeftParametersText() {
48 | return " ";
49 | }
50 |
51 | @Override
52 | protected String getRightParametersText() {
53 | return "";
54 | }
55 |
56 | @Override
57 | protected String getParameterSeparator() {
58 | return " ";
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/codec/BinaryDecoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.qpython.qsl4a.codec;
19 |
20 | /**
21 | * Defines common decoding methods for byte array decoders.
22 | *
23 | * @author Apache Software Foundation
24 | * @version $Id: BinaryDecoder.java 651573 2008-04-25 11:11:21Z niallp $
25 | */
26 | public interface BinaryDecoder extends Decoder {
27 |
28 | /**
29 | * Decodes a byte array and returns the results as a byte array.
30 | *
31 | * @param pArray A byte array which has been encoded with the
32 | * appropriate encoder
33 | *
34 | * @return a byte array that contains decoded content
35 | *
36 | * @throws DecoderException A decoder exception is thrown
37 | * if a Decoder encounters a failure condition during
38 | * the decode process.
39 | */
40 | byte[] decode(byte[] pArray) throws DecoderException;
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/BaseApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a;
18 |
19 | import android.app.Application;
20 |
21 | import org.qpython.qsl4a.qsl4a.interpreter.InterpreterConfiguration;
22 | import org.qpython.qsl4a.qsl4a.trigger.TriggerRepository;
23 |
24 | public class BaseApplication extends Application {
25 |
26 | private final FutureActivityTaskExecutor mTaskExecutor = new FutureActivityTaskExecutor(this);
27 | private TriggerRepository mTriggerRepository;
28 |
29 | protected InterpreterConfiguration mConfiguration;
30 |
31 | public FutureActivityTaskExecutor getTaskExecutor() {
32 | return mTaskExecutor;
33 | }
34 |
35 | @Override
36 | public void onCreate() {
37 | super.onCreate();
38 | mConfiguration = new InterpreterConfiguration(this);
39 | mConfiguration.startDiscovering();
40 | mTriggerRepository = new TriggerRepository(this);
41 | }
42 |
43 | public InterpreterConfiguration getInterpreterConfiguration() {
44 | return mConfiguration;
45 | }
46 |
47 | public TriggerRepository getTriggerRepository() {
48 | return mTriggerRepository;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/facade/ui/ProgressDialogTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.facade.ui;
18 |
19 | import android.app.ProgressDialog;
20 |
21 | /**
22 | * Wrapper class for progress dialog running in separate thread
23 | *
24 | * @author MeanEYE.rcf (meaneye.rcf@gmail.com)
25 | */
26 | class ProgressDialogTask extends DialogTask {
27 |
28 | private final int mStyle;
29 | private final int mMax;
30 | private final String mTitle;
31 | private final String mMessage;
32 | private final Boolean mCancelable;
33 |
34 | public ProgressDialogTask(int style, int max, String title, String message, boolean cancelable) {
35 | mStyle = style;
36 | mMax = max;
37 | mTitle = title;
38 | mMessage = message;
39 | mCancelable = cancelable;
40 | }
41 |
42 | @Override
43 | public void onCreate() {
44 | super.onCreate();
45 | mDialog = new ProgressDialog(getActivity());
46 | ((ProgressDialog) mDialog).setProgressStyle(mStyle);
47 | ((ProgressDialog) mDialog).setMax(mMax);
48 | mDialog.setCancelable(mCancelable);
49 | mDialog.setTitle(mTitle);
50 | ((ProgressDialog) mDialog).setMessage(mMessage);
51 | mDialog.show();
52 | mShowLatch.countDown();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/IoUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a;
18 |
19 | import java.io.BufferedInputStream;
20 | import java.io.BufferedOutputStream;
21 | import java.io.IOException;
22 | import java.io.InputStream;
23 | import java.io.OutputStream;
24 |
25 | public class IoUtils {
26 | private static final int BUFFER_SIZE = 1024 * 8;
27 |
28 | private IoUtils() {
29 | // Utility class.
30 | }
31 |
32 | public static int copy(InputStream input, OutputStream output) throws Exception, IOException {
33 | byte[] buffer = new byte[BUFFER_SIZE];
34 |
35 | BufferedInputStream in = new BufferedInputStream(input, BUFFER_SIZE);
36 | BufferedOutputStream out = new BufferedOutputStream(output, BUFFER_SIZE);
37 | int count = 0, n = 0;
38 | try {
39 | while ((n = in.read(buffer, 0, BUFFER_SIZE)) != -1) {
40 | out.write(buffer, 0, n);
41 | count += n;
42 | }
43 | out.flush();
44 | } finally {
45 | try {
46 | out.close();
47 | } catch (IOException e) {
48 | LogUtil.e(e.getMessage(), e);
49 | }
50 | try {
51 | in.close();
52 | } catch (IOException e) {
53 | LogUtil.e(e.getMessage(), e);
54 | }
55 | }
56 | return count;
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/future/FutureResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.future;
18 |
19 | import java.util.concurrent.CountDownLatch;
20 | import java.util.concurrent.Future;
21 | import java.util.concurrent.TimeUnit;
22 |
23 | /**
24 | * FutureResult represents an eventual execution result for asynchronous operations.
25 | *
26 | * @author Damon Kohler (damonkohler@gmail.com)
27 | */
28 | public class FutureResult implements Future {
29 |
30 | private final CountDownLatch mLatch = new CountDownLatch(1);
31 | private volatile T mResult;
32 |
33 | public void set(T result) {
34 | mResult = result;
35 | mLatch.countDown();
36 | }
37 |
38 | @Override
39 | public boolean cancel(boolean mayInterruptIfRunning) {
40 | return false;
41 | }
42 |
43 | @Override
44 | public T get() throws InterruptedException {
45 | mLatch.await();
46 | return mResult;
47 | }
48 |
49 | @Override
50 | public T get(long timeout, TimeUnit unit) throws InterruptedException {
51 | mLatch.await(timeout, unit);
52 | return mResult;
53 | }
54 |
55 | @Override
56 | public boolean isCancelled() {
57 | return false;
58 | }
59 |
60 | @Override
61 | public boolean isDone() {
62 | return mResult != null;
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/jsonrpc/JsonRpcResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.jsonrpc;
18 |
19 | import org.json.JSONException;
20 | import org.json.JSONObject;
21 |
22 | /**
23 | * Represents a JSON RPC result.
24 | *
25 | * @see http://json-rpc.org/wiki/specification
26 | *
27 | * @author Damon Kohler (damonkohler@gmail.com)
28 | */
29 | public class JsonRpcResult {
30 |
31 | private JsonRpcResult() {
32 | // Utility class.
33 | }
34 |
35 | public static JSONObject empty(int id) throws JSONException {
36 | JSONObject json = new JSONObject();
37 | json.put("id", id);
38 | json.put("result", JSONObject.NULL);
39 | json.put("error", JSONObject.NULL);
40 | return json;
41 | }
42 |
43 | public static JSONObject result(int id, Object data) throws JSONException {
44 | JSONObject json = new JSONObject();
45 | json.put("id", id);
46 | json.put("result", JsonBuilder.build(data));
47 | json.put("error", JSONObject.NULL);
48 | return json;
49 | }
50 |
51 | public static JSONObject error(int id, Throwable t) throws JSONException {
52 | JSONObject json = new JSONObject();
53 | json.put("id", id);
54 | json.put("result", JSONObject.NULL);
55 | json.put("error", t.toString());
56 | return json;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/interpreter/shell/ShellInterpreter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.interpreter.shell;
18 |
19 | import org.qpython.qsl4a.qsl4a.interpreter.Interpreter;
20 | import org.qpython.qsl4a.qsl4a.language.ShellLanguage;
21 |
22 | import java.io.File;
23 |
24 | /**
25 | * Represents the shell.
26 | *
27 | * @author Damon Kohler (damonkohler@gmail.com)
28 | */
29 | public class ShellInterpreter extends Interpreter {
30 | private final static String SHELL_BIN = "/system/bin/sh";
31 |
32 | public ShellInterpreter() {
33 | setExtension(".sh");
34 | setName("sh");
35 | setNiceName("Shell");
36 | setBinary(new File(SHELL_BIN));
37 | setInteractiveCommand("");
38 | setScriptCommand("%s");
39 | setLanguage(new ShellLanguage());
40 | setHasInteractiveMode(true);
41 | }
42 |
43 | public boolean hasInterpreterArchive() {
44 | return false;
45 | }
46 |
47 | public boolean hasExtrasArchive() {
48 | return false;
49 | }
50 |
51 | public boolean hasScriptsArchive() {
52 | return false;
53 | }
54 |
55 | public int getVersion() {
56 | return 0;
57 | }
58 |
59 | @Override
60 | public boolean isUninstallable() {
61 | return false;
62 | }
63 |
64 | @Override
65 | public boolean isInstalled() {
66 | return true;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/interpreter/InterpreterPropertyNames.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.interpreter;
18 |
19 | /**
20 | * A collection of {@link String} keys for querying an InterpreterProvider.
21 | *
22 | * @author Alexey Reznichenko (alexey.reznichenko@gmail.com)
23 | */
24 | public interface InterpreterPropertyNames {
25 |
26 | /**
27 | * Unique name of the interpreter.
28 | */
29 | public static final String NAME = "name";
30 |
31 | /**
32 | * Display name of the interpreter.
33 | */
34 | public static final String NICE_NAME = "niceName";
35 |
36 | /**
37 | * Supported script file extension.
38 | */
39 | public static final String EXTENSION = "extension";
40 |
41 | /**
42 | * Absolute path of the interpreter executable.
43 | */
44 | public static final String BINARY = "binary";
45 |
46 | /**
47 | * Final argument to interpreter binary when running the interpreter interactively.
48 | */
49 | public static final String INTERACTIVE_COMMAND = "interactiveCommand";
50 |
51 | /**
52 | * Final argument to interpreter binary when running a script.
53 | */
54 | public static final String SCRIPT_COMMAND = "scriptCommand";
55 |
56 | /**
57 | * Interpreter interactive mode flag.
58 | */
59 | public static final String HAS_INTERACTIVE_MODE = "hasInteractiveMode";
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/codec/Encoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
3 | * contributor license agreements. See the NOTICE file distributed with
4 | * this work for additional information regarding copyright ownership.
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
6 | * (the "License"); you may not use this file except in compliance with
7 | * the License. You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package org.qpython.qsl4a.codec;
19 |
20 | /**
21 | *
Provides the highest level of abstraction for Encoders.
22 | * This is the sister interface of {@link Decoder}. Every implementation of
23 | * Encoder provides this common generic interface whic allows a user to pass a
24 | * generic Object to any Encoder implementation in the codec package.
25 | *
26 | * @author Apache Software Foundation
27 | * @version $Id: Encoder.java 634915 2008-03-08 09:30:25Z bayard $
28 | */
29 | public interface Encoder {
30 |
31 | /**
32 | * Encodes an "Object" and returns the encoded content
33 | * as an Object. The Objects here may just be byte[]
34 | * or Strings depending on the implementation used.
35 | *
36 | * @param pObject An object ot encode
37 | *
38 | * @return An "encoded" Object
39 | *
40 | * @throws EncoderException an encoder exception is
41 | * thrown if the encoder experiences a failure
42 | * condition during the encoding process.
43 | */
44 | Object encode(Object pObject) throws EncoderException;
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/FutureActivityTaskExecutor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a;
18 |
19 | import android.content.Context;
20 | import android.content.Intent;
21 |
22 |
23 | import org.qpython.qsl4a.qsl4a.activity.FutureActivity;
24 | import org.qpython.qsl4a.qsl4a.future.FutureActivityTask;
25 |
26 | import java.util.Map;
27 | import java.util.concurrent.ConcurrentHashMap;
28 | import java.util.concurrent.atomic.AtomicInteger;
29 |
30 | public class FutureActivityTaskExecutor {
31 |
32 | private final Context mContext;
33 | private final Map> mTaskMap =
34 | new ConcurrentHashMap>();
35 | private final AtomicInteger mIdGenerator = new AtomicInteger(0);
36 |
37 | public FutureActivityTaskExecutor(Context context) {
38 | mContext = context;
39 | }
40 |
41 | public void execute(FutureActivityTask> task) {
42 | int id = mIdGenerator.incrementAndGet();
43 | mTaskMap.put(id, task);
44 | launchHelper(id);
45 | }
46 |
47 | public FutureActivityTask> getTask(int id) {
48 | return mTaskMap.remove(id);
49 | }
50 |
51 | private void launchHelper(int id) {
52 | Intent helper = new Intent(mContext, FutureActivity.class);
53 | helper.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
54 | helper.putExtra(Constants.EXTRA_TASK_ID, id);
55 | mContext.startActivity(helper);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/facade/EyesFreeFacade.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.facade;
18 |
19 | import android.app.Service;
20 | import android.content.Intent;
21 | import android.content.pm.PackageManager;
22 | import android.content.pm.ResolveInfo;
23 |
24 |
25 | import org.qpython.qsl4a.qsl4a.jsonrpc.RpcReceiver;
26 | import org.qpython.qsl4a.qsl4a.rpc.Rpc;
27 | import org.qpython.qsl4a.qsl4a.rpc.RpcParameter;
28 |
29 | import java.util.List;
30 |
31 | /**
32 | * Provides Text To Speech services for API 3 or less.
33 | */
34 |
35 | public class EyesFreeFacade extends RpcReceiver {
36 |
37 | private final Service mService;
38 | private final PackageManager mPackageManager;
39 |
40 | public EyesFreeFacade(FacadeManager manager) {
41 | super(manager);
42 | mService = manager.getService();
43 | mPackageManager = mService.getPackageManager();
44 | }
45 |
46 | @Rpc(description = "Speaks the provided message via TTS.")
47 | public void ttsSpeak(@RpcParameter(name = "message") String message) {
48 | Intent intent = new Intent("com.google.tts.makeBagel");
49 | intent.putExtra("message", message);
50 | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
51 | List infos = mPackageManager.queryIntentActivities(intent, 0);
52 | if (infos.size() > 0) {
53 | mService.startActivity(intent);
54 | } else {
55 | throw new RuntimeException("Eyes-Free is not installed.");
56 | }
57 | }
58 |
59 | @Override
60 | public void shutdown() {
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/facade/MjpegServer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.facade;
18 |
19 | import java.io.OutputStream;
20 | import java.net.Socket;
21 |
22 | import org.qpython.qsl4a.qsl4a.SimpleServer;
23 |
24 | class MjpegServer extends SimpleServer {
25 |
26 | private final JpegProvider mProvider;
27 |
28 | public MjpegServer(JpegProvider provider) {
29 | mProvider = provider;
30 | }
31 |
32 | @Override
33 | protected void handleConnection(Socket socket) throws Exception {
34 | byte[] data = mProvider.getJpeg();
35 | if (data == null) {
36 | return;
37 | }
38 | OutputStream outputStream = socket.getOutputStream();
39 | outputStream.write((
40 | "HTTP/1.0 200 OK\r\n" +
41 | "Server: SL4A\r\n" +
42 | "Connection: close\r\n" +
43 | "Max-Age: 0\r\n" +
44 | "Expires: 0\r\n" +
45 | "Cache-Control: no-cache, private\r\n" +
46 | "Pragma: no-cache\r\n" +
47 | "Content-Type: multipart/x-mixed-replace; boundary=--BoundaryString\r\n\r\n").getBytes());
48 | while (true) {
49 | data = mProvider.getJpeg();
50 | if (data == null) {
51 | return;
52 | }
53 | outputStream.write("--BoundaryString\r\n".getBytes());
54 | outputStream.write("Content-type: image/jpg\r\n".getBytes());
55 | outputStream.write(("Content-Length: " + data.length + "\r\n\r\n").getBytes());
56 | outputStream.write(data);
57 | outputStream.write("\r\n\r\n".getBytes());
58 | outputStream.flush();
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/src/main/java/org/qpython/qsl4a/qsl4a/facade/ui/DialogTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2010 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy of
6 | * the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 |
17 | package org.qpython.qsl4a.qsl4a.facade.ui;
18 |
19 | import android.app.Dialog;
20 |
21 | import org.qpython.qsl4a.qsl4a.facade.EventFacade;
22 | import org.qpython.qsl4a.qsl4a.future.FutureActivityTask;
23 |
24 | import java.util.concurrent.CountDownLatch;
25 |
26 | abstract class DialogTask extends FutureActivityTask