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


Java AccessibilityEvent类代码示例

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


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

示例1: onAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
@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,代码行数:21,代码来源:AutoInstallAccessibilityService.java

示例2: updateAccessibilityVisibility

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
/**
 * Update whether or not the current native tab and/or web contents are
 * currently visible (from an accessibility perspective), or whether
 * they're obscured by another view.
 */
public void updateAccessibilityVisibility() {
    View view = getView();
    if (view != null) {
        int importantForAccessibility = isObscuredByAnotherViewForAccessibility()
                ? View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
                : View.IMPORTANT_FOR_ACCESSIBILITY_YES;
        if (view.getImportantForAccessibility() != importantForAccessibility) {
            view.setImportantForAccessibility(importantForAccessibility);
            view.sendAccessibilityEvent(
                    AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
        }
    }

    ContentViewCore cvc = getContentViewCore();
    if (cvc != null) {
        boolean isWebContentObscured = isObscuredByAnotherViewForAccessibility()
                || isShowingSadTab();
        cvc.setObscuredByAnotherView(isWebContentObscured);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:26,代码来源:Tab.java

示例3: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    boolean populated = false;
    if (event.getEventType() == 8) {
        event.setEventType(4);
    }
    View selectedView = getSelectedView();
    if (selectedView != null) {
        populated = selectedView.dispatchPopulateAccessibilityEvent(event);
    }
    if (!populated) {
        if (selectedView != null) {
            event.setEnabled(selectedView.isEnabled());
        }
        event.setItemCount(getCount());
        event.setCurrentItemIndex(getSelectedItemPosition());
    }
    return populated;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:PLA_AdapterView.java

示例4: setCurrentActivityName

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
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,代码行数:18,代码来源:HongbaoService.java

示例5: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    // Dispatch scroll events from this ViewPager.
    if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED) {
        return super.dispatchPopulateAccessibilityEvent(event);
    }

    // Dispatch all other accessibility events from the current page.
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);
        if (child.getVisibility() == VISIBLE) {
            final YViewPagerNew.ItemInfo ii = infoForChild(child);
            if (ii != null && ii.position == mCurItem
                    && child.dispatchPopulateAccessibilityEvent(event)) {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:youngkaaa,项目名称:YViewPagerDemo,代码行数:23,代码来源:YViewPagerNew.java

示例6: contentChange

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
/**
 * 内容改变
 *
 * @param event
 */

private void contentChange(AccessibilityEvent event) {
    AccessibilityNodeInfo root = getRootInActiveWindow();
    if (root == null) {
        return;
    }
    if (WechatVersionUtils.canFindViewById(context) && WechatVersionUtils.canRobWechatVersion(context)) {

        List<AccessibilityNodeInfo> exitNodeInfos = root.findAccessibilityNodeInfosByViewId(WechatVersionUtils.getWechatExitId(context));

        if (exitNodeInfos != null && exitNodeInfos.size() > 0) {
            // 是聊天界面
            if (isWechatAlway) {
            }
        } else {
            isWechatAlway = false;
        }
    }
}
 
开发者ID:duanyikang,项目名称:QiangYixia,代码行数:25,代码来源:HelpService.java

示例7: autoChat

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
public void autoChat(AccessibilityEvent event, AccessibilityNodeInfo node,WeixinAutoService context,Map<String,String> record){
    int eventType = event.getEventType();
    //1、消息列表获取信息头像
    List<AccessibilityNodeInfo> msgNumImages= node.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/i4");
    if(msgNumImages!=null&&msgNumImages.size()>0){
        AutoUtil.performClick(AutoUtil.fineNodeByIdAndText(context.getRootInActiveWindow(),"com.tencent.mm:id/afv","杰"),record,"杰",1000);
        sendMsg(context.getRootInActiveWindow(),context,record);
        AutoUtil.performClick(AutoUtil.fineNodeByIdAndText(context.getRootInActiveWindow(),"com.tencent.mm:id/afv","LSan"),record,"LSan",1000);
        sendMsg(context.getRootInActiveWindow(),context,record);
        AutoUtil.performClick(AutoUtil.fineNodeByIdAndText(node,"com.tencent.mm:id/afv","华"),record,"华",1000);
        sendMsg(node,context,record);
        AutoUtil.performClick(AutoUtil.fineNodeByIdAndText(node,"com.tencent.mm:id/afv","Aoo"),record,"Aoo",1000);
        sendMsg(node,context,record);
        AutoUtil.performClick(AutoUtil.fineNodeByIdAndText(node,"com.tencent.mm:id/afv","曼婷"),record,"Aoo",1000);
        sendMsg(node,context,record);
        AutoUtil.performClick(AutoUtil.fineNodeByIdAndText(node,"com.tencent.mm:id/afv","苏苏"),record,"Aoo",1000);
        sendMsg(node,context,record);
        AutoUtil.performClick(AutoUtil.fineNodeByIdAndText(node,"com.tencent.mm:id/afv","zh琪"),record,"Aoo",1000);
        sendMsg(node,context,record);
    }
}
 
开发者ID:brute121105,项目名称:weixin_auto,代码行数:22,代码来源:WxAutoChatService.java

示例8: dispatchOnDrawerOpened

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
void dispatchOnDrawerOpened(View drawerView) {
  final LayoutParams lp = (LayoutParams) drawerView.getLayoutParams();
  if (!lp.knownOpen) {
    lp.knownOpen = true;
    if (mListener != null) {
      mListener.onDrawerOpened(drawerView);
    }

    updateChildrenImportantForAccessibility(drawerView, true);

    // Only send WINDOW_STATE_CHANGE if the host has window focus.
    if (hasWindowFocus()) {
      sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
    }

    drawerView.requestFocus();
  }
}
 
开发者ID:rogues-dev,项目名称:superglue,代码行数:19,代码来源:DebugDrawerLayout.java

示例9: performAccessibilityAction

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
@TargetApi(16)
@Override
public boolean performAccessibilityAction(int action, Bundle args) {
  if (super.performAccessibilityAction(action, args)) {
    return true;
  }
  if (duration <= 0) {
    return false;
  }
  if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
    if (scrubIncrementally(-getPositionIncrement())) {
      stopScrubbing(false);
    }
  } else if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) {
    if (scrubIncrementally(getPositionIncrement())) {
      stopScrubbing(false);
    }
  } else {
    return false;
  }
  sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
  return true;
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:24,代码来源:DefaultTimeBar.java

示例10: onInitializeAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(host, event);
    event.setClassName(DirectionalViewpager.class.getName());
    AccessibilityRecordCompat recordCompat = null;
    if (isHorizontal()) {
        recordCompat =
                AccessibilityEventCompat.asRecord(event);
    } else {
        recordCompat = AccessibilityRecordCompat.obtain();
    }
    recordCompat.setScrollable(canScroll());
    if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
            && mAdapter != null) {
        recordCompat.setItemCount(mAdapter.getCount());
        recordCompat.setFromIndex(mCurItem);
        recordCompat.setToIndex(mCurItem);
    }
}
 
