Merge branch 'master' into live-activity-data

live-activity-data
cpfeiffer 2015-09-06 00:46:50 +02:00
commit 1711a7a731
13 changed files with 119 additions and 41 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -7,31 +7,35 @@
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
android:animateLayoutChanges="true"
tools:context="nodomain.freeyourgadget.gadgetbridge.activities.FwAppInstallerActivity">
<ListView
android:id="@+id/itemListView"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
>
android:layout_height="wrap_content"
android:layout_alignParentEnd="false">
</ListView>
<TextView
android:id="@+id/infoTextView"
android:layout_width="wrap_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
/>
android:layout_alignParentTop="false"
android:layout_alignParentEnd="false"
android:layout_alignParentStart="false"
android:layout_below="@+id/itemListView" />
<ImageView
android:id="@+id/fwappStatusIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="Status Icon"
android:layout_weight="0"
/>
android:layout_centerHorizontal="true"
android:layout_alignParentTop="false"
android:layout_alignParentLeft="false"
android:layout_below="@+id/infoTextView" />
<ProgressBar
android:id="@+id/installProgressBar"
@ -39,7 +43,9 @@
android:layout_height="40dp"
android:indeterminate="true"
android:layout_gravity="center_horizontal"
android:visibility="gone"/>
android:visibility="gone"
android:layout_below="@+id/fwappStatusIcon"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
@ -47,11 +53,19 @@
android:text="@string/appinstaller_install"
android:id="@+id/installButton"
android:layout_gravity="center_horizontal"
android:enabled="false" />
android:enabled="false"
android:layout_alignParentBottom="false"
android:layout_alignWithParentIfMissing="false"
android:layout_alignParentTop="false"
android:layout_alignParentLeft="false"
android:layout_centerHorizontal="true"
android:layout_below="@+id/installProgressBar"
android:layout_marginTop="10dp" />
<android.widget.Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3"/>
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</LinearLayout>
</RelativeLayout>

View File

@ -21,7 +21,7 @@
android:text="&lt;" />
<TextView
android:id="@+id/charts_text_date"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:text="Today"

View File

@ -6,7 +6,7 @@
<string name="action_debug">Debug</string>
<string name="action_quit">Beenden</string>
<string name="controlcenter_start_sleepmonitor">Schlafmonitor (ALPHA)</string>
<string name="controlcenter_find_device">Gerätesuche</string>
<string name="controlcenter_find_device">Verlegtes Gerät finden</string>
<string name="controlcenter_take_screenshot">Bildschirmfoto</string>
<string name="controlcenter_disconnect">Trennen</string>
<string name="title_activity_debug">Debug</string>
@ -64,7 +64,7 @@
<string name="title_activity_discovery">Gerätesuche</string>
<string name="discovery_stop_scanning">Suche beenden</string>
<string name="discovery_start_scanning">Suche starten</string>
<string name="action_discover">Gerät suchen</string>
<string name="action_discover">Neues Gerät verbinden</string>
<string name="device_with_rssi">%1$s (%2$s)</string>
<string name="title_activity_android_pairing">Gerät paaren</string>
<string name="android_pairing_hint">Verwende den Android Bluetooth Paaren-Dialog um Dein Gerät zu paaren.</string>

View File

@ -16,10 +16,6 @@
<string name="appmananger_app_delete">Borrar</string>
<!--Strings related to FwAppInstaller-->
<string name="title_activity_fw_app_insaller">Instalador de FW/App</string>
<string name="fw_upgrade_notice">Estás a punto de instalar el firmware %s en lugar del que está actualmente en tu MiBand.</string>
<string name="miband_firmware_known">Este firmware ha sido probado y se sabe que es compatible con GadgetBridge.</string>
<string name="miband_firmware_unknown_warning">Este firmware no se ha probado y puede no ser compatible con GadgetBridge. No se recomienda la instalación en tu MiBand.</string>
<string name="miband_firmware_suggest_whitelist">Si a pesar de esto deseas continuar y las cosas continúan funcionando bien posteriormente, por favor, informa a los desarrolladores de GadgetBridge para que incluyan la versión de firmware:%s en la lista blanca</string>
<!--Strings related to Settings-->
<string name="title_activity_settings">Ajustes</string>
<string name="pref_header_general">Ajustes generales</string>
@ -146,7 +142,6 @@
<string name="installer_activity_unable_to_find_handler">No se ha podido encontrar un controlador para instalar este archivo.</string>
<string name="pbw_install_handler_unable_to_install">No se puede instalar el archivo: $1%s</string>
<string name="pbw_install_handler_hw_revision_mismatch">No se puede instalar este firmware: no coincide con la revision hardware de tu Pebble.</string>
<string name="installer_activity_wait_while_determining_status">Por favor, espera mientras se determina el estado de la instalación ...</string>
<string name="sleepchart_your_sleep">Tu sueño</string>
<string name="weekstepschart_steps_a_week">Pasos por semana</string>
<string name="activity_sleepchart_activity_and_sleep">Tu actividad y sueño</string>

