35146a4fb8dfe46c9222acf30fc9f1761fe17a74
[pub/Android/ownCloud.git] / src / com / owncloud / android / authentication / OwnCloudAccount.java
1 /* ownCloud Android Library is available under MIT license
2 * Copyright (C) 2014 ownCloud (http://www.owncloud.org/)
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 *
23 */
24
25 package com.owncloud.android.authentication;
26
27 import android.accounts.Account;
28 import android.os.Parcel;
29 import android.os.Parcelable;
30
31 /**
32 * Account with extra information specific for ownCloud accounts.
33 *
34 * TODO integrate in the main app
35 *
36 * @author David A. Velasco
37 */
38 public class OwnCloudAccount extends Account {
39
40 private String mAuthTokenType;
41
42 public OwnCloudAccount(String name, String type, String authTokenType) {
43 super(name, type);
44 // TODO validate authTokentype as supported
45 mAuthTokenType = authTokenType;
46 }
47
48 /**
49 * Reconstruct from parcel
50 *
51 * @param source The source parcel
52 */
53 public OwnCloudAccount(Parcel source) {
54 super(source);
55 mAuthTokenType = source.readString();
56 }
57
58 @Override
59 public void writeToParcel(Parcel dest, int flags) {
60 super.writeToParcel(dest, flags);
61 dest.writeString(mAuthTokenType);
62 }
63
64
65 public String getAuthTokenType() {
66 return mAuthTokenType;
67 }
68
69
70 public static final Parcelable.Creator<OwnCloudAccount> CREATOR = new Parcelable.Creator<OwnCloudAccount>() {
71 @Override
72 public OwnCloudAccount createFromParcel(Parcel source) {
73 return new OwnCloudAccount(source);
74 }
75
76 @Override
77 public OwnCloudAccount [] newArray(int size) {
78 return new OwnCloudAccount[size];
79 }
80 };
81
82 }