/** * Gets all relevant transfers from the Transfer Service for populating the * UI */ private void initData() { transferRecordMaps.clear(); // Use TransferUtility to get all upload transfers. observers = transferUtility.getTransfersWithType(TransferType.UPLOAD); TransferListener listener = new UploadListener(); for (TransferObserver observer : observers) { // For each transfer we will will create an entry in // transferRecordMaps which will display // as a single row in the UI HashMap<String, Object> map = new HashMap<String, Object>(); Util.fillMap(map, observer, false); transferRecordMaps.add(map); // Sets listeners to in progress transfers if (TransferState.WAITING.equals(observer.getState()) || TransferState.WAITING_FOR_NETWORK.equals(observer.getState()) || TransferState.IN_PROGRESS.equals(observer.getState())) { observer.setTransferListener(listener); } } simpleAdapter.notifyDataSetChanged(); }
/** * Gets all relevant transfers from the Transfer Service for populating the * UI */ private void initData() { transferRecordMaps.clear(); // Uses TransferUtility to get all previous download records. observers = transferUtility.getTransfersWithType(TransferType.DOWNLOAD); TransferListener listener = new DownloadListener(); for (TransferObserver observer : observers) { HashMap<String, Object> map = new HashMap<String, Object>(); Util.fillMap(map, observer, false); transferRecordMaps.add(map); // Sets listeners to in progress transfers if (TransferState.WAITING.equals(observer.getState()) || TransferState.WAITING_FOR_NETWORK.equals(observer.getState()) || TransferState.IN_PROGRESS.equals(observer.getState())) { observer.setTransferListener(listener); } } simpleAdapter.notifyDataSetChanged(); }
public void cancelTransfer() { AmazonServicesManager.getTransferUtility().cancelAllWithType(TransferType.ANY); transferCancelled = true; }