Java 类com.amazonaws.mobileconnectors.s3.transferutility.TransferListener 实例源码

项目:aws-sdk-android-samples    文件:UploadActivity.java   
/**
 * 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();
}
项目:aws-sdk-android-samples    文件:DownloadActivity.java   
/**
 * 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();
}
项目:message-samples-android    文件:S3UploadService.java   
/**
 * Uploads the file to the external storage provider
 */
public static void uploadFile(String key, File file, TransferListener listener) {
    final TransferObserver uploadObserver = sTransferUtility.upload(AWS_S3_BUCKETNAME, key, file);
    uploadObserver.setTransferListener(listener);
}