TestModels.kt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Nextcloud Android client application
  3. *
  4. * @author Alper Ozturk
  5. * Copyright (C) 2024 Alper Ozturk
  6. * Copyright (C) 2024 Nextcloud GmbH
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. */
  21. package com.nextcloud.test.model
  22. import android.os.Parcel
  23. import android.os.Parcelable
  24. import kotlinx.parcelize.Parcelize
  25. import java.io.Serializable
  26. @Parcelize
  27. class OtherTestData : Parcelable
  28. data class TestData(val message: String) : Serializable
  29. data class TestDataParcelable(val message: String) : Parcelable {
  30. constructor(parcel: Parcel) : this(parcel.readString() ?: "")
  31. override fun writeToParcel(parcel: Parcel, flags: Int) {
  32. parcel.writeString(message)
  33. }
  34. override fun describeContents(): Int {
  35. return 0
  36. }
  37. companion object CREATOR : Parcelable.Creator<TestDataParcelable> {
  38. override fun createFromParcel(parcel: Parcel): TestDataParcelable {
  39. return TestDataParcelable(parcel)
  40. }
  41. override fun newArray(size: Int): Array<TestDataParcelable?> {
  42. return arrayOfNulls(size)
  43. }
  44. }
  45. }