diff options
author | git-vdr <herrlado@gmail.com> | 2011-10-04 01:31:20 +0200 |
---|---|---|
committer | git-vdr <herrlado@gmail.com> | 2011-10-04 01:31:20 +0200 |
commit | 45e28f9e43293533662612d1340b05467862cce2 (patch) | |
tree | 07f792798f767c1d6709c480ba7b29533574f113 | |
parent | 20d16dde17050f0cf875be0be9711df4f3a841e2 (diff) | |
download | vdr-manager-45e28f9e43293533662612d1340b05467862cce2.tar.gz vdr-manager-45e28f9e43293533662612d1340b05467862cce2.tar.bz2 |
added Parcelable interface + removed provider from toString()
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java index 29215e4..eeda768 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java @@ -1,6 +1,9 @@ package de.bjusystems.vdrmanager.data; -public class Channel { +import android.os.Parcel; +import android.os.Parcelable; + +public class Channel implements Parcelable { private final int number; private final String name; @@ -24,6 +27,12 @@ public class Channel { this.provider = "Unknown"; } + public Channel(Parcel in) { + this.number = in.readInt(); + this.name = in.readString(); + this.provider = in.readString(); + } + public boolean isGroupSeparator() { return number == 0; } @@ -46,8 +55,28 @@ public class Channel { text.append(number); text.append(" - "); text.append(name); - text.append(" : "); - text.append(provider); + // text.append(" : "); + // text.append(provider); return text.toString(); } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(number); + dest.writeString(name); + dest.writeString(provider); + } + + public static final Parcelable.Creator<Channel> CREATOR = new Parcelable.Creator<Channel>() { + public Channel createFromParcel(Parcel in) { + return new Channel(in); + } + + public Channel[] newArray(int size) { + return new Channel[size]; + } + }; } |