Skip to content

Commit

Permalink
SPR-27256 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NHB348 committed Mar 10, 2015
1 parent d5eb35d commit 755ef26
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import com.rhomobile.rhodes.util.ContextFactory;
import com.rhomobile.rhodes.util.PerformOnUiThread;
import com.rhomobile.rhodes.util.Utils;
import java.io.InputStream;

import android.content.Context;
import android.graphics.Bitmap;
Expand Down Expand Up @@ -369,9 +370,22 @@ else if (action.equalsIgnoreCase("separator"))
if (iconObj != null) {
if (!(iconObj instanceof String))
throw new IllegalArgumentException("'icon' should be String");
String iconPath = "apps/" + (String)iconObj;
iconPath = RhoFileApi.normalizePath(iconPath);
Bitmap bitmap = BitmapFactory.decodeStream(RhoFileApi.open(iconPath));
InputStream is = null;
String iconPath = (String)iconObj;
is = RhoFileApi.open(iconPath);
if (is == null) {
iconPath = RhoFileApi.normalizePath(iconPath);
is = RhoFileApi.open(iconPath);
}
if (is == null) {
iconPath = "apps/" + (String)iconObj;
iconPath = RhoFileApi.normalizePath(iconPath);
is = RhoFileApi.open(iconPath);
}
if (is == null) {
throw new IllegalArgumentException("Can't find icon file: " + iconPath);
}
Bitmap bitmap = BitmapFactory.decodeStream(is);
if (bitmap == null)
throw new IllegalArgumentException("Can't find icon: " + iconPath);
bitmap.setDensity(DisplayMetrics.DENSITY_MEDIUM);
Expand Down

0 comments on commit 755ef26

Please sign in to comment.