List of usage examples for android.view.accessibility AccessibilityNodeInfo ACTION_SCROLL_FORWARD
int ACTION_SCROLL_FORWARD
To view the source code for android.view.accessibility AccessibilityNodeInfo ACTION_SCROLL_FORWARD.
Click Source Link
From source file:com.a.mirko.android.datetimepicker.time.RadialPickerLayout.java
/** * When scroll forward/backward events are received, jump the time to the higher/lower * discrete, visible value on the circle. *//* w w w . j a v a2s . co m*/ @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; }
From source file:com.borax12.materialdaterangepicker.single.time.RadialPickerLayout.java
/** * Necessary for accessibility, to ensure we support "scrolling" forward and backward * in the circle.//www . j a v a 2 s . co m */ @Override @SuppressWarnings("deprecation") public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if (Build.VERSION.SDK_INT >= 21) { info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); } else { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } }
From source file:com.customdatepicker.time.RadialPickerLayout.java
/** * Necessary for accessibility, to ensure we support "scrolling" forward and backward * in the circle./* w w w . j a v a2 s .co m*/ */ @Override @SuppressWarnings("deprecation") public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if (Build.VERSION.SDK_INT >= 21) { info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); } else if (Build.VERSION.SDK_INT >= 16) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } else { info.addAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD); info.addAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD); } }
From source file:com.jarklee.materialdatetimepicker.time.RadialPickerLayout.java
/** * Necessary for accessibility, to ensure we support "scrolling" forward and backward * in the circle./*from w w w. j a v a 2 s .c o m*/ */ @Override @SuppressWarnings("deprecation") public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if (Build.VERSION.SDK_INT >= 21) { info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } } }
From source file:com.borax12.materialdaterangepicker.single.time.RadialPickerLayout.java
/** * When scroll forward/backward events are received, jump the time to the higher/lower * discrete, visible value on the circle. */// w ww. j ava 2 s .c om @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; } else if (currentItemShowing == SECOND_INDEX) { stepSize = SECOND_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; } Timepoint newSelection; switch (currentItemShowing) { case HOUR_INDEX: newSelection = new Timepoint(value, mCurrentTime.getMinute(), mCurrentTime.getSecond()); break; case MINUTE_INDEX: newSelection = new Timepoint(mCurrentTime.getHour(), value, mCurrentTime.getSecond()); break; case SECOND_INDEX: newSelection = new Timepoint(mCurrentTime.getHour(), mCurrentTime.getMinute(), value); break; default: newSelection = mCurrentTime; } setItem(currentItemShowing, newSelection); mListener.onValueSelected(newSelection); return true; } return false; }
From source file:com.customdatepicker.time.RadialPickerLayout.java
/** * When scroll forward/backward events are received, jump the time to the higher/lower * discrete, visible value on the circle. */// w ww . j a va 2 s . c om @Override public boolean performAccessibilityAction(int action, Bundle arguments) { if (super.performAccessibilityAction(action, arguments)) { return true; } int changeMultiplier = 0; int forward; int backward; if (Build.VERSION.SDK_INT >= 16) { forward = AccessibilityNodeInfo.ACTION_SCROLL_FORWARD; backward = AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD; } else { forward = AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD; backward = AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD; } if (action == forward) { changeMultiplier = 1; } else if (action == 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; } else if (currentItemShowing == SECOND_INDEX) { stepSize = SECOND_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; } Timepoint newSelection; switch (currentItemShowing) { case HOUR_INDEX: newSelection = new Timepoint(value, mCurrentTime.getMinute(), mCurrentTime.getSecond()); break; case MINUTE_INDEX: newSelection = new Timepoint(mCurrentTime.getHour(), value, mCurrentTime.getSecond()); break; case SECOND_INDEX: newSelection = new Timepoint(mCurrentTime.getHour(), mCurrentTime.getMinute(), value); break; default: newSelection = mCurrentTime; } setItem(currentItemShowing, newSelection); mListener.onValueSelected(newSelection); return true; } return false; }
From source file:android.widget.Gallery.java
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); info.setClassName(Gallery.class.getName()); info.setScrollable(mItemCount > 1); if (isEnabled()) { if (mItemCount > 0 && mSelectedPosition < mItemCount - 1) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); }/* www . ja va 2 s. com*/ if (isEnabled() && mItemCount > 0 && mSelectedPosition > 0) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } } }
From source file:com.common.widget.hzlib.AbsListView.java
@Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { info.setClassName(AbsListView.class.getName()); }/* ww w .j a v a 2s. c o m*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (isEnabled()) { if (getFirstVisiblePosition() > 0) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } if (getLastVisiblePosition() < getCount() - 1) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } } } }
From source file:android.widget.Gallery.java
@Override public boolean performAccessibilityAction(int action, Bundle arguments) { if (super.performAccessibilityAction(action, arguments)) { return true; }/* ww w .ja v a 2s. c o m*/ switch (action) { case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: { if (isEnabled() && mItemCount > 0 && mSelectedPosition < mItemCount - 1) { final int currentChildIndex = mSelectedPosition - mFirstPosition; return scrollToChild(currentChildIndex + 1); } } return false; case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: { if (isEnabled() && mItemCount > 0 && mSelectedPosition > 0) { final int currentChildIndex = mSelectedPosition - mFirstPosition; return scrollToChild(currentChildIndex - 1); } } return false; } return false; }
From source file:com.appunite.list.AbsHorizontalListView.java
@Override @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { info.setClassName(AbsHorizontalListView.class.getName()); }/* w w w . j a v a 2s .c o m*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (isEnabled()) { if (getFirstVisiblePosition() > 0) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); } if (getLastVisiblePosition() < getCount() - 1) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD); } } } }