1 /*
2  * Copyright (C) 2021 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.cts.verifier.managedprovisioning;
18 
19 import android.os.Bundle;
20 import android.text.method.ScrollingMovementMethod;
21 import android.widget.Button;
22 import android.widget.TextView;
23 
24 import com.android.cts.verifier.PassFailButtons;
25 import com.android.cts.verifier.R;
26 
27 /**
28  * Base activity for tests that require a preparation step.
29  */
30 public abstract class ByodTestActivityWithPrepare extends PassFailButtons.Activity {
31     private TextView mLogView;
32     private TextView mInstructionsView;
33     private Button mPrepareButton;
34     private Button mGoButton;
35 
36     @Override
onCreate(Bundle savedInstanceState)37     protected void onCreate(Bundle savedInstanceState) {
38         super.onCreate(savedInstanceState);
39         setContentView(R.layout.byod_test_with_prepare);
40         setPassFailButtonClickListeners();
41 
42         mLogView = findViewById(R.id.test_log);
43         mLogView.setMovementMethod(new ScrollingMovementMethod());
44         mInstructionsView = findViewById(R.id.instructions_text);
45         mPrepareButton = findViewById(R.id.prepare_test_button);
46         mGoButton = findViewById(R.id.run_test_button);
47         mGoButton.setEnabled(false);
48         getPassButton().setEnabled(false);
49     }
50 
getLogView()51     protected TextView getLogView() {
52         return mLogView;
53     }
54 
getInstructionsView()55     protected TextView getInstructionsView() {
56         return mInstructionsView;
57     }
58 
getPrepareButton()59     protected Button getPrepareButton() {
60         return mPrepareButton;
61     }
62 
getGoButton()63     protected Button getGoButton() {
64         return mGoButton;
65     }
66 }
67