开发者ID:zwmlibs,项目名称:BookReader-master,代码行数:20,代码来源:DirectionalViewpager.java

示例11: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    event.setClassName(getClass().getName());
    event.setPackageName(getPackageName());

    LayoutParams params = getWindow().getAttributes();
    boolean isFullScreen = (params.width == LayoutParams.MATCH_PARENT) &&
            (params.height == LayoutParams.MATCH_PARENT);
    event.setFullScreen(isFullScreen);

    CharSequence title = getTitle();
    if (!TextUtils.isEmpty(title)) {
        event.getText().add(title);
    }

    return true;
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:17,代码来源:a.java

示例12: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    // Dispatch scroll events from this ViewPager.
    if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED) {
        return super.dispatchPopulateAccessibilityEvent(event);
    }

    // Dispatch all other accessibility events from the current page.
    final int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = getChildAt(i);
        if (child.getVisibility() == VISIBLE) {
            final ItemInfo ii = infoForChild(child);
            if (ii != null && ii.position == mCurItem &&
                    child.dispatchPopulateAccessibilityEvent(event)) {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:DirectionalViewpager.java

示例13: sendScrollAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
private void sendScrollAccessibilityEvent() {
    AccessibilityManager am =
            (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (am.isEnabled()) {
        if (mCurrentPage != getNextPage()) {
            AccessibilityEvent ev =
                    AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED);
            ev.setScrollable(true);
            ev.setScrollX(getScrollX());
            ev.setScrollY(getScrollY());
            ev.setMaxScrollX(mMaxScrollX);
            ev.setMaxScrollY(0);

            sendAccessibilityEventUnchecked(ev);
        }
    }
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:18,代码来源:PagedView.java

示例14: dispatchPopulateAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    final boolean result = super.dispatchPopulateAccessibilityEvent(event);
    final List<CharSequence> text = event.getText();
    text.clear();
    // Populate event with a fake title based on the current state.
    if (mState == State.APPS) {
        text.add(getString(R.string.all_apps_button_label));
    } else if (mState == State.WIDGETS) {
        text.add(getString(R.string.widget_button_text));
    } else if (mWorkspace != null) {
        text.add(mWorkspace.getCurrentPageDescription());
    } else {
        text.add(getString(R.string.all_apps_home_button_label));
    }
    return result;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:18,代码来源:Launcher.java

示例15: onInitializeAccessibilityEvent

import android.view.accessibility.AccessibilityEvent; //导入依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(event);
    if (getChildCount() > 0) {
        final AccessibilityRecordCompat record = AccessibilityEventCompat
                .asRecord(event);
        final View start = findFirstVisibleItemClosestToStart(false, true);
        final View end = findFirstVisibleItemClosestToEnd(false, true);
        if (start == null || end == null) {
            return;
        }
        final int startPos = getPosition(start);
        final int endPos = getPosition(end);
        if (startPos < endPos) {
            record.setFromIndex(startPos);
            record.setToIndex(endPos);
        } else {
            record.setFromIndex(endPos);
            record.setToIndex(startPos);
        }
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:23,代码来源:StaggeredGridLayoutManager.java


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