blob: 69dc05607fa0722cbe8c76b473ab94a88b78fafd [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.view;
18
19import android.graphics.Rect;
20
21/**
22 * A helper class that allows unit tests to access FocusFinder methods.
23 * @hide
24 */
25public class FocusFinderHelper {
26
27 private FocusFinder mFocusFinder;
28
29 /**
30 * Wrap the FocusFinder object
31 */
32 public FocusFinderHelper(FocusFinder focusFinder) {
33 mFocusFinder = focusFinder;
34 }
35
36 public boolean isBetterCandidate(int direction, Rect source, Rect rect1, Rect rect2) {
37 return mFocusFinder.isBetterCandidate(direction, source, rect1, rect2);
38 }
39
40 public boolean beamBeats(int direction, Rect source, Rect rect1, Rect rect2) {
41 return mFocusFinder.beamBeats(direction, source, rect1, rect2);
42 }
43
44 public boolean isCandidate(Rect srcRect, Rect destRect, int direction) {
45 return mFocusFinder.isCandidate(srcRect, destRect, direction);
46 }
47
48 public boolean beamsOverlap(int direction, Rect rect1, Rect rect2) {
49 return mFocusFinder.beamsOverlap(direction, rect1, rect2);
50 }
51
52 public static int majorAxisDistance(int direction, Rect source, Rect dest) {
53 return FocusFinder.majorAxisDistance(direction, source, dest);
54 }
55
56 public static int majorAxisDistanceToFarEdge(int direction, Rect source, Rect dest) {
57 return FocusFinder.majorAxisDistanceToFarEdge(direction, source, dest);
58 }
59}