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


Java AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED属性代码示例

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


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

示例1: onAccessibilityEvent

@Override
public void onAccessibilityEvent(final AccessibilityEvent event) {
    Log.v(TAG, "onAccessibilityEvent: " + event);
    if (!containsAllEventTypes && !eventTypes.contains(event.getEventType()))
        return;
    int type = event.getEventType();
    if (type == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED ||
            type == AccessibilityEvent.TYPE_VIEW_FOCUSED) {
        AccessibilityNodeInfo root = super.getRootInActiveWindow();
        if (root != null) {
            mFastRootInActiveWindow = root;
        }
    }

    for (Map.Entry<Integer, AccessibilityDelegate> entry : mDelegates.entrySet()) {
        AccessibilityDelegate delegate = entry.getValue();
        Set<Integer> types = delegate.getEventTypes();
        if (types != null && !delegate.getEventTypes().contains(event.getEventType()))
            continue;
        //long start = System.currentTimeMillis();
        if (delegate.onAccessibilityEvent(AccessibilityService.this, event))
            break;
        //Log.v(TAG, "millis: " + (System.currentTimeMillis() - start) + " delegate: " + entry.getValue().getClass().getName());
    }
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:25,代码来源:AccessibilityService.java

示例2: onAccessibilityEvent

@Override
public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
    if (null == accessibilityEvent) {
        return;
    }
    switch (accessibilityEvent.getEventType()) {
        case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: {
            Log.i("AnalystService.onAccessibilityEvent # AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED");
            mLastEventClassName = StringUtil.toNb(accessibilityEvent.getClassName());
            postEvent();
        }
        break;
        case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED: {
            Log.i("AnalystService.onAccessibilityEvent # AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED");
            if (null != mLastEventClassName) {
                postEvent();
            }
        }
        break;
    }
}
 
开发者ID:littleRich,项目名称:AutoInteraction-Library,代码行数:21,代码来源:AnalystService.java

示例3: setCurrentActivityName

private void setCurrentActivityName(AccessibilityEvent event) {
    if (event.getEventType() != AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
        return;
    }

    try {
        ComponentName componentName = new ComponentName(
                event.getPackageName().toString(),
                event.getClassName().toString()
        );

        getPackageManager().getActivityInfo(componentName, 0);
        currentActivityName = componentName.flattenToShortString();
    } catch (PackageManager.NameNotFoundException e) {
        currentActivityName = WECHAT_LUCKMONEY_GENERAL_ACTIVITY;
    }
}
 
开发者ID:KoreHuang,项目名称:WeChatLuckyMoney,代码行数:17,代码来源:HongbaoService.java

示例4: onAccessibilityEvent

@TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public void onAccessibilityEvent(final AccessibilityEvent event) {
    Log.d(TAG,"onAccessibilityEvent "+event.getSource()+event.toString());
    if(bRun==false){
        handler.sendEmptyMessage(1);
        bRun=true;
    }
    if(null == event || null == event.getSource()) { return; }
    if(event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED &&
            event.getPackageName().equals(PACKAGE)){
        final CharSequence className = event.getClassName();
        Log.d(TAG,"onAccessibilityEvent "+className);
        if(className.equals(NAME_APP_DETAILS)){
            simulationClick(event, TEXT_FORCE_STOP);
            performGlobalAction(GLOBAL_ACTION_BACK);
            isAppDetail = true;
        }
        if(isAppDetail && className.equals(NAME_ALERT_DIALOG)){
            simulationClick(event, TEXT_DETERMINE);
            performGlobalAction(GLOBAL_ACTION_BACK);
            isAppDetail = false;
        }
    }
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:23,代码来源:HelpService.java

示例5: dispatchPopulateAccessibilityEvent

@Override
public boolean dispatchPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
  // Special case to handle window state change events. As far as
  // accessibility services are concerned, state changes from
  // DrawerLayout invalidate the entire contents of the screen (like
  // an Activity or Dialog) and they should announce the title of the
  // new content.
  if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
    final List<CharSequence> eventText = event.getText();
    final View visibleDrawer = findVisibleDrawer();
    if (visibleDrawer != null) {
      final int edgeGravity = getDrawerViewAbsoluteGravity(visibleDrawer);
      final CharSequence title = getDrawerTitle(edgeGravity);
      if (title != null) {
        eventText.add(title);
      }
    }

    return true;
  }

  return super.dispatchPopulateAccessibilityEvent(host, event);
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:23,代码来源:DebugDrawerLayout.java

示例6: onCreate

@Override
public void onCreate() {
    super.onCreate();
    tipViewController=TipViewController.getInstance();
    mAccessibilityServiceInfo=new AccessibilityServiceInfo();
    mAccessibilityServiceInfo.feedbackType=FEEDBACK_GENERIC;
    mAccessibilityServiceInfo.eventTypes=AccessibilityEvent.TYPE_VIEW_CLICKED|AccessibilityEvent.TYPE_VIEW_LONG_CLICKED|AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
    int flag=0;
    if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){
        flag=flag|AccessibilityServiceInfo.FLAG_RETRIEVE_INTERACTIVE_WINDOWS;
    }
    if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.JELLY_BEAN_MR2){
        flag=flag|AccessibilityServiceInfo.FLAG_REQUEST_FILTER_KEY_EVENTS;
    }
    mAccessibilityServiceInfo.flags=flag;
    mAccessibilityServiceInfo.notificationTimeout=100;
    setServiceInfo(mAccessibilityServiceInfo);
}
 
开发者ID:l465659833,项目名称:RecentTask,代码行数:18,代码来源:AccessibilityMonitorService.java

示例7: 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

示例8: dispatchPopulateAccessibilityEvent

/**
 * Announce the currently-selected date when launched.
 */
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
        // Clear the event's current text so that only the current date will be spoken.
        event.getText().clear();
        int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR |
                DateUtils.FORMAT_SHOW_WEEKDAY;

        String dateString = DateUtils.formatDateTime(getContext(), mDateMillis, flags);
        event.getText().add(dateString);
        return true;
    }
    return super.dispatchPopulateAccessibilityEvent(event);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:AccessibleDateAnimator.java

示例9: onAccessibilityEvent

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    int eventType = event.getEventType();
    switch (eventType) {
        case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
            AccessibilityNodeInfo rootNode = getRootInActiveWindow();

            break;
        default:
            break;
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:13,代码来源:QQAccessibilityService.java

示例10: onAccessibilityEvent

@Override
public boolean onAccessibilityEvent(AccessibilityService service, AccessibilityEvent event) {
    if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
        setLatestComponent(event.getPackageName(), event.getClassName());
    }
    return false;
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:7,代码来源:AccessibilityInfoProvider.java

示例11: 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

示例12: 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

示例13: onAccessibilityEvent

@Override
public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
    if (accessibilityEvent.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
        foregroundPackageName = accessibilityEvent.getPackageName();
        foregroundClassName = accessibilityEvent.getClassName();
    }
}
 
开发者ID:Omico,项目名称:CurrentActivity,代码行数:7,代码来源:CurrentActivityAccessibilityService.java

示例14: onAccessibilityEvent

@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    if (!closeAdvancedFunction && mSp.getBoolean(Config.KEYBLOCK_ACTIVITY, false) && !RootScanActivity && !AdvancedScanActivity) {
        int eventType = event.getEventType();
        if (eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
            if (event.getClassName() != null) {
                CurrentActivityFix(event.getPackageName().toString(), event.getClassName().toString());
            }
        }
    }
}
 
开发者ID:XFY9326,项目名称:KeyBlocker,代码行数:11,代码来源:KeyBlockService.java

示例15: 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


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