Skip to content

Commit

Permalink
MBL-1318: - Removed Picasso dependency (#2018)
Browse files Browse the repository at this point in the history
Co-authored-by: leighdouglas <[email protected]>
  • Loading branch information
Arkariang and leighdouglas authored Apr 16, 2024
1 parent c6fe8d2 commit 4bb904f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 135 deletions.
10 changes: 4 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,11 @@ dependencies {
// Dependencies for HTML Parser
implementation 'org.jsoup:jsoup:1.16.1'

// Picasso
implementation 'com.squareup.picasso:picasso:2.71828'

// GLIDE
implementation 'com.github.bumptech.glide:glide:4.14.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
kapt 'com.github.bumptech.glide:compiler:4.14.2'
final glide_version = "4.16.0"
implementation "com.github.bumptech.glide:glide:$glide_version"
annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"

//Compose Coil
implementation("io.coil-kt:coil-compose:2.4.0")
Expand Down
34 changes: 22 additions & 12 deletions app/src/main/java/com/kickstarter/libs/PushNotifications.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
import androidx.core.app.TaskStackBuilder;
import androidx.core.content.ContextCompat;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.MultiTransformation;
import com.bumptech.glide.request.FutureTarget;
import com.bumptech.glide.request.RequestOptions;
import com.kickstarter.R;
import com.kickstarter.libs.qualifiers.ApplicationContext;
import com.kickstarter.libs.transformations.CircleTransformation;
import com.kickstarter.libs.transformations.CropSquareTransformation;
import com.kickstarter.libs.utils.extensions.AnyExtKt;
import com.kickstarter.libs.utils.extensions.IntentExtKt;
import com.kickstarter.models.MessageThread;
Expand All @@ -38,18 +40,17 @@
import com.kickstarter.ui.activities.ProjectPageActivity;
import com.kickstarter.ui.activities.SurveyResponseActivity;
import com.kickstarter.ui.activities.UpdateActivity;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.RequestCreator;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;

import rx.Observable;
import rx.schedulers.Schedulers;
import rx.subjects.PublishSubject;
import rx.subscriptions.CompositeSubscription;
import timber.log.Timber;

import static com.kickstarter.libs.rx.transformers.Transformers.combineLatestPair;
import static com.kickstarter.libs.rx.transformers.Transformers.neverError;
Expand Down Expand Up @@ -415,14 +416,23 @@ private void displayNotificationFromUpdateActivity(final @NonNull PushNotificati
}

try {
RequestCreator requestCreator = Picasso.get().load(url).transform(new CropSquareTransformation());
if (transformIntoCircle) {
requestCreator = requestCreator.transform(new CircleTransformation());
final FutureTarget<Bitmap> circleCrop = Glide.with(this.context)
.asBitmap()
.load(url)
.apply(RequestOptions.circleCropTransform())
.submit();
return circleCrop.get();
} else {
final FutureTarget<Bitmap> SquareRoundCorners = Glide.with(this.context)
.asBitmap()
.load(url)
.transform(new MultiTransformation<>(new CenterCrop(), new RoundedCorners(10)))
.submit();
return SquareRoundCorners.get();
}
return requestCreator.get();
} catch (IOException e) {
Timber.e(e.getMessage(), "Failed to load large icon: %s");
return null;
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
}

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ fun ImageView.loadImage(url: String?, context: Context, imageViewPlaceholder: Ap
.load(url)
.listener(object : RequestListener<Drawable> {
override fun onResourceReady(
resource: Drawable?,
model: Any?,
resource: Drawable,
model: Any,
target: Target<Drawable>?,
dataSource: com.bumptech.glide.load.DataSource?,
dataSource: com.bumptech.glide.load.DataSource,
isFirstResource: Boolean
): Boolean {
imageViewPlaceholder?.setImageDrawable(resource)
Expand All @@ -102,7 +102,7 @@ fun ImageView.loadImage(url: String?, context: Context, imageViewPlaceholder: Ap
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
target: Target<Drawable>,
isFirstResource: Boolean
): Boolean {
targetView.setImageDrawable(null)
Expand Down

0 comments on commit 4bb904f

Please sign in to comment.