本文整理汇总了Java中android.support.v4.view.accessibility.AccessibilityNodeInfoCompat类的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityNodeInfoCompat类的具体用法?Java AccessibilityNodeInfoCompat怎么用?Java AccessibilityNodeInfoCompat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccessibilityNodeInfoCompat类属于android.support.v4.view.accessibility包,在下文中一共展示了AccessibilityNodeInfoCompat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAccessibiltyNodeInfoForInputText
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
private AccessibilityNodeInfo createAccessibiltyNodeInfoForInputText(
int left, int top, int right, int bottom) {
AccessibilityNodeInfoCompat info = AccessibilityNodeInfoCompat.wrap(mInputText.createAccessibilityNodeInfo());
info.setSource(NumberPicker.this, VIRTUAL_VIEW_ID_INPUT);
if (mAccessibilityFocusedView != VIRTUAL_VIEW_ID_INPUT) {
info.addAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS);
}
if (mAccessibilityFocusedView == VIRTUAL_VIEW_ID_INPUT) {
info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
}
Rect boundsInParent = mTempRect;
boundsInParent.set(left, top, right, bottom);
info.setVisibleToUser(isVisibleToUser(boundsInParent));
info.setBoundsInParent(boundsInParent);
Rect boundsInScreen = boundsInParent;
int[] locationOnScreen = mTempArray;
getLocationOnScreen(locationOnScreen);
boundsInScreen.offset(locationOnScreen[0], locationOnScreen[1]);
info.setBoundsInScreen(boundsInScreen);
return info.unwrap();
}
示例2: onInitializeAccessibilityNodeInfo
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
super.onInitializeAccessibilityNodeInfo(host, info);
NestedScrollView nsvHost = (NestedScrollView) host;
info.setClassName(ScrollView.class.getName());
if (nsvHost.isEnabled()) {
int scrollRange = nsvHost.getScrollRange();
if (scrollRange > 0) {
info.setScrollable(true);
if (nsvHost.getScrollY() > 0) {
info.addAction(8192);
}
if (nsvHost.getScrollY() < scrollRange) {
info.addAction(4096);
}
}
}
}
示例3: NodeInfo
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
public NodeInfo(AccessibilityNodeInfoCompat node) {
id = simplifyId(node.getViewIdResourceName());
desc = node.getContentDescription();
className = node.getClassName();
packageName = node.getPackageName();
text = node.getText();
drawingOrder = node.getDrawingOrder();
accessibilityFocused = node.isAccessibilityFocused();
checked = node.isChecked();
clickable = node.isClickable();
contextClickable = node.isContextClickable();
dismissable = node.isDismissable();
enabled = node.isEnabled();
editable = node.isEditable();
focusable = node.isFocusable();
longClickable = node.isLongClickable();
selected = node.isSelected();
scrollable = node.isScrollable();
mBoundsInScreen = new Rect();
node.getBoundsInScreen(mBoundsInScreen);
bounds = boundsToString(mBoundsInScreen);
}
示例4: copyNodeInfoNoChildren
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
private void copyNodeInfoNoChildren(AccessibilityNodeInfoCompat dest, AccessibilityNodeInfoCompat src) {
Rect rect = this.mTmpRect;
src.getBoundsInParent(rect);
dest.setBoundsInParent(rect);
src.getBoundsInScreen(rect);
dest.setBoundsInScreen(rect);
dest.setVisibleToUser(src.isVisibleToUser());
dest.setPackageName(src.getPackageName());
dest.setClassName(src.getClassName());
dest.setContentDescription(src.getContentDescription());
dest.setEnabled(src.isEnabled());
dest.setClickable(src.isClickable());
dest.setFocusable(src.isFocusable());
dest.setFocused(src.isFocused());
dest.setAccessibilityFocused(src.isAccessibilityFocused());
dest.setSelected(src.isSelected());
dest.setLongClickable(src.isLongClickable());
dest.addAction(src.getActions());
dest.setMovementGranularities(src.getMovementGranularities());
}
示例5: onPopulateNodeForVirtualView
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
@Override
protected void onPopulateNodeForVirtualView(int id, AccessibilityNodeInfoCompat node) {
super.onPopulateNodeForVirtualView(id, node);
// ExploreByTouchHelper does not currently handle view scale.
// Update BoundsInScreen to appropriate value.
DragLayer dragLayer = Launcher.getLauncher(mView.getContext()).getDragLayer();
mTempCords[0] = mTempCords[1] = 0;
float scale = dragLayer.getDescendantCoordRelativeToSelf(mView, mTempCords);
node.getBoundsInParent(mTempRect);
mTempRect.left = mTempCords[0] + (int) (mTempRect.left * scale);
mTempRect.right = mTempCords[0] + (int) (mTempRect.right * scale);
mTempRect.top = mTempCords[1] + (int) (mTempRect.top * scale);
mTempRect.bottom = mTempCords[1] + (int) (mTempRect.bottom * scale);
node.setBoundsInScreen(mTempRect);
}
示例6: onInitializeAccessibilityNodeInfoForItem
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
@Override
public void onInitializeAccessibilityNodeInfoForItem(RecyclerView.Recycler recycler,
RecyclerView.State state, View host, AccessibilityNodeInfoCompat info) {
ViewGroup.LayoutParams lp = host.getLayoutParams();
if (!(lp instanceof LayoutParams)) {
super.onInitializeAccessibilityNodeInfoForItem(host, info);
return;
}
LayoutParams glp = (LayoutParams) lp;
int spanGroupIndex = getSpanGroupIndex(recycler, state, glp.getViewLayoutPosition());
if (mOrientation == HORIZONTAL) {
info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
glp.getSpanIndex(), glp.getSpanSize(),
spanGroupIndex, 1,
mSpanCount > 1 && glp.getSpanSize() == mSpanCount, false));
} else { // VERTICAL
info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
spanGroupIndex , 1,
glp.getSpanIndex(), glp.getSpanSize(),
mSpanCount > 1 && glp.getSpanSize() == mSpanCount, false));
}
}
示例7: onInitializeAccessibilityNodeInfo
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
super.onInitializeAccessibilityNodeInfo(host, info);
info.setClassName(TextInputLayout.class.getSimpleName());
CharSequence text = TextInputLayout.this.mCollapsingTextHelper.getText();
if (!TextUtils.isEmpty(text)) {
info.setText(text);
}
if (TextInputLayout.this.mEditText != null) {
info.setLabelFor(TextInputLayout.this.mEditText);
}
CharSequence error = TextInputLayout.this.mErrorView != null ? TextInputLayout.this.mErrorView.getText() : null;
if (!TextUtils.isEmpty(error)) {
info.setContentInvalid(true);
info.setError(error);
}
}
示例8: onInitializeAccessibilityNodeInfoForItem
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
@Override
public void onInitializeAccessibilityNodeInfoForItem(RecyclerView.Recycler recycler,
RecyclerView.State state, View host, AccessibilityNodeInfoCompat info) {
ViewGroup.LayoutParams lp = host.getLayoutParams();
if (!(lp instanceof LayoutParams)) {
super.onInitializeAccessibilityNodeInfoForItem(host, info);
return;
}
LayoutParams sglp = (LayoutParams) lp;
if (mOrientation == HORIZONTAL) {
info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
sglp.getSpanIndex(), sglp.mFullSpan ? mSpanCount : 1,
-1, -1,
sglp.mFullSpan, false));
} else { // VERTICAL
info.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(
-1, -1,
sglp.getSpanIndex(), sglp.mFullSpan ? mSpanCount : 1,
sglp.mFullSpan, false));
}
}
示例9: performAccessibilityAction
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
@Override
public boolean performAccessibilityAction(View host, int action, Bundle args) {
if (super.performAccessibilityAction(host, action, args)) {
return true;
}
switch (action) {
case AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD: {
if (canScrollHorizontally(1)) {
setCurrentItem(mCurItem + 1);
return true;
}
} return false;
case AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD: {
if (canScrollHorizontally(-1)) {
setCurrentItem(mCurItem - 1);
return true;
}
} return false;
}
return false;
}
示例10: performAccessibilityAction
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
public boolean performAccessibilityAction(View host, int action, Bundle args) {
if (super.performAccessibilityAction(host, action, args)) {
return true;
}
switch (action) {
case AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD: {
if (canScrollHorizontally(1)) {
setCurrentItem(mCurItem + 1);
return true;
}
}
return false;
case AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD: {
if (canScrollHorizontally(-1)) {
setCurrentItem(mCurItem - 1);
return true;
}
}
return false;
}
return false;
}
示例11: onInitializeAccessibilityNodeInfo
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
AccessibilityNodeInfoCompat superNode = AccessibilityNodeInfoCompat.obtain(info);
super.onInitializeAccessibilityNodeInfo(host, superNode);
copyNodeInfoNoChildren(info, superNode);
superNode.recycle();
info.setClassName(SlidingPaneLayout.class.getName());
info.setSource(host);
ViewParent parent = ViewCompat.getParentForAccessibility(host);
if (parent instanceof View) {
info.setParent((View) parent);
}
int childCount = SlidingPaneLayout.this.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = SlidingPaneLayout.this.getChildAt(i);
if (!filter(child) && child.getVisibility() == 0) {
ViewCompat.setImportantForAccessibility(child, 1);
info.addChild(child);
}
}
}
示例12: onInitializeAccessibilityNodeInfo
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的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);
}
示例13: getAction
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
private String getAction() {
switch (mAction) {
case AccessibilityNodeInfoCompat.ACTION_CLICK:
return "click()";
case AccessibilityNodeInfoCompat.ACTION_LONG_CLICK:
return "longClick()";
case AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD:
return "scrollBackward()";
case AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD:
return "scrollForward()";
case AccessibilityNodeInfoCompat.ACTION_SET_TEXT:
return "setText(\"\")";
}
return "";
}
示例14: performAccessibilityAction
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
@Override
public boolean performAccessibilityAction(View host, int action, Bundle args) {
if (super.performAccessibilityAction(host, action, args)) {
return true;
}
switch (action) {
case AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD: {
if (internalCanScrollVertically(1)) {
setCurrentItem(mCurItem + 1);
return true;
}
} return false;
case AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD: {
if (internalCanScrollVertically(-1)) {
setCurrentItem(mCurItem - 1);
return true;
}
} return false;
}
return false;
}
示例15: onPopulateNodeForVirtualView
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; //导入依赖的package包/类
@Override
protected void onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfoCompat node) {
node.setClassName(getClass().getName());
node.addAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_CLICK);
final int type = getTypeFromId(virtualViewId);
final int value = getValueFromId(virtualViewId);
final CharSequence description = getVirtualViewDescription(type, value);
node.setContentDescription(description);
getBoundsForVirtualView(virtualViewId, mTempRect);
node.setBoundsInParent(mTempRect);
final boolean selected = isVirtualViewSelected(type, value);
node.setSelected(selected);
final int nextId = getVirtualViewIdAfter(type, value);
if (nextId != INVALID_ID) {
node.setTraversalBefore(RadialTimePickerView.this, nextId);
}
}