Fix too many function arguments

This commit is contained in:
Sebastián Katzer 2017-02-07 09:12:04 +01:00
parent a9300a43ae
commit ff9f06382f

View File

@ -214,16 +214,13 @@ public class ForegroundService extends Service {
* @param settings A JSON dict containing the icon name. * @param settings A JSON dict containing the icon name.
*/ */
private int getIconResId(JSONObject settings) { private int getIconResId(JSONObject settings) {
Context context = getApplicationContext();
Resources res = context.getResources();
String pkgName = context.getPackageName();
String icon = settings.optString("icon", NOTIFICATION_ICON); String icon = settings.optString("icon", NOTIFICATION_ICON);
// cordova-android 6 uses mipmaps // cordova-android 6 uses mipmaps
int resId = getIconResId(res, icon, "mipmap", pkgName); int resId = getIconResId(icon, "mipmap");
if (resId == 0) { if (resId == 0) {
resId = getIconResId(res, icon, "drawable", pkgName); resId = getIconResId(icon, "drawable");
} }
return resId; return resId;
@ -232,15 +229,14 @@ public class ForegroundService extends Service {
/** /**
* Retrieve resource id of the specified icon. * Retrieve resource id of the specified icon.
* *
* @param res The app resource bundle.
* @param icon The name of the icon. * @param icon The name of the icon.
* @param type The resource type where to look for. * @param type The resource type where to look for.
* @param pkgName The name of the package.
* *
* @return The resource id or 0 if not found. * @return The resource id or 0 if not found.
*/ */
private int getIconResId(Resources res, String icon, private int getIconResId(String icon, String type) {
String type, String pkgName) { Resources res = getResources();
String pkgName = getPackageName();
int resId = res.getIdentifier(icon, type, pkgName); int resId = res.getIdentifier(icon, type, pkgName);