mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-11 01:21:56 +01:00
Pebble: move canned message to per-device settings (including migration)
This also cleans up some useless preferencehandlers that only change summary by using app:useSimpleSummaryProvider="true" for EditText
This commit is contained in:
parent
36b38c2f11
commit
0d49eaaf9e
@ -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;
|
||||
|
||||
@ -925,6 +926,21 @@ public class GBApplication extends Application {
|
||||
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));
|
||||
editor.apply();
|
||||
}
|
||||
|
@ -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<String> 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,
|
||||
|
@ -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<String> 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) {
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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<String> 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);
|
||||
|
@ -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:
|
||||
|
@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceScreen
|
||||
android:key="screen_canned_messages_dismisscall"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_title_canned_messages_dismisscall">
|
||||
<Preference
|
||||
android:key="canned_messages_dismisscall_send"
|
||||
android:title="@string/pref_title_canned_messages_set" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_1"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_2"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_3"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_4"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_5"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_6"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_7"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_8"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_9"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_10"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_11"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_12"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_13"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_14"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_15"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_16"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
</PreferenceScreen>
|
||||
</androidx.preference.PreferenceScreen>
|
81
app/src/main/res/xml/devicesettings_canned_reply_16.xml
Normal file
81
app/src/main/res/xml/devicesettings_canned_reply_16.xml
Normal file
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceScreen
|
||||
android:key="screen_canned_messages_reply"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_title_canned_replies">
|
||||
<EditTextPreference
|
||||
android:defaultValue=" (canned reply)"
|
||||
android:key="canned_reply_suffix"
|
||||
android:maxLength="64"
|
||||
android:title="@string/pref_title_canned_reply_suffix"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_1"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_2"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_3"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_4"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_5"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_6"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_7"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_8"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_9"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_10"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_11"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_12"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_13"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_14"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_15"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_16"
|
||||
android:maxLength="64"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
</PreferenceScreen>
|
||||
</androidx.preference.PreferenceScreen>
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceScreen
|
||||
android:key="screen_events_forwarding"
|
||||
android:icon="@drawable/ic_extension"
|
||||
@ -21,7 +22,8 @@
|
||||
<EditTextPreference
|
||||
android:defaultValue="@string/prefs_events_forwarding_fellsleep_broadcast_default_value"
|
||||
android:key="prefs_events_forwarding_fellsleep_broadcast"
|
||||
android:title="@string/prefs_events_forwarding_broadcast_title" />
|
||||
android:title="@string/prefs_events_forwarding_broadcast_title"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
@ -38,7 +40,8 @@
|
||||
<EditTextPreference
|
||||
android:defaultValue="@string/prefs_events_forwarding_wokeup_broadcast_default_value"
|
||||
android:key="prefs_events_forwarding_wokeup_broadcast"
|
||||
android:title="@string/prefs_events_forwarding_broadcast_title" />
|
||||
android:title="@string/prefs_events_forwarding_broadcast_title"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
@ -55,7 +58,8 @@
|
||||
<EditTextPreference
|
||||
android:defaultValue="@string/prefs_events_forwarding_startnonwear_broadcast_default_value"
|
||||
android:key="prefs_events_forwarding_startnonwear_broadcast"
|
||||
android:title="@string/prefs_events_forwarding_broadcast_title" />
|
||||
android:title="@string/prefs_events_forwarding_broadcast_title"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
|
@ -384,117 +384,6 @@
|
||||
android:summary="@string/pref_summary_location_keep_uptodate"
|
||||
android:title="@string/pref_title_location_keep_uptodate" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:title="@string/pref_header_cannned_messages">
|
||||
<PreferenceScreen android:title="@string/pref_title_canned_replies">
|
||||
<EditTextPreference
|
||||
android:defaultValue=" (canned reply)"
|
||||
android:key="canned_reply_suffix"
|
||||
android:maxLength="64"
|
||||
android:title="@string/pref_title_canned_reply_suffix" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_1"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_2"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_3"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_4"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_5"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_6"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_7"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_8"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_9"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_10"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_11"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_12"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_13"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_14"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_15"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_reply_16"
|
||||
android:maxLength="64" />
|
||||
</PreferenceScreen>
|
||||
<PreferenceScreen android:title="@string/pref_title_canned_messages_dismisscall">
|
||||
<Preference
|
||||
android:key="canned_messages_dismisscall_send"
|
||||
android:title="@string/pref_title_canned_messages_set" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_1"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_2"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_3"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_4"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_5"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_6"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_7"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_8"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_9"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_10"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_11"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_12"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_13"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_14"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_15"
|
||||
android:maxLength="64" />
|
||||
<EditTextPreference
|
||||
android:key="canned_message_dismisscall_16"
|
||||
android:maxLength="64" />
|
||||
</PreferenceScreen>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:title="@string/pref_header_development">
|
||||
<CheckBoxPreference
|
||||
|
Loading…
Reference in New Issue
Block a user