1 /*
2  * Copyright (C) 2006 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 com.android.layoutlib.bridge.MockView;
20 
21 import android.content.Context;
22 import android.graphics.Canvas;
23 import android.graphics.Rect;
24 import android.util.AttributeSet;
25 
26 /**
27  * Mock version of the SurfaceView.
28  * Only non override public methods from the real SurfaceView have been added in there.
29  * Methods that take an unknown class as parameter or as return object, have been removed for now.
30  *
31  * TODO: generate automatically.
32  *
33  */
34 public class SurfaceView extends MockView {
35 
SurfaceView(Context context)36     public SurfaceView(Context context) {
37         this(context, null);
38     }
39 
SurfaceView(Context context, AttributeSet attrs)40     public SurfaceView(Context context, AttributeSet attrs) {
41         this(context, attrs , 0);
42     }
43 
SurfaceView(Context context, AttributeSet attrs, int defStyle)44     public SurfaceView(Context context, AttributeSet attrs, int defStyle) {
45         super(context, attrs, defStyle);
46     }
47 
SurfaceView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)48     public SurfaceView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
49         super(context, attrs, defStyleAttr, defStyleRes);
50     }
51 
getHolder()52     public SurfaceHolder getHolder() {
53         return mSurfaceHolder;
54     }
55 
56     private SurfaceHolder mSurfaceHolder = new SurfaceHolder() {
57 
58         @Override
59         public boolean isCreating() {
60             return false;
61         }
62 
63         @Override
64         public void addCallback(Callback callback) {
65         }
66 
67         @Override
68         public void removeCallback(Callback callback) {
69         }
70 
71         @Override
72         public void setFixedSize(int width, int height) {
73         }
74 
75         @Override
76         public void setSizeFromLayout() {
77         }
78 
79         @Override
80         public void setFormat(int format) {
81         }
82 
83         @Override
84         public void setType(int type) {
85         }
86 
87         @Override
88         public void setKeepScreenOn(boolean screenOn) {
89         }
90 
91         @Override
92         public Canvas lockCanvas() {
93             return null;
94         }
95 
96         @Override
97         public Canvas lockCanvas(Rect dirty) {
98             return null;
99         }
100 
101         @Override
102         public void unlockCanvasAndPost(Canvas canvas) {
103         }
104 
105         @Override
106         public Surface getSurface() {
107             return null;
108         }
109 
110         @Override
111         public Rect getSurfaceFrame() {
112             return null;
113         }
114     };
115 }
116 
117