1 /* 2 * Copyright (C) 2017 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 android.autofillservice.cts; 17 18 import android.content.Intent; 19 import android.os.Bundle; 20 import android.text.TextUtils; 21 import android.util.Log; 22 import android.widget.TextView; 23 24 /** 25 * Activity that displays a "Welcome USER" message after login. 26 */ 27 public class WelcomeActivity extends AbstractAutoFillActivity { 28 29 private static WelcomeActivity sInstance; 30 31 private static final String TAG = "WelcomeActivity"; 32 33 static final String EXTRA_MESSAGE = "message"; 34 35 private TextView mOutput; 36 WelcomeActivity()37 public WelcomeActivity() { 38 sInstance = this; 39 } 40 41 @Override onCreate(Bundle savedInstanceState)42 protected void onCreate(Bundle savedInstanceState) { 43 super.onCreate(savedInstanceState); 44 45 setContentView(R.layout.welcome_activity); 46 47 mOutput = (TextView) findViewById(R.id.output); 48 49 final Intent intent = getIntent(); 50 final String message = intent.getStringExtra(EXTRA_MESSAGE); 51 52 if (!TextUtils.isEmpty(message)) { 53 mOutput.setText(message); 54 } 55 56 Log.d(TAG, "Output: " + mOutput.getText()); 57 } 58 finishIt()59 static void finishIt() { 60 if (sInstance != null) { 61 Log.d(TAG, "So long and thanks for all the fish!"); 62 sInstance.finish(); 63 } 64 } 65 } 66