1 /*
2  * Copyright (C) 2018 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 package com.example.android.autofill.app.antipatterns;
17 
18 import android.app.Activity;
19 import android.content.Intent;
20 import android.util.Log;
21 import android.view.autofill.AutofillManager;
22 
23 import com.example.android.autofill.app.R;
24 
25 /**
26  * This activity is the first step in a multi-screen login workflow that uses 2 distinct activities
27  * for username and password, which causes 2 Autofill Save UI to be shown.
28  *
29  * <p>This is a bad pattern anyways&mdash;apps should use Fragments in such scenarios.
30  */
31 
32 /*
33  * TODO list
34  * - use ConstraintLayout
35  * - use strings.xml insteaf of hardcoded strings
36  * - add icon with information
37  * - extend AppCompatActivity
38  */
39 public class UsernameOnlyActivity extends Activity {
40 
41     @Override
onStart()42     protected void onStart() {
43         super.onStart();
44 
45         setContentView(R.layout.username_only_activity);
46         findViewById(R.id.next).setOnClickListener((v) -> next());
47     }
48 
next()49     private void next() {
50         startActivity(new Intent(this, PasswordOnlyActivity.class));
51         finish();
52     }
53 }
54