View File

@ -12,11 +12,12 @@
<string name="controlcenter_disconnect">Déconnexion</string>
<string name="title_activity_debug">Débugger</string>
<!--Strings related to AppManager-->
<string name="title_activity_appmanager">Gestionnaire d\'application</string>
<string name="appmananger_app_delete">Supprimer</string>
<!--Strings related to FwAppInstaller-->
<string name="fw_upgrade_notice">Vous êtes sur le point d\'installer le firmware %s à la place de celui qui est actuellement sur votre MiBand.</string>
<string name="miband_firmware_known">Ce firmware a été testé et est compatible with GadgetBridge</string>
<string name="miband_firmware_unknown_warning">Ce firmware n\'est pas testé and peut ne pas être compatible avec GadgetBridge. Il ne vous est pas conseillé de flasher votre MiBand</string>
<string name="fw_upgrade_notice">Vous êtes sur le point d\'installer le firmware %s à la place de celui qui est actuellement sur votre Mi Band.</string>
<string name="miband_firmware_known">Ce firmware a été testé et est connu pour être compatible avec Gadgetbridge.</string>
<string name="miband_firmware_unknown_warning">Ce firmware n\'a pas été testé et peut ne pas être compatible avec Gadgetbridge. \ N \ nIl n\'est pas conseillé de flasher votre Mi Band.</string>
<!--Strings related to Settings-->
<string name="title_activity_settings">Paramètre</string>
<string name="pref_header_general">Paramètres généraux</string>
@ -30,6 +31,7 @@
<string name="pref_title_notifications_incoming_call">Appel entrant</string>
<string name="pref_title_notifications_k9mail">K9-Email</string>
<string name="pref_title_notifications_pebblemsg">Message Pebble</string>
<string name="pref_summary_notifications_pebblemsg">Support pour les applications qui envoient des notifications au Pebble via Intent. Peut être utilisé pour les conversations.</string>
<string name="pref_title_notifications_generic">Support des notififactions génériques</string>
<string name="pref_title_whenscreenon">même lorsque l\'écran est allumé</string>
<string name="always">toujours</string>
@ -54,6 +56,7 @@
<string name="this_is_a_test_notification_from_gadgetbridge">Ceci est un test de notification venant de Gadgetbridge</string>
<string name="bluetooth_is_not_supported_">Le bluetooth n\'est pas supporté</string>
<string name="bluetooth_is_disabled_">Le bluetooth est désactivé</string>
<string name="tap_connected_device_for_app_mananger">Taper sur lpour le connecter au gestionnaire d\'application</string>
<string name="tap_a_device_to_connect">Tapper sur l\'appareil pour le connecter</string>
<string name="cannot_connect_bt_address_invalid_">Ne peut être connecter. Ladresse bluetooth est invalide? </string>
<string name="gadgetbridge_running">Gadgetbridge est en fonctionnement</string>
@ -61,6 +64,7 @@
<string name="installation_failed_">installation en échec</string>
<string name="installation_successful">installation réalisé</string>
<string name="firmware_install_warning">VOUS ÊTES EN TRAIN D\'INSTALLER UN FIRMWARE, PROCEDEZ À VOS PROPRES RISQUES. CE FIRMWARE EST POUR LA VERSION HW: %s</string>
<string name="app_install_info">Vous êtes sur le point d\'installer l\'application suivante:\n\n\n%1$s Version %2$s par %3$s\n</string>
<string name="n_a">N/A</string>
<string name="initialized">initialisé</string>
<string name="appversion_by_creator">%1$s par %2$s</string>
@ -86,6 +90,7 @@
<string name="appinstaller_install">Installer</string>
<string name="discovery_connected_devices_hint">Rendre votre appareil découvrable. Actuellement les appareils connectés ne seront pas découvert.</string>
<string name="discovery_note">Note:</string>
<string name="candidate_item_device_image">Image de l\'appareil</string>
<string name="miband_prefs_about_you">A propos de vous</string>
<string name="miband_prefs_alias">Nom/Pseudo</string>
<string name="miband_prefs_year_birth">Année de naissance</string>
@ -96,6 +101,7 @@
<string name="title_activity_sleepmonitor">Moniteur de sommeil</string>
<string name="pref_write_logfiles">Ecrire le fichier de logs (besoin de redemarrer)</string>
<string name="initializing">iniitialisation</string>
<string name="busy_task_fetch_activity_data">Récupération des données d\'activité</string>
<string name="sleep_activity_date_range">De %1$s à %2$s</string>
<string name="miband_prefs_wearside">Port main gauche ou droite?</string>
<string name="pref_screen_vibration_profile">Profil de vibration</string>
@ -138,5 +144,27 @@
<string name="installer_activity_unable_to_find_handler">Impossible de trouver un gestionnaire pour installer ce fichier.</string>
<string name="pbw_install_handler_unable_to_install">Impossible d\'installer le fichier donné: $1%s</string>
<string name="pbw_install_handler_hw_revision_mismatch">Impossible d\'installer le firmware donnée: il ne correspond pas à la version du matériel de votre Pebble.</string>
<string name="installer_activity_wait_while_determining_status">S\'il vous plaît patienter pendant la détermination de l\'état de l\'installation ...</string>
<string name="installer_activity_wait_while_determining_status">S\'il vous plait patientez pendant la détermination du status de l\'installation...</string>
<string name="notif_battery_low_title">Gadget batterie Vide!</string>
<string name="notif_battery_low_percent">%1$s batterie restante: %2$s%%</string>
<string name="notif_battery_low_bigtext_last_charge_time">Dernière charge: %s \n</string>
<string name="notif_battery_low_bigtext_number_of_charges">Nombre de charges: %s</string>
<string name="sleepchart_your_sleep">Votre sommeil</string>
<string name="weekstepschart_steps_a_week">Pas de la semaine</string>
<string name="activity_sleepchart_activity_and_sleep">Votre activité et sommeil</string>
<string name="updating_firmware">Mise à jour du Firmware...</string>
<string name="fwapp_install_device_not_ready">Le fichier ne peut pas être installé, l\'appareil n\'est pas prêt.</string>
<string name="miband_installhandler_miband_firmware">Firmware Mi Band %1$s</string>
<string name="miband_fwinstaller_compatible_version">Version compatible</string>
<string name="miband_fwinstaller_untested_version">Version non testé!</string>
<string name="fwappinstaller_connection_state">Connexion à l\'appareil: %1$s</string>
<string name="pbw_installhandler_pebble_firmware">Firmware Pebble %1$s</string>
<string name="pbwinstallhandler_correct_hw_revision">Révision correcte du matériel</string>
<string name="pbwinstallhandler_incorrect_hw_revision">Version Hardware incorrecte!</string>
<string name="pbwinstallhandler_app_item">%1$s (%2$s)</string>
<string name="updatefirmwareoperation_updateproblem_do_not_reboot">Problème avec le transfert du firmware. Ne redémarrez pas votre bande Mi!</string>
<string name="updatefirmwareoperation_metadata_updateproblem">Problème avec le transfert de métadonnées du firmware</string>
<string name="updatefirmwareoperation_update_complete">Installation complète du firmware</string>
<string name="updatefirmwareoperation_update_complete_rebooting">Installation complète du firmware, redémarrage de l\'appareil</string>
<string name="updatefirmwareoperation_write_failed">Échec lors de l\'écriture du firmware</string>
</resources>

View File

@ -8,7 +8,7 @@
<string name="action_quit">Quit</string>
<string name="controlcenter_fetch_activity_data">Synchronize</string>
<string name="controlcenter_start_sleepmonitor">Sleep Monitor (ALPHA)</string>
<string name="controlcenter_find_device">Find Device…</string>
<string name="controlcenter_find_device">Find lost Device…</string>
<string name="controlcenter_take_screenshot">Take Screenshot</string>
<string name="controlcenter_disconnect">Disconnect</string>
@ -86,7 +86,7 @@
<string name="discovery_stop_scanning">Stop Scanning</string>
<string name="discovery_start_scanning">Start Discovery</string>
<string name="action_discover">Discover Device</string>
<string name="action_discover">Connect new Device</string>
<string name="device_with_rssi">%1$s (%2$s)</string>
<string name="title_activity_android_pairing">Pair Device</string>
<string name="android_pairing_hint">Use the Android Bluetooth Pairing dialog to pair the device.</string>

View File

@ -58,8 +58,8 @@ public class TestDeviceSupport extends AbstractDeviceSupport {
}
@Override
public void onGenericNotification(String title, String details) {
public void onGenericNotification(String title, String details, int handle) {
}
@Override