X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/9e0f02131f17a2494d84886570617fd0dddb3530..d95d2ac85680c0dcb8a2d863d809c40b64a5808d:/src/com/owncloud/android/authentication/OwnCloudAccount.java
diff --git a/src/com/owncloud/android/authentication/OwnCloudAccount.java b/src/com/owncloud/android/authentication/OwnCloudAccount.java
index 35146a4f..4e819b90 100644
--- a/src/com/owncloud/android/authentication/OwnCloudAccount.java
+++ b/src/com/owncloud/android/authentication/OwnCloudAccount.java
@@ -1,82 +1,61 @@
-/* ownCloud Android Library is available under MIT license
- * Copyright (C) 2014 ownCloud (http://www.owncloud.org/)
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
+/* ownCloud Android client application
+ * Copyright (C) 2014 ownCloud Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*
*/
package com.owncloud.android.authentication;
+import com.owncloud.android.lib.common.OwnCloudCredentials;
+
import android.accounts.Account;
-import android.os.Parcel;
-import android.os.Parcelable;
+import android.content.Context;
+import android.net.Uri;
/**
- * Account with extra information specific for ownCloud accounts.
- *
- * TODO integrate in the main app
+ * OwnCloud Account
*
* @author David A. Velasco
*/
-public class OwnCloudAccount extends Account {
-
- private String mAuthTokenType;
+public class OwnCloudAccount {
- public OwnCloudAccount(String name, String type, String authTokenType) {
- super(name, type);
- // TODO validate authTokentype as supported
- mAuthTokenType = authTokenType;
- }
-
- /**
- * Reconstruct from parcel
- *
- * @param source The source parcel
- */
- public OwnCloudAccount(Parcel source) {
- super(source);
- mAuthTokenType = source.readString();
- }
-
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- super.writeToParcel(dest, flags);
- dest.writeString(mAuthTokenType);
+ private Uri mBaseUri;
+
+ private OwnCloudCredentials mCredentials;
+
+ public OwnCloudAccount(Account savedAccount, Context context) {
+
}
-
-
- public String getAuthTokenType() {
- return mAuthTokenType;
- }
-
-
- public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
- @Override
- public OwnCloudAccount createFromParcel(Parcel source) {
- return new OwnCloudAccount(source);
+
+ public OwnCloudAccount(Uri baseUri, OwnCloudCredentials credentials) {
+ if (baseUri == null) {
+ throw new IllegalArgumentException("Parameter 'baseUri' cannot be null");
}
+ mBaseUri = baseUri;
+ mCredentials = credentials;
+ }
+
+ public boolean isAnonymous() {
+ return (mCredentials == null);
+ }
+
+ public Uri getBaseUri() {
+ return mBaseUri;
+ }
+
+ public OwnCloudCredentials getCredentials() {
+ return mCredentials;
+ }
- @Override
- public OwnCloudAccount [] newArray(int size) {
- return new OwnCloudAccount[size];
- }
- };
-
}