fedilab-Android-App/app/src/main/java/app/fedilab/android/client/Entities/PollOptions.java

87 lines
2.4 KiB
Java
Raw Normal View History

2019-05-18 11:10:30 +02:00
package app.fedilab.android.client.Entities;
2019-03-24 16:38:12 +01:00
/* Copyright 2019 Thomas Schneider
*
2019-05-18 11:10:30 +02:00
* This file is a part of Fedilab
2019-03-24 16:38:12 +01:00
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
2019-05-18 11:10:30 +02:00
* Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
2019-03-24 16:38:12 +01:00
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
2019-05-18 11:10:30 +02:00
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
2019-03-24 16:38:12 +01:00
* see <http://www.gnu.org/licenses>. */
import android.os.Parcel;
import android.os.Parcelable;
2019-11-03 14:16:08 +01:00
import android.text.SpannableString;
import android.text.TextUtils;
2019-03-24 16:38:12 +01:00
public class PollOptions implements Parcelable {
2019-11-15 16:32:25 +01:00
public static final Creator<PollOptions> CREATOR = new Creator<PollOptions>() {
@Override
public PollOptions createFromParcel(Parcel source) {
return new PollOptions(source);
}
@Override
public PollOptions[] newArray(int size) {
return new PollOptions[size];
}
};
private String title;
private SpannableString titleSpan;
private int votes_count;
public PollOptions() {
}
2020-03-08 10:29:06 +01:00
2019-11-15 16:32:25 +01:00
protected PollOptions(Parcel in) {
this.title = in.readString();
this.votes_count = in.readInt();
this.titleSpan = (SpannableString) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
}
2019-03-24 16:38:12 +01:00
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getVotes_count() {
return votes_count;
}
public void setVotes_count(int votes_count) {
this.votes_count = votes_count;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.title);
dest.writeInt(this.votes_count);
2019-11-03 14:16:08 +01:00
TextUtils.writeToParcel(this.titleSpan, dest, flags);
2019-03-24 16:38:12 +01:00
}
2019-11-03 14:16:08 +01:00
public SpannableString getTitleSpan() {
2020-06-19 17:17:17 +02:00
if (titleSpan == null) {
2020-06-16 20:09:29 +02:00
titleSpan = new SpannableString(title);
}
2019-11-03 14:16:08 +01:00
return titleSpan;
}
2020-05-07 16:16:54 +02:00
void setTitleSpan(SpannableString titleSpan) {
2019-11-03 14:16:08 +01:00
this.titleSpan = titleSpan;
}
2019-03-24 16:38:12 +01:00
}