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


Java AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD屬性代碼示例

本文整理匯總了Java中android.view.accessibility.AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD屬性的典型用法代碼示例。如果您正苦於以下問題:Java AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD屬性的具體用法?Java AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD怎麽用?Java AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.view.accessibility.AccessibilityNodeInfo的用法示例。


在下文中一共展示了AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: perform

@Test
public void perform() throws Exception {
    ScrollMaxAction action = new ScrollMaxAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
    UiObject root = new TestUiObject(20);
    action.perform(root);
    System.out.println(TestUiObject.max);
    assertEquals(1, TestUiObject.count);
}
 
開發者ID:feifadaima,項目名稱:https-github.com-hyb1996-NoRootScriptDroid,代碼行數:8,代碼來源:ScrollMaxActionTest.java

示例6: perform

@Test
public void perform() throws Exception {
    ScrollAction action = new ScrollAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD, 0);
    UiObject root = new TestUiObject(5);
    action.perform(root);
    System.out.println(TestUiObject.max);
    assertEquals(1, TestUiObject.count);
}
 
開發者ID:feifadaima,項目名稱:https-github.com-hyb1996-NoRootScriptDroid,代碼行數:8,代碼來源:ScrollActionTest.java

示例7: 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

示例8: 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_BACKWARD屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。