• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AccessibilityActionCompat类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onInitializeAccessibilityNodeInfo

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
    if (DrawerLayout.CAN_HIDE_DESCENDANTS) {
        super.onInitializeAccessibilityNodeInfo(host, info);
    } else {
        AccessibilityNodeInfoCompat superNode = AccessibilityNodeInfoCompat.obtain(info);
        super.onInitializeAccessibilityNodeInfo(host, superNode);
        info.setSource(host);
        ViewParent parent = ViewCompat.getParentForAccessibility(host);
        if (parent instanceof View) {
            info.setParent((View) parent);
        }
        copyNodeInfoNoChildren(info, superNode);
        superNode.recycle();
        addChildrenForAccessibility(info, (ViewGroup) host);
    }
    info.setClassName(DrawerLayout.class.getName());
    info.setFocusable(false);
    info.setFocused(false);
    info.removeAction(AccessibilityActionCompat.ACTION_FOCUS);
    info.removeAction(AccessibilityActionCompat.ACTION_CLEAR_FOCUS);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:22,代码来源:DrawerLayout.java


示例2: supportsAction

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
/**
 * Returns {@code true} if the node supports the specified action. This method supports actions
 * introduced in API level 21 and later. However, it does not support bitmasks.
 *
 */
public static boolean supportsAction(AccessibilityNodeInfoCompat node, int action) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // New actions in >= API 21 won't appear in getActions() but in getActionList().
        // On Lollipop+ devices, pre-API 21 actions will also appear in getActionList().
        List<AccessibilityActionCompat> actions = node.getActionList();
        int size = actions.size();
        for (int i = 0; i < size; ++i) {
            AccessibilityActionCompat actionCompat = actions.get(i);
            if (actionCompat.getId() == action) {
                return true;
            }
        }
        return false;
    } else {
        // On < API 21, actions aren't guaranteed to appear in getActionsList(), so we need to
        // check getActions() instead.
        return (node.getActions() & action) == action;
    }
}
 
开发者ID:google,项目名称:talkback,代码行数:25,代码来源:AccessibilityNodeInfoUtils.java


示例3: performActionWithArgs_actionAndArgsReceivedByNode

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
@Test
public void performActionWithArgs_actionAndArgsReceivedByNode() {
    String argsKey = "test";
    Bundle args = new Bundle();
    args.putBoolean(argsKey, true);
    assertTrue(args.getBoolean(argsKey));
    AccessibilityNodeActionNode accessibilityNodeActionNode = new AccessibilityNodeActionNode(
            mNodeInfoCompat, new AccessibilityActionCompat(ACTION_ID, ACTION_NAME), args);
    accessibilityNodeActionNode.performAction();
    AccessibilityNodeInfo info = (AccessibilityNodeInfo) mNodeInfoCompat.getInfo();
    ShadowAccessibilityNodeInfo shadowInfo =
            (ShadowAccessibilityNodeInfo) ShadowExtractor.extract(info);

    List<Pair<Integer, Bundle>> performedActions = shadowInfo.getPerformedActionsWithArgs();
    assertEquals(1, performedActions.size());
    assertEquals(ACTION_ID, performedActions.get(0).first.intValue());
    assertNotNull(performedActions.get(0).second);
    assertTrue(performedActions.get(0).second.getBoolean(argsKey));
    accessibilityNodeActionNode.recycle();
}
 
开发者ID:google,项目名称:talkback,代码行数:21,代码来源:AccessibilityNodeActionNodeTest.java


示例4: onInitializeAccessibilityNodeInfo

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
    if (CAN_HIDE_DESCENDANTS) {
        super.onInitializeAccessibilityNodeInfo(host, info);
    } else {
        // Obtain a node for the host, then manually generate the list
        // of children to only include non-obscured views.
        final AccessibilityNodeInfoCompat superNode =
                AccessibilityNodeInfoCompat.obtain(info);
        super.onInitializeAccessibilityNodeInfo(host, superNode);

        info.setSource(host);
        final ViewParent parent = ViewCompat.getParentForAccessibility(host);
        if (parent instanceof View) {
            info.setParent((View) parent);
        }
        copyNodeInfoNoChildren(info, superNode);
        superNode.recycle();

        addChildrenForAccessibility(info, (ViewGroup) host);
    }

    info.setClassName(DrawerLayout.class.getName());

    // This view reports itself as focusable so that it can intercept
    // the back button, but we should prevent this view from reporting
    // itself as focusable to accessibility services.
    info.setFocusable(false);
    info.setFocused(false);
    info.removeAction(AccessibilityActionCompat.ACTION_FOCUS);
    info.removeAction(AccessibilityActionCompat.ACTION_CLEAR_FOCUS);
}
 
