1 /*
2  * Copyright (C) 2011 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.acceleration;
18 
19 import android.acceleration.cts.R;
20 
21 import android.app.Activity;
22 import android.os.Bundle;
23 import android.view.View;
24 
25 public abstract class BaseAcceleratedActivity extends Activity {
26 
27     private AcceleratedView mHardwareAcceleratedView;
28     private AcceleratedView mSoftwareAcceleratedView;
29 
30     private AcceleratedView mManualHardwareAcceleratedView;
31     private AcceleratedView mManualSoftwareAcceleratedView;
32 
33     @Override
onCreate(Bundle savedInstanceState)34     protected void onCreate(Bundle savedInstanceState) {
35         super.onCreate(savedInstanceState);
36         setContentView(R.layout.acceleration);
37 
38         mHardwareAcceleratedView = (AcceleratedView) findViewById(R.id.hardware_accelerated_view);
39         mSoftwareAcceleratedView = (AcceleratedView) findViewById(R.id.software_accelerated_view);
40 
41         mManualHardwareAcceleratedView =
42             (AcceleratedView) findViewById(R.id.manual_hardware_accelerated_view);
43         mManualSoftwareAcceleratedView =
44             (AcceleratedView) findViewById(R.id.manual_software_accelerated_view);
45 
46         mManualHardwareAcceleratedView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
47         mManualSoftwareAcceleratedView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
48     }
49 
getHardwareAcceleratedView()50     public AcceleratedView getHardwareAcceleratedView() {
51         return mHardwareAcceleratedView;
52     }
53 
getSoftwareAcceleratedView()54     public AcceleratedView getSoftwareAcceleratedView() {
55         return mSoftwareAcceleratedView;
56     }
57 
getManualHardwareAcceleratedView()58     public AcceleratedView getManualHardwareAcceleratedView() {
59         return mManualHardwareAcceleratedView;
60     }
61 
getManualSoftwareAcceleratedView()62     public AcceleratedView getManualSoftwareAcceleratedView() {
63         return mManualSoftwareAcceleratedView;
64     }
65 }
66