示例#1
1
 private void initHolesBitmaps(List<Hole> holes) throws ParseException, LoadException {
   for (Hole hole : holes) {
     hole.setBitmap(
         (Bitmap)
             ContentProcessor.init()
                 .useCache(BitmapMemoryCache.getInstance())
                 .fromRes(resources)
                 .bitmap()
                 .load(String.valueOf(Hole.getModelIds()[0])));
     hole.setRocksBitmap(
         (Bitmap)
             ContentProcessor.init()
                 .useCache(BitmapMemoryCache.getInstance())
                 .fromRes(resources)
                 .bitmap()
                 .load(String.valueOf(Hole.getRocksModelIds()[0])));
     for (Rock rock : hole.getRocks()) {
       rock.setBitmap(
           (Bitmap)
               ContentProcessor.init()
                   .useCache(BitmapMemoryCache.getInstance())
                   .fromRes(resources)
                   .bitmap()
                   .load(String.valueOf(Rock.getRandomModelResId())));
     }
   }
 }
示例#2
0
 private void initKalahBitmaps(Kalah kalah) throws ParseException, LoadException {
   kalah.setBitmap(
       (Bitmap)
           ContentProcessor.init()
               .useCache(BitmapMemoryCache.getInstance())
               .fromRes(resources)
               .bitmap()
               .load(String.valueOf(Kalah.getModelIds()[0])));
   kalah.setRocksBitmap(
       (Bitmap)
           ContentProcessor.init()
               .useCache(BitmapMemoryCache.getInstance())
               .fromRes(resources)
               .bitmap()
               .load(String.valueOf(Kalah.getRocksModelIds()[0])));
   for (Rock rock : kalah.getRocks()) {
     rock.setBitmap(
         (Bitmap)
             ContentProcessor.init()
                 .useCache(BitmapMemoryCache.getInstance())
                 .fromRes(resources)
                 .bitmap()
                 .load(String.valueOf(Rock.getRandomModelResId())));
   }
 }
示例#3
0
  // TODO refactor this method
  public void initAllBitmaps() {
    try {
      initHolesBitmaps(currentHoles);
      initHolesBitmaps(otherHoles);

      initKalahBitmaps(currentKalah);
      initKalahBitmaps(otherKalah);

      this.setBitmap(
          (Bitmap)
              ContentProcessor.init()
                  .useCache(BitmapMemoryCache.getInstance())
                  .fromRes(resources)
                  .bitmap()
                  .load(String.valueOf(GameField.getModelIds()[0])));
    } catch (Exception e) {
      Log.d("GameField", "Failed to init bitmaps ", e);
    }
  }