Search in sources :

Example 6 with ScriptInterface

use of com.stardust.autojs.annotation.ScriptInterface in project Auto.js by hyb1996.

the class AppUtils method viewFile.

@ScriptInterface
public void viewFile(String path) {
    if (path == null)
        throw new NullPointerException("path == null");
    path = "file://" + path;
    String mimeType = MimeTypes.fromFileOr(path, "*/*");
    mContext.startActivity(new Intent(Intent.ACTION_VIEW).setDataAndType(Uri.parse(path), mimeType).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
Also used : Intent(android.content.Intent) ScriptInterface(com.stardust.autojs.annotation.ScriptInterface)

Example 7 with ScriptInterface

use of com.stardust.autojs.annotation.ScriptInterface in project Auto.js by hyb1996.

the class AppUtils method editFile.

@ScriptInterface
public void editFile(String path) {
    if (path == null)
        throw new NullPointerException("path == null");
    path = "file://" + path;
    String mimeType = MimeTypes.fromFileOr(path, "*/*");
    mContext.startActivity(new Intent(Intent.ACTION_EDIT).setDataAndType(Uri.parse(path), mimeType).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
Also used : Intent(android.content.Intent) ScriptInterface(com.stardust.autojs.annotation.ScriptInterface)

Aggregations

ScriptInterface (com.stardust.autojs.annotation.ScriptInterface)7 PackageManager (android.content.pm.PackageManager)3 Intent (android.content.Intent)2 ApplicationInfo (android.content.pm.ApplicationInfo)2 NonNull (android.support.annotation.NonNull)1 AccessibilityNodeInfo (android.view.accessibility.AccessibilityNodeInfo)1 ScriptInterruptedException (com.stardust.autojs.runtime.exception.ScriptInterruptedException)1 UiObjectCollection (com.stardust.automator.UiObjectCollection)1