Merge branch 'master' into master

here
ivanovlev 2017-01-15 12:27:25 +03:00 committed by GitHub
commit 01d9a63e8b
11 changed files with 85 additions and 17 deletions

View File

@ -1,12 +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

View File

@ -220,7 +220,7 @@
</intent-filter>
</receiver>
<activity android:name=".externalevents.WeatherNotificationConfig"
<activity android:name=".activities.WeatherNotificationConfig"
android:label="mockup">
<intent-filter>
<action android:name="ru.gelin.android.weather.notification.ACTION_WEATHER_SKIN_PREFERENCES"/>

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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) {

View File

@ -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
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_margin="10dp">
<TextView
android:text="Weather on your Pebble"
android:textAlignment="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="20dp"/>
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="@dimen/activity_vertical_margin" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/weather_notification_label"
android:text="@string/weather_notification_label"
/>
</LinearLayout>

View File

@ -27,6 +27,9 @@
<item
android:id="@+id/appmanager_weather_deactivate"
android:title="@string/appmanager_weather_deactivate" />
<item
android:id="@+id/appmanager_weather_install_provider"
android:title="@string/appmanager_weather_install_provider" />
<item
android:id="@+id/appmanager_app_configure"
android:title="@string/app_configure"/>

View File

@ -32,6 +32,7 @@
<string name="appmanager_hrm_deactivate">Deactivate HRM</string>
<string name="appmanager_weather_activate">Activate system weather app</string>
<string name="appmanager_weather_deactivate">Deactivate system weather app</string>
<string name="appmanager_weather_install_provider">Install the weather notification app</string>
<string name="app_configure">Configure</string>
<string name="app_move_to_top">Move to top</string>
@ -115,6 +116,9 @@
<string name="pref_title_sunrise_sunset">Sunrise and Sunset</string>
<string name="pref_summary_sunrise_sunset">Send sunrise and sunset times based on the location to the pebble timeline</string>
<string name="pref_title_autoremove_notifications">Autoremove dismissed Notifications</string>
<string name="pref_summary_autoremove_notifications">Notifications are automatically removed from the Pebble when dismissed from the Android device</string>
<string name="pref_header_location">Location</string>
<string name="pref_title_location_aquire">Acquire Location</string>
<string name="pref_title_location_latitude">Latitude</string>
@ -374,4 +378,6 @@
<!-- Strings related to Pebble Pairing Activity-->
<string name="title_activity_pebble_pairing">Pebble Pairing</string>
<string name="pebble_pairing_hint">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</string>
<string name="weather_notification_label">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.</string>
</resources>

View File

@ -2,12 +2,14 @@
<changelog>
<release version="0.17.0" versioncode="81">
<change>Add weather support through "Weather Notification" app</change>
<change>Various fixes for K9 mail when using the generic notification receiver</change>
<change>Various fixes for K9 mail when using the generic notification receiver</change>
<change>Added transliteration option for notifications in the settings screen</change>
<change>Add a preference to hide the notification icon of Gadgetbridge</change>
<change>Pebble: Support for build-in weather system app (FW 4.x)</change>
<change>Pebble: Add weather support for various watchfaces</change>
<change>Pebble: Delete notifications that got dismissed on the phone</change>
<change>Pebble: Add option to disable call display</change>
<change>Pebble: Add option to automatically delete notifications that got dismissed on the phone</change>
<change>Pebble: Add option to disable call display</change>
<change>Pebble: Bugfix for some PebbleKit enabled 3rd party apps (TCW and maybe other)</change>
<change>Pebble 2/LE: Improve reliablitly and transfer speed</change>
<change>HPlus: Improved discovery and pairing</change>

View File

@ -179,6 +179,11 @@
android:title="@string/pref_title_sunrise_sunset"
android:summary="@string/pref_summary_sunrise_sunset"
android:key="send_sunrise_sunset" />
<CheckBoxPreference
android:defaultValue="false"
android:key="autoremove_notifications"
android:summary="@string/pref_summary_autoremove_notifications"
android:title="@string/pref_title_autoremove_notifications" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_header_activitytrackers">
<ListPreference