1 /*
2  * Copyright (C) 2016 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 com.android.documentsui.dirlist;
18 
19 import android.view.KeyEvent;
20 import android.view.View;
21 
22 /**
23  * A purely dummy instance of FocusHandler.
24  */
25 public final class TestFocusHandler implements FocusHandler {
26 
27     public boolean handleKey;
28     public int focusPos = 0;
29     public String focusModelId;
30     public boolean advanceFocusAreaCalled;
31     public boolean focusDirectoryCalled;
32 
33     @Override
handleKey(DocumentHolder doc, int keyCode, KeyEvent event)34     public boolean handleKey(DocumentHolder doc, int keyCode, KeyEvent event) {
35         return handleKey;
36     }
37 
38     @Override
onFocusChange(View v, boolean hasFocus)39     public void onFocusChange(View v, boolean hasFocus) {
40     }
41 
42     @Override
advanceFocusArea()43     public boolean advanceFocusArea() {
44         advanceFocusAreaCalled = true;
45         return true;
46     }
47 
48     @Override
focusDirectoryList()49     public boolean focusDirectoryList() {
50         focusDirectoryCalled = true;
51         return true;
52     }
53 
54     @Override
hasFocusedItem()55     public boolean hasFocusedItem() {
56         return true;
57     }
58 
59     @Override
getFocusPosition()60     public int getFocusPosition() {
61         return focusPos;
62     }
63 
64     @Override
getFocusModelId()65     public String getFocusModelId() {
66         return focusModelId;
67     }
68 
69     @Override
focusDocument(String modelId)70     public void focusDocument(String modelId) {
71     }
72 
73     @Override
onLayoutCompleted()74     public void onLayoutCompleted() {
75     }
76 }