// Path: app/src/main/java/com/itheima/mobilesafe/utils/Constants.java
// public class Constants {
//     //Tags of the fragments
//     public final static int ANTI_THEFT_FRAG = 0;
//     public final static int APPS_MAG_FRAG = 2;
//     public final static int TASK_FRAG = 3;
//     public final static int A_TOOLS_FRAG = 7;
//     public final static int SETTINGS_FRAG = 8;
//     public final static int SETUP1_FRAG = 9;
//     public final static int SETUP2_FRAG = 10;
//     public final static int SETUP3_FRAG = 11;
//     public final static int SETUP4_FRAG = 12;
//     public final static int SETUP_FRAG = 13;
//     public final static int CONTACTS_FRAG = 14;
//     public final static int NUM_ADDRESS_QUERY_FRAG = 15;
//     public final static int BLACKLIST_FRAG = 16;
//     public final static int TRAFFIC_MAG_FRAG = 17;
//     public final static int ANTI_VIRUS_FRAG = 18;
//     public final static int CLEAR_CACHE_FRAG = 19;
// 
//     //activity request code
//     public final static int REQUEST_CODE_ENABLE_ADMIN = 10001;
//     public final static int PERMISSION_OVERLAY = 10002;
//     public final static int PERMISSION_WRITE_SETTINGS = 10003;
//     public final static int CHANGEING_DEFAULT_SMS_APP = 10004;
//     public final static int ACCOUNT_KIT_REQ_CODE = 10005;
//     public final static int UNINSTASLL_APP = 10006;
//     public final static int OPEN_SETTINGS = 10007;
//     public final static int ACCESS_PERMISSION = 10008;
// 
//     //response code
//     public static final int FAILED_TO_SEND = 0;
//     public static final int SENT_SUCCESSFULLY = 1;
//     public static final int TIMEOUT = 2;
// 
//     public static String[] addressBgs = new String[]{"半透明", "活力橙", "卫士蓝", "金属灰", "苹果绿"};
//     public static int[] addressBgRes = new int[]{R.drawable.call_locate_white, R.drawable.call_locate_orange, R.drawable.call_locate_blue, R.drawable.call_locate_gray, R.drawable.call_locate_green};
// 
//     //Login
//     public final static int NONE = 0;
//     public final static int ACCOUNTKIT = 1;
//     public final static int FB = 2;
//     public final static int GOOGLE = 3;
//     public final static int SINA = 4;
//     public final static int QQ = 5;
//     public final static int WEIBO = 6;
//     public final static int WECHAT = 7;
//     public static String[] loginAccounts = new String[]{"NONE", "AccountKit", "Facebook", "Google", "Sina", "QQ", "Weibo", "WeChat"};
// }


import android.app.Activity;
import android.content.Intent;
import com.facebook.accountkit.AccessToken;
import com.facebook.accountkit.AccountKit;
import com.facebook.accountkit.ui.AccountKitActivity;
import com.facebook.accountkit.ui.AccountKitConfiguration;
import com.facebook.accountkit.ui.LoginType;
import com.itheima.mobilesafe.utils.Constants;
package com.itheima.mobilesafe.utils.login;



/**
 * Created by Catherine on 2016/10/19.
 * Soft-World Inc.
 * catherine919@soft-world.com.tw
 */

public class AccountKitUtils implements BaseLogin {

    @Override
    public void login(Activity activity, Object TYPE) {
        final Intent intent = new Intent(activity, AccountKitActivity.class);
        AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder =
                new AccountKitConfiguration.AccountKitConfigurationBuilder(
                        (LoginType) TYPE,
                        AccountKitActivity.ResponseType.TOKEN); // or .ResponseType.TOKEN
        configurationBuilder.setDefaultCountryCode("TW");
        configurationBuilder.setFacebookNotificationsEnabled(true);
        final AccountKitConfiguration configuration = configurationBuilder.build();
        intent.putExtra(
                AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
                configuration);
        activity.startActivityForResult(intent, Constants.ACCOUNT_KIT_REQ_CODE);
    }

    @Override
    public void logout() {
        AccountKit.logOut();
    }

