From a046d5a804d6842796a718fba4e98c3259340a60 Mon Sep 17 00:00:00 2001
From: Runt <qingingrunt2010@qq.com>
Date: Sat, 04 Jun 2022 12:42:04 +0000
Subject: [PATCH] 接口参数问题 标题栏 添加收藏功能
---
app/src/main/java/com/auto/lyric/service/AutoInputService.java | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/app/src/main/java/com/auto/lyric/service/AutoInputService.java b/app/src/main/java/com/auto/lyric/service/AutoInputService.java
index c68f2c6..9e90755 100644
--- a/app/src/main/java/com/auto/lyric/service/AutoInputService.java
+++ b/app/src/main/java/com/auto/lyric/service/AutoInputService.java
@@ -129,19 +129,21 @@
* 点击弹出 edit弹框
*/
private void clickEdit(){
- List<AccessibilityNodeInfo> list = getRootInActiveWindow().findAccessibilityNodeInfosByText("说点什么...");
- Log.e(TAG,"获取到控件 "+list.size());
- if (list != null && list.size() > 0 && flag) {
- //模拟第三方点击事件
- //找到你的节点以后 就直接点击他就行了
- //AccessibilityNodeInfo node = list.get(0);
- list.get(0).performAction(AccessibilityNodeInfo.ACTION_CLICK);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
- Log.e(TAG,"执行点击 "+list.get(0).getPaneTitle());
+ try{
+ List<AccessibilityNodeInfo> list = getRootInActiveWindow().findAccessibilityNodeInfosByText("说点什么...");
+ Log.e(TAG,"获取到控件 "+list.size());
+ if (list != null && list.size() > 0 && flag) {
+ //模拟第三方点击事件
+ //找到你的节点以后 就直接点击他就行了
+ //AccessibilityNodeInfo node = list.get(0);
+ list.get(0).performAction(AccessibilityNodeInfo.ACTION_CLICK);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ Log.e(TAG,"执行点击 "+list.get(0).getPaneTitle());
+ }
+ }else if(flag){
+ //Toast.makeText(getBaseContext(),"未找到控件",Toast.LENGTH_SHORT).show();
}
- }else if(flag){
- //Toast.makeText(getBaseContext(),"未找到控件",Toast.LENGTH_SHORT).show();
- }
+ }catch ( Exception e){}
}
@SuppressLint("NewApi")
@@ -176,8 +178,8 @@
@SuppressLint("NewApi")
private AccessibilityNodeInfo getViewByDesc(AccessibilityNodeInfo node, String desc){
try{
- Log.e(TAG,desc +" getViewByDesc id:"+node.getViewIdResourceName() +" class:"+node.getClassName()+" text:"+node.getText()+" "+node.getContentDescription());
- Log.e(TAG,"getViewByDesc node:"+node);
+ //Log.e(TAG,desc +" getViewByDesc id:"+node.getViewIdResourceName() +" class:"+node.getClassName()+" text:"+node.getText()+" "+node.getContentDescription());
+ //Log.e(TAG,"getViewByDesc node:"+node);
if(node.getChildCount() > 0){
for(int i = 0 ; i < node.getChildCount() ; i ++){
if(node.getChild(i) != null) {
@@ -209,7 +211,9 @@
@Override
public void onInterrupt() {
+ Log.e(TAG,"onInterrupt 服务停止");
unregisterReceiver(receiver);
+ Toast.makeText(getBaseContext(),"服务停止",Toast.LENGTH_SHORT).show();
}
@Override
protected void onServiceConnected() {
--
Gitblit v1.9.1