Esempio n. 1
0
 @Override
 protected void onPostExecute(Map<CurrencyLocales, List<CurrencyData>> result) {
   // notifyListeners(Notifications.UPDATE_RATES_DONE);
   setRefreshActionButtonState(false);
   if (updateOK && !result.isEmpty()) {
     DataSource source = null;
     try {
       source = new SQLiteDataSource();
       source.connect(activity);
       source.addRates(result);
     } catch (DataSourceException e) {
       Log.e(Defs.LOG_TAG, "Could not save currencies to database!", e);
       Toast.makeText(getActivity(), R.string.error_db_load_rates, Defs.TOAST_ERR_TIME).show();
     } finally {
       IOUtils.closeQuitely(source);
     }
     updateCurrenciesListView(result.get(getSelectedCurrenciesLocale()));
   } else {
     tvLastUpdate.setText(lastUpdateLastValue);
     Toast.makeText(getActivity(), R.string.error_download_rates, Defs.TOAST_ERR_TIME).show();
   }
 }