From 1e24fa7ad811af958ed6bd22e8ffbbe464471614 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Sat, 14 Jan 2017 00:26:21 +0100 Subject: [PATCH 1/7] Dummy weather notifucation config activity --- app/src/main/AndroidManifest.xml | 2 +- .../activities/WeatherNotificationConfig.java | 15 +++++++++++ .../WeatherNotificationConfig.java | 9 ------- .../layout/activity_weather_notification.xml | 25 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 5 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WeatherNotificationConfig.java delete mode 100644 app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/WeatherNotificationConfig.java create mode 100644 app/src/main/res/layout/activity_weather_notification.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e1b691f81..ff2b210f5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -220,7 +220,7 @@ - diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WeatherNotificationConfig.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WeatherNotificationConfig.java new file mode 100644 index 000000000..49574bed7 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WeatherNotificationConfig.java @@ -0,0 +1,15 @@ +package nodomain.freeyourgadget.gadgetbridge.activities; + +import android.os.Bundle; +import android.os.PersistableBundle; +import android.widget.TextView; + +import nodomain.freeyourgadget.gadgetbridge.R; + +public class WeatherNotificationConfig extends GBActivity { + @Override + public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) { + super.onCreate(savedInstanceState, persistentState); + setContentView(R.layout.activity_weather_notification); + } +} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/WeatherNotificationConfig.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/WeatherNotificationConfig.java deleted file mode 100644 index a2b325e35..000000000 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/WeatherNotificationConfig.java +++ /dev/null @@ -1,9 +0,0 @@ -package nodomain.freeyourgadget.gadgetbridge.externalevents; - -import android.app.Activity; - -public class WeatherNotificationConfig extends Activity { - - //TODO: we just need the user to enable us in the weather notification settings. There must be a better way - -} diff --git a/app/src/main/res/layout/activity_weather_notification.xml b/app/src/main/res/layout/activity_weather_notification.xml new file mode 100644 index 000000000..bbb5a7377 --- /dev/null +++ b/app/src/main/res/layout/activity_weather_notification.xml @@ -0,0 +1,25 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 522883d9f..64b880f4c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -372,4 +372,5 @@ Pebble Pairing A pairing dialog is expected to pop up on your Android device. If that does not happen, look in the notification drawer and accept the pairing request. After that accept the pairing request on your Pebble + Enable this style to get weather information on your Pebble.\n\nConfiguration will be possible in a later version. From 23a1663384c63a924c5ed63ce798d63689a62fa5 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sat, 14 Jan 2017 11:16:01 +0100 Subject: [PATCH 2/7] fix wording (style -> skin) --- app/src/main/res/values/strings.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 64b880f4c..300c6b747 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -372,5 +372,6 @@ Pebble Pairing A pairing dialog is expected to pop up on your Android device. If that does not happen, look in the notification drawer and accept the pairing request. After that accept the pairing request on your Pebble - Enable this style to get weather information on your Pebble.\n\nConfiguration will be possible in a later version. + + Enable this skin to get weather information on your Pebble.\n\nConfiguration will be possible in a later version. From cb3460912fcc3feb72f904d47935e092ce4b6cab Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Sat, 14 Jan 2017 14:53:56 +0100 Subject: [PATCH 3/7] Update changelog --- CHANGELOG.md | 1 + app/src/main/res/xml/changelog_master.xml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ee0d0da8..806a2f204 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ####Version 0.17.0 (next) * Add weather support through "Weather Notification" app * Various fixes for K9 mail when using the generic notification receiver +* Add a preference to hide the persistent notification icon of Gadgetbridge * Pebble: Support for build-in weather system app (FW 4.x) * Pebble: Add weather support for various watchfaces * Pebble: Add option to disable call display diff --git a/app/src/main/res/xml/changelog_master.xml b/app/src/main/res/xml/changelog_master.xml index c54077e4c..01795f090 100644 --- a/app/src/main/res/xml/changelog_master.xml +++ b/app/src/main/res/xml/changelog_master.xml @@ -2,11 +2,12 @@ Add weather support through "Weather Notification" app - Various fixes for K9 mail when using the generic notification receiver + Various fixes for K9 mail when using the generic notification receiver + Add a preference to hide the notification icon of Gadgetbridge Pebble: Support for build-in weather system app (FW 4.x) Pebble: Add weather support for various watchfaces Pebble: Delete notifications that got dismissed on the phone - Pebble: Add option to disable call display + Pebble: Add option to disable call display Pebble: Bugfix for some PebbleKit enabled 3rd party apps (TCW and maybe other) Pebble 2/LE: Improve reliablitly and transfer speed HPlus: Improved discovery and pairing From 0152e7ce02dcb58034f3a590ad5a758bfae6055d Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Sat, 14 Jan 2017 15:10:57 +0100 Subject: [PATCH 4/7] Make the text in the Weather configuration mock activity a bit more clear. --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 300c6b747..e51eea292 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -373,5 +373,5 @@ Pebble Pairing A pairing dialog is expected to pop up on your Android device. If that does not happen, look in the notification drawer and accept the pairing request. After that accept the pairing request on your Pebble - Enable this skin to get weather information on your Pebble.\n\nConfiguration will be possible in a later version. + Make sure that this skin is enabled in the Weather Notification app to get weather information on your Pebble.\n\nNo configuration is needed here.\n\nYou can enable the system weather app of your Pebble from the app management.\n\nSupported watchfaces will show the weather automatically. From 4dfef382a9ea8c632c68576e96530ee369df6696 Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Sat, 14 Jan 2017 18:19:41 +0100 Subject: [PATCH 5/7] Pebble: change the overflow menu of the weather system app. If the weather notification app is not installed, link to fdroid (app if installed, web page of the app if not). If the weather notification app is installed, show the options to activate and deactivate it. --- .../appmanager/AbstractAppManagerFragment.java | 17 +++++++++++++++++ app/src/main/res/menu/appmanager_context.xml | 3 +++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 21 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AbstractAppManagerFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AbstractAppManagerFragment.java index 3e68b2dfa..946d72ae3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AbstractAppManagerFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/appmanager/AbstractAppManagerFragment.java @@ -4,6 +4,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; @@ -298,6 +299,7 @@ public abstract class AbstractAppManagerFragment extends Fragment { if (!PebbleProtocol.UUID_WEATHER.equals(selectedApp.getUUID())) { menu.removeItem(R.id.appmanager_weather_activate); menu.removeItem(R.id.appmanager_weather_deactivate); + menu.removeItem(R.id.appmanager_weather_install_provider); } if (selectedApp.getType() == GBDeviceApp.Type.APP_SYSTEM || selectedApp.getType() == GBDeviceApp.Type.WATCHFACE_SYSTEM) { menu.removeItem(R.id.appmanager_app_delete); @@ -305,6 +307,18 @@ public abstract class AbstractAppManagerFragment extends Fragment { if (!selectedApp.isConfigurable()) { menu.removeItem(R.id.appmanager_app_configure); } + + if (PebbleProtocol.UUID_WEATHER.equals(selectedApp.getUUID())) { + PackageManager pm = getActivity().getPackageManager(); + try { + pm.getPackageInfo("ru.gelin.android.weather.notification", PackageManager.GET_ACTIVITIES); + menu.removeItem(R.id.appmanager_weather_install_provider); + } catch (PackageManager.NameNotFoundException e) { + menu.removeItem(R.id.appmanager_weather_activate); + menu.removeItem(R.id.appmanager_weather_deactivate); + } + } + switch (selectedApp.getType()) { case WATCHFACE: case APP_GENERIC: @@ -382,6 +396,9 @@ public abstract class AbstractAppManagerFragment extends Fragment { case R.id.appmanager_weather_deactivate: GBApplication.deviceService().onAppDelete(selectedApp.getUUID()); return true; + case R.id.appmanager_weather_install_provider: + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://f-droid.org/app/ru.gelin.android.weather.notification"))); + return true; case R.id.appmanager_app_configure: GBApplication.deviceService().onAppStart(selectedApp.getUUID(), true); diff --git a/app/src/main/res/menu/appmanager_context.xml b/app/src/main/res/menu/appmanager_context.xml index 766f6c5a2..2f281ce82 100644 --- a/app/src/main/res/menu/appmanager_context.xml +++ b/app/src/main/res/menu/appmanager_context.xml @@ -27,6 +27,9 @@ + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e51eea292..cabf031ab 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -32,6 +32,7 @@ Deactivate HRM Activate system weather app Deactivate system weather app + Install the weather notification app Configure Move to top From ce67bf2c520b9836f8b987b35bca563b391d4a2b Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 15 Jan 2017 00:10:40 +0100 Subject: [PATCH 6/7] Pebble: make the feature to automatically delete notifications from the pebble optional (This is not pebble specific at all but as long as other devices do not use that it will stay in the Pebble specific preference screen) --- CHANGELOG.md | 4 ++-- .../gadgetbridge/externalevents/NotificationListener.java | 7 +++++-- app/src/main/res/values/strings.xml | 3 +++ app/src/main/res/xml/changelog_master.xml | 2 +- app/src/main/res/xml/preferences.xml | 5 +++++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 806a2f204..35f3d5123 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,13 @@ ###Changelog -####Version 0.17.0 (next) +####Version 0.17.0 * Add weather support through "Weather Notification" app * Various fixes for K9 mail when using the generic notification receiver * Add a preference to hide the persistent notification icon of Gadgetbridge * Pebble: Support for build-in weather system app (FW 4.x) * Pebble: Add weather support for various watchfaces * Pebble: Add option to disable call display -* Pebble: Delete notifications that got dismissed on the phone +* Pebble: Add option to automatically delete notifications that got dismissed on the phone * Pebble: Bugfix for some PebbleKit enabled 3rd party apps (TCW and maybe other) * Pebble 2/LE: Improve reliablitly and transfer speed * HPlus: Improved discovery and pairing 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 80942dd94..81a417951 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/externalevents/NotificationListener.java @@ -410,9 +410,12 @@ public class NotificationListener extends NotificationListenerService { return; } - LOG.info("notification removed, will ask device to delete it"); + Prefs prefs = GBApplication.getPrefs(); + if (prefs.getBoolean("autoremove_notifications", false)) { + LOG.info("notification removed, will ask device to delete it"); - GBApplication.deviceService().onDeleteNotification((int) sbn.getPostTime()); //FIMXE: a truly unique id would be better + GBApplication.deviceService().onDeleteNotification((int) sbn.getPostTime()); //FIMXE: a truly unique id would be better + } } private void dumpExtras(Bundle bundle) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cabf031ab..0667156fd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -114,6 +114,9 @@ Sunrise and Sunset Send sunrise and sunset times based on the location to the pebble timeline + Autoremove dismissed Notifications + Notifications are automatically removed from the Pebble when dismissed from the Android device + Location Acquire Location Latitude diff --git a/app/src/main/res/xml/changelog_master.xml b/app/src/main/res/xml/changelog_master.xml index 01795f090..d5f774bdf 100644 --- a/app/src/main/res/xml/changelog_master.xml +++ b/app/src/main/res/xml/changelog_master.xml @@ -6,7 +6,7 @@ Add a preference to hide the notification icon of Gadgetbridge Pebble: Support for build-in weather system app (FW 4.x) Pebble: Add weather support for various watchfaces - Pebble: Delete notifications that got dismissed on the phone + Pebble: Add option to automatically delete notifications that got dismissed on the phone Pebble: Add option to disable call display Pebble: Bugfix for some PebbleKit enabled 3rd party apps (TCW and maybe other) Pebble 2/LE: Improve reliablitly and transfer speed diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 43985431d..84bba8c31 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -172,6 +172,11 @@ android:title="@string/pref_title_sunrise_sunset" android:summary="@string/pref_summary_sunrise_sunset" android:key="send_sunrise_sunset" /> + Date: Sun, 15 Jan 2017 00:33:54 +0100 Subject: [PATCH 7/7] fix typo --- app/src/main/res/xml/preferences.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 84bba8c31..c8f1964e1 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -174,7 +174,7 @@ android:key="send_sunrise_sunset" />