Exemplo n.º 1
0
 /*
  * Fills in the map with information in the observer so that it can be used
  * with a SimpleAdapter to populate the UI
  */
 public static void fillMap(
     Map<String, Object> map, TransferObserver observer, boolean isChecked) {
   int progress = (int) ((double) observer.getBytesTransferred() * 100 / observer.getBytesTotal());
   map.put("id", observer.getId());
   map.put("checked", isChecked);
   map.put("fileName", observer.getAbsoluteFilePath());
   map.put("progress", progress);
   map.put(
       "bytes",
       getBytesString(observer.getBytesTransferred())
           + "/"
           + getBytesString(observer.getBytesTotal()));
   map.put("state", observer.getState());
   map.put("percentage", progress + "%");
 }