当前位置: 首页>>代码示例>>Java>>正文


Java AccessibilityNodeInfo.ACTION_SCROLL_FORWARD属性代码示例

本文整理汇总了Java中android.view.accessibility.AccessibilityNodeInfo.ACTION_SCROLL_FORWARD属性的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityNodeInfo.ACTION_SCROLL_FORWARD属性的具体用法?Java AccessibilityNodeInfo.ACTION_SCROLL_FORWARD怎么用?Java AccessibilityNodeInfo.ACTION_SCROLL_FORWARD使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.view.accessibility.AccessibilityNodeInfo的用法示例。


在下文中一共展示了AccessibilityNodeInfo.ACTION_SCROLL_FORWARD属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performAccessibilityAction

@TargetApi(16)
@Override
public boolean performAccessibilityAction(int action, Bundle args) {
  if (super.performAccessibilityAction(action, args)) {
    return true;
  }
  if (duration <= 0) {
    return false;
  }
  if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
    if (scrubIncrementally(-getPositionIncrement())) {
      stopScrubbing(false);
    }
  } else if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) {
    if (scrubIncrementally(getPositionIncrement())) {
      stopScrubbing(false);
    }
  } else {
    return false;
  }
  sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
  return true;
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:23,代码来源:DefaultTimeBar.java

示例2: performAccessibilityAction

@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
    if (super.performAccessibilityAction(action, arguments)) {
        return true;
    }
    switch (action) {
        case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
            if (getCurrentPage() < getPageCount() - 1) {
                scrollRight();
                return true;
            }
        } break;
        case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
            if (getCurrentPage() > 0) {
                scrollLeft();
                return true;
            }
        } break;
    }
    return false;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:21,代码来源:PagedView.java

示例3: performAccessibilityAction

@TargetApi(16)
@Override
public boolean performAccessibilityAction(int action, Bundle args) {
    if (super.performAccessibilityAction(action, args)) {
        return true;
    }
    if (duration <= 0) {
        return false;
    }
    if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
        if (scrubIncrementally(-getPositionIncrement())) {
            stopScrubbing(false);
        }
    } else if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) {
        if (scrubIncrementally(getPositionIncrement())) {
            stopScrubbing(false);
        }
    } else {
        return false;
    }
    sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
    return true;
}
 
开发者ID:rubensousa,项目名称:PreviewSeekBar,代码行数:23,代码来源:CustomTimeBar.java

示例4: performAccessibilityAction

@Override
public boolean performAccessibilityAction(View host, int action, Bundle arguments) {
    if (super.performAccessibilityAction(host, action, arguments)) {
        return true;
    }

    switch (action) {
        case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD:
            adjustPicker(1);
            return true;
        case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD:
            adjustPicker(-1);
            return true;
    }

    return false;
}
 
开发者ID:Gericop,项目名称:DateTimePicker,代码行数:17,代码来源:RadialTimePickerView.java

示例5: onNestedPrePerformAccessibilityAction

@Override
public boolean onNestedPrePerformAccessibilityAction(View target, int action, Bundle args) {
    if (super.onNestedPrePerformAccessibilityAction(target, action, args)) {
        return true;
    }

    if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD && mCollapseOffset != 0) {
        smoothScrollTo(0, 0);
        return true;
    }
    return false;
}
 
开发者ID:RikkaW,项目名称:Bridge,代码行数:12,代码来源:ResolverDrawerLayout.java

示例6: performAccessibilityAction

/**
 * When scroll forward/backward events are received, jump the time to the higher/lower
 * discrete, visible value on the circle.
 */
@SuppressLint("NewApi")
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
    if (super.performAccessibilityAction(action, arguments)) {
        return true;
    }

    int changeMultiplier = 0;
    if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) {
        changeMultiplier = 1;
    } else if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
        changeMultiplier = -1;
    }
    if (changeMultiplier != 0) {
        int value = getCurrentlyShowingValue();
        int stepSize = 0;
        int currentItemShowing = getCurrentItemShowing();
        if (currentItemShowing == HOUR_INDEX) {
            stepSize = HOUR_VALUE_TO_DEGREES_STEP_SIZE;
            value %= 12;
        } else if (currentItemShowing == MINUTE_INDEX) {
            stepSize = MINUTE_VALUE_TO_DEGREES_STEP_SIZE;
        }

        int degrees = value * stepSize;
        degrees = snapOnly30s(degrees, changeMultiplier);
        value = degrees / stepSize;
        int maxValue = 0;
        int minValue = 0;
        if (currentItemShowing == HOUR_INDEX) {
            if (mIs24HourMode) {
                maxValue = 23;
            } else {
                maxValue = 12;
                minValue = 1;
            }
        } else {
            maxValue = 55;
        }
        if (value > maxValue) {
            // If we scrolled forward past the highest number, wrap around to the lowest.
            value = minValue;
        } else if (value < minValue) {
            // If we scrolled backward past the lowest number, wrap around to the highest.
            value = maxValue;
        }
        setItem(currentItemShowing, value);
        mListener.onValueSelected(currentItemShowing, value, false);
        return true;
    }

    return false;
}
 
开发者ID:ttpho,项目名称:TimePicker,代码行数:57,代码来源:RadialPickerLayout.java

示例7: performAccessibilityAction

/**
 * When scroll forward/backward events are received, announce the newly scrolled-to month.
 */
@SuppressLint("NewApi")
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
    if (action != AccessibilityNodeInfo.ACTION_SCROLL_FORWARD &&
            action != AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
        return super.performAccessibilityAction(action, arguments);
    }

    // Figure out what month is showing.
    int firstVisiblePosition = getFirstVisiblePosition();
    int minMonth = mController.getStartDate().get(Calendar.MONTH);
    int month = (firstVisiblePosition + minMonth) % MonthAdapter.MONTHS_IN_YEAR;
    int year = (firstVisiblePosition + minMonth) / MonthAdapter.MONTHS_IN_YEAR + mController.getMinYear();
    MonthAdapter.CalendarDay day = new MonthAdapter.CalendarDay(year, month, 1);

    // Scroll either forward or backward one month.
    if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) {
        day.month++;
        if (day.month == 12) {
            day.month = 0;
            day.year++;
        }
    } else if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
        View firstVisibleView = getChildAt(0);
        // If the view is fully visible, jump one month back. Otherwise, we'll just jump
        // to the first day of first visible month.
        if (firstVisibleView != null && firstVisibleView.getTop() >= -1) {
            // There's an off-by-one somewhere, so the top of the first visible item will
            // actually be -1 when it's at the exact top.
            day.month--;
            if (day.month == -1) {
                day.month = 11;
                day.year--;
            }
        }
    }

    // Go to that month.
    Utils.tryAccessibilityAnnounce(this, getMonthAndYearString(day));
    goTo(day, true, false, true);
    mPerformingScroll = true;
    return true;
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:46,代码来源:DayPickerView.java


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