From c8fbb97765a1a537c8349151081e4b531a875150 Mon Sep 17 00:00:00 2001 From: Dan Roundhill Date: Mon, 9 Nov 2015 08:09:27 -0800 Subject: [PATCH] Revert "Fixes issue where private blog images wouldn't load." This reverts commit c37fd9027cfe0eefd49320eadebcad14696c4856. --- .../org/wordpress/android/util/UrlUtils.java | 8 ------- .../android/util/helpers/WPImageGetter.java | 23 ++++--------------- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/UrlUtils.java b/WordPressUtils/src/main/java/org/wordpress/android/util/UrlUtils.java index 0a7a0fdd8662..f4b5756d25ee 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/UrlUtils.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/UrlUtils.java @@ -231,14 +231,6 @@ public static boolean isImageUrl(String url) { cleanedUrl.endsWith("gif") || cleanedUrl.endsWith("png"); } - /** - * Returns true if the url is on wordpress.com - */ - public static boolean isWPComUrl(String url) { - return !TextUtils.isEmpty(url) && url.contains("wordpress.com"); - } - - public static String appendUrlParameter(String url, String paramName, String paramValue) { Map parameters = new HashMap<>(); parameters.put(paramName, paramValue); diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/helpers/WPImageGetter.java b/WordPressUtils/src/main/java/org/wordpress/android/util/helpers/WPImageGetter.java index b550c6b1a0de..b03d740457e8 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/helpers/WPImageGetter.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/helpers/WPImageGetter.java @@ -3,7 +3,6 @@ import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; -import android.support.v4.util.ArrayMap; import android.text.Html; import android.text.TextUtils; import android.widget.TextView; @@ -14,18 +13,14 @@ import org.wordpress.android.util.AppLog; import org.wordpress.android.util.AppLog.T; import org.wordpress.android.util.PhotonUtils; -import org.wordpress.android.util.UrlUtils; import java.lang.ref.WeakReference; -import java.util.Map; /** * ImageGetter for Html.fromHtml() * adapted from existing ImageGetter code in NoteCommentFragment */ public class WPImageGetter implements Html.ImageGetter { - private static final String IMAGE_QUALITY = "65"; - private final WeakReference mWeakView; private final int mMaxSize; private ImageLoader mImageLoader; @@ -37,13 +32,13 @@ public WPImageGetter(TextView view) { } public WPImageGetter(TextView view, int maxSize) { - mWeakView = new WeakReference<>(view); + mWeakView = new WeakReference(view); mMaxSize = maxSize; } public WPImageGetter(TextView view, int maxSize, ImageLoader imageLoader, Drawable loadingDrawable, Drawable failedDrawable) { - mWeakView = new WeakReference<>(view); + mWeakView = new WeakReference(view); mMaxSize = maxSize; mImageLoader = imageLoader; mLoadingDrawable = loadingDrawable; @@ -69,20 +64,10 @@ public Drawable getDrawable(String source) { source = "http:" + source; } - // Resize to max size if requested (otherwise the full-sized image will be downloaded + // use Photon if a max size is requested (otherwise the full-sized image will be downloaded // and then resized) if (mMaxSize > 0) { - if (UrlUtils.isWPComUrl(source)) { - // Adjust query params for wp.com urls - Map params = new ArrayMap<>(); - params.put("w", String.valueOf(mMaxSize)); - params.put("quality", IMAGE_QUALITY); - - source = UrlUtils.appendUrlParameters(UrlUtils.removeQuery(source), params); - } else { - // Otherwise use photon - source = PhotonUtils.getPhotonImageUrl(source, mMaxSize, 0); - } + source = PhotonUtils.getPhotonImageUrl(source, mMaxSize, 0); } final RemoteDrawable remote = new RemoteDrawable(mLoadingDrawable, mFailedDrawable);