• 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.widget.cts;
18 
19 import android.content.Context;
20 import android.graphics.Rect;
21 import android.util.AttributeSet;
22 import android.view.View;
23 import android.view.ViewGroup;
24 import android.view.ViewParent;
25 import android.view.ContextMenu.ContextMenuInfo;
26 import android.view.animation.Transformation;
27 import android.widget.Gallery;
28 
29 /**
30  * A minimal mock gallery for {@link Gallery} test.
31  */
32 public class MyGallery extends Gallery {
33     private ContextMenuInfo mContextMenuInfo;
34 
MyGallery(Context context)35     public MyGallery(Context context) {
36         super(context);
37     }
38 
MyGallery(Context context, AttributeSet attrs)39     public MyGallery(Context context, AttributeSet attrs) {
40         super(context, attrs);
41     }
42 
MyGallery(Context context, AttributeSet attrs, int defStyle)43     public MyGallery(Context context, AttributeSet attrs, int defStyle) {
44         super(context, attrs, defStyle);
45     }
46 
47     @Override
getChildStaticTransformation(View child, Transformation t)48     protected boolean getChildStaticTransformation(View child, Transformation t) {
49         return super.getChildStaticTransformation(child, t);
50     }
51 
setParent(ViewParent v)52     protected void setParent(ViewParent v) {
53         mParent = v;
54     }
55 
56     @Override
checkLayoutParams(ViewGroup.LayoutParams p)57     protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
58         return super.checkLayoutParams(p);
59     }
60 
61     @Override
computeHorizontalScrollExtent()62     protected int computeHorizontalScrollExtent() {
63         return super.computeHorizontalScrollExtent();
64     }
65 
66     @Override
computeHorizontalScrollOffset()67     protected int computeHorizontalScrollOffset() {
68         return super.computeHorizontalScrollOffset();
69     }
70 
71     @Override
computeHorizontalScrollRange()72     protected int computeHorizontalScrollRange() {
73         return super.computeHorizontalScrollRange();
74     }
75 
76     @Override
dispatchSetPressed(boolean pressed)77     protected void dispatchSetPressed(boolean pressed) {
78         super.dispatchSetPressed(pressed);
79     }
80 
81     @Override
generateDefaultLayoutParams()82     protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
83         return super.generateDefaultLayoutParams();
84     }
85 
86     @Override
generateLayoutParams(ViewGroup.LayoutParams p)87     protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
88         return super.generateLayoutParams(p);
89     }
90 
91     @Override
getChildDrawingOrder(int childCount, int i)92     protected int getChildDrawingOrder(int childCount, int i) {
93         return super.getChildDrawingOrder(childCount, i);
94     }
95 
96     @Override
getContextMenuInfo()97     protected ContextMenuInfo getContextMenuInfo() {
98         if (mContextMenuInfo == null) {
99             mContextMenuInfo = new MyContextMenuInfo();
100         }
101         return mContextMenuInfo;
102     }
103 
104     @Override
onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)105     protected void onFocusChanged(boolean gainFocus, int direction,
106             Rect previouslyFocusedRect) {
107         super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
108     }
109 
110     @Override
onLayout(boolean changed, int l, int t, int r, int b)111     protected void onLayout(boolean changed, int l, int t, int r, int b) {
112         super.onLayout(changed, l, t, r, b);
113     }
114 
115     private static class MyContextMenuInfo implements ContextMenuInfo {
116     }
117 }
118