From 1e9855a8f8c227d406d65c248118e4079fcb4005 Mon Sep 17 00:00:00 2001 From: Arne Date: Sun, 24 Mar 2024 05:53:24 +0100 Subject: [PATCH] exchange picasso with glide --- build.gradle | 1 - .../conversations/http/PicassoHelper.java | 4 -- .../ui/ContactDetailsActivity.java | 52 +++++++------------ .../ui/adapter/MessageAdapter.java | 7 +-- .../conversations/ui/widget/RichLinkView.java | 12 ++--- src/main/res/values/about.xml | 1 - 6 files changed, 24 insertions(+), 53 deletions(-) delete mode 100644 src/main/java/eu/siacs/conversations/http/PicassoHelper.java diff --git a/build.gradle b/build.gradle index 6e34b6abd..863930410 100644 --- a/build.gradle +++ b/build.gradle @@ -100,7 +100,6 @@ dependencies { implementation 'me.drakeet.support:toastcompat:1.1.0' implementation 'org.osmdroid:osmdroid-android:6.1.16' implementation 'com.leinardi.android:speed-dial:3.3.0' - implementation 'com.squareup.picasso:picasso:2.71828' implementation "com.squareup.okhttp3:okhttp:4.11.0" implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0' diff --git a/src/main/java/eu/siacs/conversations/http/PicassoHelper.java b/src/main/java/eu/siacs/conversations/http/PicassoHelper.java deleted file mode 100644 index 0545a7d4a..000000000 --- a/src/main/java/eu/siacs/conversations/http/PicassoHelper.java +++ /dev/null @@ -1,4 +0,0 @@ -package eu.siacs.conversations.http; - -public class PicassoHelper { -} diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index 78ba50d2f..bd19acb36 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -1,15 +1,6 @@ package eu.siacs.conversations.ui; import static eu.siacs.conversations.ui.util.IntroHelper.showIntro; -import eu.siacs.conversations.databinding.ThreadRowBinding; -import de.monocles.chat.Util; -import androidx.annotation.NonNull; - -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.drawable.BitmapDrawable; -import android.util.Patterns; -import android.view.ViewGroup; import android.Manifest; import android.content.ActivityNotFoundException; @@ -18,6 +9,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -29,24 +21,24 @@ import android.provider.Settings; import android.text.Spannable; import android.text.SpannableString; import android.text.style.RelativeSizeSpan; +import android.util.Patterns; +import android.util.TypedValue; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; +import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; +import android.widget.ArrayAdapter; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.EditText; import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.TextView; -import android.widget.ArrayAdapter; import android.widget.Toast; -import android.view.inputmethod.InputMethodManager; import androidx.annotation.NonNull; -import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.Toolbar; @@ -56,31 +48,30 @@ import androidx.databinding.DataBindingUtil; import com.bumptech.glide.Glide; import com.google.common.base.Optional; -import com.squareup.picasso.Picasso; import org.openintents.openpgp.util.OpenPgpUtils; -import java.io.IOException; -import java.net.URL; -import java.net.URLConnection; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.ArrayList; import java.util.Comparator; +import java.util.List; import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Pattern; import java.util.stream.Collectors; -import eu.siacs.conversations.entities.Bookmark; +import de.monocles.chat.Util; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.crypto.axolotl.FingerprintStatus; import eu.siacs.conversations.crypto.axolotl.XmppAxolotlSession; import eu.siacs.conversations.databinding.ActivityContactDetailsBinding; +import eu.siacs.conversations.databinding.CommandRowBinding; +import eu.siacs.conversations.databinding.ThreadRowBinding; import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Bookmark; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.ListItem; @@ -94,28 +85,21 @@ import eu.siacs.conversations.ui.util.AvatarWorkerTask; import eu.siacs.conversations.ui.util.CallManager; import eu.siacs.conversations.ui.util.GridManager; import eu.siacs.conversations.ui.util.JidDialog; +import eu.siacs.conversations.ui.util.ShareUtil; import eu.siacs.conversations.ui.util.SoftKeyboardUtils; import eu.siacs.conversations.utils.Compatibility; import eu.siacs.conversations.utils.Emoticons; import eu.siacs.conversations.utils.IrregularUnicodeDetector; import eu.siacs.conversations.utils.MenuDoubleTabUtil; -import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.utils.TimeFrameUtils; import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.XmppUri; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.XmppConnection; -import eu.siacs.conversations.xml.Element; -import eu.siacs.conversations.ui.util.ShareUtil; -import eu.siacs.conversations.databinding.CommandRowBinding; -import de.monocles.chat.Util; -import android.view.ViewGroup; -import android.util.TypedValue; -import android.graphics.drawable.Drawable; -import android.widget.ViewFlipper; - import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession; import eu.siacs.conversations.xmpp.jingle.RtpCapability; import me.drakeet.support.toast.ToastCompat; @@ -759,7 +743,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp 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); + Glide.with(this).asBitmap().load(url.get(j)).into(binding.statusImage); } binding.statusImage.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { @@ -792,7 +776,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp 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); + Glide.with(this).asBitmap().load(url.get(j)).into(binding.statusImage); } binding.statusImage.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 90d21c191..0926c886f 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -23,11 +23,8 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.graphics.Rect; import android.graphics.Typeface; -import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; @@ -74,9 +71,7 @@ import com.bumptech.glide.Glide; import com.daimajia.swipe.SwipeLayout; import com.google.common.base.Strings; import com.lelloman.identicon.view.GithubIdenticonView; -import com.squareup.picasso.Picasso; -import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.lang.ref.WeakReference; @@ -1181,7 +1176,7 @@ public class MessageAdapter extends ArrayAdapter { layoutParams.setMargins(0, (int) (metrics.density * 4), 0, (int) (metrics.density * 4)); viewHolder.images.setLayoutParams(layoutParams); viewHolder.image.setOnClickListener(v -> showLocation(message)); - Picasso .get() + Glide.with(activity) .load(Uri.parse(url)) .placeholder(R.drawable.ic_map_marker_grey600_48dp) .error(R.drawable.ic_map_marker_grey600_48dp) diff --git a/src/main/java/eu/siacs/conversations/ui/widget/RichLinkView.java b/src/main/java/eu/siacs/conversations/ui/widget/RichLinkView.java index 0bcbc6af5..7fe1810f1 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/RichLinkView.java +++ b/src/main/java/eu/siacs/conversations/ui/widget/RichLinkView.java @@ -12,7 +12,7 @@ import android.widget.TextView; import androidx.annotation.RequiresApi; -import com.squareup.picasso.Picasso; +import com.bumptech.glide.Glide; import java.util.HashMap; import java.util.Map; @@ -93,14 +93,12 @@ public class RichLinkView extends RelativeLayout { imageView.setAdjustViewBounds(true); if (meta.getImageurl() != null && !meta.getImageurl().equals("") && !meta.getImageurl().isEmpty()) { if (!dataSaverDisabled) { - Picasso.get() - .load(R.drawable.ic_web_grey600_48) - .into(imageView); + Glide.with(this).load(R.drawable.ic_web_grey600_48).into(imageView); } else { imageView.setVisibility(VISIBLE); - Picasso.get() + Glide.with(this) .load(meta.getImageurl()) - .resize(80, 80) + .override(80,80) .centerInside() .placeholder(R.drawable.ic_web_grey600_48) .error(R.drawable.ic_web_grey600_48) @@ -108,7 +106,7 @@ public class RichLinkView extends RelativeLayout { } } else { imageView.setVisibility(VISIBLE); - Picasso.get() + Glide.with(this) .load(R.drawable.ic_web_grey600_48) .into(imageView); } diff --git a/src/main/res/values/about.xml b/src/main/res/values/about.xml index 8485f9f3d..291a9150b 100644 --- a/src/main/res/values/about.xml +++ b/src/main/res/values/about.xml @@ -33,7 +33,6 @@ \n\nhttps://github.com/google/gson\n(Apache License, Version 2.0) \n\nhttp://hc.apache.org/httpcomponents-client\n(Apache License, Version 2.0) \n\nhttp://hc.apache.org/httpcomponents-core\n(Apache License, Version 2.0) - \n\nhttps://github.com/square/picasso\n(Apache License, Version 2.0) \n\nhttps://github.com/davemorrissey/subsampling-scale-image-view\n(Apache License, Version 2.0) \n\nhttps://github.com/koral--/android-gif-drawable\n(The MIT License (MIT)) \n\nhttps://github.com/google/ExoPlayer\n(Apache License, Version 2.0)