Home | History | Annotate | Download | only in view

Lines Matching refs:direction

35  * The algorithm used for finding the next focusable view in a given direction
76 * @param direction Direction to look.
79 public final View findNextFocus(ViewGroup root, View focused, int direction) {
80 return findNextFocus(root, focused, null, direction);
88 * @param direction Direction to look.
91 public View findNextFocusFromRect(ViewGroup root, Rect focusedRect, int direction) {
93 return findNextFocus(root, null, mFocusedRect, direction);
96 private View findNextFocus(ViewGroup root, View focused, Rect focusedRect, int direction) {
100 next = findNextUserSpecifiedFocus(effectiveRoot, focused, direction);
108 effectiveRoot.addFocusables(focusables, direction);
110 next = findNextFocus(effectiveRoot, focused, focusedRect, direction, focusables);
154 * @param direction Direction to look
160 @View.FocusDirection int direction) {
163 next = findNextUserSpecifiedKeyboardNavigationCluster(root, currentCluster, direction);
172 root.addKeyboardNavigationClusters(clusters, direction);
175 root, currentCluster, clusters, direction);
184 int direction) {
186 currentCluster.findUserSetNextKeyboardNavigationCluster(root, direction);
193 private View findNextUserSpecifiedFocus(ViewGroup root, View focused, int direction) {
195 View userSetNextFocus = focused.findUserSetNextFocus(root, direction);
205 userSetNextFocus = userSetNextFocus.findUserSetNextFocus(root, direction);
207 cycleCheck = cycleCheck.findUserSetNextFocus(root, direction);
219 int direction, ArrayList<View> focusables) {
231 switch (direction) {
259 switch (direction) {
263 direction);
269 focusedRect, direction);
271 throw new IllegalArgumentException("Unknown direction: " + direction);
279 @View.FocusDirection int direction) {
289 switch (direction) {
299 throw new IllegalArgumentException("Unknown direction: " + direction);
304 View focused, Rect focusedRect, int direction) {
314 switch (direction) {
336 Rect focusedRect, int direction) {
340 switch(direction) {
367 if (isBetterCandidate(direction, focusedRect, mOtherRect, mBestCandidateRect)) {
449 * direction from a source rect? This is the core routine that determines
451 * @param direction the direction (up, down, left, right)
457 boolean isBetterCandidate(int direction, Rect source, Rect rect1, Rect rect2) {
461 if (!isCandidate(source, rect1, direction)) {
467 if (!isCandidate(source, rect2, direction)) {
472 if (beamBeats(direction, source, rect1, rect2)) {
477 if (beamBeats(direction, source, rect2, rect1)) {
483 majorAxisDistance(direction, source, rect1),
484 minorAxisDistance(direction, source, rect1))
486 majorAxisDistance(direction, source, rect2),
487 minorAxisDistance(direction, source, rect2)));
496 boolean beamBeats(int direction, Rect source, Rect rect1, Rect rect2) {
497 final boolean rect1InSrcBeam = beamsOverlap(direction, source, rect1);
498 final boolean rect2InSrcBeam = beamsOverlap(direction, source, rect2);
507 // if rect1 is to the direction of, and rect2 is not, rect1 wins.
508 // for example, for direction left, if rect1 is to the left of the source
511 if (!isToDirectionOf(direction, source, rect2)) {
516 if ((direction == View.FOCUS_LEFT || direction == View.FOCUS_RIGHT)) {
522 // e.g for direction down, completely closer means for rect2's top
524 return (majorAxisDistance(direction, source, rect1)
525 < majorAxisDistanceToFarEdge(direction, source, rect2));
539 * Is destRect a candidate for the next focus given the direction? This
540 * checks whether the dest is at least partially to the direction of (e.g left of)
546 boolean isCandidate(Rect srcRect, Rect destRect, int direction) {
547 switch (direction) {
561 throw new IllegalArgumentException("direction must be one of "
567 * Do the "beams" w.r.t the given direction's axis of rect1 and rect2 overlap?
568 * @param direction the direction (up, down, left, right)
573 boolean beamsOverlap(int direction, Rect rect1, Rect rect2) {
574 switch (direction) {
582 throw new IllegalArgumentException("direction must be one of "
589 boolean isToDirectionOf(int direction, Rect src, Rect dest) {
590 switch (direction) {
600 throw new IllegalArgumentException("direction must be one of "
605 * @return The distance from the edge furthest in the given direction
606 * of source to the edge nearest in the given direction of dest. If the
607 * dest is not in the direction from source, return 0.
609 static int majorAxisDistance(int direction, Rect source, Rect dest) {
610 return Math.max(0, majorAxisDistanceRaw(direction, source, dest));
613 static int majorAxisDistanceRaw(int direction, Rect source, Rect dest) {
614 switch (direction) {
624 throw new IllegalArgumentException("direction must be one of "
629 * @return The distance along the major axis w.r.t the direction from the
631 * dest is not in the direction from source, return 1 (to break ties with
634 static int majorAxisDistanceToFarEdge(int direction, Rect source, Rect dest) {
635 return Math.max(1, majorAxisDistanceToFarEdgeRaw(direction, source, dest));
638 static int majorAxisDistanceToFarEdgeRaw(int direction, Rect source, Rect dest) {
639 switch (direction) {
649 throw new IllegalArgumentException("direction must be one of "
654 * Find the distance on the minor axis w.r.t the direction to the nearest
656 * @param direction the direction (up, down, left, right)
661 static int minorAxisDistance(int direction, Rect source, Rect dest) {
662 switch (direction) {
676 throw new IllegalArgumentException("direction must be one of "
686 * @param direction Direction to look
691 public View findNearestTouchable(ViewGroup root, int x, int y, int direction, int[] deltas) {
711 if (!isTouchCandidate(x, y, touchableBounds, direction)) {
717 switch (direction) {
740 switch (direction) {
762 * Is destRect a candidate for the next touch given the direction?
764 private boolean isTouchCandidate(int x, int y, Rect destRect, int direction) {
765 switch (direction) {
775 throw new IllegalArgumentException("direction must be one of "