本文整理汇总了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());
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}
}
示例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;
}
}
示例13: onAccessibilityEvent
@Override
public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
if (accessibilityEvent.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
foregroundPackageName = accessibilityEvent.getPackageName();
foregroundClassName = accessibilityEvent.getClassName();
}
}
示例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());
}
}
}
}
示例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;
}
}