當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。