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