开发者ID:jecelyin,项目名称:920-text-editor-v2,代码行数:33,代码来源:TranslucentDrawerLayout.java


示例5: onPopulateNodeForVirtualView

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
@Override
protected void onPopulateNodeForVirtualView(
    int virtualViewId, AccessibilityNodeInfoCompat node) {
  if (hasCloseIcon()) {
    node.setContentDescription(
        getContext().getString(R.string.mtrl_chip_close_icon_content_description));
    node.setBoundsInParent(getCloseIconTouchBoundsInt());
    node.addAction(AccessibilityActionCompat.ACTION_CLICK);
    node.setEnabled(isEnabled());
  } else {
    node.setContentDescription("");
  }
}
 
开发者ID:material-components,项目名称:material-components-android,代码行数:14,代码来源:Chip.java


示例6: getCustomActions

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
public static List<AccessibilityActionCompat> getCustomActions(
        AccessibilityNodeInfoCompat node) {
    List<AccessibilityActionCompat> customActions = new ArrayList<>();
    for (AccessibilityActionCompat action : node.getActionList()) {
        if (isCustomAction(action)) {
            // We don't use custom actions that doesn't have a label
            if (!TextUtils.isEmpty(action.getLabel())) {
                customActions.add(action);
            }
        }
    }

    return customActions;
}
 
开发者ID:google,项目名称:talkback,代码行数:15,代码来源:AccessibilityNodeInfoUtils.java


示例7: recursivelyPopulateMenuItemsForNode

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
/**
 * Populates a menu with the context menu items for a node, searching up its ancestor
 * hierarchy if the current node has no custom actions.
 */
private void recursivelyPopulateMenuItemsForNode(TalkBackService service,
                 ContextMenuItemBuilder menuItemBuilder, AccessibilityNodeInfoCompat node,
                 List<ContextMenuItem> menu) {
    if (node == null) {
        return;
    }

    for (AccessibilityActionCompat action : AccessibilityNodeInfoUtils.getCustomActions(node)) {
        CharSequence label = action.getLabel();
        int id = action.getId();
        if (TextUtils.isEmpty(label)) {
            continue;
        }

        ContextMenuItem item = menuItemBuilder.createMenuItem(service, Menu.NONE, id, Menu.NONE,
                label);
        item.setOnMenuItemClickListener(new CustomMenuItem(id,
                AccessibilityNodeInfoCompat.obtain(node)));
        item.setCheckable(false);
        menu.add(item);
    }

    if (menu.isEmpty()) {
      recursivelyPopulateMenuItemsForNode(service, menuItemBuilder, node.getParent(), menu);
    }
}
 
开发者ID:google,项目名称:talkback,代码行数:31,代码来源:RuleCustomAction.java


示例8: setUp

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
@Before
public void setUp() {
    ShadowAccessibilityNodeInfo.resetObtainedInstances();
    mNodeInfoCompat = new SwitchAccessNodeCompat(AccessibilityNodeInfo.obtain());
    ShadowAccessibilityNodeInfo shadowInfo =
            (ShadowAccessibilityNodeInfo) ShadowExtractor.extract(mNodeInfoCompat.getInfo());
    shadowInfo.setBoundsInScreen(NODE_BOUNDS);
    mAccessibilityNodeActionNode = new AccessibilityNodeActionNode(
            mNodeInfoCompat, new AccessibilityActionCompat(ACTION_ID, ACTION_NAME));
}
 
开发者ID:google,项目名称:talkback,代码行数:11,代码来源:AccessibilityNodeActionNodeTest.java


