本文整理汇总了Java中android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction类的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityAction类的具体用法?Java AccessibilityAction怎么用?Java AccessibilityAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccessibilityAction类属于android.view.accessibility.AccessibilityNodeInfo包,在下文中一共展示了AccessibilityAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInitializeAccessibilityNodeInfo
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
@TargetApi(21)
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName(DefaultTimeBar.class.getCanonicalName());
info.setContentDescription(getProgressText());
if (duration <= 0) {
return;
}
if (Util.SDK_INT >= 21) {
info.addAction(AccessibilityAction.ACTION_SCROLL_FORWARD);
info.addAction(AccessibilityAction.ACTION_SCROLL_BACKWARD);
} else if (Util.SDK_INT >= 16) {
info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
}
}
示例2: LauncherAccessibilityDelegate
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
public LauncherAccessibilityDelegate(Launcher launcher) {
mLauncher = launcher;
mActions.put(REMOVE, new AccessibilityAction(REMOVE,
launcher.getText(R.string.remove_drop_target_label)));
mActions.put(INFO, new AccessibilityAction(INFO,
launcher.getText(R.string.app_info_drop_target_label)));
mActions.put(UNINSTALL, new AccessibilityAction(UNINSTALL,
launcher.getText(R.string.uninstall_drop_target_label)));
mActions.put(ADD_TO_WORKSPACE, new AccessibilityAction(ADD_TO_WORKSPACE,
launcher.getText(R.string.action_add_to_workspace)));
mActions.put(MOVE, new AccessibilityAction(MOVE,
launcher.getText(R.string.action_move)));
mActions.put(MOVE_TO_WORKSPACE, new AccessibilityAction(MOVE_TO_WORKSPACE,
launcher.getText(R.string.action_move_to_workspace)));
mActions.put(RESIZE, new AccessibilityAction(RESIZE,
launcher.getText(R.string.action_resize)));
mActions.put(DEEP_SHORTCUTS, new AccessibilityAction(DEEP_SHORTCUTS,
launcher.getText(R.string.action_deep_shortcut)));
}
示例3: LauncherAccessibilityDelegate
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
public LauncherAccessibilityDelegate(Launcher launcher) {
mLauncher = launcher;
mActions.put(REMOVE, new AccessibilityAction(REMOVE,
launcher.getText(R.string.delete_target_label)));
mActions.put(INFO, new AccessibilityAction(INFO,
launcher.getText(R.string.info_target_label)));
mActions.put(UNINSTALL, new AccessibilityAction(UNINSTALL,
launcher.getText(R.string.delete_target_uninstall_label)));
mActions.put(ADD_TO_WORKSPACE, new AccessibilityAction(ADD_TO_WORKSPACE,
launcher.getText(R.string.action_add_to_workspace)));
mActions.put(MOVE, new AccessibilityAction(MOVE,
launcher.getText(R.string.action_move)));
mActions.put(MOVE_TO_WORKSPACE, new AccessibilityAction(MOVE_TO_WORKSPACE,
launcher.getText(R.string.action_move_to_workspace)));
mActions.put(RESIZE, new AccessibilityAction(RESIZE,
launcher.getText(R.string.action_resize)));
}
示例4: convertSearchDirectionToScrollAction
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
/**
* Returns the scroll action for the given {@link TraversalStrategy.SearchDirection} if the
* scroll action is available on the current SDK version. Otherwise, returns 0.
*/
public static int convertSearchDirectionToScrollAction(
@TraversalStrategy.SearchDirection int direction) {
boolean supportsDirectional = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
if (direction == TraversalStrategy.SEARCH_FOCUS_FORWARD) {
return AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD;
} else if (direction == TraversalStrategy.SEARCH_FOCUS_BACKWARD) {
return AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD;
} else if (supportsDirectional) {
if (direction == TraversalStrategy.SEARCH_FOCUS_LEFT) {
return AccessibilityAction.ACTION_SCROLL_LEFT.getId();
} else if (direction == TraversalStrategy.SEARCH_FOCUS_RIGHT) {
return AccessibilityAction.ACTION_SCROLL_RIGHT.getId();
} else if (direction == TraversalStrategy.SEARCH_FOCUS_UP) {
return AccessibilityAction.ACTION_SCROLL_UP.getId();
} else if (direction == TraversalStrategy.SEARCH_FOCUS_DOWN) {
return AccessibilityAction.ACTION_SCROLL_DOWN.getId();
}
}
return 0;
}
示例5: convertScrollActionToSearchDirection
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
/**
* Returns the {@link TraversalStrategy.SearchDirectionOrUnknown} for the given scroll
* action; {@link TraversalStrategy#SEARCH_FOCUS_UNKNOWN} is returned for a scroll action
* that can't be handled (e.g. because the current API level doesn't support it).
*/
public static @TraversalStrategy.SearchDirectionOrUnknown int
convertScrollActionToSearchDirection(int scrollAction) {
boolean supportsDirectional = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M;
if (scrollAction == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) {
return TraversalStrategy.SEARCH_FOCUS_FORWARD;
} else if (scrollAction == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
return TraversalStrategy.SEARCH_FOCUS_BACKWARD;
} else if (supportsDirectional) {
if (scrollAction == AccessibilityAction.ACTION_SCROLL_LEFT.getId()) {
return TraversalStrategy.SEARCH_FOCUS_LEFT;
} else if (scrollAction == AccessibilityAction.ACTION_SCROLL_RIGHT.getId()) {
return TraversalStrategy.SEARCH_FOCUS_RIGHT;
} else if (scrollAction == AccessibilityAction.ACTION_SCROLL_UP.getId()) {
return TraversalStrategy.SEARCH_FOCUS_UP;
} else if (scrollAction == AccessibilityAction.ACTION_SCROLL_DOWN.getId()) {
return TraversalStrategy.SEARCH_FOCUS_DOWN;
}
}
return TraversalStrategy.SEARCH_FOCUS_UNKNOWN;
}
示例6: equals
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
@Override
@Implementation
public boolean equals(Object other) {
if (other == null) {
return false;
}
if (other == this) {
return true;
}
if (other.getClass() != AccessibilityAction.class) {
return false;
}
return id == ((AccessibilityAction) other).getId();
}
示例7: OverviewScreenAccessibilityDelegate
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
public OverviewScreenAccessibilityDelegate(Workspace workspace) {
mWorkspace = workspace;
Context context = mWorkspace.getContext();
boolean isRtl = Utilities.isRtl(context.getResources());
mActions.put(MOVE_BACKWARD, new AccessibilityAction(MOVE_BACKWARD,
context.getText(isRtl ? R.string.action_move_screen_right :
R.string.action_move_screen_left)));
mActions.put(MOVE_FORWARD, new AccessibilityAction(MOVE_FORWARD,
context.getText(isRtl ? R.string.action_move_screen_left :
R.string.action_move_screen_right)));
}
示例8: onInitializeAccessibilityNodeInfo
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
Context context = host.getContext();
info.addAction(new AccessibilityAction(OVERVIEW, context.getText(OVERVIEW)));
if (Utilities.isWallpaperAllowed(context)) {
info.addAction(new AccessibilityAction(WALLPAPERS, context.getText(WALLPAPERS)));
}
info.addAction(new AccessibilityAction(WIDGETS, context.getText(WIDGETS)));
info.addAction(new AccessibilityAction(SETTINGS, context.getText(SETTINGS)));
}
示例9: getActionList
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
private List<AccessibilityAction> getActionList() {
if (mIcon == null || !(mIcon.getTag() instanceof ItemInfo)) {
return Collections.EMPTY_LIST;
}
AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain();
mDelegate.addSupportedActions(mIcon, info, true);
List<AccessibilityAction> result = new ArrayList<>(info.getActionList());
info.recycle();
return result;
}
示例10: show
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
public boolean show() {
List<AccessibilityAction> actions = getActionList();
if (actions.isEmpty()) {
return false;
}
PopupMenu popup = new PopupMenu(mLauncher, mIcon);
popup.setOnMenuItemClickListener(this);
Menu menu = popup.getMenu();
for (AccessibilityAction action : actions) {
menu.add(Menu.NONE, action.getId(), Menu.NONE, action.getLabel());
}
popup.show();
return true;
}
示例11: onInitializeAccessibilityNodeInfo
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
if (VERSION.SDK_INT >= 21) {
info.addAction(AccessibilityAction.ACTION_SCROLL_BACKWARD);
info.addAction(AccessibilityAction.ACTION_SCROLL_FORWARD);
return;
}
info.addAction(4096);
info.addAction(8192);
}
示例12: onInitializeAccessibilityNodeInfo
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
Context context = host.getContext();
info.addAction(new AccessibilityAction(OVERVIEW, context.getText(OVERVIEW)));
if (Utilities.isWallapaperAllowed(context)) {
info.addAction(new AccessibilityAction(WALLPAPERS, context.getText(WALLPAPERS)));
}
info.addAction(new AccessibilityAction(WIDGETS, context.getText(WIDGETS)));
info.addAction(new AccessibilityAction(SETTINGS, context.getText(SETTINGS)));
}
示例13: setProgressValue
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
/**
* Perform accessibility action ACTION_SET_PROGRESS on the node
*
* @param value desired progress value
* @return true if action performed successfully
*/
public static boolean setProgressValue(final AccessibilityNodeInfo node, final float value) {
if (!node.getActionList().contains(AccessibilityAction.ACTION_SET_PROGRESS)) {
Logger.debug("The element does not support ACTION_SET_PROGRESS action.");
return false;
}
Logger.debug(String.format(
"Trying to perform ACTION_SET_PROGRESS accessibility action with value %s", value));
final Bundle args = new Bundle();
args.putFloat(AccessibilityNodeInfo.ACTION_ARGUMENT_PROGRESS_VALUE, value);
return node.performAction(AccessibilityAction.ACTION_SET_PROGRESS.getId(), args);
}
示例14: onInitializeAccessibilityNodeInfo
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
public final void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo paramAccessibilityNodeInfo)
{
super.onInitializeAccessibilityNodeInfo(paramAccessibilityNodeInfo);
if (Build.VERSION.SDK_INT >= 21)
{
la localla = g();
for (int i = 0; i < localla.size(); i++) {
paramAccessibilityNodeInfo.addAction(new AccessibilityNodeInfo.AccessibilityAction(((Integer)localla.b[(i << 1)]).intValue(), (CharSequence)localla.b[(1 + (i << 1))]));
}
}
}
示例15: onInitializeAccessibilityNodeInfo
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; //导入依赖的package包/类
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo paramAccessibilityNodeInfo)
{
super.onInitializeAccessibilityNodeInfo(paramAccessibilityNodeInfo);
if ((this.R != 0) || (Build.VERSION.SDK_INT < 21)) {}
for (;;)
{
return;
la localla = g();
for (int i1 = 0; i1 < localla.size(); i1++) {
paramAccessibilityNodeInfo.addAction(new AccessibilityNodeInfo.AccessibilityAction(((Integer)localla.b[(i1 << 1)]).intValue(), (CharSequence)localla.b[(1 + (i1 << 1))]));
}
}
}