Home | History | Annotate | Download | only in setup
      1 /*
      2  * Copyright (C) 2014 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.email.setup;
     18 
     19 import android.content.ComponentName;
     20 import android.content.Context;
     21 import android.content.Intent;
     22 
     23 
     24 public class AuthenticatorSetupIntentHelper {
     25     // NORMAL is the standard entry from the Email app; EAS and POP_IMAP are used when entering via
     26     // Settings -> Accounts
     27     public static final int FLOW_MODE_UNSPECIFIED = -1;
     28     public static final int FLOW_MODE_NORMAL = 0;
     29     public static final int FLOW_MODE_ACCOUNT_MANAGER = 1;
     30     public static final int FLOW_MODE_EDIT = 3;
     31     public static final int FLOW_MODE_FORCE_CREATE = 4;
     32 
     33     public static final int FLOW_MODE_NO_ACCOUNTS = 8;
     34 
     35 
     36     public static final String EXTRA_FLOW_MODE = "FLOW_MODE";
     37     public static final String EXTRA_FLOW_ACCOUNT_TYPE = "FLOW_ACCOUNT_TYPE";
     38 
     39 
     40     public static Intent actionNewAccountIntent(final Context context) {
     41         final Intent i = new Intent();
     42         i.setComponent(
     43                 new ComponentName(context, "com.android.email.activity.setup.AccountSetupFinal"));
     44         i.putExtra(EXTRA_FLOW_MODE, FLOW_MODE_NORMAL);
     45         return i;
     46     }
     47 
     48     public static Intent actionNewAccountWithResultIntent(final Context context) {
     49         final Intent i = new Intent();
     50         i.setComponent(
     51                 new ComponentName(context, "com.android.email.activity.setup.AccountSetupFinal"));
     52         i.putExtra(EXTRA_FLOW_MODE, FLOW_MODE_NO_ACCOUNTS);
     53         return i;
     54     }
     55 
     56     public static Intent actionGetCreateAccountIntent(
     57             final Context context, final String accountManagerType) {
     58         final Intent i = new Intent();
     59         i.setComponent(
     60                 new ComponentName(context, "com.android.email.activity.setup.AccountSetupFinal"));
     61         i.putExtra(EXTRA_FLOW_MODE, FLOW_MODE_ACCOUNT_MANAGER);
     62         i.putExtra(EXTRA_FLOW_ACCOUNT_TYPE, accountManagerType);
     63         return i;
     64     }
     65 }