release 2.0.13 Beta2
This commit is contained in:
@@ -9,8 +9,8 @@ android {
|
||||
applicationId "com.stardust.scriptdroid"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 23
|
||||
versionCode 141
|
||||
versionName "2.0.13 Beta"
|
||||
versionCode 142
|
||||
versionName "2.0.13 Beta2"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
ndk {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"path":"documentation"
|
||||
},
|
||||
{
|
||||
"title": "EMCAScript教程",
|
||||
"title": "ECMAScript教程",
|
||||
"type": "catalogue"
|
||||
},
|
||||
{
|
||||
@@ -65,7 +65,7 @@
|
||||
"path":"documentation"
|
||||
}
|
||||
],
|
||||
"EMCAScript教程": [
|
||||
"ECMAScript教程": [
|
||||
{
|
||||
"title": "基础",
|
||||
"type": "catalogue"
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
### text(文件控件)
|
||||
12
app/src/main/assets/sample/QQ与微信/QQ批量删除好友.js
Normal file
12
app/src/main/assets/sample/QQ与微信/QQ批量删除好友.js
Normal file
@@ -0,0 +1,12 @@
|
||||
"auto";
|
||||
|
||||
launchApp("QQ");
|
||||
|
||||
toast("在好友列表中点谁删谁");
|
||||
|
||||
while(true){
|
||||
while(!click("更多"));
|
||||
while(!click("删除好友"));
|
||||
sleep(300);
|
||||
while(!click("删除好友"));
|
||||
}
|
||||
55
app/src/main/assets/sample/QQ与微信/QQ点赞群成员.js
Normal file
55
app/src/main/assets/sample/QQ与微信/QQ点赞群成员.js
Normal file
@@ -0,0 +1,55 @@
|
||||
"auto";
|
||||
var liked = {};
|
||||
while(true){
|
||||
var list = className("AbsListView").findOne();
|
||||
list.children().each(function(child){
|
||||
if(child.className() != "android.widget.FrameLayout"){
|
||||
return;
|
||||
}
|
||||
if(!isGroupMember(child)){
|
||||
return;
|
||||
}
|
||||
if(isMyself(child)){
|
||||
return;
|
||||
}
|
||||
child.child(0).click();
|
||||
like();
|
||||
while(!click("返回"));
|
||||
while(!click("成员资料"));
|
||||
while(!click("返回"));
|
||||
});
|
||||
className("AbsListView").findOne().scrollForward();
|
||||
}
|
||||
|
||||
|
||||
function isGroupMember(child){
|
||||
if(child.childCount() != 1){
|
||||
return false;
|
||||
}
|
||||
return child.child(0) && child.child(0).className() == "android.widget.FrameLayout";
|
||||
}
|
||||
|
||||
function isMyself(child){
|
||||
var l = child.findByText("我");
|
||||
return l && l.size() > 0;
|
||||
}
|
||||
|
||||
function like(){
|
||||
var qq = getQQ();
|
||||
if(liked[qq]){
|
||||
while(!click("返回"));
|
||||
return;
|
||||
}
|
||||
while(!click("更多"));
|
||||
while(!click("查看个人资料卡"));
|
||||
var likeBtn = descEndsWith("点击可赞").findOne();
|
||||
for(let i = 0; i < 10; i++){
|
||||
likeBtn.click();
|
||||
sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
function getQQ(){
|
||||
var qq = textMatches("\\d{5,12}").findOne().text();
|
||||
return qq;
|
||||
}
|
||||
32
app/src/main/assets/sample/QQ与微信/QQ顺序点赞脚本.js
Normal file
32
app/src/main/assets/sample/QQ与微信/QQ顺序点赞脚本.js
Normal file
@@ -0,0 +1,32 @@
|
||||
"auto";
|
||||
|
||||
var 延迟 = 200;
|
||||
|
||||
function 下滑(){
|
||||
className("AbsListView").scrollable().scrollForward();
|
||||
}
|
||||
|
||||
function 赞(){
|
||||
className("ImageView").desc("赞").untilFind()
|
||||
.each(function(item){
|
||||
for(var i = 0; i < 10; i++){
|
||||
item.click();
|
||||
sleep(延迟);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function 显示更多(){
|
||||
for(let i = 0; i < 2;i++){
|
||||
click("显示更多");
|
||||
}
|
||||
}
|
||||
|
||||
toast("请打开自己的资料页,点击点赞图标");
|
||||
sleep(1000);
|
||||
|
||||
while(notStopped()){
|
||||
赞();
|
||||
显示更多();
|
||||
下滑();
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import io.mattcarroll.hover.HoverMenu;
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.Set;
|
||||
|
||||
import io.mattcarroll.hover.NavigatorContent;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/3/11.
|
||||
*/
|
||||
@@ -46,7 +47,7 @@ public class HoverMenuAdapter implements io.mattcarroll.hover.HoverMenuAdapter {
|
||||
private final Context mContext;
|
||||
private final List<String> mTabIds;
|
||||
private final Map<String, NavigatorContent> mData = new LinkedHashMap<>();
|
||||
private final Set<ContentChangeListener> mContentChangeListeners = new HashSet<>();
|
||||
private final Set<io.mattcarroll.hover.HoverMenuAdapter.ContentChangeListener> mContentChangeListeners = new HashSet<>();
|
||||
private View[] mViews;
|
||||
|
||||
public HoverMenuAdapter(@NonNull HoverMenuService context) {
|
||||
|
||||
@@ -112,6 +112,7 @@ public class HoverMenuService extends Service {
|
||||
mWindowHoverMenu.hide();
|
||||
stopSelf();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,7 +31,7 @@ public class FireSettingReceiver extends AbstractPluginSettingReceiver {
|
||||
|
||||
@Override
|
||||
protected void firePluginSetting(@NonNull Context context, @NonNull Bundle bundle) {
|
||||
context.startService(new Intent(context, ScriptExecutionIntentService.class)
|
||||
context.startActivity(new Intent(context, RunIntentActivity.class)
|
||||
.putExtras(bundle));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,10 @@ import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import com.afollestad.materialdialogs.DialogAction;
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.stardust.app.Fragment;
|
||||
import com.stardust.scriptdroid.App;
|
||||
import com.stardust.scriptdroid.Pref;
|
||||
import com.stardust.scriptdroid.R;
|
||||
@@ -82,7 +78,7 @@ public class SideMenuFragment extends android.support.v4.app.Fragment {
|
||||
mExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final boolean checked = AccessibilityService.isEnable(App.getApp());
|
||||
final boolean checked = AccessibilityService.isEnabled(App.getApp());
|
||||
mAccessibilityServiceSwitch.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -114,7 +110,7 @@ public class SideMenuFragment extends android.support.v4.app.Fragment {
|
||||
|
||||
@CheckedChange(R.id.sw_auto_operate_service)
|
||||
void setAutoOperateServiceEnable(CompoundButton button, boolean enable) {
|
||||
boolean isAccessibilityServiceEnabled = AccessibilityService.isEnable(App.getApp());
|
||||
boolean isAccessibilityServiceEnabled = AccessibilityService.isEnabled(App.getApp());
|
||||
if (enable && !isAccessibilityServiceEnabled) {
|
||||
AccessibilityServiceTool.enableAccessibilityService();
|
||||
} else if (!enable && isAccessibilityServiceEnabled) {
|
||||
|
||||
@@ -49,8 +49,6 @@ public class MyScriptListFragment extends Fragment {
|
||||
private MaterialDialog mScriptFileOperationDialog;
|
||||
private MaterialDialog mDirectoryOperationDialog;
|
||||
private ScriptFile mSelectedScriptFile;
|
||||
private MaterialDialog.InputCallback mFileNameInputCallback = new InputCallback(false);
|
||||
private MaterialDialog.InputCallback mDirectoryNameInputCallback = new InputCallback(true);
|
||||
private String mFilePathToImport;
|
||||
|
||||
@Nullable
|
||||
@@ -186,7 +184,7 @@ public class MyScriptListFragment extends Fragment {
|
||||
|
||||
|
||||
public void newDirectory() {
|
||||
showNameInputDialog("", mDirectoryNameInputCallback, new MaterialDialog.InputCallback() {
|
||||
showNameInputDialog("", new InputCallback(true), new MaterialDialog.InputCallback() {
|
||||
@Override
|
||||
public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
|
||||
if (new ScriptFile(getCurrentDirectory(), input.toString()).mkdirs()) {
|
||||
@@ -204,7 +202,7 @@ public class MyScriptListFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void showFileNameInputDialog(String prefix, final MaterialDialog.InputCallback callback) {
|
||||
showNameInputDialog(prefix, mFileNameInputCallback, callback);
|
||||
showNameInputDialog(prefix, new InputCallback(false), callback);
|
||||
}
|
||||
|
||||
private void showNameInputDialog(String prefix, MaterialDialog.InputCallback textWatcher, final MaterialDialog.InputCallback callback) {
|
||||
@@ -334,6 +332,7 @@ public class MyScriptListFragment extends Fragment {
|
||||
|
||||
private boolean mIsDirectory = false;
|
||||
private String mExcluded;
|
||||
private boolean mIsFirstTextChanged = true;
|
||||
|
||||
InputCallback(boolean isDirectory, String excluded) {
|
||||
mIsDirectory = isDirectory;
|
||||
@@ -346,6 +345,10 @@ public class MyScriptListFragment extends Fragment {
|
||||
|
||||
@Override
|
||||
public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
|
||||
if (mIsFirstTextChanged) {
|
||||
mIsFirstTextChanged = false;
|
||||
return;
|
||||
}
|
||||
EditText editText = dialog.getInputEditText();
|
||||
if (editText == null)
|
||||
return;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:accessibilityEventTypes="typeAllMask"
|
||||
android:accessibilityFeedbackType="feedbackGeneric"
|
||||
android:accessibilityFlags="flagIncludeNotImportantViews|flagReportViewIds|flagRequestEnhancedWebAccessibility|flagRequestFilterKeyEvents"
|
||||
android:accessibilityFlags="flagRetrieveInteractiveWindows|flagIncludeNotImportantViews|flagReportViewIds|flagRequestEnhancedWebAccessibility|flagRequestFilterKeyEvents"
|
||||
android:canPerformGestures="true"
|
||||
android:canRequestEnhancedWebAccessibility="true"
|
||||
android:canRetrieveWindowContent="true"
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
|
||||
import com.stardust.util.Consumer;
|
||||
import com.stardust.util.Func1;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -203,6 +204,15 @@ public class UiObjectCollection {
|
||||
return this;
|
||||
}
|
||||
|
||||
public UiObjectCollection filter(Func1<UiObject, Boolean> func1) {
|
||||
List<UiObject> list = new ArrayList<>();
|
||||
for (UiObject uiObject : mNodes) {
|
||||
if (func1.call(uiObject))
|
||||
list.add(uiObject);
|
||||
}
|
||||
return of(list);
|
||||
}
|
||||
|
||||
public UiObjectCollection find(UiGlobalSelector selector) {
|
||||
List<UiObject> list = new ArrayList<>();
|
||||
for (UiObject object : mNodes) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.KeyEvent;
|
||||
import android.view.WindowManager;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@@ -16,6 +17,9 @@ import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/5/2.
|
||||
@@ -29,7 +33,8 @@ public class AccessibilityService extends android.accessibilityservice.Accessibi
|
||||
private static final String TAG = "AccessibilityService";
|
||||
|
||||
private static final SortedMap<Integer, AccessibilityDelegate> mDelegates = new TreeMap<>();
|
||||
private static final Object LOCK = new Object();
|
||||
private static final ReentrantLock LOCK = new ReentrantLock();
|
||||
private static final Condition ENABLED = LOCK.newCondition();
|
||||
private static AccessibilityService instance;
|
||||
private static boolean containsAllEventTypes = false;
|
||||
private static final Set<Integer> eventTypes = new HashSet<>();
|
||||
@@ -43,7 +48,7 @@ public class AccessibilityService extends android.accessibilityservice.Accessibi
|
||||
eventTypes.addAll(set);
|
||||
}
|
||||
|
||||
public static boolean isEnable(Context context) {
|
||||
public static boolean isEnabled(Context context) {
|
||||
return AccessibilityServiceUtils.isAccessibilityServiceEnabled(context, AccessibilityService.class);
|
||||
}
|
||||
|
||||
@@ -54,7 +59,6 @@ public class AccessibilityService extends android.accessibilityservice.Accessibi
|
||||
@Override
|
||||
public void onAccessibilityEvent(final AccessibilityEvent event) {
|
||||
Log.v(TAG, "onAccessibilityEvent: " + event);
|
||||
Log.v(TAG, "getRootInActiveWindow: " + super.getRootInActiveWindow());
|
||||
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
|
||||
|| event.getEventType() == AccessibilityEvent.TYPE_VIEW_HOVER_ENTER
|
||||
|| event.getEventType() == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT) {
|
||||
@@ -108,9 +112,9 @@ public class AccessibilityService extends android.accessibilityservice.Accessibi
|
||||
Log.v(TAG, "onServiceConnected: " + getServiceInfo().toString());
|
||||
instance = this;
|
||||
super.onServiceConnected();
|
||||
synchronized (LOCK) {
|
||||
LOCK.notifyAll();
|
||||
}
|
||||
LOCK.lock();
|
||||
ENABLED.signalAll();
|
||||
LOCK.unlock();
|
||||
// FIXME: 2017/2/12 有时在无障碍中开启服务后这里不会调用服务也不会运行,安卓的BUG???
|
||||
}
|
||||
|
||||
@@ -123,12 +127,13 @@ public class AccessibilityService extends android.accessibilityservice.Accessibi
|
||||
}
|
||||
|
||||
public static void waitForEnabled(long timeOut) {
|
||||
synchronized (LOCK) {
|
||||
try {
|
||||
LOCK.wait(timeOut);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LOCK.lock();
|
||||
try {
|
||||
ENABLED.await(timeOut, TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
LOCK.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
11
common/src/main/java/com/stardust/util/Func1.java
Normal file
11
common/src/main/java/com/stardust/util/Func1.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.stardust.util;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/7/7.
|
||||
*/
|
||||
|
||||
public interface Func1<T, R> {
|
||||
|
||||
R call(T t);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user