新增 app.sendBroadcast("inspect_layout_hierarchy"),app.sendBroadcast("inspect_layout_bounds");
This commit is contained in:
@@ -55,6 +55,11 @@ module.exports = function(runtime, global){
|
||||
}
|
||||
|
||||
app.sendBroadcast = function(i){
|
||||
if(typeof(i) == "string"){
|
||||
if(runtime.getProperty("broadcast." + i)){
|
||||
app.sendLocalBroadcastSync(app.intent({action: runtime.getProperty("broadcast." + i)}));
|
||||
}
|
||||
}
|
||||
context.sendBroadcast(app.intent(i));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.stardust.autojs.annotation.ScriptInterface;
|
||||
@@ -49,6 +50,11 @@ public class AppUtils {
|
||||
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
public void sendLocalBroadcastSync(Intent intent){
|
||||
LocalBroadcastManager.getInstance(mContext).sendBroadcastSync(intent);
|
||||
}
|
||||
|
||||
@ScriptInterface
|
||||
public boolean launchApp(String appName) {
|
||||
String pkg = getPackageName(appName);
|
||||
|
||||
Reference in New Issue
Block a user