From f2016a7c33526f2d0ab81da5da2e4afd8fdbfb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Mon, 16 Jan 2017 15:18:19 +0100 Subject: [PATCH] Pass json settings as an argument --- src/android/ForegroundService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/android/ForegroundService.java b/src/android/ForegroundService.java index f674fdd..0c37b73 100644 --- a/src/android/ForegroundService.java +++ b/src/android/ForegroundService.java @@ -155,7 +155,7 @@ public class ForegroundService extends Service { .setTicker(settings.optString("ticker", "")) .setOngoing(true) .setPriority(Notification.PRIORITY_MIN) - .setSmallIcon(getIconResId()); + .setSmallIcon(getIconResId(settings)); if (bigText || text.contains("\n")) { notification.setStyle( @@ -196,9 +196,10 @@ public class ForegroundService extends Service { /** * Retrieves the resource ID of the app icon. + * + * @param settings A JSON dict containing the icon name. */ - private int getIconResId() { - JSONObject settings = BackgroundMode.getSettings(); + private int getIconResId(JSONObject settings) { Context context = getApplicationContext(); Resources res = context.getResources(); String pkgName = context.getPackageName();