當前位置: 首頁>>代碼示例>>Java>>正文


Java AccessibilityRecordCompat.getToIndex方法代碼示例

本文整理匯總了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();
}
 
開發者ID:google,項目名稱:talkback,代碼行數:31,代碼來源:ProcessorFocusAndSingleTap.java

示例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);
    }
}
 
開發者ID:google,項目名稱:talkback,代碼行數:77,代碼來源:EventSpeechRule.java


注:本文中的android.support.v4.view.accessibility.AccessibilityRecordCompat.getToIndex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。