diff --git a/CHANGELOG.md b/CHANGELOG.md index 356a7fe85..3ed02cc2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ###Changelog ####Next Version +* Pebble: Support replying to SMS form the watch (canned replies) * Pebble: Allow installing apps compiled with SDK 2.x also on the basalt platform (Time, Time Steel) * Pebble: Fix decoding strings in appmessages from the pebble (fixes sending SMS from "Dialer for Pebble") * Some new and updated icons diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8b6ee4050..1c84c40f1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,16 +2,17 @@ - + + @@ -46,23 +47,19 @@ - + android:parentActivityName=".activities.ControlCenter"> - + android:parentActivityName=".activities.SettingsActivity"> - + android:parentActivityName=".activities.ControlCenter"> - + android:parentActivityName=".activities.SettingsActivity"> - @@ -223,13 +221,11 @@ android:name=".activities.DebugActivity" android:label="@string/title_activity_debug" android:parentActivityName=".activities.ControlCenter" - android:windowSoftInputMode="stateHidden"> - + android:windowSoftInputMode="stateHidden"> - + android:parentActivityName=".activities.ControlCenter"> @@ -239,18 +235,15 @@ - + android:parentActivityName=".activities.ControlCenter"> - + android:parentActivityName=".activities.SettingsActivity"> - + android:parentActivityName=".activities.ConfigureAlarms"> 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 2886d9358..f9d3b8144 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/AbstractDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/AbstractDeviceSupport.java @@ -10,6 +10,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.support.v4.content.LocalBroadcastManager; +import android.telephony.SmsManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -230,7 +231,8 @@ public abstract class AbstractDeviceSupport implements DeviceSupport { case REPLY: String phoneNumber = GBApplication.getIDSenderLookup().lookup(deviceEvent.handle); if (phoneNumber != null) { - GB.toast(context, "got notfication reply for " + phoneNumber + " : " + deviceEvent.reply, 2, GB.INFO); + LOG.info("got notfication reply for " + phoneNumber + " : " + deviceEvent.reply); + SmsManager.getDefault().sendTextMessage(phoneNumber, null, deviceEvent.reply, null, null); } break; } 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 a0be93339..7365ff72d 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 @@ -1512,6 +1512,7 @@ public class PebbleProtocol extends GBDeviceProtocol { sendBytesAck.encodedBytes = encodeActionResponse2x(id, action, 6, "Muted"); break; case 0x05: + String caption = ""; byte attribute_count = buf.get(); if (attribute_count > 0) { byte attribute = buf.get(); @@ -1522,14 +1523,17 @@ public class PebbleProtocol extends GBDeviceProtocol { buf.get(reply); devEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.REPLY; devEvtNotificationControl.reply = new String(reply); + caption = "Sent"; } else { + caption = "FAILED"; devEvtNotificationControl = null; // error } } else { + caption = "FAILED"; devEvtNotificationControl = null; // error } sendBytesAck = new GBDeviceEventSendBytes(); - sendBytesAck.encodedBytes = encodeActionResponse2x(id, action, 6, "NOT IMPLEMENTED"); + sendBytesAck.encodedBytes = encodeActionResponse2x(id, action, 6, caption); break; default: return null; @@ -1589,14 +1593,18 @@ public class PebbleProtocol extends GBDeviceProtocol { buf.get(reply); devEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.REPLY; devEvtNotificationControl.reply = new String(reply); + caption = "SENT"; + icon_id = PebbleIconID.RESULT_SENT; } else { devEvtNotificationControl = null; // error + caption = "FAILED"; + icon_id = PebbleIconID.RESULT_FAILED; } } else { + caption = "FAILED"; + icon_id = PebbleIconID.RESULT_FAILED; devEvtNotificationControl = null; // error } - caption = "NOT IMPLEMENTED"; - icon_id = PebbleIconID.GENERIC_WARNING; break; } GBDeviceEventSendBytes sendBytesAck = new GBDeviceEventSendBytes();