some style updates and removing redundant code

This commit is contained in:
Tibor Kaputa 2021-08-12 21:58:32 +02:00 committed by GitHub
parent 7f6015039f
commit 3398d582e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 12 deletions

View File

@ -613,7 +613,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
importIDs[it.importId] = it.startTS
}
val eventTypeId = if (birthdays) getBirthdaysEventTypeId() else getAnniversariesEventTypeId()
val eventTypeId = if (birthdays) eventsHelper.getBirthdaysEventTypeId() else eventsHelper.getAnniversariesEventTypeId()
val source = if (birthdays) SOURCE_CONTACT_BIRTHDAY else SOURCE_CONTACT_ANNIVERSARY
queryCursor(uri, projection, selection, selectionArgs, showErrors = true) { cursor ->
@ -625,9 +625,9 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
try {
val formatter = SimpleDateFormat(format, Locale.getDefault())
val date = formatter.parse(startDate)
val flags = if(format in yearDateFormats){
val flags = if (format in yearDateFormats) {
FLAG_ALL_DAY
}else {
} else {
FLAG_ALL_DAY or FLAG_MISSING_YEAR
}
@ -684,7 +684,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
try {
val eventTypeId = if (birthdays) getBirthdaysEventTypeId() else getAnniversariesEventTypeId()
val eventTypeId = if (birthdays) eventsHelper.getBirthdaysEventTypeId() else eventsHelper.getAnniversariesEventTypeId()
val source = if (birthdays) SOURCE_CONTACT_BIRTHDAY else SOURCE_CONTACT_ANNIVERSARY
val existingEvents = if (birthdays) eventsDB.getBirthdays() else eventsDB.getAnniversaries()
@ -746,14 +746,6 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
callback(eventsFound, eventsAdded)
}
private fun getBirthdaysEventTypeId(): Long {
return eventsHelper.getBirthdaysEventTypeId()
}
private fun getAnniversariesEventTypeId(): Long {
return eventsHelper.getAnniversariesEventTypeId()
}
private fun updateView(view: Int) {
calendar_fab.beVisibleIf(view != YEARLY_VIEW && view != WEEKLY_VIEW)
config.storedView = view