diff --git a/.travis.yml b/.travis.yml index 38045ed0..d58ee5f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ android: - tools # The BuildTools version used by your project - - build-tools-23.0.2 + - build-tools-23.0.3 # The SDK version used to compile your project - android-23 diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppBlacklistActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppBlacklistActivity.java index adf33ddc..bef49438 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppBlacklistActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AppBlacklistActivity.java @@ -48,6 +48,7 @@ public class AppBlacklistActivity extends GBActivity { }; private SharedPreferences sharedPrefs; + private IdentityHashMap nameMap; @Override protected void onCreate(Bundle savedInstanceState) { @@ -61,7 +62,7 @@ public class AppBlacklistActivity extends GBActivity { ListView appListView = (ListView) findViewById(R.id.appListView); // sort the package list by label and blacklist status - final IdentityHashMap nameMap = new IdentityHashMap<>(packageList.size()); + nameMap = new IdentityHashMap<>(packageList.size()); for (ApplicationInfo ai : packageList) { CharSequence name = pm.getApplicationLabel(ai); if (name == null) { @@ -98,7 +99,7 @@ public class AppBlacklistActivity extends GBActivity { CheckBox checkbox = (CheckBox) view.findViewById(R.id.item_checkbox); deviceAppVersionAuthorLabel.setText(appInfo.packageName); - deviceAppNameLabel.setText(appInfo.loadLabel(pm)); + deviceAppNameLabel.setText(nameMap.get(appInfo)); deviceImageView.setImageDrawable(appInfo.loadIcon(pm)); checkbox.setChecked(GBApplication.blacklist.contains(appInfo.packageName)); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java index 85e3ceb7..c26cb1b8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java @@ -117,7 +117,7 @@ public class DeviceCommunicationService extends Service { mGBDevice = device; boolean enableReceivers = mDeviceSupport != null && (mDeviceSupport.useAutoConnect() || mGBDevice.isInitialized()); setReceiversEnableState(enableReceivers); - GB.updateNotification(mGBDevice.getName() + " " + mGBDevice.getStateString(), context); + GB.updateNotification(mGBDevice.getName() + " " + mGBDevice.getStateString(), mGBDevice.isInitialized(), context); } else { LOG.error("Got ACTION_DEVICE_CHANGED from unexpected device: " + mGBDevice); } @@ -387,7 +387,7 @@ public class DeviceCommunicationService extends Service { private void start() { if (!mStarted) { - startForeground(GB.NOTIFICATION_ID, GB.createNotification(getString(R.string.gadgetbridge_running), this)); + startForeground(GB.NOTIFICATION_ID, GB.createNotification(getString(R.string.gadgetbridge_running), false, this)); mStarted = true; } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java index a20e0f2e..07a7d593 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java @@ -45,7 +45,7 @@ public class GB { public static final String DISPLAY_MESSAGE_SEVERITY = "severity"; public static GBEnvironment environment; - public static Notification createNotification(String text, Context context) { + public static Notification createNotification(String text, boolean connected, Context context) { if (env().isLocalTest()) { return null; } @@ -59,7 +59,7 @@ public class GB { builder.setContentTitle(context.getString(R.string.app_name)) .setTicker(text) .setContentText(text) - .setSmallIcon(R.drawable.ic_notification) + .setSmallIcon(connected ? R.drawable.ic_notification : R.drawable.ic_notification_disconnected) .setContentIntent(pendingIntent) .setOngoing(true); if (GBApplication.isRunningLollipopOrLater()) { @@ -68,8 +68,8 @@ public class GB { return builder.build(); } - public static void updateNotification(String text, Context context) { - Notification notification = createNotification(text, context); + public static void updateNotification(String text, boolean connected, Context context) { + Notification notification = createNotification(text, connected, context); updateNotification(notification, NOTIFICATION_ID, context); } diff --git a/app/src/main/res/drawable-hdpi/ic_notification_disconnected.png b/app/src/main/res/drawable-hdpi/ic_notification_disconnected.png new file mode 100644 index 00000000..5d510a7a Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_notification_disconnected.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_notification_disconnected.png b/app/src/main/res/drawable-mdpi/ic_notification_disconnected.png new file mode 100644 index 00000000..f1587ca3 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_notification_disconnected.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_notification_disconnected.png b/app/src/main/res/drawable-xhdpi/ic_notification_disconnected.png new file mode 100644 index 00000000..b382a8f7 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_notification_disconnected.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_notification_disconnected.png b/app/src/main/res/drawable-xxhdpi/ic_notification_disconnected.png new file mode 100644 index 00000000..cf509b11 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_notification_disconnected.png differ