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 android.translation.cts;
18 
19 import android.app.Activity;
20 import android.content.Intent;
21 import android.os.Bundle;
22 import android.view.autofill.AutofillId;
23 import android.widget.TextView;
24 
25 import java.util.ArrayList;
26 import java.util.List;
27 
28 /**
29  * A simple activity that contains a TextView used for translation testing.
30  */
31 public class SimpleActivity extends Activity {
32 
33     public static final String HELLO_TEXT_ID = "hello";
34 
35     private static final String TAG = "SimpleActivity";
36 
37     private TextView mHelloText;
38 
39     @Override
onCreate(Bundle savedInstanceState)40     protected void onCreate(Bundle savedInstanceState) {
41         super.onCreate(savedInstanceState);
42         setContentView(R.layout.simple_activity);
43 
44         mHelloText = findViewById(R.id.hello);
45     }
46 
getViewsForTranslation()47     List<AutofillId> getViewsForTranslation() {
48         final List<AutofillId> views = new ArrayList<>();
49         views.add(mHelloText.getAutofillId());
50         return views;
51     }
52 
getHelloText()53     TextView getHelloText() {
54         return mHelloText;
55     }
56 
startEmptyActivity()57     void startEmptyActivity() {
58         Intent intent = new Intent(this, EmptyActivity.class);
59         startActivity(intent);
60     }
61 }
62