TaskItemModelにフィールド追加

This commit is contained in:
rca 2024-06-29 11:27:46 +09:00
parent 9ef445e9fc
commit 931786320d

View File

@ -4,6 +4,9 @@ import android.graphics.Color;
import androidx.annotation.NonNull;
import java.util.List;
import one.nem.kidshift.model.ChildModel;
import one.nem.kidshift.model.tasks.condition.TaskConditionBaseModel;
public class TaskItemModel {
@ -13,36 +16,41 @@ public class TaskItemModel {
private String iconEmoji; // Optional
private String bgColor; // Optional
private int reward;
private List<ChildModel> attachedChildren; // Optional
// コンストラクタ
// 全プロパティ
public TaskItemModel(String id, String name, String iconEmoji, String bgColor, int reward) {
public TaskItemModel(String id, String name, String iconEmoji, String bgColor, int reward, List<ChildModel> attachedChildren) {
this.id = id;
this.name = name;
this.iconEmoji = iconEmoji;
this.bgColor = bgColor;
this.reward = reward;
this.attachedChildren = attachedChildren;
}
// IDなし (登録時など)
public TaskItemModel(String name, String iconEmoji, String bgColor, int reward) {
public TaskItemModel(String name, String iconEmoji, String bgColor, int reward, List<ChildModel> attachedChildren) {
this.name = name;
this.iconEmoji = iconEmoji;
this.bgColor = bgColor;
this.reward = reward;
this.attachedChildren = attachedChildren;
}
// Optionalなフィールドなし
public TaskItemModel(String id, String name, int reward) {
public TaskItemModel(String id, String name, int reward, List<ChildModel> attachedChildren) {
this.id = id;
this.name = name;
this.reward = reward;
this.attachedChildren = attachedChildren;
}
// ID, Optionalなフィールドなし (登録時など)
public TaskItemModel(String name, int reward) {
public TaskItemModel(String name, int reward, List<ChildModel> attachedChildren) {
this.name = name;
this.reward = reward;
this.attachedChildren = attachedChildren;
}
//
@ -97,4 +105,12 @@ public class TaskItemModel {
public void setBgColorInt(int color) {
this.bgColor = String.format("#%06X", 0xFFFFFF & color);
}
public List<ChildModel> getAttachedChildren() {
return attachedChildren;
}
public void setAttachedChildren(List<ChildModel> attachedChildren) {
this.attachedChildren = attachedChildren;
}
}