1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-25 19:36:50 +01:00

Merge remote-tracking branch 'origin/master' into feature-weather

This commit is contained in:
Daniele Gobbetti 2016-01-25 13:12:30 +01:00
commit c08d49d28e
4 changed files with 47 additions and 5 deletions

View File

@ -1,5 +1,9 @@
###Changelog
####Version 0.7.3
* Pebble: Report connection state to PebbleKit companion apps via content provider. NOTE: Makes Gadgetbridge mutual exclusive with the original Pebble app.
* Ignore generic notification when from SMSSecure when SMS Notifications are on
####Version 0.7.2
* Pebble: Allow replying to generic notifications that contain a wearable reply action (tested with Signal)
* Pebble: Support seting up a common suffix for canned replies (defaults to " (canned reply)")

View File

@ -14,8 +14,8 @@ android {
targetSdkVersion 23
// note: always bump BOTH versionCode and versionName!
versionName "0.7.2"
versionCode 38
versionName "0.7.3"
versionCode 39
}
buildTypes {
release {

View File

@ -1,11 +1,21 @@
package nodomain.freeyourgadget.gadgetbridge.contentprovider;
import android.content.BroadcastReceiver;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.v4.content.LocalBroadcastManager;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
public class PebbleContentProvider extends ContentProvider {
@ -24,8 +34,22 @@ public class PebbleContentProvider extends ContentProvider {
static final String URL = "content://" + PROVIDER_NAME + "/state";
static final Uri CONTENT_URI = Uri.parse(URL);
private GBDevice mGBDevice = null;
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(GBDevice.ACTION_DEVICE_CHANGED)) {
mGBDevice = intent.getParcelableExtra(GBDevice.EXTRA_DEVICE);
}
}
};
@Override
public boolean onCreate() {
LocalBroadcastManager.getInstance(this.getContext()).registerReceiver(mReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
return true;
}
@ -33,7 +57,17 @@ public class PebbleContentProvider extends ContentProvider {
public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
if (uri.equals(CONTENT_URI)) {
MatrixCursor mc = new MatrixCursor(columnNames);
mc.addRow(new Object[]{1, 1, 0, 3, 8, 0, "Gadgetbridge"});
int connected = 0;
int appMessage = 0;
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.getContext());
if (sharedPrefs.getBoolean("pebble_enable_pebblekit", false)) {
appMessage = 1;
}
if (mGBDevice != null && mGBDevice.getType() == DeviceType.PEBBLE && mGBDevice.isInitialized()) {
connected = 1;
}
mc.addRow(new Object[]{connected, appMessage, 0, 3, 8, 2, "Gadgetbridge"});
return mc;
} else {
return null;

View File

@ -196,8 +196,11 @@ public class NotificationListener extends NotificationListenerService {
}
}
if (source.equals("com.moez.QKSMS") || source.equals("com.android.mms") ||
source.equals("com.sonyericsson.conversations") || source.equals("com.android.messaging")) {
if (source.equals("com.moez.QKSMS") ||
source.equals("com.android.mms") ||
source.equals("com.sonyericsson.conversations") ||
source.equals("com.android.messaging") ||
source.equals("org.smssecure.smssecure")) {
if (!"never".equals(sharedPrefs.getString("notification_mode_sms", "when_screen_off"))) {
return;
}
@ -236,6 +239,7 @@ public class NotificationListener extends NotificationListenerService {
case "com.android.mms":
case "com.android.messaging":
case "com.sonyericsson.conversations":
case "org.smssecure.smssecure":
notificationSpec.type = NotificationType.SMS;
break;
case "eu.siacs.conversations":