use of com.odysee.app.model.LbryFile in project odysee-android by OdyseeTeam.
the class FileViewFragment method showUnsupportedView.
private void showUnsupportedView() {
View root = getView();
if (root != null) {
root.findViewById(R.id.file_view_exoplayer_container).setVisibility(View.GONE);
root.findViewById(R.id.file_view_unsupported_container).setVisibility(View.VISIBLE);
String fileNameString = "";
Claim actualClaim = collectionClaimItem != null ? collectionClaimItem : fileClaim;
if (actualClaim.getFile() != null && !Helper.isNullOrEmpty(actualClaim.getFile().getDownloadPath())) {
LbryFile lbryFile = actualClaim.getFile();
File file = new File(lbryFile.getDownloadPath());
fileNameString = String.format("\"%s\" ", file.getName());
}
((TextView) root.findViewById(R.id.file_view_unsupported_text)).setText(getString(R.string.unsupported_content_desc, fileNameString));
}
}
use of com.odysee.app.model.LbryFile in project odysee-android by OdyseeTeam.
the class FollowingFragment method onDownloadAction.
public void onDownloadAction(String downloadAction, String uri, String outpoint, String fileInfoJson, double progress) {
if ("abort".equals(downloadAction)) {
if (contentListAdapter != null) {
contentListAdapter.clearFileForClaimOrUrl(outpoint, uri);
}
return;
}
try {
JSONObject fileInfo = new JSONObject(fileInfoJson);
LbryFile claimFile = LbryFile.fromJSONObject(fileInfo);
String claimId = claimFile.getClaimId();
if (contentListAdapter != null) {
contentListAdapter.updateFileForClaimByIdOrUrl(claimFile, claimId, uri);
}
} catch (JSONException ex) {
// invalid file info for download
}
}
use of com.odysee.app.model.LbryFile in project odysee-android by OdyseeTeam.
the class Lbry method get.
public static LbryFile get(boolean saveFile) throws ApiCallException {
LbryFile file = null;
Map<String, Object> params = new HashMap<>();
params.put("save_file", saveFile);
try {
JSONObject result = (JSONObject) parseResponse(apiCall(METHOD_GET, params));
file = LbryFile.fromJSONObject(result);
if (file != null) {
String fileClaimId = file.getClaimId();
if (!Helper.isNullOrEmpty(fileClaimId)) {
ClaimCacheKey key = new ClaimCacheKey();
key.setClaimId(fileClaimId);
if (claimCache.containsKey(key)) {
claimCache.get(key).setFile(file);
}
}
}
} catch (LbryRequestException | LbryResponseException ex) {
throw new ApiCallException("Could not execute resolve call", ex);
}
return file;
}
use of com.odysee.app.model.LbryFile in project odysee-android by OdyseeTeam.
the class SearchFragment method onDownloadAction.
public void onDownloadAction(String downloadAction, String uri, String outpoint, String fileInfoJson, double progress) {
if ("abort".equals(downloadAction)) {
if (resultListAdapter != null) {
resultListAdapter.clearFileForClaimOrUrl(outpoint, uri);
}
return;
}
try {
JSONObject fileInfo = new JSONObject(fileInfoJson);
LbryFile claimFile = LbryFile.fromJSONObject(fileInfo);
String claimId = claimFile.getClaimId();
if (resultListAdapter != null) {
resultListAdapter.updateFileForClaimByIdOrUrl(claimFile, claimId, uri);
}
} catch (JSONException ex) {
// invalid file info for download
}
}
use of com.odysee.app.model.LbryFile in project odysee-android by OdyseeTeam.
the class LibraryFragment method onDownloadAction.
public void onDownloadAction(String downloadAction, String uri, String outpoint, String fileInfoJson, double progress) {
if ("abort".equals(downloadAction)) {
if (contentListAdapter != null) {
contentListAdapter.clearFileForClaimOrUrl(outpoint, uri, currentFilter == FILTER_DOWNLOADS);
}
return;
}
try {
JSONObject fileInfo = new JSONObject(fileInfoJson);
LbryFile claimFile = LbryFile.fromJSONObject(fileInfo);
String claimId = claimFile.getClaimId();
if (contentListAdapter != null) {
contentListAdapter.updateFileForClaimByIdOrUrl(claimFile, claimId, uri, true);
}
} catch (JSONException ex) {
// invalid file info for download
}
}
Aggregations