本文整理汇总了Java中com.amazonaws.mobileconnectors.s3.transferutility.TransferState类的典型用法代码示例。如果您正苦于以下问题:Java TransferState类的具体用法?Java TransferState怎么用?Java TransferState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransferState类属于com.amazonaws.mobileconnectors.s3.transferutility包,在下文中一共展示了TransferState类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initData
import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; //导入依赖的package包/类
/**
* 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();
}
开发者ID:awslabs,项目名称:aws-sdk-android-samples,代码行数:28,代码来源:UploadActivity.java
示例2: initData
import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; //导入依赖的package包/类
/**
* 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();
}
开发者ID:awslabs,项目名称:aws-sdk-android-samples,代码行数:24,代码来源:DownloadActivity.java
示例3: setProgressListener
import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; //导入依赖的package包/类
/**
* Sets the progress listener for a given s3Key being transferred.
* @param relativeFilePath the relative path and file name.
* @param listener the progress listener.
*/
public synchronized void setProgressListener(final String relativeFilePath, final ContentProgressListener listener) {
final Integer transferId = managedFilesToTransfers.get(relativeFilePath);
if (transferId != null) {
if (listener == null) {
progressListeners.remove(transferId);
return;
}
final TransferObserver observer = transfersInProgress.get(transferId);
if (observer != null) {
final ContentProgressListener currentListener = progressListeners.get(transferId);
progressListeners.put(transferId, listener);
if (currentListener != listener) {
observer.refresh();
final TransferState transferState = observer.getState();
if (transferState == TransferState.WAITING ||
transferState == TransferState.WAITING_FOR_NETWORK ||
transferState == TransferState.RESUMED_WAITING) {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
onStateChanged(transferId, transferState);
}
});
}
}
}
} else {
Log.w(LOG_TAG, String.format("Attempt to set progress listener for file '%s'," +
" but no transfer is in progress for that file.", relativeFilePath));
}
}
开发者ID:jtran064,项目名称:PlatePicks-Android,代码行数:40,代码来源:S3TransferHelper.java
示例4: getTransferState
import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; //导入依赖的package包/类
private synchronized TransferState getTransferState(final String relativeFilePath) {
final Integer transferId = managedFilesToTransfers.get(relativeFilePath);
if (transferId == null) {
return null;
}
final TransferObserver observer = transfersInProgress.get(transferId);
observer.refresh();
return observer.getState();
}
开发者ID:jtran064,项目名称:PlatePicks-Android,代码行数:10,代码来源:S3TransferHelper.java
示例5: onStateChanged
import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; //导入依赖的package包/类
@Override
public final void onStateChanged(int id, TransferState state) {
Log.i(TAG, "onStateChanged: id: " + id + " state: " + state + " filename: " + filename);
if(state == TransferState.COMPLETED) {
Media media = new Media(localMedia);
media.setId(getKey());
media.setUrl(getUrl());
onTransferFinished(media);
} else if(state == TransferState.WAITING_FOR_NETWORK) {
onTransferWaitingNetwork();
} else if (state == TransferState.FAILED) {
onTransferFailed();
}
}
开发者ID:rapidpro,项目名称:ureport-android,代码行数:16,代码来源:TransferListenerAdapter.java
示例6: onStateChanged
import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; //导入依赖的package包/类
@Override
public void onStateChanged(int id, TransferState state) {
if (listener == null) return;
ActiveUpload upload = activeUploadMap.get(id);
if (upload == null) {
Timber.w("No ActiveUpload associated with transfer id %d. Cannot notify listener", id);
return;
}
Timber.d("Transfer %s state %s", upload.file.getName(), state.name());
switch (state) {
case IN_PROGRESS:
Timber.d("Marking ActiveUpload start time");
upload.markStartTime();
break;
case COMPLETED:
int bytesPerSecond = (int) (upload.file.length() / (System.currentTimeMillis() - upload.startTimeMs));
listener.onUploadComplete(upload.file, upload.destinationUrl, bytesPerSecond);
activeUploadMap.remove(id);
break;
case CANCELED:
listener.onUploadError(upload.file, upload.destinationUrl, new Exception("Transfer cancelled"));
activeUploadMap.remove(id);
break;
case FAILED:
listener.onUploadError(upload.file, upload.destinationUrl, new Exception("Transfer failed"));
activeUploadMap.remove(id);
break;
}
}
开发者ID:PerchLive,项目名称:PerchBroadcast-Android-SDK,代码行数:38,代码来源:S3QueuedUploader.java
示例7: isTransferWaiting
import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; //导入依赖的package包/类
public boolean isTransferWaiting(final String relativeFilePath) {
final TransferState xferState = getTransferState(relativeFilePath);
return WAITING_FOR_CONTENT_STATES.contains(xferState);
}
开发者ID:jtran064,项目名称:PlatePicks-Android,代码行数:5,代码来源:S3TransferHelper.java
示例8: onStateChanged
import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; //导入依赖的package包/类
@Override
public void onStateChanged(int id, TransferState newState) {
Log.d(TAG, "onStateChanged: " + id + ", " + newState);
updateList();
}
开发者ID:awslabs,项目名称:aws-sdk-android-samples,代码行数:6,代码来源:UploadActivity.java
示例9: onStateChanged
import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; //导入依赖的package包/类
@Override
public void onStateChanged(int id, TransferState state) {
Log.d(TAG, "onStateChanged: " + id + ", " + state);
updateList();
}
开发者ID:awslabs,项目名称:aws-sdk-android-samples,代码行数:6,代码来源:DownloadActivity.java
示例10: onStateChanged
import com.amazonaws.mobileconnectors.s3.transferutility.TransferState; //导入依赖的package包/类
void onStateChanged(String imageId, TransferState state);
开发者ID:KwalaGroup,项目名称:Android-Client,代码行数:2,代码来源:NetworkStore.java
注:本文中的com.amazonaws.mobileconnectors.s3.transferutility.TransferState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论