Example usage for android.view.accessibility AccessibilityNodeInfo ACTION_SCROLL_BACKWARD

List of usage examples for android.view.accessibility AccessibilityNodeInfo ACTION_SCROLL_BACKWARD

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityNodeInfo ACTION_SCROLL_BACKWARD.

Prototype

int ACTION_SCROLL_BACKWARD

To view the source code for android.view.accessibility AccessibilityNodeInfo ACTION_SCROLL_BACKWARD.

Click Source Link

Document

Action to scroll the node content backward.

Usage

From source file:cc.flydev.launcher.Page.java

private void sendScrollAccessibilityEvent() {
    AccessibilityManager am = (AccessibilityManager) getContext()
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    if (am.isEnabled()) {
        AccessibilityEvent ev = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED);
        ev.setItemCount(getChildCount());
        ev.setFromIndex(mCurrentPage);//from  w w w .  ja  v  a2  s  . com

        final int action;
        if (getNextPage() >= mCurrentPage) {
            action = AccessibilityNodeInfo.ACTION_SCROLL_FORWARD;
        } else {
            action = AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD;
        }

        ev.setAction(action);
        sendAccessibilityEventUnchecked(ev);
    }
}

From source file:com.android.screenspeak.eventprocessor.ProcessorFocusAndSingleTap.java

/**
 * Listens for scroll events./*from   ww w .ja  v  a 2s . c om*/
 *
 * @param action The type of scroll event received.
 */
@Override
public void onScroll(AccessibilityNodeInfoCompat scrolledNode, int action) {
    if (scrolledNode == null) {
        clearScrollAction();
    }

    switch (action) {
    case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD:
    case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD:
        mLastScrollAction = action;
        if (mActionScrolledNode != null) {
            mActionScrolledNode.recycle();
        }

        if (scrolledNode != null) {
            mActionScrolledNode = AccessibilityNodeInfoCompat.obtain(scrolledNode);
        }
        break;
    }
}

From source file:com.android.yijiang.kzx.widget.betterpickers.radialtimepicker.RadialPickerLayout.java

/**
 * Necessary for accessibility, to ensure we support "scrolling" forward and backward in the circle.
 *//* w w  w.  j a v  a  2s . co m*/
@SuppressLint("NewApi")
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
    info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
}

From source file:com.codetroopers.betterpickers.radialtimepicker.RadialPickerLayout.java

/**
 * Necessary for accessibility, to ensure we support "scrolling" forward and backward in the circle.
 *///from   www.ja  v a 2 s.c o m
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
    info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
}

From source file:org.holoeverywhere.widget.datetimepicker.time.RadialPickerLayout.java

/**
 * Necessary for accessibility, to ensure we support "scrolling" forward and backward
 * in the circle./*  ww w . ja va 2s. com*/
 */
@Override
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(info);
    info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
    info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
}

From source file:com.a.mirko.android.datetimepicker.time.RadialPickerLayout.java

/**
 * Necessary for accessibility, to ensure we support "scrolling" forward and backward
 * in the circle./*from   ww w  . j  a v a 2s. co m*/
 */
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    if (Build.VERSION.SDK_INT >= 14) {
        super.onInitializeAccessibilityNodeInfo(info);
        info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
        info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
    }
}

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.
 *///from w  w  w .  ja v  a  2  s. c o  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.//from   w  w  w. j av a2 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 {
        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./*www.  j  av a 2  s .c om*/
 */
@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.//  www .j av  a  2  s .com
 */
@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);
        }
    }
}