Fix task deserialization issue

This commit is contained in:
Phillip Thelen 2018-09-18 11:30:15 +02:00
parent fe90b25010
commit f18943eabe
3 changed files with 10 additions and 5 deletions

View file

@ -21,6 +21,10 @@ open class Task : RealmObject, Parcelable {
@PrimaryKey
@SerializedName("_id")
var id: String? = null
set(value) {
field = value
repeat?.taskId = value
}
var userId: String = ""
var priority: Float = 0.0f
var text: String = ""

View file

@ -29,6 +29,7 @@ public class SubscriptionPlan extends RealmObject {
public Integer gemsBought;
public Integer extraMonths;
public Integer quantity;
@Nullable
public SubscriptionPlanConsecutive consecutive;
public int mysteryItemCount;
@ -39,7 +40,7 @@ public class SubscriptionPlan extends RealmObject {
}
public int totalNumberOfGems() {
if (customerId == null) {
if (customerId == null || consecutive == null) {
return 0;
}
return 25 + consecutive.getGemCapExtra();

View file

@ -75,13 +75,13 @@ class SubscriptionDetailsView : LinearLayout {
paymentProcessorTextView.text = plan.paymentMethod
if (plan.consecutive.count == 1) {
if (plan.consecutive?.count == 1) {
monthsSubscribedTextView.text = resources.getString(R.string.one_month)
} else {
monthsSubscribedTextView.text = resources.getString(R.string.months, plan.consecutive.count)
monthsSubscribedTextView.text = resources.getString(R.string.months, plan.consecutive?.count ?: 0)
}
gemCapTextView.text = (plan.consecutive.gemCapExtra + 25).toString()
currentHourglassesTextView.text = plan.consecutive.trinkets.toString()
gemCapTextView.text = (plan.consecutive?.gemCapExtra ?: 0 + 25).toString()
currentHourglassesTextView.text = plan.consecutive?.trinkets.toString()
if (plan.paymentMethod != null) {
if (plan.paymentMethod == "Google") {