Add balance to HabitRPGUser model + use it to set gem text on header

This commit is contained in:
Mickael Goubin 2015-11-01 22:37:51 +01:00
parent 9bfe1ff7c5
commit ee8fee9802
2 changed files with 10 additions and 2 deletions

View file

@ -109,7 +109,7 @@ public class AvatarWithBarsViewModel {
goldText.setText(gp+"");
silverText.setText(sp+"");
gemsText.setText("?");
gemsText.setText(user.getBalance()*4+"");
}
public static void setHpBarData(ValueBarBinding valueBar, Stats stats, Context ctx)

View file

@ -31,7 +31,7 @@ public class HabitRPGUser extends BaseModel {
List<Task> rewards;
List<Task> habits;
List<Tag> tags;
private int balance;
@Column
@ForeignKey(references = {@ForeignKeyReference(columnName = "stats_id",
columnType = Long.class,
@ -132,6 +132,14 @@ public class HabitRPGUser extends BaseModel {
this.items = items;
}
public void setBalance(int balance) {
this.balance=balance;
}
public int getBalance() {
return this.balance;
}
@OneToMany(methods = {OneToMany.Method.SAVE, OneToMany.Method.DELETE}, variableName = "habits")
public List<Task> getHabits() {
if(habits == null) {