fix fucking accessibility service
This commit is contained in:
@@ -9,8 +9,8 @@ android {
|
||||
applicationId "com.stardust.scriptdroid"
|
||||
minSdkVersion 17
|
||||
targetSdkVersion 23
|
||||
versionCode 147
|
||||
versionName "2.0.14 Beta"
|
||||
versionCode 148
|
||||
versionName "2.0.14 Alpha"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
ndk {
|
||||
|
||||
@@ -3,27 +3,30 @@
|
||||
var 好友验证信息 = "AutoJs自动添加群好友";
|
||||
var 延迟 = 500;
|
||||
|
||||
toast("请打开群成员列表");
|
||||
launchApp("QQ");
|
||||
toast("请打开要加的群");
|
||||
sleep(500);
|
||||
if(currentActivity() != "com.tencent.mobileqq.activity.TroopMemberListActivity"){
|
||||
openGroupMemberList();
|
||||
}
|
||||
|
||||
var added = {};
|
||||
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();
|
||||
sleep(500);
|
||||
addAsFriend();
|
||||
sleep(延迟);
|
||||
});
|
||||
className("AbsListView").findOne().scrollForward();
|
||||
var list = className("AbsListView").findOne();
|
||||
var count = list.childCount();
|
||||
for(var i = 0; i < count; i++){
|
||||
var child = list.child(i);
|
||||
if(!child || child.className() != "android.widget.FrameLayout"){
|
||||
continue;
|
||||
}
|
||||
if(!isGroupMember(child) || isMyself(child)){
|
||||
continue;
|
||||
}
|
||||
child.child(0).click();
|
||||
sleep(500);
|
||||
addAsFriend();
|
||||
sleep(延迟);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +34,9 @@ function isGroupMember(child){
|
||||
if(child.childCount() != 1){
|
||||
return false;
|
||||
}
|
||||
if(!child.findByText("Baby Q").isEmpty()){
|
||||
return false;
|
||||
}
|
||||
return child.child(0) && child.child(0).className() == "android.widget.FrameLayout";
|
||||
}
|
||||
|
||||
@@ -41,6 +47,7 @@ function isMyself(child){
|
||||
|
||||
function addAsFriend(){
|
||||
var qq = getQQ();
|
||||
toast(qq);
|
||||
if(added[qq]){
|
||||
while(!click("返回"));
|
||||
return;
|
||||
@@ -63,4 +70,12 @@ function addAsFriend(){
|
||||
function getQQ(){
|
||||
var qq = textMatches("\\d{5,12}").findOne().text();
|
||||
return qq;
|
||||
}
|
||||
|
||||
function openGroupMemberList(){
|
||||
desc("群资料卡").click();
|
||||
var groupMemberCountView = textEndsWith("名成员").findOne();
|
||||
var groupMemberCount = parseInt(/\d+/.exec(groupMemberCountView.text())[0]);
|
||||
groupMemberCountView.parent().click();
|
||||
sleep(groupMemberCount * 4);
|
||||
}
|
||||
@@ -24,11 +24,13 @@ sleep(100);
|
||||
waitForActivity("com.tencent.mobileqq.activity.VisitorsActivity");
|
||||
|
||||
while(notStopped()){
|
||||
var i = 0;
|
||||
var i = 0;
|
||||
while(i < 10){
|
||||
i += 赞() ? 1 : 0;
|
||||
click("取消");
|
||||
}
|
||||
显示更多();
|
||||
下滑();
|
||||
if(currentActivity() == "com.tencent.mobileqq.activity.VisitorsActivity"){
|
||||
下滑();
|
||||
}
|
||||
}
|
||||
21
app/src/main/assets/sample/QQ与微信/QQ名片点赞(只点赞好友).js
Normal file
21
app/src/main/assets/sample/QQ与微信/QQ名片点赞(只点赞好友).js
Normal file
@@ -0,0 +1,21 @@
|
||||
"auto";
|
||||
|
||||
toast("请打开自己的资料页,点击点赞图标");
|
||||
sleep(500);
|
||||
waitForActivity("com.tencent.mobileqq.activity.VisitorsActivity");
|
||||
|
||||
while(notStopped()){
|
||||
for(var i = 0; i < 10; i++){
|
||||
className("ImageView").desc("赞").untilFind().each(function(like){
|
||||
var parent = like.parent();
|
||||
if(like.parent().findByText("(好友)")){
|
||||
like.click();
|
||||
}
|
||||
});
|
||||
}
|
||||
click("显示更多");
|
||||
click("显示更多");
|
||||
if(currentActivity() == "com.tencent.mobileqq.activity.VisitorsActivity"){
|
||||
className("AbsListView").scrollable().scrollForward();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,32 @@
|
||||
"auto";
|
||||
var liked = {};
|
||||
|
||||
launchApp("QQ");
|
||||
toast("请打开要点赞的群");
|
||||
sleep(500);
|
||||
if(currentActivity() != "com.tencent.mobileqq.activity.TroopMemberListActivity"){
|
||||
openGroupMemberList();
|
||||
}
|
||||
|
||||
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();
|
||||
var count = list.childCount();
|
||||
for(var i = 0; i < count; i++){
|
||||
var child = list.child(i);
|
||||
if(!child || child.className() != "android.widget.FrameLayout"){
|
||||
continue;
|
||||
}
|
||||
if(!isGroupMember(child) || isMyself(child)){
|
||||
continue;
|
||||
}
|
||||
child.child(0).click();
|
||||
sleep(500);
|
||||
like();
|
||||
while(!click("返回"));
|
||||
while(!click("成员资料"));
|
||||
while(!click("返回"));
|
||||
sleep(500);
|
||||
}
|
||||
list.scrollForward();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +34,9 @@ function isGroupMember(child){
|
||||
if(child.childCount() != 1){
|
||||
return false;
|
||||
}
|
||||
if(!child.findByText("Baby Q").isEmpty()){
|
||||
return false;
|
||||
}
|
||||
return child.child(0) && child.child(0).className() == "android.widget.FrameLayout";
|
||||
}
|
||||
|
||||
@@ -35,11 +46,6 @@ function isMyself(child){
|
||||
}
|
||||
|
||||
function like(){
|
||||
var qq = getQQ();
|
||||
if(liked[qq]){
|
||||
while(!click("返回"));
|
||||
return;
|
||||
}
|
||||
while(!click("更多"));
|
||||
while(!click("查看个人资料卡"));
|
||||
var likeBtn = descEndsWith("点击可赞").findOne();
|
||||
@@ -52,4 +58,12 @@ function like(){
|
||||
function getQQ(){
|
||||
var qq = textMatches("\\d{5,12}").findOne().text();
|
||||
return qq;
|
||||
}
|
||||
|
||||
function openGroupMemberList(){
|
||||
desc("群资料卡").click();
|
||||
var groupMemberCountView = textEndsWith("名成员").findOne();
|
||||
var groupMemberCount = parseInt(/\d+/.exec(groupMemberCountView.text())[0]);
|
||||
groupMemberCountView.parent().click();
|
||||
sleep(groupMemberCount * 4);
|
||||
}
|
||||
@@ -30,7 +30,12 @@ public class HoverMenuManger {
|
||||
if (!HoverMenuService.isServiceRunning()) {
|
||||
if (!SettingsCompat.canDrawOverlays(App.getApp())) {
|
||||
Toast.makeText(App.getApp(), R.string.text_no_floating_window_permission, Toast.LENGTH_SHORT).show();
|
||||
SettingsCompat.manageDrawOverlays(App.getApp());
|
||||
try {
|
||||
SettingsCompat.manageDrawOverlays(App.getApp());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
IntentUtil.goToAppDetailSettings(App.getApp());
|
||||
}
|
||||
} else {
|
||||
HoverMenuService.startService(App.getApp());
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.stardust.scriptdroid.external.floatingwindow.menu.view.FloatingLayout
|
||||
import com.stardust.scriptdroid.external.floatingwindow.menu.view.FloatingLayoutHierarchyView;
|
||||
import com.stardust.scriptdroid.tool.AccessibilityServiceTool;
|
||||
import com.stardust.theme.ThemeColorManagerCompat;
|
||||
import com.stardust.util.IntentUtil;
|
||||
import com.stardust.util.MessageEvent;
|
||||
import com.stardust.util.MessageIntent;
|
||||
|
||||
@@ -129,7 +130,12 @@ public class HoverMenuService extends Service {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(this, R.string.text_no_floating_window_permission, Toast.LENGTH_SHORT).show();
|
||||
SettingsCompat.manageDrawOverlays(this);
|
||||
try {
|
||||
SettingsCompat.manageDrawOverlays(this);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
IntentUtil.goToAppDetailSettings(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.stardust.scriptdroid.tool.AccessibilityServiceTool;
|
||||
import com.stardust.scriptdroid.ui.main.MainActivity_;
|
||||
import com.stardust.util.ClipboardUtil;
|
||||
import com.stardust.util.MessageEvent;
|
||||
import com.stardust.view.accessibility.AccessibilityService;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
@@ -61,10 +62,14 @@ public class MainMenuNavigatorContent implements NavigatorContent {
|
||||
Toast.makeText(mView.getContext(), R.string.text_layout_inspector_is_dumping, Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
if (inspector.getCapture() == null) {
|
||||
if (AccessibilityService.getInstance() == null) {
|
||||
Toast.makeText(mView.getContext(), R.string.text_no_accessibility_permission_to_capture, Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
if (inspector.getCapture() == null) {
|
||||
Toast.makeText(mView.getContext(), R.string.text_inspect_failed, Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.stardust.scriptdroid.external.floatingwindow.menu.layout_inspector;
|
||||
|
||||
import android.os.Build;
|
||||
import android.support.annotation.RequiresApi;
|
||||
import android.util.Log;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
|
||||
@@ -43,6 +45,17 @@ public class LayoutInspector {
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
private void refreshChildList(AccessibilityNodeInfo root) {
|
||||
if (root == null)
|
||||
return;
|
||||
root.refresh();
|
||||
int childCount = root.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
refreshChildList(root.getChild(i));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDumping() {
|
||||
return mDumping;
|
||||
}
|
||||
|
||||
@@ -207,6 +207,7 @@
|
||||
<string name="text_number_format_error">格式错误</string>
|
||||
<string name="text_accessibility_settings">打开无障碍服务</string>
|
||||
<string name="text_discard_record">放弃录制</string>
|
||||
<string name="text_inspect_failed">布局抓取失败,请关闭悬浮窗后动一下页面重试</string>
|
||||
|
||||
<string-array name="record_control_keys">
|
||||
<item>无</item>
|
||||
|
||||
Reference in New Issue
Block a user