当前位置: 首页>>代码示例>>Java>>正文


Java AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED属性代码示例

本文整理汇总了Java中android.view.accessibility.AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED属性的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED属性的具体用法?Java AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED怎么用?Java AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.view.accessibility.AccessibilityEvent的用法示例。


在下文中一共展示了AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onAccessibilityEvent

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    int eventType = event.getEventType();
    switch (eventType) {
        case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:
        case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
        case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
            for (String id : installBtnId) {
                AccessibilityNodeInfo node = AccessibilityNodeUtil.findNodeById(event.getSource(), id);
                if (node != null) {
                    AccessibilityNodeUtil.click(node);
                    Toast.makeText(this, "安装成功", Toast.LENGTH_SHORT).show();
                    break;
                }
            }
            break;
        default:
            break;
    }
}
 
开发者ID:pengwei1024,项目名称:adb-install-robot,代码行数:20,代码来源:AutoInstallAccessibilityService.java

示例2: watchNotifications

private boolean watchNotifications(AccessibilityEvent event) {
    // Not a notification
    if (event.getEventType() != AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
        return false;

    // Not a hongbao
    String tip = event.getText().toString();
    if (!tip.contains(WECHAT_NOTIFICATION_TIP)) return true;

    Parcelable parcelable = event.getParcelableData();
    if (parcelable instanceof Notification) {
        Notification notification = (Notification) parcelable;
        try {
            /* 清除signature,避免进入会话后误判 */
            signature.cleanSignature();

            notification.contentIntent.send();
        } catch (PendingIntent.CanceledException e) {
            e.printStackTrace();
        }
    }
    return true;
}
 
开发者ID:KoreHuang,项目名称:WeChatLuckyMoney,代码行数:23,代码来源:HongbaoService.java

示例3: onAccessibilityEvent

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
	if (event.getEventType()==AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) {
		List<CharSequence> texts = event.getText();
		if (!texts.isEmpty()) {
			for (CharSequence text : texts) {
				String content = text.toString();
				if (content.contains(TIXING)|content.contains(QITA)) {
					openNotify(event);
					return;
				}
			}
		}
	}
	openHongBao(event);
}
 
开发者ID:qq1198,项目名称:mtoolbox,代码行数:16,代码来源:HongBaoService.java

示例4: monitorNotifications

/**
 * notification监控
 */
