Added: Root automator, custom theme color, some helps

This commit is contained in:
hyb1996
2017-03-07 13:49:56 +08:00
parent 6ec0601373
commit 38c22646e0
88 changed files with 6659 additions and 412 deletions

View File

@@ -1,4 +1,15 @@
if(__engine__ == "rhino"){
__importClassOld__ = importClass;
var importClass = function(pack){
if(typeof(pack) == "string"){
__importClassOld__(Packages[pack]);
}else{
__importClassOld__(pack);
}
}
}
var toast = function(text){
droid.toast(text);
}
@@ -22,8 +33,10 @@ var launchApp = function(appName){
function performAction(action, args){
if(args.length == 4){
return action(droid.bounds(args[0], args[1], args[2], args[3]));
}else{
return action(droid.text(args[0]));
}else if(args.length == 2){
return action(droid.text(args[0], args[1]));
}else {
return action(droid.text(args[0], -1));
}
}
@@ -39,6 +52,10 @@ var longClick = function(a, b, c, d){
}, arguments);
}
var clickId = function(id){
return droid.click(droid.id(id));
}
var scrollUp = function(a, b, c, d){
if(arguments.length == 0)
return droid.scrollAllUp();
@@ -136,4 +153,76 @@ var getActivityName = function(){
var setClip = function(text){
droid.setClip(text);
}
}
var Tap = function(x, y){
return shell("input tap " + x + " " + y, true).code == 1;
}
var Swipe = function(x1, y1, x2, y2){
return shell("input swipe " + x1 + " " + y1 + " " + x2 + " " + y2, true).code == 1;
}
var KeyCode = function(keyCode){
return shell("input keyevent " + keyCode, true).code == 1;
}
var Home = function(){
return KeyCode(3);
}
var Back = function(){
return KeyCode(4);
}
var Power = function(){
return KeyCode(26);
}
var Up = function(){
return KeyCode(19);
}
var Down = function(){
return KeyCode(20);
}
var Left = function(){
return KeyCode(21);
}
var Right = function(){
return KeyCode(22);
}
var OK = function(){
return KeyCode(23);
}
var VolumeUp = function(){
return KeyCode(24);
}
var VolumeDown = function(){
return KeyCode(25);
}
var Menu = function(){
return KeyCode(1);
}
var Camera = function(){
return KeyCode(27);
}
var Text = function(text){
return shell("input text " + text, true).code == 1;
}
/*
importClass("com.stardust.scriptdroid.service.AccessibilityDelegate");
var addAccessibilityDelegate = function(delegate){
droid.addAccessibilityDelegate(delegate);
}
*/