Tue, 10 Feb 2015 18:12:00 +0100
Import initial revisions of existing project AndroidCaldavSyncAdapater,
forked from upstream repository at 27e8a0f8495c92e0780d450bdf0c7cec77a03a55.
michael@0 | 1 | /** |
michael@0 | 2 | * Copyright (c) 2012-2013, Gerald Garcia |
michael@0 | 3 | * |
michael@0 | 4 | * This file is part of Andoid Caldav Sync Adapter Free. |
michael@0 | 5 | * |
michael@0 | 6 | * Andoid Caldav Sync Adapter Free is free software: you can redistribute |
michael@0 | 7 | * it and/or modify it under the terms of the GNU General Public License |
michael@0 | 8 | * as published by the Free Software Foundation, either version 3 of the |
michael@0 | 9 | * License, or at your option any later version. |
michael@0 | 10 | * |
michael@0 | 11 | * Andoid Caldav Sync Adapter Free is distributed in the hope that |
michael@0 | 12 | * it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
michael@0 | 13 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
michael@0 | 14 | * GNU General Public License for more details. |
michael@0 | 15 | * |
michael@0 | 16 | * You should have received a copy of the GNU General Public License |
michael@0 | 17 | * along with Andoid Caldav Sync Adapter Free. |
michael@0 | 18 | * If not, see <http://www.gnu.org/licenses/>. |
michael@0 | 19 | * |
michael@0 | 20 | */ |
michael@0 | 21 | |
michael@0 | 22 | package org.gege.caldavsyncadapter.authenticator; |
michael@0 | 23 | |
michael@0 | 24 | |
michael@0 | 25 | |
michael@0 | 26 | import android.accounts.AbstractAccountAuthenticator; |
michael@0 | 27 | import android.accounts.Account; |
michael@0 | 28 | import android.accounts.AccountAuthenticatorResponse; |
michael@0 | 29 | import android.accounts.AccountManager; |
michael@0 | 30 | import android.accounts.NetworkErrorException; |
michael@0 | 31 | import android.content.Context; |
michael@0 | 32 | import android.content.Intent; |
michael@0 | 33 | import android.os.Bundle; |
michael@0 | 34 | import android.util.Log; |
michael@0 | 35 | |
michael@0 | 36 | public class Authenticator extends AbstractAccountAuthenticator { |
michael@0 | 37 | |
michael@0 | 38 | private static final String TAG = "Authenticator"; |
michael@0 | 39 | private Context mContext; |
michael@0 | 40 | |
michael@0 | 41 | public Authenticator(Context context) { |
michael@0 | 42 | super(context); |
michael@0 | 43 | |
michael@0 | 44 | mContext = context; |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | @Override |
michael@0 | 48 | public Bundle addAccount(AccountAuthenticatorResponse response, |
michael@0 | 49 | String accountType, String authTokenType, |
michael@0 | 50 | String[] requiredFeatures, Bundle options) |
michael@0 | 51 | throws NetworkErrorException { |
michael@0 | 52 | |
michael@0 | 53 | |
michael@0 | 54 | Log.v(TAG, "addAccount()"); |
michael@0 | 55 | |
michael@0 | 56 | final Intent intent = new Intent(mContext, AuthenticatorActivity.class); |
michael@0 | 57 | intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); |
michael@0 | 58 | final Bundle bundle = new Bundle(); |
michael@0 | 59 | bundle.putParcelable(AccountManager.KEY_INTENT, intent); |
michael@0 | 60 | return bundle; |
michael@0 | 61 | |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | @Override |
michael@0 | 65 | public Bundle confirmCredentials(AccountAuthenticatorResponse response, |
michael@0 | 66 | Account account, Bundle options) throws NetworkErrorException { |
michael@0 | 67 | // TODO Auto-generated method stub |
michael@0 | 68 | return null; |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | @Override |
michael@0 | 72 | public Bundle editProperties(AccountAuthenticatorResponse response, |
michael@0 | 73 | String accountType) { |
michael@0 | 74 | // TODO Auto-generated method stub |
michael@0 | 75 | return null; |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | @Override |
michael@0 | 79 | public Bundle getAuthToken(AccountAuthenticatorResponse response, |
michael@0 | 80 | Account account, String authTokenType, Bundle options) |
michael@0 | 81 | throws NetworkErrorException { |
michael@0 | 82 | // TODO Auto-generated method stub |
michael@0 | 83 | return null; |
michael@0 | 84 | } |
michael@0 | 85 | |
michael@0 | 86 | @Override |
michael@0 | 87 | public String getAuthTokenLabel(String authTokenType) { |
michael@0 | 88 | // TODO Auto-generated method stub |
michael@0 | 89 | return null; |
michael@0 | 90 | } |
michael@0 | 91 | |
michael@0 | 92 | @Override |
michael@0 | 93 | public Bundle hasFeatures(AccountAuthenticatorResponse response, |
michael@0 | 94 | Account account, String[] features) throws NetworkErrorException { |
michael@0 | 95 | // TODO Auto-generated method stub |
michael@0 | 96 | return null; |
michael@0 | 97 | } |
michael@0 | 98 | |
michael@0 | 99 | @Override |
michael@0 | 100 | public Bundle updateCredentials(AccountAuthenticatorResponse response, |
michael@0 | 101 | Account account, String authTokenType, Bundle options) |
michael@0 | 102 | throws NetworkErrorException { |
michael@0 | 103 | // TODO Auto-generated method stub |
michael@0 | 104 | return null; |
michael@0 | 105 | } |
michael@0 | 106 | |
michael@0 | 107 | } |