Esempio n. 1
0
 static {
   try {
     if (mDefaultBitmap == null) {
       mDefaultBitmap =
           DemoUtils.decodeStream(
               CCPAppManager.getContext().getAssets().open("avatar/default_nor_avatar.png"),
               ResourceHelper.getDensity(null));
     }
   } catch (IOException e) {
   }
 }
Esempio n. 2
0
  /**
   * 查找头像
   *
   * @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;
  }