private void monitorNotifications(AccessibilityEvent event) {
    if (event.getEventType() != AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) return;
    if (event.getText() == null ||
            (event.getText().toString() != null && !event.getText().toString().contains(SelfConst.WX_RED_NOTIFICATION_TEXT)))
        return;
    //模拟点击Notification
    if (event.getParcelableData() != null && event.getParcelableData() instanceof Notification) {
        Notification notification = (Notification) event.getParcelableData();
        try {
            notification.contentIntent.send();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:WanAndroid,项目名称:GetRedPackets,代码行数:18,代码来源:WXRedPluginService.java

示例5: eventToString

private String eventToString(AccessibilityEvent event) {
    StringBuilder builder = new StringBuilder();
    String eventType = "";
    switch (event.getEventType()){
        case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED: // 通知栏状态变化
            eventType = "TYPE_NOTIFICATION_STATE_CHANGED";
            break;
        case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: // 窗口状态变化
            eventType = "TYPE_WINDOW_STATE_CHANGED";
            break;
        case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:  // 窗口内容变化
            eventType = "TYPE_WINDOW_CONTENT_CHANGED";
            break;
    }
    builder.append("EventType: ").append(eventType);
    builder.append("; ClassName: ").append(event.getClassName());
    builder.append("; Text: ").append(event.getText());
    builder.append("; ContentDescription: ").append(event.getContentDescription());
    builder.append("; ItemCount: ").append(event.getItemCount());
    builder.append("; ParcelableData: ").append(event.getParcelableData());
    return builder.toString();
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:22,代码来源:QHBService.java

示例6: onAccessibilityEvent

@Override
    public void onAccessibilityEvent(AccessibilityEvent event) {
        super.onAccessibilityEvent(event);
        AccessibilityNodeInfo rootInActiveWindow = getRootInActiveWindow();
        if (rootInActiveWindow == null) {
            L.d("openContactInfo nodeInfo is null");
            return;
        }

        L.d("得到当前包名 "+rootInActiveWindow.getPackageName() + " 类名 " + rootInActiveWindow.getClass());

        if (rootInActiveWindow.getPackageName() != null &&
                !(rootInActiveWindow.getPackageName() + "").equals("com.tencent.mm")) {
            L.e("不是 微信 返回");
            return;
        }

        if (mIsNeedCloseWeChat) {
            if (rootInActiveWindow.getPackageName() != null &&
                    (rootInActiveWindow.getPackageName() + "").equals(AccessUtil.WECHAT_PACKAGE_NAME)) {

                if (AccessUtil.isWeChatMain(rootInActiveWindow)) {
                    mIsNeedCloseWeChat = false;
                    L.d("ismain");

                    mActivity.startActivity(mIntent);
                } else {
                    AccessUtil.performBack(this, rootInActiveWindow);
                }
                return;
            } else {
//                mIsNeedCloseWeChat = false;

//                if (mIntent != null && mActivity != null) {
//                    mActivity.startActivity(mIntent);
//                }
            }
        }

        int eventType = event.getEventType();
        switch (eventType) {
            //第一步:监听通知栏消息
            case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
                WeChatMsg.sendNotify(event);
                break;
            //第二步:监听是否进入微信聊天界面
            case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:
//                WeChatNearly.nearly(this, getRootInActiveWindow(), this, "你好");
                L.d("type " + type);
                switch (type) {
                    case Mode.autoHello://自动打招呼
                        mWeChatNearly.change(this, rootInActiveWindow, this, "你好");
                        break;
                    case Mode.group://群发
                        mWeChatGroup.change(this, rootInActiveWindow, this, "你好");
                        break;
                    case Mode.autoChat://自动聊天
                        mWeChatAutoReply.change(this, rootInActiveWindow, this, "你好");
                        break;
                    case Mode.closeService://无法实现
                        AccessUtil.openNext(rootInActiveWindow, "测试");
                        break;
                }
                break;
            default:
                break;
        }
    }
 
开发者ID:kaixuanluo,项目名称:pc-android-controller-android,代码行数:68,代码来源:WeChatAccessService.java

示例7: onAccessibilityEvent

@Override
public void onAccessibilityEvent(AccessibilityEvent event)
{
	final int eventType = event.getEventType(); // ClassName:
	// com.tencent.mm.ui.LauncherUI

	// 通知栏事件
	if (eventType == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
	{
		List<CharSequence> texts = event.getText();
		if (!texts.isEmpty())
		{
			for (CharSequence t : texts)
			{
				String text = String.valueOf(t);
				if (text.contains(WX_HONGBAO_TEXT_KEY) || text.contains(QQ_HONGBAO_TEXT_KEY))
				{
					openNotify(event);
					break;
				}
			}
		}
	} else if (eventType == AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE)
	{
		// 从微信主界面进入聊天界面
		openHongBao(event);
	} else if (eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)
	{
		// 处理微信聊天界面
		openHongBao(event);
	}
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:32,代码来源:MD5_jni.java

示例8: onAccessibilityEvent

@Override
   public void onAccessibilityEvent(AccessibilityEvent event)
   {
SharedPreferences sharedPreferences = getSharedPreferences("nico.styTool_preferences", MODE_PRIVATE); 
boolean isFirstRun = sharedPreferences.getBoolean("ok_c", true); 
//Editor editor = sharedPreferences.edit(); 
if (isFirstRun) 
{ 
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
    builder.setSmallIcon(R.mipmap.ic_launcher);
    builder.setContentTitle("妮媌");
    builder.setContentText("QQ抢红包正在运行");
    builder.setOngoing(true);
    Notification notification = builder.build();
    NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    manager.notify(NOTIFICATION_ID, notification);
}
else 
{ 

}

if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
{
    List<CharSequence> texts = event.getText();
    if (!texts.isEmpty())
    {
	for (CharSequence text : texts)
	{
	    String content = text.toString();
	    if (content.contains(QQ_KEYWORD_NOTIFICATION))
	    {
		openNotify(event);
		return;
	    }
	}
    }
}
openHongBao(event);
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:40,代码来源:dex_smali.java

示例9: onReceive

@Override
public void onReceive(AccessibilityEvent event) {
    switch (event.getEventType()) {
        case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED: // 通知栏状态变化
            notificationEvent(event);
            break;
        case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: // 窗口状态变化
            windowStateEvent(event);
            break;
        case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:  // 窗口内容变化
            windowContentEvent(event);
            break;
    }
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:14,代码来源:WeChatAccessibilityJob.java

示例10: onAccessibilityEvent

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    int eventType = event.getEventType();
    CharSequence packageName = event.getPackageName();
    switch (eventType) {
        case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
            AccessibilityNodeInfo rootNode = getRootInActiveWindow();
            if (rootNode != null) {

                if (packageName.equals("com.android.settings")) {
                    AccessibilityNodeInfo settingNode = AceHelper.findNodeByText(rootNode,"WLAN");
                    AceHelper.performClick(settingNode);
                    rootNode.recycle();
                } else if (packageName.equals("com.android.wifisettings")) {
                    AccessibilityNodeInfo wifiNode = AceHelper.findNodeByText(rootNode, "TP-LINK_F770");
                    AccessibilityNodeInfo wifiNodeParent = wifiNode.getParent();
                    AccessibilityNodeInfo iconNode = AceHelper.findNodeById(wifiNodeParent, "com.android.wifisettings:id/advance_layout");
                    AceHelper.performClick(iconNode);
                }
            }
            break;
        case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
            Toast.makeText(this, "Notify", Toast.LENGTH_SHORT).show();
            event.getSource().recycle();
            break;
        case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:
            break;
        default:
            break;
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:32,代码来源:WifiProxyAccessibilityService.java

示例11: setDynamicContent

/**
     * Set the content this service should be receiving
     */
    private void setDynamicContent() {
        if (DEBUG) {
            MyLog.i(CLS_NAME, "setDynamicContent: interceptGoogle: " + initInterceptGoogle);
            MyLog.i(CLS_NAME, "setDynamicContent: announceNotifications: " + initAnnounceNotifications);
        }

        if (!initInterceptGoogle && !initAnnounceNotifications) {
            if (DEBUG) {
                MyLog.i(CLS_NAME, "setDynamicContent: none required: finishing");
            }

//            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
//                this.disableSelf();
//            }
//
//            this.stopSelf();

        } else {
            if (DEBUG) {
                MyLog.i(CLS_NAME, "setDynamicContent: updating content");
            }

            final AccessibilityServiceInfo serviceInfo = new AccessibilityServiceInfo();

            serviceInfo.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN;
            serviceInfo.flags = AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;
            serviceInfo.notificationTimeout = UPDATE_TIMEOUT;

            if (initInterceptGoogle && initAnnounceNotifications) {
                serviceInfo.eventTypes = AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
                        | AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED
                        | AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
            } else if (initInterceptGoogle) {
                serviceInfo.packageNames = new String[]{Installed.PACKAGE_NAME_GOOGLE_NOW};
                serviceInfo.eventTypes = AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED
                        | AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED;
            } else {
                serviceInfo.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
            }

            this.setServiceInfo(serviceInfo);
        }
    }
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:46,代码来源:SaiyAccessibilityService.java


注:本文中的android.view.accessibility.AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。