diff --git a/CHANGELOG.md b/CHANGELOG.md index eb67a7822..8c0b2ca28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ###Changelog +####Version 0.5.3 +* Pebble: For generic notifications, support dismissing individual notficications and "Open on Phone" feature (OG & PT) +* Pebble: Allow to treat K9 notifcations as generic notifications (if notification mode is set to never) +* Ignore QKSMS notificaions to avoid double notification for incoming SMS +* Improved UI of Firmware/App installer +* Device state again visible on lockscreen +* Date display and navigation now working properly for all charts + ####Version 0.5.2 * Pebble: support "dismiss all" action also on Pebble Time/FW 3.x notifications * Miband: show a notification when the battery is below 10% diff --git a/README.md b/README.md index 01bb5bf5d..0c42e1ebb 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,8 @@ need to create an account and transmit any of your data to the vendor's servers. * SMS notification (sender, body) * K-9 Mail notification support (sender, subject, preview) * Support for generic notifications (above filtered out) -* Dismiss all notifications from the action menu of a notification +* Dismiss individial notifications or open corresponding app on phone from the action menu (generic notifications) +* Dismiss all notifications from the action menu (non-generic notifications) * Music playback info (artist, album, track). Apollo and CM 12.1 Music App supported. * Music control: play/pause, next track, previous track, volume up, volume down * List and remove installed apps/watchfaces @@ -34,7 +35,7 @@ need to create an account and transmit any of your data to the vendor's servers. All features are also supported on the Pebble Time, except for the following: -* Listing installed watchfaces (it will simply display the UUIDs of previously installed watchapps, no matter if they are stil installed or not) +* Listing installed watchfaces (it will simply display the UUIDs of previously installed watchapps, no matter if they are still installed or not) * Firmware installation is untested and will probably not work. ## How to use (Pebble) diff --git a/app/build.gradle b/app/build.gradle index 40c65d15d..2a53d1da2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "nodomain.freeyourgadget.gadgetbridge" minSdkVersion 19 targetSdkVersion 23 - versionCode 23 - versionName "0.5.2" + versionCode 24 + versionName "0.5.3" } buildTypes { release { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/FwAppInstallerActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/FwAppInstallerActivity.java index a9f568d7c..a9ff065f3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/FwAppInstallerActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/FwAppInstallerActivity.java @@ -179,7 +179,9 @@ public class FwAppInstallerActivity extends Activity implements InstallActivity @Override public void setInstallEnabled(boolean enable) { - installButton.setEnabled(device != null && device.isConnected() && enable); + boolean enabled = device != null && device.isConnected() && enable; + installButton.setEnabled(enabled); + installButton.setVisibility(enabled ? View.VISIBLE : View.GONE); } @Override diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java index e5cb681aa..016f93d29 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java @@ -130,8 +130,7 @@ public class NotificationListener extends NotificationListenerService { source.equals("com.android.dialer") || source.equals("com.android.mms") || source.equals("com.moez.QKSMS") || - source.equals("com.cyanogenmod.eleven") || - source.equals("com.fsck.k9")) { + source.equals("com.cyanogenmod.eleven")) { return; } @@ -141,6 +140,12 @@ public class NotificationListener extends NotificationListenerService { } } + if (source.equals("com.fsck.k9")) { + if (!"never".equals(sharedPrefs.getString("notification_mode_k9mail", "when_screen_off"))) { + return; + } + } + LOG.info("Processing notification from source " + source); Bundle extras = notification.extras; 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 ce34d9a53..84a57cee4 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 @@ -478,7 +478,7 @@ public class PebbleProtocol extends GBDeviceProtocol { buf.put((byte) 0x00); // ? buf.put((byte) 0x01); // add notifications - buf.putInt(0x00000002); // flags - ? + buf.putInt(0x00000000); // flags - ? buf.putInt(id); buf.putInt(0x00000000); // ANCS id buf.putInt(timestamp); @@ -664,6 +664,27 @@ public class PebbleProtocol extends GBDeviceProtocol { return encodeBlobdb(UUID.randomUUID(), BLOBDB_INSERT, BLOBDB_NOTIFICATION, buf.array()); } + public byte[] encodeActionResponse2x(int id, int iconId, String caption) { + short length = (short) (18 + caption.length()); + ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + length); + buf.order(ByteOrder.BIG_ENDIAN); + buf.putShort(length); + buf.putShort(ENDPOINT_EXTENSIBLENOTIFS); + buf.order(ByteOrder.LITTLE_ENDIAN); + buf.put(NOTIFICATIONACTION_RESPONSE); + buf.putInt(id); + buf.put((byte) 0x01); // action id? + buf.put(NOTIFICATIONACTION_ACK); + buf.put((byte) 2); //nr of attributes + buf.put((byte) 6); // icon + buf.putShort((short) 4); // length + buf.putInt(iconId); + buf.put((byte) 2); // title + buf.putShort((short) caption.length()); + buf.put(caption.getBytes()); + return buf.array(); + } + public byte[] encodeActionResponse(UUID uuid, int iconId, String caption) { short length = (short) (29 + caption.length()); ByteBuffer buf = ByteBuffer.allocate(LENGTH_PREFIX + length); @@ -1132,7 +1153,7 @@ public class PebbleProtocol extends GBDeviceProtocol { return null; } - private GBDeviceEventNotificationControl decodeNotificationAction2x(ByteBuffer buf) { + private GBDeviceEvent[] decodeNotificationAction2x(ByteBuffer buf) { buf.order(ByteOrder.LITTLE_ENDIAN); byte command = buf.get(); @@ -1142,9 +1163,13 @@ public class PebbleProtocol extends GBDeviceProtocol { if (action >= 0x01 && action <= 0x03) { GBDeviceEventNotificationControl devEvtNotificationControl = new GBDeviceEventNotificationControl(); devEvtNotificationControl.handle = id; + GBDeviceEventSendBytes sendBytesAck = null; + switch (action) { case 0x01: devEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.OPEN; + sendBytesAck = new GBDeviceEventSendBytes(); + sendBytesAck.encodedBytes = encodeActionResponse2x(id, 6, "Opened"); break; case 0x02: devEvtNotificationControl.event = GBDeviceEventNotificationControl.Event.DISMISS; @@ -1155,7 +1180,7 @@ public class PebbleProtocol extends GBDeviceProtocol { default: return null; } - return devEvtNotificationControl; + return new GBDeviceEvent[]{sendBytesAck, devEvtNotificationControl}; } LOG.info("unexpected paramerter in dismiss action: " + action); } @@ -1182,7 +1207,7 @@ public class PebbleProtocol extends GBDeviceProtocol { case 0x01: dismissNotification.event = GBDeviceEventNotificationControl.Event.OPEN; caption = "Opened"; - icon_id = 47; // FIXME: find a better one + icon_id = 49; break; case 0x02: dismissNotification.event = GBDeviceEventNotificationControl.Event.DISMISS; @@ -1488,7 +1513,7 @@ public class PebbleProtocol extends GBDeviceProtocol { devEvts = new GBDeviceEvent[]{decodeScreenshot(buf, length)}; break; case ENDPOINT_EXTENSIBLENOTIFS: - devEvts = new GBDeviceEvent[]{decodeNotificationAction2x(buf)}; + devEvts = decodeNotificationAction2x(buf); break; case ENDPOINT_NOTIFICATIONACTION: devEvts = decodeNotificationAction3x(buf); diff --git a/app/src/main/res/layout/activity_appinstaller.xml b/app/src/main/res/layout/activity_appinstaller.xml index 3e64f9150..8846623b0 100644 --- a/app/src/main/res/layout/activity_appinstaller.xml +++ b/app/src/main/res/layout/activity_appinstaller.xml @@ -1,4 +1,4 @@ - + android:layout_height="wrap_content" + android:layout_alignParentEnd="false"> + android:layout_alignParentTop="false" + android:layout_alignParentEnd="false" + android:layout_alignParentStart="false" + android:layout_below="@+id/itemListView" /> + android:layout_centerHorizontal="true" + android:layout_alignParentTop="false" + android:layout_alignParentLeft="false" + android:layout_below="@+id/infoTextView" /> + android:visibility="gone" + android:layout_below="@+id/fwappStatusIcon" + android:layout_centerHorizontal="true" />