static { try { if (mDefaultBitmap == null) { mDefaultBitmap = DemoUtils.decodeStream( CCPAppManager.getContext().getAssets().open("avatar/default_nor_avatar.png"), ResourceHelper.getDensity(null)); } } catch (IOException e) { } }
/** * 查找头像 * * @param username * @return */ public static Bitmap getPhoto(String username) { try { if (photoCache.containsKey(username)) { return photoCache.get(username); } Bitmap bitmap = DemoUtils.decodeStream( CCPAppManager.getContext().getAssets().open("avatar/" + username), ResourceHelper.getDensity(null)); photoCache.put(username, bitmap); return bitmap; } catch (IOException e) { } return mDefaultBitmap; }
private static List<InnerBitmapEntity> getBitmapEntitys(int count) { List<InnerBitmapEntity> mList = new LinkedList<InnerBitmapEntity>(); String value = ECPropertiesUtil.readData( CCPAppManager.getContext(), String.valueOf(count), R.raw.nine_rect); LogUtil.d("value=>" + value); String[] arr1 = value.split(";"); int length = arr1.length; for (int i = 0; i < length; i++) { String content = arr1[i]; String[] arr2 = content.split(","); InnerBitmapEntity entity = null; for (int j = 0; j < arr2.length; j++) { entity = new InnerBitmapEntity(); entity.x = Float.valueOf(arr2[0]); entity.y = Float.valueOf(arr2[1]); entity.width = Float.valueOf(arr2[2]); entity.height = Float.valueOf(arr2[3]); } mList.add(entity); } return mList; }