fixes crash when media url is empty
This commit is contained in:
parent
a33c259760
commit
2e3d8b8cae
1 changed files with 24 additions and 12 deletions
|
@ -249,14 +249,23 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
previews[i].setVisibility(View.VISIBLE);
|
previews[i].setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if(previewUrl == null || previewUrl.isEmpty()) {
|
||||||
|
Picasso.with(context)
|
||||||
|
.load(mediaPreviewUnloadedId)
|
||||||
|
.into(previews[i]);
|
||||||
|
} else {
|
||||||
Picasso.with(context)
|
Picasso.with(context)
|
||||||
.load(previewUrl)
|
.load(previewUrl)
|
||||||
.placeholder(mediaPreviewUnloadedId)
|
.placeholder(mediaPreviewUnloadedId)
|
||||||
.into(previews[i]);
|
.into(previews[i]);
|
||||||
|
}
|
||||||
|
|
||||||
final String url = attachments[i].url;
|
final String url = attachments[i].url;
|
||||||
final Status.MediaAttachment.Type type = attachments[i].type;
|
final Status.MediaAttachment.Type type = attachments[i].type;
|
||||||
|
|
||||||
|
if(url == null || url.isEmpty()) {
|
||||||
|
previews[i].setOnClickListener(null);
|
||||||
|
} else {
|
||||||
previews[i].setOnClickListener(new View.OnClickListener() {
|
previews[i].setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -265,6 +274,9 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (sensitive) {
|
if (sensitive) {
|
||||||
sensitiveMediaWarning.setVisibility(View.VISIBLE);
|
sensitiveMediaWarning.setVisibility(View.VISIBLE);
|
||||||
sensitiveMediaWarning.setOnClickListener(new View.OnClickListener() {
|
sensitiveMediaWarning.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
Loading…
Reference in a new issue