Welcome.java revision 96c5af40d639d629267794f4f0338a267ff94ce5
1/*
2 * Copyright (C) 2008 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
17package com.android.email.activity;
18
19import com.android.email.Account;
20import com.android.email.Email;
21import com.android.email.Preferences;
22
23import android.app.Activity;
24import android.content.Intent;
25import android.os.Bundle;
26
27/**
28 * The Welcome activity initializes the application and decides what Activity
29 * the user should start with.
30 * If no accounts are configured the user is taken to the Accounts Activity where they
31 * can configure an account.
32 * If a single account is configured the user is taken directly to the FolderMessageList for
33 * the INBOX of that account.
34 * If more than one account is configuref the user is takaen to the Accounts Activity so they
35 * can select an account.
36 */
37public class Welcome extends Activity {
38    @Override
39    public void onCreate(Bundle icicle) {
40        super.onCreate(icicle);
41
42        Account[] accounts = Preferences.getPreferences(this).getAccounts();
43        if (accounts.length == 1) {
44            FolderMessageList.actionHandleAccount(this, accounts[0], Email.INBOX);
45        } else {
46            Accounts.actionShowAccounts(this);
47        }
48
49        finish();
50    }
51}
52