OwnCloudAccount.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* ownCloud Android client application
  2. * Copyright (C) 2014 ownCloud Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. package com.owncloud.android.authentication;
  18. import android.accounts.Account;
  19. import android.os.Parcel;
  20. import android.os.Parcelable;
  21. /**
  22. * Account with extra information specific for ownCloud accounts.
  23. *
  24. * TODO integrate in the main app
  25. *
  26. * @author David A. Velasco
  27. */
  28. public class OwnCloudAccount extends Account {
  29. private String mAuthTokenType;
  30. public OwnCloudAccount(String name, String type, String authTokenType) {
  31. super(name, type);
  32. // TODO validate authTokentype as supported
  33. mAuthTokenType = authTokenType;
  34. }
  35. /**
  36. * Reconstruct from parcel
  37. *
  38. * @param source The source parcel
  39. */
  40. public OwnCloudAccount(Parcel source) {
  41. super(source);
  42. mAuthTokenType = source.readString();
  43. }
  44. @Override
  45. public void writeToParcel(Parcel dest, int flags) {
  46. super.writeToParcel(dest, flags);
  47. dest.writeString(mAuthTokenType);
  48. }
  49. public String getAuthTokenType() {
  50. return mAuthTokenType;
  51. }
  52. public static final Parcelable.Creator<OwnCloudAccount> CREATOR = new Parcelable.Creator<OwnCloudAccount>() {
  53. @Override
  54. public OwnCloudAccount createFromParcel(Parcel source) {
  55. return new OwnCloudAccount(source);
  56. }
  57. @Override
  58. public OwnCloudAccount [] newArray(int size) {
  59. return new OwnCloudAccount[size];
  60. }
  61. };
  62. }