• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
17 package android.view;
18 
19 import android.graphics.Rect;
20 
21 /**
22  * A helper class that allows unit tests to access FocusFinder methods.
23  * @hide
24  */
25 public class FocusFinderHelper {
26 
27     private FocusFinder mFocusFinder;
28 
29     /**
30      * Wrap the FocusFinder object
31      */
FocusFinderHelper(FocusFinder focusFinder)32     public FocusFinderHelper(FocusFinder focusFinder) {
33         mFocusFinder = focusFinder;
34     }
35 
isBetterCandidate(int direction, Rect source, Rect rect1, Rect rect2)36     public boolean isBetterCandidate(int direction, Rect source, Rect rect1, Rect rect2) {
37         return mFocusFinder.isBetterCandidate(direction, source, rect1, rect2);
38     }
39 
beamBeats(int direction, Rect source, Rect rect1, Rect rect2)40     public boolean beamBeats(int direction, Rect source, Rect rect1, Rect rect2) {
41         return mFocusFinder.beamBeats(direction, source, rect1, rect2);
42     }
43 
isCandidate(Rect srcRect, Rect destRect, int direction)44     public boolean isCandidate(Rect srcRect, Rect destRect, int direction) {
45         return mFocusFinder.isCandidate(srcRect, destRect, direction);
46     }
47 
beamsOverlap(int direction, Rect rect1, Rect rect2)48     public boolean beamsOverlap(int direction, Rect rect1, Rect rect2) {
49         return mFocusFinder.beamsOverlap(direction, rect1, rect2);
50     }
51 
majorAxisDistance(int direction, Rect source, Rect dest)52     public static int majorAxisDistance(int direction, Rect source, Rect dest) {
53         return FocusFinder.majorAxisDistance(direction, source, dest);
54     }
55 
majorAxisDistanceToFarEdge(int direction, Rect source, Rect dest)56     public static int majorAxisDistanceToFarEdge(int direction, Rect source, Rect dest) {
57         return FocusFinder.majorAxisDistanceToFarEdge(direction, source, dest);
58     }
59 }
60