formatting some files, no real change

This commit is contained in:
tibbi 2020-05-04 22:41:34 +02:00
parent afcb9825b3
commit 42230c5639
5 changed files with 109 additions and 109 deletions

View File

@ -302,7 +302,7 @@ class EventActivity : SimpleActivity() {
mRepeatLimit = getLong(REPEAT_LIMIT)
mAttendees = Gson().fromJson<ArrayList<Attendee>>(getString(ATTENDEES), object : TypeToken<List<Attendee>>() {}.type)
?: ArrayList()
?: ArrayList()
mEventTypeId = getLong(EVENT_TYPE_ID)
mEventCalendarId = getInt(EVENT_CALENDAR_ID)
@ -732,8 +732,8 @@ class EventActivity : SimpleActivity() {
private fun showReminderTypePicker(currentValue: Int, callback: (Int) -> Unit) {
val items = arrayListOf(
RadioItem(REMINDER_NOTIFICATION, getString(R.string.notification)),
RadioItem(REMINDER_EMAIL, getString(R.string.email))
RadioItem(REMINDER_NOTIFICATION, getString(R.string.notification)),
RadioItem(REMINDER_EMAIL, getString(R.string.email))
)
RadioGroupDialog(this, items, currentValue) {
callback(it as Int)
@ -809,7 +809,7 @@ class EventActivity : SimpleActivity() {
private fun getCalendarId() = if (mEvent.source == SOURCE_SIMPLE_CALENDAR) config.lastUsedCaldavCalendarId else mEvent.getCalDAVCalendarId()
private fun getCalendarWithId(calendars: List<CalDAVCalendar>, calendarId: Int): CalDAVCalendar? =
calendars.firstOrNull { it.id == calendarId }
calendars.firstOrNull { it.id == calendarId }
private fun updateCurrentCalendarInfo(currentCalendar: CalDAVCalendar?) {
event_type_image.beVisibleIf(currentCalendar == null)
@ -852,8 +852,8 @@ class EventActivity : SimpleActivity() {
private fun resetTime() {
if (mEventEndDateTime.isBefore(mEventStartDateTime) &&
mEventStartDateTime.dayOfMonth() == mEventEndDateTime.dayOfMonth() &&
mEventStartDateTime.monthOfYear() == mEventEndDateTime.monthOfYear()) {
mEventStartDateTime.dayOfMonth() == mEventEndDateTime.dayOfMonth() &&
mEventStartDateTime.monthOfYear() == mEventEndDateTime.monthOfYear()) {
mEventEndDateTime = mEventEndDateTime.withTime(mEventStartDateTime.hourOfDay, mEventStartDateTime.minuteOfHour, mEventStartDateTime.secondOfMinute, 0)
updateEndTimeText()
@ -960,9 +960,9 @@ class EventActivity : SimpleActivity() {
}
var reminders = arrayListOf(
Reminder(mReminder1Minutes, mReminder1Type),
Reminder(mReminder2Minutes, mReminder2Type),
Reminder(mReminder3Minutes, mReminder3Type)
Reminder(mReminder1Minutes, mReminder1Type),
Reminder(mReminder2Minutes, mReminder2Type),
Reminder(mReminder3Minutes, mReminder3Type)
)
reminders = reminders.filter { it.minutes != REMINDER_OFF }.sortedBy { it.minutes }.toMutableList() as ArrayList<Reminder>
@ -1137,7 +1137,7 @@ class EventActivity : SimpleActivity() {
hideKeyboard()
config.backgroundColor.getContrastColor()
val datepicker = DatePickerDialog(this, mDialogTheme, startDateSetListener, mEventStartDateTime.year, mEventStartDateTime.monthOfYear - 1,
mEventStartDateTime.dayOfMonth)
mEventStartDateTime.dayOfMonth)
datepicker.datePicker.firstDayOfWeek = if (config.isSundayFirst) Calendar.SUNDAY else Calendar.MONDAY
datepicker.show()
@ -1151,7 +1151,7 @@ class EventActivity : SimpleActivity() {
private fun setupEndDate() {
hideKeyboard()
val datepicker = DatePickerDialog(this, mDialogTheme, endDateSetListener, mEventEndDateTime.year, mEventEndDateTime.monthOfYear - 1,
mEventEndDateTime.dayOfMonth)
mEventEndDateTime.dayOfMonth)
datepicker.datePicker.firstDayOfWeek = if (config.isSundayFirst) Calendar.SUNDAY else Calendar.MONDAY
datepicker.show()
@ -1373,9 +1373,9 @@ class EventActivity : SimpleActivity() {
if (attendee.isMe) {
event_contact_attendee.setOnClickListener {
val items = arrayListOf(
RadioItem(Attendees.ATTENDEE_STATUS_ACCEPTED, getString(R.string.going)),
RadioItem(Attendees.ATTENDEE_STATUS_DECLINED, getString(R.string.not_going)),
RadioItem(Attendees.ATTENDEE_STATUS_TENTATIVE, getString(R.string.maybe_going))
RadioItem(Attendees.ATTENDEE_STATUS_ACCEPTED, getString(R.string.going)),
RadioItem(Attendees.ATTENDEE_STATUS_DECLINED, getString(R.string.not_going)),
RadioItem(Attendees.ATTENDEE_STATUS_TENTATIVE, getString(R.string.maybe_going))
)
RadioGroupDialog(this@EventActivity, items, attendee.status) {
@ -1448,13 +1448,13 @@ class EventActivity : SimpleActivity() {
val contacts = ArrayList<Attendee>()
val uri = Data.CONTENT_URI
val projection = arrayOf(
Data.CONTACT_ID,
StructuredName.PREFIX,
StructuredName.GIVEN_NAME,
StructuredName.MIDDLE_NAME,
StructuredName.FAMILY_NAME,
StructuredName.SUFFIX,
StructuredName.PHOTO_THUMBNAIL_URI)
Data.CONTACT_ID,
StructuredName.PREFIX,
StructuredName.GIVEN_NAME,
StructuredName.MIDDLE_NAME,
StructuredName.FAMILY_NAME,
StructuredName.SUFFIX,
StructuredName.PHOTO_THUMBNAIL_URI)
val selection = "${Data.MIMETYPE} = ?"
val selectionArgs = arrayOf(StructuredName.CONTENT_ITEM_TYPE)
@ -1482,8 +1482,8 @@ class EventActivity : SimpleActivity() {
val contacts = ArrayList<Attendee>()
val uri = CommonDataKinds.Email.CONTENT_URI
val projection = arrayOf(
Data.CONTACT_ID,
CommonDataKinds.Email.DATA
Data.CONTACT_ID,
CommonDataKinds.Email.DATA
)
queryCursor(uri, projection) { cursor ->
@ -1500,7 +1500,7 @@ class EventActivity : SimpleActivity() {
event_show_on_map.applyColorFilter(getAdjustedPrimaryColor())
val textColor = config.textColor
arrayOf(event_time_image, event_time_zone_image, event_repetition_image, event_reminder_image, event_type_image, event_caldav_calendar_image,
event_reminder_1_type, event_reminder_2_type, event_reminder_3_type, event_attendees_image).forEach {
event_reminder_1_type, event_reminder_2_type, event_reminder_3_type, event_attendees_image).forEach {
it.applyColorFilter(textColor)
}
}

View File

@ -126,7 +126,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
override fun onResume() {
super.onResume()
if (mStoredTextColor != config.textColor || mStoredBackgroundColor != config.backgroundColor || mStoredPrimaryColor != config.primaryColor
|| mStoredDayCode != Formatter.getTodayCode() || mStoredDimPastEvents != config.dimPastEvents) {
|| mStoredDayCode != Formatter.getTodayCode() || mStoredDimPastEvents != config.dimPastEvents) {
updateViewPager()
}
@ -329,11 +329,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
val intent = Intent(this, SplashActivity::class.java)
intent.action = SHORTCUT_NEW_EVENT
val shortcut = ShortcutInfo.Builder(this, "new_event")
.setShortLabel(newEvent)
.setLongLabel(newEvent)
.setIcon(Icon.createWithBitmap(bmp))
.setIntent(intent)
.build()
.setShortLabel(newEvent)
.setLongLabel(newEvent)
.setIcon(Icon.createWithBitmap(bmp))
.setIntent(intent)
.build()
try {
manager.dynamicShortcuts = Arrays.asList(shortcut)
@ -407,11 +407,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun showViewDialog() {
val items = arrayListOf(
RadioItem(DAILY_VIEW, getString(R.string.daily_view)),
RadioItem(WEEKLY_VIEW, getString(R.string.weekly_view)),
RadioItem(MONTHLY_VIEW, getString(R.string.monthly_view)),
RadioItem(YEARLY_VIEW, getString(R.string.yearly_view)),
RadioItem(EVENTS_LIST_VIEW, getString(R.string.simple_event_list)))
RadioItem(DAILY_VIEW, getString(R.string.daily_view)),
RadioItem(WEEKLY_VIEW, getString(R.string.weekly_view)),
RadioItem(MONTHLY_VIEW, getString(R.string.monthly_view)),
RadioItem(YEARLY_VIEW, getString(R.string.yearly_view)),
RadioItem(EVENTS_LIST_VIEW, getString(R.string.simple_event_list)))
RadioGroupDialog(this, items, config.storedView) {
calendar_fab.beVisibleIf(it as Int != YEARLY_VIEW)
@ -558,9 +558,9 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
var eventsFound = 0
val uri = Data.CONTENT_URI
val projection = arrayOf(Contacts.DISPLAY_NAME,
CommonDataKinds.Event.CONTACT_ID,
CommonDataKinds.Event.CONTACT_LAST_UPDATED_TIMESTAMP,
CommonDataKinds.Event.START_DATE)
CommonDataKinds.Event.CONTACT_ID,
CommonDataKinds.Event.CONTACT_LAST_UPDATED_TIMESTAMP,
CommonDataKinds.Event.START_DATE)
val selection = "${Data.MIMETYPE} = ? AND ${CommonDataKinds.Event.TYPE} = ?"
val type = if (birthdays) CommonDataKinds.Event.TYPE_BIRTHDAY else CommonDataKinds.Event.TYPE_ANNIVERSARY
@ -592,8 +592,8 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
val source = if (birthdays) SOURCE_CONTACT_BIRTHDAY else SOURCE_CONTACT_ANNIVERSARY
val lastUpdated = cursor.getLongValue(CommonDataKinds.Event.CONTACT_LAST_UPDATED_TIMESTAMP)
val event = Event(null, timestamp, timestamp, name, reminder1Minutes = reminders[0], reminder2Minutes = reminders[1],
reminder3Minutes = reminders[2], importId = contactId, timeZone = DateTimeZone.getDefault().id, flags = FLAG_ALL_DAY,
repeatInterval = YEAR, repeatRule = REPEAT_SAME_DAY, eventType = eventTypeId, source = source, lastUpdated = lastUpdated)
reminder3Minutes = reminders[2], importId = contactId, timeZone = DateTimeZone.getDefault().id, flags = FLAG_ALL_DAY,
repeatInterval = YEAR, repeatRule = REPEAT_SAME_DAY, eventType = eventTypeId, source = source, lastUpdated = lastUpdated)
val importIDsToDelete = ArrayList<String>()
for ((key, value) in importIDs) {
@ -846,15 +846,15 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
val licenses = LICENSE_JODA
val faqItems = arrayListOf(
FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons),
FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons),
FAQItem(R.string.faq_1_title, R.string.faq_1_text),
FAQItem(R.string.faq_2_title, R.string.faq_2_text),
FAQItem(R.string.faq_3_title, R.string.faq_3_text),
FAQItem(R.string.faq_4_title, R.string.faq_4_text),
FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons),
FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons),
FAQItem(R.string.faq_7_title_commons, R.string.faq_7_text_commons))
FAQItem(R.string.faq_1_title_commons, R.string.faq_1_text_commons),
FAQItem(R.string.faq_4_title_commons, R.string.faq_4_text_commons),
FAQItem(R.string.faq_1_title, R.string.faq_1_text),
FAQItem(R.string.faq_2_title, R.string.faq_2_text),
FAQItem(R.string.faq_3_title, R.string.faq_3_text),
FAQItem(R.string.faq_4_title, R.string.faq_4_text),
FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons),
FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons),
FAQItem(R.string.faq_7_title_commons, R.string.faq_7_text_commons))
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
}

View File

@ -126,7 +126,7 @@ class SettingsActivity : SimpleActivity() {
private fun setupSectionColors() {
val adjustedPrimaryColor = getAdjustedPrimaryColor()
arrayListOf(reminders_label, caldav_label, weekly_view_label, monthly_view_label, simple_event_list_label, widgets_label, events_label,
new_events_label, migrating_label).forEach {
new_events_label, migrating_label).forEach {
it.setTextColor(adjustedPrimaryColor)
}
}
@ -325,16 +325,16 @@ class SettingsActivity : SimpleActivity() {
settings_reminder_sound_holder.setOnClickListener {
SelectAlarmSoundDialog(this, config.reminderSoundUri, config.reminderAudioStream, GET_RINGTONE_URI, ALARM_SOUND_TYPE_NOTIFICATION, false,
onAlarmPicked = {
if (it != null) {
updateReminderSound(it)
}
}, onAlarmSoundDeleted = {
if (it.uri == config.reminderSoundUri) {
val defaultAlarm = getDefaultAlarmSound(ALARM_SOUND_TYPE_NOTIFICATION)
updateReminderSound(defaultAlarm)
}
})
onAlarmPicked = {
if (it != null) {
updateReminderSound(it)
}
}, onAlarmSoundDeleted = {
if (it.uri == config.reminderSoundUri) {
val defaultAlarm = getDefaultAlarmSound(ALARM_SOUND_TYPE_NOTIFICATION)
updateReminderSound(defaultAlarm)
}
})
}
}
@ -348,10 +348,10 @@ class SettingsActivity : SimpleActivity() {
settings_reminder_audio_stream.text = getAudioStreamText()
settings_reminder_audio_stream_holder.setOnClickListener {
val items = arrayListOf(
RadioItem(AudioManager.STREAM_ALARM, getString(R.string.alarm_stream)),
RadioItem(AudioManager.STREAM_SYSTEM, getString(R.string.system_stream)),
RadioItem(AudioManager.STREAM_NOTIFICATION, getString(R.string.notification_stream)),
RadioItem(AudioManager.STREAM_RING, getString(R.string.ring_stream)))
RadioItem(AudioManager.STREAM_ALARM, getString(R.string.alarm_stream)),
RadioItem(AudioManager.STREAM_SYSTEM, getString(R.string.system_stream)),
RadioItem(AudioManager.STREAM_NOTIFICATION, getString(R.string.notification_stream)),
RadioItem(AudioManager.STREAM_RING, getString(R.string.ring_stream)))
RadioGroupDialog(this@SettingsActivity, items, config.reminderAudioStream) {
config.reminderAudioStream = it as Int
@ -484,10 +484,10 @@ class SettingsActivity : SimpleActivity() {
settings_font_size.text = getFontSizeText()
settings_font_size_holder.setOnClickListener {
val items = arrayListOf(
RadioItem(FONT_SIZE_SMALL, getString(R.string.small)),
RadioItem(FONT_SIZE_MEDIUM, getString(R.string.medium)),
RadioItem(FONT_SIZE_LARGE, getString(R.string.large)),
RadioItem(FONT_SIZE_EXTRA_LARGE, getString(R.string.extra_large)))
RadioItem(FONT_SIZE_SMALL, getString(R.string.small)),
RadioItem(FONT_SIZE_MEDIUM, getString(R.string.medium)),
RadioItem(FONT_SIZE_LARGE, getString(R.string.large)),
RadioItem(FONT_SIZE_EXTRA_LARGE, getString(R.string.extra_large)))
RadioGroupDialog(this@SettingsActivity, items, config.fontSize) {
config.fontSize = it as Int
@ -510,12 +510,12 @@ class SettingsActivity : SimpleActivity() {
settings_list_widget_view_to_open.text = getDefaultViewText()
settings_list_widget_view_to_open_holder.setOnClickListener {
val items = arrayListOf(
RadioItem(DAILY_VIEW, getString(R.string.daily_view)),
RadioItem(WEEKLY_VIEW, getString(R.string.weekly_view)),
RadioItem(MONTHLY_VIEW, getString(R.string.monthly_view)),
RadioItem(YEARLY_VIEW, getString(R.string.yearly_view)),
RadioItem(EVENTS_LIST_VIEW, getString(R.string.simple_event_list)),
RadioItem(LAST_VIEW, getString(R.string.last_view)))
RadioItem(DAILY_VIEW, getString(R.string.daily_view)),
RadioItem(WEEKLY_VIEW, getString(R.string.weekly_view)),
RadioItem(MONTHLY_VIEW, getString(R.string.monthly_view)),
RadioItem(YEARLY_VIEW, getString(R.string.yearly_view)),
RadioItem(EVENTS_LIST_VIEW, getString(R.string.simple_event_list)),
RadioItem(LAST_VIEW, getString(R.string.last_view)))
RadioGroupDialog(this@SettingsActivity, items, config.listWidgetViewToOpen) {
config.listWidgetViewToOpen = it as Int

View File

@ -16,25 +16,25 @@ open class SimpleActivity : BaseSimpleActivity() {
var calDAVRefreshCallback: (() -> Unit)? = null
override fun getAppIconIDs() = arrayListOf(
R.mipmap.ic_launcher_red,
R.mipmap.ic_launcher_pink,
R.mipmap.ic_launcher_purple,
R.mipmap.ic_launcher_deep_purple,
R.mipmap.ic_launcher_indigo,
R.mipmap.ic_launcher_blue,
R.mipmap.ic_launcher_light_blue,
R.mipmap.ic_launcher_cyan,
R.mipmap.ic_launcher_teal,
R.mipmap.ic_launcher_green,
R.mipmap.ic_launcher_light_green,
R.mipmap.ic_launcher_lime,
R.mipmap.ic_launcher_yellow,
R.mipmap.ic_launcher_amber,
R.mipmap.ic_launcher,
R.mipmap.ic_launcher_deep_orange,
R.mipmap.ic_launcher_brown,
R.mipmap.ic_launcher_blue_grey,
R.mipmap.ic_launcher_grey_black
R.mipmap.ic_launcher_red,
R.mipmap.ic_launcher_pink,
R.mipmap.ic_launcher_purple,
R.mipmap.ic_launcher_deep_purple,
R.mipmap.ic_launcher_indigo,
R.mipmap.ic_launcher_blue,
R.mipmap.ic_launcher_light_blue,
R.mipmap.ic_launcher_cyan,
R.mipmap.ic_launcher_teal,
R.mipmap.ic_launcher_green,
R.mipmap.ic_launcher_light_green,
R.mipmap.ic_launcher_lime,
R.mipmap.ic_launcher_yellow,
R.mipmap.ic_launcher_amber,
R.mipmap.ic_launcher,
R.mipmap.ic_launcher_deep_orange,
R.mipmap.ic_launcher_brown,
R.mipmap.ic_launcher_blue_grey,
R.mipmap.ic_launcher_grey_black
)
override fun getAppLauncherName() = getString(R.string.app_launcher_name)

View File

@ -246,10 +246,10 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
val channelId = "simple_calendar_${config.lastReminderChannel}_${config.reminderAudioStream}_${event.eventType}"
if (isOreoPlus()) {
val audioAttributes = AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_ALARM)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setLegacyStreamType(config.reminderAudioStream)
.build()
.setUsage(AudioAttributes.USAGE_ALARM)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setLegacyStreamType(config.reminderAudioStream)
.build()
val name = eventTypesDB.getEventTypeWithId(event.eventType)?.getDisplayTitle()
val importance = NotificationManager.IMPORTANCE_HIGH
@ -272,17 +272,17 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
val contentText = if (publicVersion) resources.getString(R.string.public_event_notification_text) else content
val builder = NotificationCompat.Builder(this, channelId)
.setContentTitle(contentTitle)
.setContentText(contentText)
.setSmallIcon(R.drawable.ic_calendar_vector)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setDefaults(Notification.DEFAULT_LIGHTS)
.setCategory(Notification.CATEGORY_EVENT)
.setAutoCancel(true)
.setSound(Uri.parse(soundUri), config.reminderAudioStream)
.setChannelId(channelId)
.addAction(R.drawable.ic_snooze_vector, getString(R.string.snooze), getSnoozePendingIntent(this, event))
.setContentTitle(contentTitle)
.setContentText(contentText)
.setSmallIcon(R.drawable.ic_calendar_vector)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setDefaults(Notification.DEFAULT_LIGHTS)
.setCategory(Notification.CATEGORY_EVENT)
.setAutoCancel(true)
.setSound(Uri.parse(soundUri), config.reminderAudioStream)
.setChannelId(channelId)
.addAction(R.drawable.ic_snooze_vector, getString(R.string.snooze), getSnoozePendingIntent(this, event))
if (config.vibrateOnReminder) {
val vibrateArray = LongArray(2) { 500 }
@ -413,7 +413,7 @@ fun Context.addDayNumber(rawTextColor: Int, day: DayMonthly, linearLayout: Linea
}
private fun addTodaysBackground(textView: TextView, res: Resources, dayLabelHeight: Int, primaryColor: Int) =
textView.addResizedBackgroundDrawable(res, dayLabelHeight, primaryColor, R.drawable.ic_circle_filled)
textView.addResizedBackgroundDrawable(res, dayLabelHeight, primaryColor, R.drawable.ic_circle_filled)
fun Context.addDayEvents(day: DayMonthly, linearLayout: LinearLayout, res: Resources, dividerMargin: Int) {
val eventLayoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)