Fixes with GIF

This commit is contained in:
tom79 2019-07-30 14:36:35 +02:00
parent 722d6a4249
commit 7db78d6fa4
2 changed files with 24 additions and 20 deletions

View File

@ -1827,9 +1827,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
status.setAccount(account);
}
//Displays name & emoji in toot header
final Account ppurl;
final Account accountForUrl;
if (status.getReblog() != null) {
ppurl = status.getReblog().getAccount();
accountForUrl = status.getReblog().getAccount();
holder.status_account_displayname.setVisibility(View.VISIBLE);
holder.status_account_displayname.setText(context.getResources().getString(R.string.reblog_by, status.getAccount().getUsername()));
holder.status_account_displayname.setOnClickListener(new View.OnClickListener() {
@ -1849,7 +1849,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
holder.status_account_displayname_owner.setVisibility(View.VISIBLE);
} else {
ppurl = status.getAccount();
accountForUrl = status.getAccount();
holder.status_account_displayname.setVisibility(View.GONE);
if (status.getAccount().getdisplayNameSpan() == null || status.getAccount().getdisplayNameSpan().toString().trim().length() == 0)
holder.status_account_displayname_owner.setText(status.getAccount().getUsername().replace("@", ""), TextView.BufferType.SPANNABLE);
@ -2009,13 +2009,13 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}
if (status.getReblog() != null) {
Helper.loadGiF(context, ppurl, holder.status_account_profile_boost);
Helper.loadGiF(context, accountForUrl, holder.status_account_profile_boost);
Helper.loadGiF(context, status.getAccount().getAvatar(), holder.status_account_profile_boost_by);
holder.status_account_profile_boost.setVisibility(View.VISIBLE);
holder.status_account_profile_boost_by.setVisibility(View.VISIBLE);
holder.status_account_profile.setVisibility(View.GONE);
} else {
Helper.loadGiF(context, ppurl, holder.status_account_profile);
Helper.loadGiF(context, accountForUrl, holder.status_account_profile);
holder.status_account_profile_boost.setVisibility(View.GONE);
holder.status_account_profile_boost_by.setVisibility(View.GONE);
holder.status_account_profile.setVisibility(View.VISIBLE);

View File

@ -3155,21 +3155,25 @@ public class Helper {
return;
}
}
if( !disableGif) {
try {
Glide.with(imageView.getContext())
.load(url)
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
.into(imageView);
} catch (Exception ignored) { }
}else {
try {
Glide.with(context)
.asBitmap()
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
.load(url)
.into(imageView);
} catch (Exception ignored) {
if( url != null) {
if (!disableGif && url.endsWith(".gif")) {
try {
Glide.with(imageView.getContext())
.asGif()
.load(url)
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
.into(imageView);
} catch (Exception ignored) {
}
} else {
try {
Glide.with(context)
.asBitmap()
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
.load(url)
.into(imageView);
} catch (Exception ignored) {
}
}
}
}