1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-25 03:16:51 +01:00

Move the Calendar receiver code in the proper place.

This commit is contained in:
Daniele Gobbetti 2017-04-17 20:33:39 +02:00
parent 61690eb2cc
commit 1e231e6129
2 changed files with 5 additions and 16 deletions

View File

@ -20,7 +20,6 @@ package nodomain.freeyourgadget.gadgetbridge.externalevents;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.widget.Toast;
import org.slf4j.Logger;
@ -84,20 +83,6 @@ public class CalendarReceiver extends BroadcastReceiver {
public CalendarReceiver(GBDevice gbDevice) {
LOG.info("Created calendar receiver.");
mGBDevice = gbDevice;
Context context = GBApplication.getContext();
IntentFilter calendarIntentFilter = new IntentFilter();
calendarIntentFilter.addAction("android.intent.action.PROVIDER_CHANGED");
calendarIntentFilter.addDataScheme("content");
calendarIntentFilter.addDataAuthority("com.android.calendar", null);
BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
syncCalendar();
}
};
context.registerReceiver(receiver, calendarIntentFilter);
}
@Override

View File

@ -616,8 +616,12 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
registerReceiver(mAlarmReceiver, new IntentFilter("DAILY_ALARM"));
}
if (mCalendarReceiver == null) {
IntentFilter calendarIntentFilter = new IntentFilter();
calendarIntentFilter.addAction("android.intent.action.PROVIDER_CHANGED");
calendarIntentFilter.addDataScheme("content");
calendarIntentFilter.addDataAuthority("com.android.calendar", null);
mCalendarReceiver = new CalendarReceiver(mGBDevice);
registerReceiver(mCalendarReceiver, new IntentFilter("CALENDAR_SYNC"));
registerReceiver(mCalendarReceiver, calendarIntentFilter);
}
if (mAlarmClockReceiver == null) {
mAlarmClockReceiver = new AlarmClockReceiver();