1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/org/gege/caldavsyncadapter/authenticator/Authenticator.java Tue Feb 10 18:12:00 2015 +0100 1.3 @@ -0,0 +1,107 @@ 1.4 +/** 1.5 + * Copyright (c) 2012-2013, Gerald Garcia 1.6 + * 1.7 + * This file is part of Andoid Caldav Sync Adapter Free. 1.8 + * 1.9 + * Andoid Caldav Sync Adapter Free is free software: you can redistribute 1.10 + * it and/or modify it under the terms of the GNU General Public License 1.11 + * as published by the Free Software Foundation, either version 3 of the 1.12 + * License, or at your option any later version. 1.13 + * 1.14 + * Andoid Caldav Sync Adapter Free is distributed in the hope that 1.15 + * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 1.16 + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.17 + * GNU General Public License for more details. 1.18 + * 1.19 + * You should have received a copy of the GNU General Public License 1.20 + * along with Andoid Caldav Sync Adapter Free. 1.21 + * If not, see <http://www.gnu.org/licenses/>. 1.22 + * 1.23 + */ 1.24 + 1.25 +package org.gege.caldavsyncadapter.authenticator; 1.26 + 1.27 + 1.28 + 1.29 +import android.accounts.AbstractAccountAuthenticator; 1.30 +import android.accounts.Account; 1.31 +import android.accounts.AccountAuthenticatorResponse; 1.32 +import android.accounts.AccountManager; 1.33 +import android.accounts.NetworkErrorException; 1.34 +import android.content.Context; 1.35 +import android.content.Intent; 1.36 +import android.os.Bundle; 1.37 +import android.util.Log; 1.38 + 1.39 +public class Authenticator extends AbstractAccountAuthenticator { 1.40 + 1.41 + private static final String TAG = "Authenticator"; 1.42 + private Context mContext; 1.43 + 1.44 + public Authenticator(Context context) { 1.45 + super(context); 1.46 + 1.47 + mContext = context; 1.48 + } 1.49 + 1.50 + @Override 1.51 + public Bundle addAccount(AccountAuthenticatorResponse response, 1.52 + String accountType, String authTokenType, 1.53 + String[] requiredFeatures, Bundle options) 1.54 + throws NetworkErrorException { 1.55 + 1.56 + 1.57 + Log.v(TAG, "addAccount()"); 1.58 + 1.59 + final Intent intent = new Intent(mContext, AuthenticatorActivity.class); 1.60 + intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); 1.61 + final Bundle bundle = new Bundle(); 1.62 + bundle.putParcelable(AccountManager.KEY_INTENT, intent); 1.63 + return bundle; 1.64 + 1.65 + } 1.66 + 1.67 + @Override 1.68 + public Bundle confirmCredentials(AccountAuthenticatorResponse response, 1.69 + Account account, Bundle options) throws NetworkErrorException { 1.70 + // TODO Auto-generated method stub 1.71 + return null; 1.72 + } 1.73 + 1.74 + @Override 1.75 + public Bundle editProperties(AccountAuthenticatorResponse response, 1.76 + String accountType) { 1.77 + // TODO Auto-generated method stub 1.78 + return null; 1.79 + } 1.80 + 1.81 + @Override 1.82 + public Bundle getAuthToken(AccountAuthenticatorResponse response, 1.83 + Account account, String authTokenType, Bundle options) 1.84 + throws NetworkErrorException { 1.85 + // TODO Auto-generated method stub 1.86 + return null; 1.87 + } 1.88 + 1.89 + @Override 1.90 + public String getAuthTokenLabel(String authTokenType) { 1.91 + // TODO Auto-generated method stub 1.92 + return null; 1.93 + } 1.94 + 1.95 + @Override 1.96 + public Bundle hasFeatures(AccountAuthenticatorResponse response, 1.97 + Account account, String[] features) throws NetworkErrorException { 1.98 + // TODO Auto-generated method stub 1.99 + return null; 1.100 + } 1.101 + 1.102 + @Override 1.103 + public Bundle updateCredentials(AccountAuthenticatorResponse response, 1.104 + Account account, String authTokenType, Bundle options) 1.105 + throws NetworkErrorException { 1.106 + // TODO Auto-generated method stub 1.107 + return null; 1.108 + } 1.109 + 1.110 +}