From 15fed32d92fe1444f489d8708e22f8db209a6dc8 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Sun, 4 Oct 2020 06:32:04 +0530 Subject: [PATCH] Convert SoftwareComponent to Kotlin and use the Parcelize annotation. --- .../newpipe/about/SoftwareComponent.java | 83 ------------------- .../schabi/newpipe/about/SoftwareComponent.kt | 16 ++++ 2 files changed, 16 insertions(+), 83 deletions(-) delete mode 100644 app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.java create mode 100644 app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.kt diff --git a/app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.java b/app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.java deleted file mode 100644 index 946945142..000000000 --- a/app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.schabi.newpipe.about; - -import android.os.Parcel; -import android.os.Parcelable; - -public class SoftwareComponent implements Parcelable { - public static final Creator CREATOR = new Creator() { - @Override - public SoftwareComponent createFromParcel(final Parcel source) { - return new SoftwareComponent(source); - } - - @Override - public SoftwareComponent[] newArray(final int size) { - return new SoftwareComponent[size]; - } - }; - - private final License license; - private final String name; - private final String years; - private final String copyrightOwner; - private final String link; - private final String version; - - public SoftwareComponent(final String name, final String years, final String copyrightOwner, - final String link, final License license) { - this.name = name; - this.years = years; - this.copyrightOwner = copyrightOwner; - this.link = link; - this.license = license; - this.version = null; - } - - protected SoftwareComponent(final Parcel in) { - this.name = in.readString(); - this.license = in.readParcelable(License.class.getClassLoader()); - this.copyrightOwner = in.readString(); - this.link = in.readString(); - this.years = in.readString(); - this.version = in.readString(); - } - - public String getName() { - return name; - } - - public String getYears() { - return years; - } - - public String getCopyrightOwner() { - return copyrightOwner; - } - - public String getLink() { - return link; - } - - public String getVersion() { - return version; - } - - public License getLicense() { - return license; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(final Parcel dest, final int flags) { - dest.writeString(name); - dest.writeParcelable(license, flags); - dest.writeString(copyrightOwner); - dest.writeString(link); - dest.writeString(years); - dest.writeString(version); - } -} diff --git a/app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.kt b/app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.kt new file mode 100644 index 000000000..2e967ebe8 --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/about/SoftwareComponent.kt @@ -0,0 +1,16 @@ +package org.schabi.newpipe.about + +import android.os.Parcelable +import kotlinx.android.parcel.Parcelize + +@Parcelize +class SoftwareComponent +@JvmOverloads +constructor( + val name: String, + val years: String, + val copyrightOwner: String, + val link: String, + val license: License, + val version: String? = null +) : Parcelable