[Android] Fix BadParcelableException by using @Parcelize

Nicolas Pomepuy git at videolan.org
Tue Aug 13 10:27:07 CEST 2019


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Aug 12 08:56:38 2019 +0200| [f6f5c9d5ae1a6cdd26e6049b7cffd127e801bd16] | committer: Geoffrey Métais

Fix BadParcelableException by using @Parcelize

(cherry picked from commit c01d26bcf57d947de31c30f599d4ff5f0af61693)

> https://code.videolan.org/videolan/vlc-android/commit/f6f5c9d5ae1a6cdd26e6049b7cffd127e801bd16
---

 .../org/videolan/vlc/gui/tv/MediaItemDetails.kt    | 35 ++--------------------
 1 file changed, 3 insertions(+), 32 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetails.kt b/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetails.kt
index 20941ce48..8b47848eb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetails.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetails.kt
@@ -22,39 +22,10 @@ package org.videolan.vlc.gui.tv
 
 import android.os.Parcel
 import android.os.Parcelable
+import kotlinx.android.parcel.Parcelize
 
+ at Parcelize
 data class MediaItemDetails(var title: String? = null, var subTitle: String? = null,
                             var body: String? = null,
                             var location: String? = null,
-                            var artworkUrl: String? = null) : Parcelable {
-    constructor(parcel: Parcel) : this(
-            parcel.readString(),
-            parcel.readString(),
-            parcel.readString(),
-            parcel.readString(),
-            parcel.readString())
-
-    override fun writeToParcel(parcel: Parcel, flags: Int) {
-        parcel.writeString(title)
-        parcel.writeString(subTitle)
-        parcel.writeString(body)
-        parcel.writeString(location)
-        parcel.writeString(artworkUrl)
-    }
-
-    override fun describeContents(): Int {
-        return 0
-    }
-
-    companion object CREATOR : Parcelable.Creator<MediaItemDetails> {
-        override fun createFromParcel(parcel: Parcel): MediaItemDetails {
-            return MediaItemDetails(parcel)
-        }
-
-        override fun newArray(size: Int): Array<MediaItemDetails?> {
-            return arrayOfNulls(size)
-        }
-    }
-
-
-}
+                            var artworkUrl: String? = null) : Parcelable



More information about the Android mailing list