diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java index 28b3304fc..d3c2830c7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java @@ -86,6 +86,7 @@ import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.AMAZFITCOR2; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.MIBAND; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.MIBAND2; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.MIBAND3; +import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.PEBBLE; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.fromKey; import static nodomain.freeyourgadget.gadgetbridge.util.GB.NOTIFICATION_CHANNEL_HIGH_PRIORITY_ID; import static nodomain.freeyourgadget.gadgetbridge.util.GB.NOTIFICATION_CHANNEL_ID; @@ -105,7 +106,7 @@ public class GBApplication extends Application { private static SharedPreferences sharedPrefs; private static final String PREFS_VERSION = "shared_preferences_version"; //if preferences have to be migrated, increment the following and add the migration logic in migratePrefs below; see http://stackoverflow.com/questions/16397848/how-can-i-migrate-android-preferences-with-a-new-version - private static final int CURRENT_PREFS_VERSION = 7; + private static final int CURRENT_PREFS_VERSION = 8; private static final int ERROR_IN_GADGETBRIDGE_NOTIFICATION = 42; @@ -922,7 +923,22 @@ public class GBApplication extends Application { migrateStringPrefToPerDevicePref("mi_button_press_broadcast", "nodomain.freeyourgadget.gadgetbridge.ButtonPressed", "button_action_broadcast", new ArrayList<>(Collections.singletonList(MIBAND2))); } if (oldVersion < 7) { - migrateStringPrefToPerDevicePref("mi_reserve_alarm_calendar","0","reserve_alarms_calendar", new ArrayList<>(Arrays.asList(MIBAND, MIBAND2))); + migrateStringPrefToPerDevicePref("mi_reserve_alarm_calendar", "0", "reserve_alarms_calendar", new ArrayList<>(Arrays.asList(MIBAND, MIBAND2))); + } + + if (oldVersion < 8) { + for (int i = 1; i <= 16; i++) { + String message = prefs.getString("canned_message_dismisscall_" + i, null); + if (message != null) { + migrateStringPrefToPerDevicePref("canned_message_dismisscall_" + i, "", "canned_message_dismisscall_" + i, new ArrayList<>(Collections.singletonList(PEBBLE))); + } + } + for (int i = 1; i <= 16; i++) { + String message = prefs.getString("canned_reply_" + i, null); + if (message != null) { + migrateStringPrefToPerDevicePref("canned_reply_" + i, "", "canned_reply_" + i, new ArrayList<>(Collections.singletonList(PEBBLE))); + } + } } editor.putString(PREFS_VERSION, Integer.toString(CURRENT_PREFS_VERSION)); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java index 277404ee8..8f9d613fd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java @@ -45,7 +45,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Locale; @@ -60,7 +59,6 @@ import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager; import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandPreferencesActivity; import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.ConfigActivity; import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimePreferenceActivity; -import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils; import nodomain.freeyourgadget.gadgetbridge.util.FileUtils; import nodomain.freeyourgadget.gadgetbridge.util.GB; @@ -287,25 +285,6 @@ public class SettingsActivity extends AbstractSettingsActivity { } }); - pref = findPreference("canned_messages_dismisscall_send"); - pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - public boolean onPreferenceClick(Preference preference) { - Prefs prefs = GBApplication.getPrefs(); - ArrayList messages = new ArrayList<>(); - for (int i = 1; i <= 16; i++) { - String message = prefs.getString("canned_message_dismisscall_" + i, null); - if (message != null && !message.equals("")) { - messages.add(message); - } - } - CannedMessagesSpec cannedMessagesSpec = new CannedMessagesSpec(); - cannedMessagesSpec.type = CannedMessagesSpec.TYPE_MISSEDCALLS; - cannedMessagesSpec.cannedMessages = messages.toArray(new String[messages.size()]); - GBApplication.deviceService().onSetCannedMessages(cannedMessagesSpec); - return true; - } - }); - pref = findPreference("weather_city"); pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override @@ -475,39 +454,6 @@ public class SettingsActivity extends AbstractSettingsActivity { "pebble_reconnect_attempts", "location_latitude", "location_longitude", - "canned_reply_suffix", - "canned_reply_1", - "canned_reply_2", - "canned_reply_3", - "canned_reply_4", - "canned_reply_5", - "canned_reply_6", - "canned_reply_7", - "canned_reply_8", - "canned_reply_9", - "canned_reply_10", - "canned_reply_11", - "canned_reply_12", - "canned_reply_13", - "canned_reply_14", - "canned_reply_15", - "canned_reply_16", - "canned_message_dismisscall_1", - "canned_message_dismisscall_2", - "canned_message_dismisscall_3", - "canned_message_dismisscall_4", - "canned_message_dismisscall_5", - "canned_message_dismisscall_6", - "canned_message_dismisscall_7", - "canned_message_dismisscall_8", - "canned_message_dismisscall_9", - "canned_message_dismisscall_10", - "canned_message_dismisscall_11", - "canned_message_dismisscall_12", - "canned_message_dismisscall_13", - "canned_message_dismisscall_14", - "canned_message_dismisscall_15", - "canned_message_dismisscall_16", PREF_USER_YEAR_OF_BIRTH, PREF_USER_HEIGHT_CM, PREF_USER_WEIGHT_KG, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java index fafb12b71..c7dc9bddf 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java @@ -29,13 +29,14 @@ import androidx.preference.PreferenceFragmentCompat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.ArrayList; import java.util.Objects; import nodomain.freeyourgadget.gadgetbridge.GBApplication; -import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.makibeshr3.MakibesHR3Constants; import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst; +import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec; import nodomain.freeyourgadget.gadgetbridge.util.Prefs; import nodomain.freeyourgadget.gadgetbridge.util.XTimePreference; import nodomain.freeyourgadget.gadgetbridge.util.XTimePreferenceFragment; @@ -70,6 +71,14 @@ import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.Dev import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_VIBRATION_STRENGH_PERCENTAGE; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_WEARLOCATION; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_ACTIVATE_DISPLAY_ON_LIFT; +import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_FELL_SLEEP_BROADCAST; +import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_FELL_SLEEP_SELECTION; +import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_SELECTION_BROADCAST; +import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_SELECTION_OFF; +import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_START_NON_WEAR_BROADCAST; +import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_START_NON_WEAR_SELECTION; +import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_WOKE_UP_BROADCAST; +import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_WOKE_UP_SELECTION; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION_END; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION_START; @@ -78,14 +87,6 @@ import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISPLAY_ON_LIFT_START; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_EXPOSE_HR_THIRDPARTY; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_SHORTCUTS; -import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_FELL_SLEEP_SELECTION; -import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_SELECTION_OFF; -import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_SELECTION_BROADCAST; -import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_FELL_SLEEP_BROADCAST; -import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_START_NON_WEAR_BROADCAST; -import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_START_NON_WEAR_SELECTION; -import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_WOKE_UP_BROADCAST; -import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_WOKE_UP_SELECTION; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB_END; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB_OFF; @@ -161,7 +162,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat { } private void setChangeListener() { - Prefs prefs = new Prefs(getPreferenceManager().getSharedPreferences()); + final Prefs prefs = new Prefs(getPreferenceManager().getSharedPreferences()); String disconnectNotificationState = prefs.getString(PREF_DISCONNECT_NOTIFICATION, PREF_DO_NOT_DISTURB_OFF); boolean disconnectNotificationScheduled = disconnectNotificationState.equals(PREF_DO_NOT_DISTURB_SCHEDULED); @@ -451,6 +452,26 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat { }); } + final Preference cannedMessagesDismissCall = findPreference("canned_messages_dismisscall_send"); + if (cannedMessagesDismissCall != null) { + cannedMessagesDismissCall.setOnPreferenceClickListener(new androidx.preference.Preference.OnPreferenceClickListener() { + public boolean onPreferenceClick(androidx.preference.Preference preference) { + ArrayList messages = new ArrayList<>(); + for (int i = 1; i <= 16; i++) { + String message = prefs.getString("canned_message_dismisscall_" + i, null); + if (message != null && !message.equals("")) { + messages.add(message); + } + } + CannedMessagesSpec cannedMessagesSpec = new CannedMessagesSpec(); + cannedMessagesSpec.type = CannedMessagesSpec.TYPE_REJECTEDCALLS; + cannedMessagesSpec.cannedMessages = messages.toArray(new String[0]); + GBApplication.deviceService().onSetCannedMessages(cannedMessagesSpec); + return true; + } + }); + } + setInputTypeFor(HuamiConst.PREF_BUTTON_ACTION_BROADCAST_DELAY, InputType.TYPE_CLASS_NUMBER); setInputTypeFor(HuamiConst.PREF_BUTTON_ACTION_PRESS_MAX_INTERVAL, InputType.TYPE_CLASS_NUMBER); setInputTypeFor(HuamiConst.PREF_BUTTON_ACTION_PRESS_COUNT, InputType.TYPE_CLASS_NUMBER); @@ -459,9 +480,6 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat { setInputTypeFor(DeviceSettingsPreferenceConst.PREF_RESERVER_ALARMS_CALENDAR, InputType.TYPE_CLASS_NUMBER); String deviceActionsFellSleepSelection = prefs.getString(PREF_DEVICE_ACTION_FELL_SLEEP_SELECTION, PREF_DEVICE_ACTION_SELECTION_OFF); - final String deviceActionsFellSleepBroadcastValue = prefs.getString(PREF_DEVICE_ACTION_FELL_SLEEP_BROADCAST, - this.getContext().getString(R.string.prefs_events_forwarding_fellsleep_broadcast_default_value)); - final Preference deviceActionsFellSleep = findPreference(PREF_DEVICE_ACTION_FELL_SLEEP_SELECTION); final Preference deviceActionsFellSleepBroadcast = findPreference(PREF_DEVICE_ACTION_FELL_SLEEP_BROADCAST); boolean deviceActionsFellSleepSelectionBroadcast = deviceActionsFellSleepSelection.equals(PREF_DEVICE_ACTION_SELECTION_BROADCAST); @@ -476,21 +494,10 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat { }); } if (deviceActionsFellSleepBroadcast != null) { - deviceActionsFellSleepBroadcast.setSummary(deviceActionsFellSleepBroadcastValue); deviceActionsFellSleepBroadcast.setEnabled(deviceActionsFellSleepSelectionBroadcast); - deviceActionsFellSleepBroadcast.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newVal) { - deviceActionsFellSleepBroadcast.setSummary(newVal.toString()); - return true; - } - }); } String deviceActionsWokeUpSelection = prefs.getString(PREF_DEVICE_ACTION_WOKE_UP_SELECTION, PREF_DEVICE_ACTION_SELECTION_OFF); - final String deviceActionsWokeUpBroadcastValue = prefs.getString(PREF_DEVICE_ACTION_WOKE_UP_BROADCAST, - this.getContext().getString(R.string.prefs_events_forwarding_wokeup_broadcast_default_value)); - final Preference deviceActionsWokeUp = findPreference(PREF_DEVICE_ACTION_WOKE_UP_SELECTION); final Preference deviceActionsWokeUpBroadcast = findPreference(PREF_DEVICE_ACTION_WOKE_UP_BROADCAST); boolean deviceActionsWokeUpSelectionBroadcast = deviceActionsWokeUpSelection.equals(PREF_DEVICE_ACTION_SELECTION_BROADCAST); @@ -505,21 +512,10 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat { }); } if (deviceActionsWokeUpBroadcast != null) { - deviceActionsWokeUpBroadcast.setSummary(deviceActionsWokeUpBroadcastValue); deviceActionsWokeUpBroadcast.setEnabled(deviceActionsWokeUpSelectionBroadcast); - deviceActionsWokeUpBroadcast.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newVal) { - deviceActionsWokeUpBroadcast.setSummary(newVal.toString()); - return true; - } - }); } String deviceActionsStartNonWearSelection = prefs.getString(PREF_DEVICE_ACTION_START_NON_WEAR_SELECTION, PREF_DEVICE_ACTION_SELECTION_OFF); - final String deviceActionsStartNonWearBroadcastValue = prefs.getString(PREF_DEVICE_ACTION_START_NON_WEAR_BROADCAST, - this.getContext().getString(R.string.prefs_events_forwarding_startnonwear_broadcast_default_value)); - final Preference deviceActionsStartNonWear = findPreference(PREF_DEVICE_ACTION_START_NON_WEAR_SELECTION); final Preference deviceActionsStartNonWearBroadcast = findPreference(PREF_DEVICE_ACTION_START_NON_WEAR_BROADCAST); boolean deviceActionsStartNonWearSelectionBroadcast = deviceActionsStartNonWearSelection.equals(PREF_DEVICE_ACTION_SELECTION_BROADCAST); @@ -534,17 +530,8 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat { }); } if (deviceActionsStartNonWearBroadcast != null) { - deviceActionsStartNonWearBroadcast.setSummary(deviceActionsStartNonWearBroadcastValue); deviceActionsStartNonWearBroadcast.setEnabled(deviceActionsStartNonWearSelectionBroadcast); - deviceActionsStartNonWearBroadcast.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newVal) { - deviceActionsStartNonWearBroadcast.setSummary(newVal.toString()); - return true; - } - }); } - } static DeviceSpecificSettingsFragment newInstance(String settingsFileSuffix, @NonNull int[] supportedSettings) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java index 3ef7b9ea6..4454061ca 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/pebble/PebbleCoordinator.java @@ -22,9 +22,11 @@ import android.content.Context; import android.net.Uri; import androidx.annotation.NonNull; + import de.greenrobot.dao.query.QueryBuilder; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.GBException; +import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.activities.appmanager.AppManagerActivity; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; @@ -172,5 +174,15 @@ public class PebbleCoordinator extends AbstractDeviceCoordinator { } @Override - public boolean supportsUnicodeEmojis() { return true; } + public boolean supportsUnicodeEmojis() { + return true; + } + + @Override + public int[] getSupportedDeviceSpecificSettings(GBDevice device) { + return new int[]{ + R.xml.devicesettings_canned_reply_16, + R.xml.devicesettings_canned_dismisscall_16 + }; + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CannedMessagesSpec.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CannedMessagesSpec.java index 820489071..ae16cfbc1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CannedMessagesSpec.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CannedMessagesSpec.java @@ -18,7 +18,7 @@ package nodomain.freeyourgadget.gadgetbridge.model; public class CannedMessagesSpec { public static final byte TYPE_GENERIC = 0; - public static final byte TYPE_MISSEDCALLS = 1; + public static final byte TYPE_REJECTEDCALLS = 1; public static final byte TYPE_NEWSMS = 2; public int type; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/AbstractDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/AbstractDeviceSupport.java index 4301ac001..8d01c3351 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/AbstractDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/AbstractDeviceSupport.java @@ -24,6 +24,7 @@ import android.bluetooth.BluetoothAdapter; import android.companion.CompanionDeviceManager; import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; @@ -378,7 +379,7 @@ public abstract class AbstractDeviceSupport implements DeviceSupport { notificationListenerIntent.putExtra("handle", deviceEvent.handle); notificationListenerIntent.putExtra("title", deviceEvent.title); if (deviceEvent.reply != null) { - Prefs prefs = GBApplication.getPrefs(); + SharedPreferences prefs = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()); String suffix = prefs.getString("canned_reply_suffix", null); if (suffix != null && !Objects.equals(suffix, "")) { deviceEvent.reply += suffix; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java index 4a5464e4b..c54c3e072 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java @@ -410,13 +410,14 @@ public class DeviceCommunicationService extends Service implements SharedPrefere // I would rather like to save that as an array in SharedPreferences // this would work but I dont know how to do the same in the Settings Activity's xml ArrayList replies = new ArrayList<>(); + SharedPreferences devicePrefs = GBApplication.getDeviceSpecificSharedPrefs(mGBDevice.getAddress()); for (int i = 1; i <= 16; i++) { - String reply = prefs.getString("canned_reply_" + i, null); + String reply = devicePrefs.getString("canned_reply_" + i, null); if (reply != null && !reply.equals("")) { replies.add(reply); } } - notificationSpec.cannedReplies = replies.toArray(new String[replies.size()]); + notificationSpec.cannedReplies = replies.toArray(new String[0]); } mDeviceSupport.onNotification(notificationSpec); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java index 17c483e69..a443220ff 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java @@ -1510,7 +1510,7 @@ public class PebbleProtocol extends GBDeviceProtocol { String blobDBKey; switch (cannedMessagesSpec.type) { - case CannedMessagesSpec.TYPE_MISSEDCALLS: + case CannedMessagesSpec.TYPE_REJECTEDCALLS: blobDBKey = "com.pebble.android.phone"; break; case CannedMessagesSpec.TYPE_NEWSMS: diff --git a/app/src/main/res/xml/devicesettings_canned_dismisscall_16.xml b/app/src/main/res/xml/devicesettings_canned_dismisscall_16.xml new file mode 100644 index 000000000..f516cdd47 --- /dev/null +++ b/app/src/main/res/xml/devicesettings_canned_dismisscall_16.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/xml/devicesettings_canned_reply_16.xml b/app/src/main/res/xml/devicesettings_canned_reply_16.xml new file mode 100644 index 000000000..d35d4197b --- /dev/null +++ b/app/src/main/res/xml/devicesettings_canned_reply_16.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/xml/devicesettings_device_actions.xml b/app/src/main/res/xml/devicesettings_device_actions.xml index 4f197f7ed..39ca0a2d4 100644 --- a/app/src/main/res/xml/devicesettings_device_actions.xml +++ b/app/src/main/res/xml/devicesettings_device_actions.xml @@ -1,5 +1,6 @@ - + + android:title="@string/prefs_events_forwarding_broadcast_title" + app:useSimpleSummaryProvider="true" /> + android:title="@string/prefs_events_forwarding_broadcast_title" + app:useSimpleSummaryProvider="true" /> + android:title="@string/prefs_events_forwarding_broadcast_title" + app:useSimpleSummaryProvider="true" /> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 7573f8eec..a53e4b286 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -384,117 +384,6 @@ android:summary="@string/pref_summary_location_keep_uptodate" android:title="@string/pref_title_location_keep_uptodate" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -