Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
fb23ee7970
1 changed files with 18 additions and 2 deletions
|
@ -14,6 +14,7 @@ import org.apache.commons.logging.Log;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.WindowManager;
|
||||
|
@ -42,6 +43,13 @@ public class RenderingIcons {
|
|||
return null;
|
||||
|
||||
try {
|
||||
// Bitmap ic = getIcon(ctx, s);
|
||||
// if(ic == null) {
|
||||
// return null;
|
||||
// }
|
||||
// ByteBuffer buf = ByteBuffer.allocate(ic.getByteCount());
|
||||
// ic.copyPixelsToBuffer(buf);
|
||||
// return buf.array();
|
||||
final InputStream inputStream = ctx.getResources().openRawResource(resId.intValue());
|
||||
final ByteArrayOutputStream proxyOutputStream = new ByteArrayOutputStream(1024);
|
||||
final byte[] ioBuffer = new byte[1024];
|
||||
|
@ -52,7 +60,10 @@ public class RenderingIcons {
|
|||
inputStream.close();
|
||||
final byte[] bitmapData = proxyOutputStream.toByteArray();
|
||||
log.info("Icon data length is " + bitmapData.length); //$NON-NLS-1$
|
||||
|
||||
Bitmap dm = android.graphics.BitmapFactory.decodeByteArray(bitmapData, 0, bitmapData.length) ;
|
||||
if(dm != null){
|
||||
System.out.println("IC " + s +" " + dm.getHeight() + "x" + dm.getWidth());
|
||||
}
|
||||
//if(android.graphics.BitmapFactory.decodeByteArray(bitmapData, 0, bitmapData.length) == null)
|
||||
// throw new Exception();
|
||||
return bitmapData;
|
||||
|
@ -87,7 +98,12 @@ public class RenderingIcons {
|
|||
WindowManager wmgr = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
|
||||
wmgr.getDefaultDisplay().getMetrics(dm);
|
||||
}
|
||||
Bitmap bmp = UnscaledBitmapLoader.loadFromResource(ctx.getResources(), resId.intValue(), null, dm);
|
||||
// BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
// options.inScaled = false;
|
||||
// options.inTargetDensity = dm.densityDpi;
|
||||
// options.inDensity = dm.densityDpi;
|
||||
Bitmap bmp = BitmapFactory.decodeResource(ctx.getResources(), resId, null);
|
||||
// Bitmap bmp = UnscaledBitmapLoader.loadFromResource(ctx.getResources(), resId.intValue(), null, dm);
|
||||
iconsBmp.put(s, bmp);
|
||||
} else {
|
||||
iconsBmp.put(s, null);
|
||||
|
|
Loading…
Reference in a new issue