mirror of
https://codeberg.org/monocles/monocles_chat.git
synced 2025-01-30 00:39:59 +01:00
Play gifs inside chat also disables animated avatar and animated status images
(cherry picked from commit 03eb51ad46
)
This commit is contained in:
parent
9f1f1348e8
commit
49ec864c54
4 changed files with 81 additions and 34 deletions
|
@ -756,8 +756,10 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
|
|||
if (containsLink(statusMessages.get(i))) {
|
||||
List<String> url = extractUrls(statusMessages.get(i));
|
||||
for (int j = 0; j < url.size(); j++) {
|
||||
if (this != null) {
|
||||
if (this != null && xmppConnectionService.getBooleanPreference("play_gif_inside", R.bool.play_gif_inside)) {
|
||||
Glide.with(this).load(url.get(j)).into(binding.statusImage);
|
||||
} else {
|
||||
Picasso.get().load(url.get(j)).into(binding.statusImage);
|
||||
}
|
||||
binding.statusImage.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
|
@ -787,8 +789,10 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
|
|||
if (containsLink(statusMessages.get(i))) {
|
||||
List<String> url = extractUrls(statusMessages.get(i));
|
||||
for (int j = 0; j < url.size(); j++) {
|
||||
if (this != null) {
|
||||
if (this != null && xmppConnectionService.getBooleanPreference("play_gif_inside", R.bool.play_gif_inside)) {
|
||||
Glide.with(this).load(url.get(j)).into(binding.statusImage);
|
||||
} else {
|
||||
Picasso.get().load(url.get(j)).into(binding.statusImage);
|
||||
}
|
||||
binding.statusImage.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -1290,6 +1290,8 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference
|
|||
xmppConnectionService.reinitializeMuclumbusService();
|
||||
} else if (name.equals("enforce_dane")) {
|
||||
reconnectAccounts();
|
||||
} else if (name.equals("play_gif_inside")) {
|
||||
reconnectAccounts();
|
||||
} else if (name.equals("show_less_avatars")) {
|
||||
refreshUiReal();
|
||||
} else if (name.equals("show_record_voice_btn")) {
|
||||
|
|
|
@ -1616,7 +1616,7 @@ public abstract class XmppActivity extends ActionBarActivity {
|
|||
}
|
||||
});
|
||||
imageDataThread.start();
|
||||
if (activity != null) {
|
||||
if (activity != null && getBooleanPreference("play_gif_inside", R.bool.play_gif_inside)) {
|
||||
Glide.with(activity).load(imageUrl).into(statusimage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,42 +100,83 @@ public class AvatarWorkerTask extends AsyncTask<AvatarService.Avatarable, Void,
|
|||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
final Drawable bm = activity.avatarService().get(avatarable, (int) activity.getResources().getDimension(size), true);
|
||||
setContentDescription(avatarable, imageView);
|
||||
if (bm != null && JidFromJabberNetwork == null) {
|
||||
cancelPotentialWork(avatarable, imageView);
|
||||
if (overlay) {
|
||||
activity.xmppConnectionService.fileBackend.drawOverlay(bm, R.drawable.pencil_overlay, 0.35f, true);
|
||||
imageView.setImageDrawable(bm);
|
||||
if (activity.xmppConnectionService.getBooleanPreference("play_gif_inside", R.bool.play_gif_inside)) {
|
||||
final Drawable bm = activity.avatarService().get(avatarable, (int) activity.getResources().getDimension(size), true);
|
||||
setContentDescription(avatarable, imageView);
|
||||
if (bm != null && JidFromJabberNetwork == null) {
|
||||
cancelPotentialWork(avatarable, imageView);
|
||||
if (overlay) {
|
||||
activity.xmppConnectionService.fileBackend.drawOverlay(bm, R.drawable.pencil_overlay, 0.35f, true);
|
||||
imageView.setImageDrawable(bm);
|
||||
} else {
|
||||
imageView.setImageDrawable(bm);
|
||||
}
|
||||
imageView.setBackgroundColor(0x00000000);
|
||||
} else if (JidFromJabberNetwork != null) {
|
||||
try {
|
||||
new GetAvatarFromJabberNetwork(activity.xmppConnectionService, avatarable, imageView, size, overlay).execute(Config.CHANNEL_DISCOVERY + "/avatar/v1/" + JidFromJabberNetwork);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
loadAvatar(avatarable, imageView, size, overlay, null);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 28 && bm instanceof AnimatedImageDrawable) {
|
||||
((AnimatedImageDrawable) bm).start();
|
||||
}
|
||||
} else {
|
||||
imageView.setImageDrawable(bm);
|
||||
}
|
||||
imageView.setBackgroundColor(0x00000000);
|
||||
} else if (JidFromJabberNetwork != null) {
|
||||
try {
|
||||
new GetAvatarFromJabberNetwork(activity.xmppConnectionService, avatarable, imageView, size, overlay).execute(Config.CHANNEL_DISCOVERY + "/avatar/v1/" + JidFromJabberNetwork);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
loadAvatar(avatarable, imageView, size, overlay, null);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 28 && bm instanceof AnimatedImageDrawable) {
|
||||
((AnimatedImageDrawable) bm).start();
|
||||
imageView.setBackgroundColor(avatarable.getAvatarBackgroundColor());
|
||||
imageView.setImageDrawable(null);
|
||||
final AvatarWorkerTask task = new AvatarWorkerTask(imageView, size);
|
||||
final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task);
|
||||
if (overlay) {
|
||||
activity.xmppConnectionService.fileBackend.drawOverlayFromDrawable(asyncDrawable, R.drawable.pencil_overlay, 1.0f);
|
||||
imageView.setImageDrawable(asyncDrawable);
|
||||
} else {
|
||||
imageView.setImageDrawable(asyncDrawable);
|
||||
|
||||
}
|
||||
try {
|
||||
task.execute(avatarable);
|
||||
} catch (final RejectedExecutionException ignored) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
imageView.setBackgroundColor(avatarable.getAvatarBackgroundColor());
|
||||
imageView.setImageDrawable(null);
|
||||
final AvatarWorkerTask task = new AvatarWorkerTask(imageView, size);
|
||||
final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task);
|
||||
if (overlay) {
|
||||
activity.xmppConnectionService.fileBackend.drawOverlayFromDrawable(asyncDrawable, R.drawable.pencil_overlay, 1.0f);
|
||||
imageView.setImageDrawable(asyncDrawable);
|
||||
final Drawable bm = activity.avatarService().get(avatarable, (int) activity.getResources().getDimension(size), false);
|
||||
setContentDescription(avatarable, imageView);
|
||||
if (bm != null && JidFromJabberNetwork == null) {
|
||||
cancelPotentialWork(avatarable, imageView);
|
||||
if (overlay) {
|
||||
activity.xmppConnectionService.fileBackend.drawOverlay(bm, R.drawable.pencil_overlay, 0.35f, true);
|
||||
imageView.setImageDrawable(bm);
|
||||
} else {
|
||||
imageView.setImageDrawable(bm);
|
||||
}
|
||||
imageView.setBackgroundColor(0x00000000);
|
||||
} else if (JidFromJabberNetwork != null) {
|
||||
try {
|
||||
new GetAvatarFromJabberNetwork(activity.xmppConnectionService, avatarable, imageView, size, overlay).execute(Config.CHANNEL_DISCOVERY + "/avatar/v1/" + JidFromJabberNetwork);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
loadAvatar(avatarable, imageView, size, overlay, null);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 28 && bm instanceof AnimatedImageDrawable) {
|
||||
((AnimatedImageDrawable) bm).start();
|
||||
}
|
||||
} else {
|
||||
imageView.setImageDrawable(asyncDrawable);
|
||||
imageView.setBackgroundColor(avatarable.getAvatarBackgroundColor());
|
||||
imageView.setImageDrawable(null);
|
||||
final AvatarWorkerTask task = new AvatarWorkerTask(imageView, size);
|
||||
final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task);
|
||||
if (overlay) {
|
||||
activity.xmppConnectionService.fileBackend.drawOverlayFromDrawable(asyncDrawable, R.drawable.pencil_overlay, 1.0f);
|
||||
imageView.setImageDrawable(asyncDrawable);
|
||||
} else {
|
||||
imageView.setImageDrawable(asyncDrawable);
|
||||
|
||||
}
|
||||
try {
|
||||
task.execute(avatarable);
|
||||
} catch (final RejectedExecutionException ignored) {
|
||||
}
|
||||
try {
|
||||
task.execute(avatarable);
|
||||
} catch (final RejectedExecutionException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue