public double getLastPrice(String currency) {
   if (fxRates.get(currency) != null && fxRates.get(currency) > 0.0) {
     PrefsUtil.getInstance(context)
         .setValue(
             "LAST_KNOWN_VALUE_FOR_CURRENCY_" + currency, Double.toString(fxRates.get(currency)));
     return fxRates.get(currency);
   } else {
     return Double.parseDouble(
         PrefsUtil.getInstance(context)
             .getValue("LAST_KNOWN_VALUE_FOR_CURRENCY_" + currency, "0.0"));
   }
 }
Ejemplo n.º 2
0
  /**
   * Delete items of the cleaning paths
   *
   * @param cleaningPaths ArrayList<String>
   */
  public static void deleteExplorer(ArrayList<String> cleaningPaths) {
    File directory;

    for (String path : cleaningPaths) {
      directory = new File(PrefsUtil.getExplorerRootPath() + path);
      if (directory.exists()) {
        deleteRecursively(directory.listFiles());
      }
    }
  }
Ejemplo n.º 3
0
  /**
   * Get total file size of cleaning paths
   *
   * @param cleaningPaths
   * @return
   */
  public static double getTotalFileSize(ArrayList<String> cleaningPaths) {
    File file;
    double sum = 0.0;

    for (String path : cleaningPaths) {
      file = new File(PrefsUtil.getExplorerRootPath() + path);
      if (file.exists()) {
        sum += getFileSize(file);
      }
    }

    return sum;
  }