use of com.odysee.app.model.LbryFile in project odysee-android by OdyseeTeam.
the class LibraryFragment method updateStats.
private void updateStats() {
totalBytes = 0;
totalVideoBytes = 0;
totalAudioBytes = 0;
totalImageBytes = 0;
totalOtherBytes = 0;
if (currentFiles != null) {
for (LbryFile file : currentFiles) {
long writtenBytes = file.getWrittenBytes();
String mime = file.getMimeType();
if (mime != null) {
if (mime.startsWith("video/")) {
totalVideoBytes += writtenBytes;
} else if (mime.startsWith("audio/")) {
totalAudioBytes += writtenBytes;
} else if (mime.startsWith("image/")) {
totalImageBytes += writtenBytes;
} else {
totalOtherBytes += writtenBytes;
}
}
totalBytes += writtenBytes;
}
}
renderStats();
}
use of com.odysee.app.model.LbryFile in project odysee-android by OdyseeTeam.
the class FileViewFragment method onRelatedDownloadAction.
private void onRelatedDownloadAction(String downloadAction, String uri, String outpoint, String fileInfoJson, double progress) {
if ("abort".equals(downloadAction)) {
if (relatedContentAdapter != null) {
relatedContentAdapter.clearFileForClaimOrUrl(outpoint, uri);
}
return;
}
try {
JSONObject fileInfo = new JSONObject(fileInfoJson);
LbryFile claimFile = LbryFile.fromJSONObject(fileInfo);
String claimId = claimFile.getClaimId();
if (relatedContentAdapter != null) {
relatedContentAdapter.updateFileForClaimByIdOrUrl(claimFile, claimId, uri);
}
} catch (JSONException ex) {
// invalid file info for download
}
}
Aggregations