示例9: getActionLabel_withDisambiguationNumber_shouldReturnChangedName

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
@Test
public void getActionLabel_withDisambiguationNumber_shouldReturnChangedName() {
    AccessibilityNodeActionNode accessibilityNodeActionNode = new AccessibilityNodeActionNode(
            mNodeInfoCompat, new AccessibilityActionCompat(ACTION_ID, ACTION_NAME));
    accessibilityNodeActionNode.setNumberToAppendToDuplicateAction(5);
    CharSequence actionLabel = accessibilityNodeActionNode.getActionLabel(mContext);
    assertFalse(TextUtils.equals(ACTION_NAME, actionLabel));
    assertTrue(TextUtils.indexOf(actionLabel, ACTION_NAME) != -1);
    accessibilityNodeActionNode.recycle();
}
 
开发者ID:google,项目名称:talkback,代码行数:11,代码来源:AccessibilityNodeActionNodeTest.java


示例10: onPopulateNodeForVirtualView

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
@Override
protected void onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfoCompat node) {
    final boolean hasBounds = getBoundsForDay(virtualViewId, mTempRect);

    if (!hasBounds) {
        // The day is invalid, kill the node.
        mTempRect.setEmpty();
        node.setContentDescription("");
        node.setBoundsInParent(mTempRect);
        node.setVisibleToUser(false);
        return;
    }

    node.setText(getDayText(virtualViewId));
    node.setContentDescription(getDayDescription(virtualViewId));
    node.setBoundsInParent(mTempRect);

    final boolean isDayEnabled = isDayEnabled(virtualViewId);
    if (isDayEnabled) {
        node.addAction(AccessibilityActionCompat.ACTION_CLICK);
    }

    node.setEnabled(isDayEnabled);

    if (virtualViewId == mActivatedDay) {
        // TODO: This should use activated once that's supported.
        node.setChecked(true);
    }

}
 
开发者ID:TR4Android,项目名称:AppCompat-Extension-Library,代码行数:31,代码来源:SimpleMonthView.java


