Update event repository
This commit is contained in:
parent
ff171d4022
commit
1dc050e77f
@ -131,7 +131,6 @@
|
||||
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
|
||||
<action android:name="android.intent.action.BATTERY_LOW"/>
|
||||
<action android:name="android.intent.action.BATTERY_OKAY"/>
|
||||
<action android:name="android.intent.action.CONFIGURATION_CHANGED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
|
@ -40,7 +40,7 @@ class EventRepository(val context: Context) {
|
||||
|
||||
fun getNextEvent(): Event? {
|
||||
val nextEvent = getEventByEventId(Preferences.nextEventId)
|
||||
return if (nextEvent != null && nextEvent.endDate > Calendar.getInstance().timeInMillis) {
|
||||
val event = if (nextEvent != null && nextEvent.endDate > Calendar.getInstance().timeInMillis) {
|
||||
nextEvent
|
||||
} else {
|
||||
val events = getEvents()
|
||||
@ -53,9 +53,21 @@ class EventRepository(val context: Context) {
|
||||
null
|
||||
}
|
||||
}
|
||||
return try {
|
||||
realm.copyFromRealm(event!!)
|
||||
} catch (ex: Exception) {
|
||||
event
|
||||
}
|
||||
}
|
||||
|
||||
fun getEventByEventId(id: Long): Event? = realm.where(Event::class.java).equalTo("eventID", id).findFirst()
|
||||
fun getEventByEventId(id: Long): Event? {
|
||||
val event = realm.where(Event::class.java).equalTo("eventID", id).findFirst()
|
||||
return try {
|
||||
realm.copyFromRealm(event!!)
|
||||
} catch (ex: Exception) {
|
||||
event
|
||||
}
|
||||
}
|
||||
|
||||
fun goToNextEvent() {
|
||||
val eventList = getEvents()
|
||||
|
@ -68,7 +68,6 @@ object CalendarHelper {
|
||||
for (instance in instances) {
|
||||
try {
|
||||
val e = provider.getEvent(instance.eventId)
|
||||
Log.d("ciao", "evento: $instance")
|
||||
if (e != null && !e.deleted && instance.begin <= limit.timeInMillis && now.timeInMillis < instance.end && (Preferences.calendarAllDay || !e.allDay) && !getFilteredCalendarIdList().contains(
|
||||
e.calendarId
|
||||
) && (Preferences.showDeclinedEvents || e.selfAttendeeStatus.toInt() != CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED)
|
||||
|
@ -30,7 +30,6 @@ class ActivityDetectionReceiver : BroadcastReceiver() {
|
||||
val result = ActivityTransitionResult.extractResult(intent)!!
|
||||
val lastEvent = result.transitionEvents.last()
|
||||
|
||||
Log.d("ciao", "activity detected: $lastEvent")
|
||||
if (lastEvent.activityType == DetectedActivity.WALKING || lastEvent.activityType == DetectedActivity.RUNNING && lastEvent.transitionType == ActivityTransition.ACTIVITY_TRANSITION_EXIT) {
|
||||
requestDailySteps(context)
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ class BatteryLevelReceiver : BroadcastReceiver() {
|
||||
Intent.ACTION_BATTERY_OKAY -> Preferences.isBatteryLevelLow = false
|
||||
}
|
||||
MainWidget.updateWidget(context)
|
||||
|
||||
Log.d("ciao", "intent: ${intent}")
|
||||
}
|
||||
|
||||
}
|
@ -262,7 +262,11 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
|
||||
}
|
||||
|
||||
widget_loader?.animate()?.scaleX(0f)?.scaleY(0f)?.alpha(0f)?.setDuration(200L)?.start()
|
||||
bitmap_container?.setImageBitmap(bitmap)
|
||||
bitmap_container?.apply {
|
||||
setImageBitmap(bitmap)
|
||||
scaleX = 0.9f
|
||||
scaleY = 0.9f
|
||||
}
|
||||
widget?.animate()?.alpha(1f)?.start()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user