    @Override
// Path: app/src/main/java/com/itheima/mobilesafe/utils/Constants.java
// public class Constants {
//     //Tags of the fragments
//     public final static int ANTI_THEFT_FRAG = 0;
//     public final static int APPS_MAG_FRAG = 2;
//     public final static int TASK_FRAG = 3;
//     public final static int A_TOOLS_FRAG = 7;
//     public final static int SETTINGS_FRAG = 8;
//     public final static int SETUP1_FRAG = 9;
//     public final static int SETUP2_FRAG = 10;
//     public final static int SETUP3_FRAG = 11;
//     public final static int SETUP4_FRAG = 12;
//     public final static int SETUP_FRAG = 13;
//     public final static int CONTACTS_FRAG = 14;
//     public final static int NUM_ADDRESS_QUERY_FRAG = 15;
//     public final static int BLACKLIST_FRAG = 16;
//     public final static int TRAFFIC_MAG_FRAG = 17;
//     public final static int ANTI_VIRUS_FRAG = 18;
//     public final static int CLEAR_CACHE_FRAG = 19;
// 
//     //activity request code
//     public final static int REQUEST_CODE_ENABLE_ADMIN = 10001;
//     public final static int PERMISSION_OVERLAY = 10002;
//     public final static int PERMISSION_WRITE_SETTINGS = 10003;
//     public final static int CHANGEING_DEFAULT_SMS_APP = 10004;
//     public final static int ACCOUNT_KIT_REQ_CODE = 10005;
//     public final static int UNINSTASLL_APP = 10006;
//     public final static int OPEN_SETTINGS = 10007;
//     public final static int ACCESS_PERMISSION = 10008;
// 
//     //response code
//     public static final int FAILED_TO_SEND = 0;
//     public static final int SENT_SUCCESSFULLY = 1;
//     public static final int TIMEOUT = 2;
// 
//     public static String[] addressBgs = new String[]{"半透明", "活力橙", "卫士蓝", "金属灰", "苹果绿"};
//     public static int[] addressBgRes = new int[]{R.drawable.call_locate_white, R.drawable.call_locate_orange, R.drawable.call_locate_blue, R.drawable.call_locate_gray, R.drawable.call_locate_green};
// 
//     //Login
//     public final static int NONE = 0;
//     public final static int ACCOUNTKIT = 1;
//     public final static int FB = 2;
//     public final static int GOOGLE = 3;
//     public final static int SINA = 4;
//     public final static int QQ = 5;
//     public final static int WEIBO = 6;
//     public final static int WECHAT = 7;
//     public static String[] loginAccounts = new String[]{"NONE", "AccountKit", "Facebook", "Google", "Sina", "QQ", "Weibo", "WeChat"};
// }


// Path: app/src/main/java/com/itheima/mobilesafe/utils/login/AccountKitUtils.java
import android.app.Activity;
import android.content.Intent;
import com.facebook.accountkit.AccessToken;
import com.facebook.accountkit.AccountKit;
import com.facebook.accountkit.ui.AccountKitActivity;
import com.facebook.accountkit.ui.AccountKitConfiguration;
import com.facebook.accountkit.ui.LoginType;
import com.itheima.mobilesafe.utils.Constants;

package com.itheima.mobilesafe.utils.login;



/**
 * Created by Catherine on 2016/10/19.
 * Soft-World Inc.
 * catherine919@soft-world.com.tw
 */

public class AccountKitUtils implements BaseLogin {

    @Override
    public void login(Activity activity, Object TYPE) {
        final Intent intent = new Intent(activity, AccountKitActivity.class);
        AccountKitConfiguration.AccountKitConfigurationBuilder configurationBuilder =
                new AccountKitConfiguration.AccountKitConfigurationBuilder(
                        (LoginType) TYPE,
                        AccountKitActivity.ResponseType.TOKEN); // or .ResponseType.TOKEN
        configurationBuilder.setDefaultCountryCode("TW");
        configurationBuilder.setFacebookNotificationsEnabled(true);
        final AccountKitConfiguration configuration = configurationBuilder.build();
        intent.putExtra(
                AccountKitActivity.ACCOUNT_KIT_ACTIVITY_CONFIGURATION,
                configuration);
        activity.startActivityForResult(intent, Constants.ACCOUNT_KIT_REQ_CODE);
    }

    @Override
    public void logout() {
        AccountKit.logOut();
    }

    @Override
    public boolean isLogin() {