...
 
Commits (6)
......@@ -132,8 +132,8 @@ public class Contact {
long timeZoneDiff = nextBirthday.getTimeZone().getOffset(nextBirthday.getTimeInMillis())
- now.getTimeZone().getOffset(now.getTimeInMillis());
long diffInMillies = nextBirthday.getTimeInMillis() - now.getTimeInMillis() + timeZoneDiff;
this.daysUntilNextBirthday = (int) TimeUnit.DAYS.convert(diffInMillies,
long diffInMillis = nextBirthday.getTimeInMillis() - now.getTimeInMillis() + timeZoneDiff;
this.daysUntilNextBirthday = (int) TimeUnit.DAYS.convert(diffInMillis,
TimeUnit.MILLISECONDS);
if (this.daysUntilNextBirthday < 0){
......@@ -144,14 +144,13 @@ public class Contact {
this.bornInFuture = this.bornOn.compareTo(now) >= 1 && !this.missingYearInfo;
diffInMillies = bornOn.getTimeInMillis() - now.getTimeInMillis();
this.daysOld = Math.abs((int) TimeUnit.DAYS.convert(diffInMillies,
diffInMillis = bornOn.getTimeInMillis() - now.getTimeInMillis();
this.daysOld = Math.abs((int) TimeUnit.DAYS.convert(diffInMillis,
TimeUnit.MILLISECONDS));
if (this.bornInFuture) {
this.age = 0;
this.daysOld = 0;
this.daysUntilNextBirthday = 0;
}
}
}
......@@ -256,7 +255,7 @@ public class Contact {
return this.zodiacElementSymbol;
}
public void setMissinYearInfo() {
public void setMissingYearInfo() {
this.missingYearInfo = true;
}
......
......@@ -162,11 +162,20 @@ public class ContactsDataAdapter extends RecyclerView.Adapter<ContactsDataAdapte
holder.lineTwo.setText(eventTypeLabel);
holder.lineThree.setText(partyMsg);
if (age == 0 && !contact.shallWePartyToday()) {
if(contact.shallWePartyToday()) {
holder.lineFour.setText(ctx.getResources().getQuantityString(
R.plurals.days_old, daysOld, daysOld));
R.plurals.years_old, age, age));
} else {
if (age == 1) {
holder.lineFour.setText(ctx.getResources().getQuantityString(
R.plurals.days_old, daysOld, daysOld));
} else if(age > 1) {
holder.lineFour.setText(ctx.getResources().getQuantityString(
R.plurals.years_old, age, age));
}
}
/* Zodiac Icons */
if (!hideZoadiac) {
status = status + " " + zodiacSign + " " + zodiacSignElement;
......
......@@ -140,11 +140,19 @@ public class NotificationHelper extends ContextWrapper {
if (contact.shallWePartyToday()) {
body.append(getBaseContext().getString(R.string.party_message));
} else {
body.append(getBaseContext().getResources().getQuantityString(
R.plurals.message_notification_message_bt_to_come,
contact.getDaysUntilNextBirthday(),
contact.getContactFirstName(), contact.getAge(),
contact.getDaysUntilNextBirthday()));
if(contact.getAge() > 0) {
body.append(getBaseContext().getResources().getQuantityString(
R.plurals.message_notification_message_bt_to_come,
contact.getDaysUntilNextBirthday(),
contact.getContactFirstName(), contact.getAge(),
contact.getDaysUntilNextBirthday()));
} else {
body.append(getBaseContext().getResources().getQuantityString(
R.plurals.message_notification_message_bt_to_come_no_age,
contact.getDaysUntilNextBirthday(),
contact.getContactFirstName(),
contact.getDaysUntilNextBirthday()));
}
}
/* Contact Picture */
......
......@@ -336,7 +336,7 @@ public class BirthdayDataProvider {
bornOn.setTime(bornOnDate);
if (!pattern.contains("y")) {
contact.setMissinYearInfo();
contact.setMissingYearInfo();
bornOn.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR));
}
......
......@@ -69,6 +69,11 @@
<item quantity="other">%1$s turning %2$d in %3$d days</item>
</plurals>
<plurals name="message_notification_message_bt_to_come_no_age">
<item quantity="one">%1$s\'s birthday is tomorrow</item>
<item quantity="other">%1$s\'s birthday is in %2$d days</item>
</plurals>
<string name="menu_birthday_list">Birthday List</string>
<string name="menu_settings">Settings</string>
<string name="menu_statistics_age">Age Statistics</string>
......