1
0
mirror of https://github.com/etesync/android synced 2024-11-26 09:58:11 +00:00
This commit is contained in:
Tom Hacohen 2019-01-06 15:43:47 +00:00
parent 576fb262a7
commit ad4f92deef
3 changed files with 9 additions and 7 deletions

View File

@ -68,7 +68,7 @@ class CalendarsSyncAdapterService : SyncAdapterService() {
val principal = HttpUrl.get(settings.uri!!)!! val principal = HttpUrl.get(settings.uri!!)!!
for (calendar in AndroidCalendar.find(account, provider, LocalCalendar.Factory, CalendarContract.Calendars.SYNC_EVENTS + "!=0", null) as Array<LocalCalendar>) { for (calendar in AndroidCalendar.find(account, provider, LocalCalendar.Factory, CalendarContract.Calendars.SYNC_EVENTS + "!=0", null)) {
App.log.info("Synchronizing calendar #" + calendar.id + ", URL: " + calendar.name) App.log.info("Synchronizing calendar #" + calendar.id + ", URL: " + calendar.name)
val syncManager = CalendarSyncManager(context, account, settings, extras, authority, syncResult, calendar, principal) val syncManager = CalendarSyncManager(context, account, settings, extras, authority, syncResult, calendar, principal)
syncManager.performSync() syncManager.performSync()
@ -118,7 +118,7 @@ class CalendarsSyncAdapterService : SyncAdapterService() {
remote[journalEntity.uid] = journalEntity remote[journalEntity.uid] = journalEntity
} }
val local = AndroidCalendar.find(account, provider, LocalCalendar.Factory, null, null) as Array<LocalCalendar> val local = AndroidCalendar.find(account, provider, LocalCalendar.Factory, null, null)
val updateColors = settings.manageCalendarColors val updateColors = settings.manageCalendarColors

View File

@ -448,7 +448,7 @@ constructor(protected val context: Context, protected val account: Account, prot
val entry = SyncEntry(local.content, action) val entry = SyncEntry(local.content, action)
val tmp = JournalEntryManager.Entry() val tmp = JournalEntryManager.Entry()
tmp.update(crypto, entry.toJson(), previousEntry!!) tmp.update(crypto, entry.toJson(), previousEntry)
previousEntry = tmp previousEntry = tmp
localEntries!!.add(previousEntry) localEntries!!.add(previousEntry)

View File

@ -314,11 +314,11 @@ class JournalItemActivity : BaseActivity(), Refreshable {
// ANNIVERSARY // ANNIVERSARY
if (contact.anniversary != null) { if (contact.anniversary != null) {
addInfoItem(view.context, aboutCard, getString(R.string.journal_item_anniversary), null, getDisplayedDate(contact.anniversary?.date, contact.anniversary?.partialDate!!)) addInfoItem(view.context, aboutCard, getString(R.string.journal_item_anniversary), null, getDisplayedDate(contact.anniversary?.date, contact.anniversary?.partialDate))
} }
// BDAY // BDAY
if (contact.birthDay != null) { if (contact.birthDay != null) {
addInfoItem(view.context, aboutCard, getString(R.string.journal_item_birthday), null, getDisplayedDate(contact.birthDay?.date, contact.birthDay?.partialDate!!)) addInfoItem(view.context, aboutCard, getString(R.string.journal_item_birthday), null, getDisplayedDate(contact.birthDay?.date, contact.birthDay?.partialDate))
} }
// RELATED // RELATED
@ -333,17 +333,19 @@ class JournalItemActivity : BaseActivity(), Refreshable {
} }
} }
private fun getDisplayedDate(date: Date?, partialDate: PartialDate): String? { private fun getDisplayedDate(date: Date?, partialDate: PartialDate?): String? {
if (date != null) { if (date != null) {
val epochDate = date.time val epochDate = date.time
return getDisplayedDatetime(epochDate, epochDate, true, context) return getDisplayedDatetime(epochDate, epochDate, true, context)
} else { } else if (partialDate != null){
val formatter = SimpleDateFormat("d MMMM", Locale.getDefault()) val formatter = SimpleDateFormat("d MMMM", Locale.getDefault())
val calendar = GregorianCalendar() val calendar = GregorianCalendar()
calendar.set(Calendar.DAY_OF_MONTH, partialDate.date!!) calendar.set(Calendar.DAY_OF_MONTH, partialDate.date!!)
calendar.set(Calendar.MONTH, partialDate.month!! - 1) calendar.set(Calendar.MONTH, partialDate.month!! - 1)
return formatter.format(calendar.time) return formatter.format(calendar.time)
} }
return null
} }
companion object { companion object {