本文整理汇总了Java中android.support.v4.view.accessibility.AccessibilityRecordCompat.getToIndex方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityRecordCompat.getToIndex方法的具体用法?Java AccessibilityRecordCompat.getToIndex怎么用?Java AccessibilityRecordCompat.getToIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.accessibility.AccessibilityRecordCompat
的用法示例。
在下文中一共展示了AccessibilityRecordCompat.getToIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleViewScrolled
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
private void handleViewScrolled(AccessibilityEvent event, AccessibilityRecordCompat record) {
AccessibilityNodeInfoCompat source = null;
@TraversalStrategy.SearchDirectionOrUnknown int direction;
boolean wasScrollAction;
if (mActionScrolledNode != null) {
source = record.getSource();
if (source == null) return;
if (source.equals(mActionScrolledNode)) {
direction = mLastScrollDirection;
wasScrollAction = true;
clearScrollAction();
} else {
direction = getScrollDirection(event);
wasScrollAction = false;
}
} else {
direction = getScrollDirection(event);
wasScrollAction = false;
}
followScrollEvent(source, record, direction, wasScrollAction);
mLastScrollFromIndex = record.getFromIndex();
mLastScrollToIndex = record.getToIndex();
mLastScrollX = record.getScrollX();
mLastScrollY = record.getScrollY();
tryFocusCachedRecord();
}
示例2: getPropertyValue
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
/**
* Returns the value of a given <code>property</code> of an <code>event</code>.
*
* @param property The property
* @param event The event.
* @return the value.
*/
private Object getPropertyValue(Context context, String property, AccessibilityEvent event) {
final AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event);
if (property == null) {
throw new IllegalArgumentException("Unknown property : " + property);
}
// TODO: Don't do so many string comparisons here.
switch (property) {
case PROPERTY_EVENT_TYPE:
return event.getEventType();
case PROPERTY_PACKAGE_NAME:
return event.getPackageName();
case PROPERTY_CLASS_NAME:
return event.getClassName();
case PROPERTY_CLASS_NAME_STRICT:
return event.getClassName();
case PROPERTY_TEXT:
return AccessibilityEventUtils.getEventAggregateText(event);
case PROPERTY_BEFORE_TEXT:
return event.getBeforeText();
case PROPERTY_CONTENT_DESCRIPTION:
return event.getContentDescription();
case PROPERTY_CONTENT_DESCRIPTION_OR_TEXT:
return AccessibilityEventUtils.getEventTextOrDescription(event);
case PROPERTY_NODE_DESCRIPTION_OR_FALLBACK:
return getNodeDescriptionOrFallback(event);
case PROPERTY_EVENT_TIME:
return event.getEventTime();
case PROPERTY_ITEM_COUNT:
return event.getItemCount();
case PROPERTY_CURRENT_ITEM_INDEX:
return event.getCurrentItemIndex();
case PROPERTY_FROM_INDEX:
return event.getFromIndex();
case PROPERTY_TO_INDEX:
return record.getToIndex();
case PROPERTY_SCROLLABLE:
return record.isScrollable();
case PROPERTY_SCROLL_X:
return record.getScrollX();
case PROPERTY_SCROLL_Y:
return record.getScrollY();
case PROPERTY_RECORD_COUNT:
return AccessibilityEventCompat.getRecordCount(event);
case PROPERTY_CHECKED:
return event.isChecked();
case PROPERTY_ENABLED:
return event.isEnabled();
case PROPERTY_FULL_SCREEN:
return event.isFullScreen();
case PROPERTY_PASSWORD:
return event.isPassword();
case PROPERTY_ADDED_COUNT:
return event.getAddedCount();
case PROPERTY_REMOVED_COUNT:
return event.getRemovedCount();
case PROPERTY_VERSION_CODE:
return PackageManagerUtils.getVersionCode(context, event.getPackageName());
case PROPERTY_VERSION_NAME:
return PackageManagerUtils.getVersionName(context, event.getPackageName());
case PROPERTY_PLATFORM_RELEASE:
return Build.VERSION.RELEASE;
case PROPERTY_PLATFORM_SDK:
return Build.VERSION.SDK_INT;
default:
throw new IllegalArgumentException("Unknown property : " + property);
}
}