33import android .graphics .Canvas ;
44import android .graphics .drawable .BitmapDrawable ;
55import android .graphics .drawable .Drawable ;
6- import android .support .v4 .util .ArrayMap ;
76import android .text .Html ;
87import android .text .TextUtils ;
98import android .widget .TextView ;
1413import org .wordpress .android .util .AppLog ;
1514import org .wordpress .android .util .AppLog .T ;
1615import org .wordpress .android .util .PhotonUtils ;
17- import org .wordpress .android .util .UrlUtils ;
1816
1917import java .lang .ref .WeakReference ;
20- import java .util .Map ;
2118
2219/**
2320 * ImageGetter for Html.fromHtml()
2421 * adapted from existing ImageGetter code in NoteCommentFragment
2522 */
2623public class WPImageGetter implements Html .ImageGetter {
27- private static final String IMAGE_QUALITY = "65" ;
28-
2924 private final WeakReference <TextView > mWeakView ;
3025 private final int mMaxSize ;
3126 private ImageLoader mImageLoader ;
@@ -37,13 +32,13 @@ public WPImageGetter(TextView view) {
3732 }
3833
3934 public WPImageGetter (TextView view , int maxSize ) {
40- mWeakView = new WeakReference <>(view );
35+ mWeakView = new WeakReference <TextView >(view );
4136 mMaxSize = maxSize ;
4237 }
4338
4439 public WPImageGetter (TextView view , int maxSize , ImageLoader imageLoader , Drawable loadingDrawable ,
4540 Drawable failedDrawable ) {
46- mWeakView = new WeakReference <>(view );
41+ mWeakView = new WeakReference <TextView >(view );
4742 mMaxSize = maxSize ;
4843 mImageLoader = imageLoader ;
4944 mLoadingDrawable = loadingDrawable ;
@@ -69,20 +64,10 @@ public Drawable getDrawable(String source) {
6964 source = "http:" + source ;
7065 }
7166
72- // Resize to max size if requested (otherwise the full-sized image will be downloaded
67+ // use Photon if a max size is requested (otherwise the full-sized image will be downloaded
7368 // and then resized)
7469 if (mMaxSize > 0 ) {
75- if (UrlUtils .isWPComUrl (source )) {
76- // Adjust query params for wp.com urls
77- Map <String , String > params = new ArrayMap <>();
78- params .put ("w" , String .valueOf (mMaxSize ));
79- params .put ("quality" , IMAGE_QUALITY );
80-
81- source = UrlUtils .appendUrlParameters (UrlUtils .removeQuery (source ), params );
82- } else {
83- // Otherwise use photon
84- source = PhotonUtils .getPhotonImageUrl (source , mMaxSize , 0 );
85- }
70+ source = PhotonUtils .getPhotonImageUrl (source , mMaxSize , 0 );
8671 }
8772
8873 final RemoteDrawable remote = new RemoteDrawable (mLoadingDrawable , mFailedDrawable );
0 commit comments