示例11: onInitializeAccessibilityNodeInfo

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
public final void onInitializeAccessibilityNodeInfo(View paramView, AccessibilityNodeInfoCompat paramAccessibilityNodeInfoCompat)
{
  if (DrawerLayout.CAN_HIDE_DESCENDANTS) {
    super.onInitializeAccessibilityNodeInfo(paramView, paramAccessibilityNodeInfoCompat);
  }
  for (;;)
  {
    paramAccessibilityNodeInfoCompat.setClassName(DrawerLayout.class.getName());
    paramAccessibilityNodeInfoCompat.setFocusable(false);
    paramAccessibilityNodeInfoCompat.setFocused(false);
    paramAccessibilityNodeInfoCompat.removeAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_FOCUS);
    paramAccessibilityNodeInfoCompat.removeAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_CLEAR_FOCUS);
    return;
    AccessibilityNodeInfoCompat localAccessibilityNodeInfoCompat = AccessibilityNodeInfoCompat.obtain(paramAccessibilityNodeInfoCompat);
    super.onInitializeAccessibilityNodeInfo(paramView, localAccessibilityNodeInfoCompat);
    AccessibilityNodeInfoCompat.IMPL.setSource(paramAccessibilityNodeInfoCompat.mInfo, paramView);
    ViewParent localViewParent = ViewCompat.getParentForAccessibility(paramView);
    if ((localViewParent instanceof View)) {
      paramAccessibilityNodeInfoCompat.setParent((View)localViewParent);
    }
    Rect localRect = this.mTmpRect;
    localAccessibilityNodeInfoCompat.getBoundsInParent(localRect);
    AccessibilityNodeInfoCompat.IMPL.setBoundsInParent(paramAccessibilityNodeInfoCompat.mInfo, localRect);
    localAccessibilityNodeInfoCompat.getBoundsInScreen(localRect);
    AccessibilityNodeInfoCompat.IMPL.setBoundsInScreen(paramAccessibilityNodeInfoCompat.mInfo, localRect);
    boolean bool1 = AccessibilityNodeInfoCompat.IMPL.isVisibleToUser(localAccessibilityNodeInfoCompat.mInfo);
    AccessibilityNodeInfoCompat.IMPL.setVisibleToUser(paramAccessibilityNodeInfoCompat.mInfo, bool1);
    CharSequence localCharSequence1 = localAccessibilityNodeInfoCompat.getPackageName();
    AccessibilityNodeInfoCompat.IMPL.setPackageName(paramAccessibilityNodeInfoCompat.mInfo, localCharSequence1);
    paramAccessibilityNodeInfoCompat.setClassName(localAccessibilityNodeInfoCompat.getClassName());
    CharSequence localCharSequence2 = localAccessibilityNodeInfoCompat.getContentDescription();
    AccessibilityNodeInfoCompat.IMPL.setContentDescription(paramAccessibilityNodeInfoCompat.mInfo, localCharSequence2);
    boolean bool2 = localAccessibilityNodeInfoCompat.isEnabled();
    AccessibilityNodeInfoCompat.IMPL.setEnabled(paramAccessibilityNodeInfoCompat.mInfo, bool2);
    boolean bool3 = localAccessibilityNodeInfoCompat.isClickable();
    AccessibilityNodeInfoCompat.IMPL.setClickable(paramAccessibilityNodeInfoCompat.mInfo, bool3);
    paramAccessibilityNodeInfoCompat.setFocusable(localAccessibilityNodeInfoCompat.isFocusable());
    paramAccessibilityNodeInfoCompat.setFocused(localAccessibilityNodeInfoCompat.isFocused());
    boolean bool4 = AccessibilityNodeInfoCompat.IMPL.isAccessibilityFocused(localAccessibilityNodeInfoCompat.mInfo);
    AccessibilityNodeInfoCompat.IMPL.setAccessibilityFocused(paramAccessibilityNodeInfoCompat.mInfo, bool4);
    boolean bool5 = localAccessibilityNodeInfoCompat.isSelected();
    AccessibilityNodeInfoCompat.IMPL.setSelected(paramAccessibilityNodeInfoCompat.mInfo, bool5);
    boolean bool6 = localAccessibilityNodeInfoCompat.isLongClickable();
    AccessibilityNodeInfoCompat.IMPL.setLongClickable(paramAccessibilityNodeInfoCompat.mInfo, bool6);
    paramAccessibilityNodeInfoCompat.addAction(localAccessibilityNodeInfoCompat.getActions());
    AccessibilityNodeInfoCompat.IMPL.recycle(localAccessibilityNodeInfoCompat.mInfo);
    ViewGroup localViewGroup = (ViewGroup)paramView;
    int i = localViewGroup.getChildCount();
    for (int j = 0; j < i; j++)
    {
      View localView = localViewGroup.getChildAt(j);
      if (DrawerLayout.access$400(localView)) {
        AccessibilityNodeInfoCompat.IMPL.addChild(paramAccessibilityNodeInfoCompat.mInfo, localView);
      }
    }
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:58,代码来源:DrawerLayout.java


示例12: isCustomAction

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
public static boolean isCustomAction(AccessibilityActionCompat action) {
    return action.getId() > SYSTEM_ACTION_MAX;
}
 
开发者ID:google,项目名称:talkback,代码行数:4,代码来源:AccessibilityNodeInfoUtils.java


示例13: accept

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
@Override
public boolean accept(TalkBackService service, AccessibilityNodeInfoCompat node) {
    List<AccessibilityActionCompat> actions = node.getActionList();
    return actions != null && !actions.isEmpty();
}
 
开发者ID:google,项目名称:talkback,代码行数:6,代码来源:RuleCustomAction.java


示例14: ClickActionDelegate

import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat; //导入依赖的package包/类
public ClickActionDelegate(Context context, int resId) {
    mClickAction = new AccessibilityActionCompat(
            AccessibilityNodeInfoCompat.ACTION_CLICK, context.getString(resId));
}
 
开发者ID:TR4Android,项目名称:AppCompat-Extension-Library,代码行数:5,代码来源:AppCompatTimePickerDelegate.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EditingModalGraphMouse类代码示例发布时间:2022-05-23
下一篇:
Java NullDebugCounter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap