From 45e28f9e43293533662612d1340b05467862cce2 Mon Sep 17 00:00:00 2001 From: git-vdr Date: Tue, 4 Oct 2011 01:31:20 +0200 Subject: added Parcelable interface + removed provider from toString() --- .../src/de/bjusystems/vdrmanager/data/Channel.java | 35 ++++++++++++++++++++-- 1 file 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 CREATOR = new Parcelable.Creator() { + public Channel createFromParcel(Parcel in) { + return new Channel(in); + } + + public Channel[] newArray(int size) { + return new Channel[size]; + } + }; } -- cgit v1.2.3