Skip to content

Commit

Permalink
Fix too many function arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
katzer committed Feb 7, 2017
1 parent a9300a4 commit ff9f063
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/android/ForegroundService.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,13 @@ protected void updateNotification (JSONObject settings) {
* @param settings A JSON dict containing the icon name.
*/
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
int resId = getIconResId(res, icon, "mipmap", pkgName);
int resId = getIconResId(icon, "mipmap");

if (resId == 0) {
resId = getIconResId(res, icon, "drawable", pkgName);
resId = getIconResId(icon, "drawable");
}

return resId;
Expand All @@ -232,15 +229,14 @@ private int getIconResId(JSONObject settings) {
/**
* Retrieve resource id of the specified icon.
*
* @param res The app resource bundle.
* @param icon The name of the icon.
* @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.
*/
private int getIconResId(Resources res, String icon,
String type, String pkgName) {
private int getIconResId(String icon, String type) {
Resources res = getResources();
String pkgName = getPackageName();

int resId = res.getIdentifier(icon, type, pkgName);

Expand Down

0 comments on commit ff9f063

Please sign in to comment.