Pebble: Add option for Calender Timeline sync (default on)

master
Andreas Shimokawa 2017-04-24 12:39:40 +02:00
parent 839e350d1e
commit bc4503c8bf
3 changed files with 16 additions and 7 deletions

View File

@ -43,12 +43,11 @@ import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
import nodomain.freeyourgadget.gadgetbridge.externalevents.AlarmClockReceiver;
import nodomain.freeyourgadget.gadgetbridge.externalevents.AlarmReceiver;
import nodomain.freeyourgadget.gadgetbridge.externalevents.BluetoothConnectReceiver;
import nodomain.freeyourgadget.gadgetbridge.externalevents.CalendarReceiver;
import nodomain.freeyourgadget.gadgetbridge.externalevents.BluetoothPairingRequestReceiver;
import nodomain.freeyourgadget.gadgetbridge.externalevents.CalendarReceiver;
import nodomain.freeyourgadget.gadgetbridge.externalevents.MusicPlaybackReceiver;
import nodomain.freeyourgadget.gadgetbridge.externalevents.PebbleReceiver;
import nodomain.freeyourgadget.gadgetbridge.externalevents.PhoneCallReceiver;
@ -584,7 +583,7 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
LOG.info("Setting broadcast receivers to: " + enable);
if (enable && initialized && coordinator != null && coordinator.supportsCalendarEvents()) {
if (mCalendarReceiver == null) {
if (mCalendarReceiver == null && getPrefs().getBoolean("enable_calendar_sync", true)) {
IntentFilter calendarIntentFilter = new IntentFilter();
calendarIntentFilter.addAction("android.intent.action.PROVIDER_CHANGED");
calendarIntentFilter.addDataScheme("content");

View File

@ -128,8 +128,11 @@
<string name="pref_title_enable_pebblekit">Allow 3rd Party Android App Access</string>
<string name="pref_summary_enable_pebblekit">Enable experimental support for Android Apps using PebbleKit</string>
<string name="pref_header_pebble_timeline">Pebble Timeline</string>
<string name="pref_title_sunrise_sunset">Sunrise and Sunset</string>
<string name="pref_summary_sunrise_sunset">Send sunrise and sunset times based on the location to the pebble timeline</string>
<string name="pref_title_enable_calendar_sync">Sync Calendar</string>
<string name="pref_summary_enable_calendar_sync">Send calendar events to the timeline</string>
<string name="pref_title_autoremove_notifications">Autoremove dismissed Notifications</string>
<string name="pref_summary_autoremove_notifications">Notifications are automatically removed from the Pebble when dismissed from the Android device</string>

View File

@ -189,10 +189,6 @@
android:key="pebble_reconnect_attempts"
android:maxLength="4"
android:title="@string/pref_title_pebble_reconnect_attempts" />
<CheckBoxPreference
android:title="@string/pref_title_sunrise_sunset"
android:summary="@string/pref_summary_sunrise_sunset"
android:key="send_sunrise_sunset" />
<CheckBoxPreference
android:defaultValue="false"
android:key="autoremove_notifications"
@ -206,6 +202,17 @@
android:defaultValue="@string/p_pebble_privacy_mode_off"
android:summary="%s" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_header_pebble_timeline">
<CheckBoxPreference
android:defaultValue="true"
android:key="enable_calendar_sync"
android:summary="@string/pref_summary_enable_calendar_sync"
android:title="@string/pref_title_enable_calendar_sync" />
<CheckBoxPreference
android:key="send_sunrise_sunset"
android:summary="@string/pref_summary_sunrise_sunset"
android:title="@string/pref_title_sunrise_sunset" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_header_activitytrackers">
<ListPreference
android:defaultValue="4"