This commit is contained in:
Tommaso Berlose
2020-10-02 15:00:37 +02:00
parent ec40a277d7
commit 59dc5de21a
174 changed files with 440 additions and 219 deletions

View File

@ -69,4 +69,15 @@ object CalendarHelper {
fun removeEventUpdatesAndroidN(context: Context) {
EventListenerJob.remove(context)
}
fun List<Event>.applyFilters() : List<Event> {
return this
.asSequence()
.filter { (Preferences.showDeclinedEvents || it.selfAttendeeStatus != CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED) }
.filter { (Preferences.showAcceptedEvents || it.selfAttendeeStatus != CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED) }
.filter { (Preferences.showInvitedEvents || it.selfAttendeeStatus != CalendarContract.Attendees.ATTENDEE_STATUS_INVITED) }
.filter { (Preferences.calendarAllDay || !it.allDay) }
.filter { (!Preferences.showOnlyBusyEvents || it.availability != CalendarContract.EventsEntity.AVAILABILITY_FREE) }
.toList()
}
}

View File

@ -10,6 +10,7 @@ import android.media.session.MediaSessionManager
import android.media.session.PlaybackState
import android.util.Log
import androidx.core.app.NotificationManagerCompat
import com.chibatching.kotpref.blockingBulk
import com.chibatching.kotpref.bulk
import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.receivers.MusicNotificationListener
@ -78,7 +79,7 @@ object MediaPlayerHelper {
}
private fun removeMediaInfo() {
Preferences.bulk {
Preferences.blockingBulk {
remove(Preferences::mediaPlayerTitle)
remove(Preferences::mediaPlayerArtist)
remove(Preferences::mediaPlayerAlbum)