package com.bignerdranch.android.photogallery;

import android.os.HandlerThread;
import android.util.Log;

public class ThumbnailDownloader<T> extends HandlerThread {

    private static final String TAG = "ThumbnailDownloader";

    public ThumbnailDownloader() {
        super(TAG);
    }

    public void queueThumbnail(T target, String url) {
        Log.i(TAG, "Gor a URL: " + url);
    }
}

@@ -60,330 +60,2399 @@
 oid.
-os.HandlerThread;%0Aimport android.util.Log;%0A%0Apublic class ThumbnailDownloader%3CT%3E extends HandlerThread %7B%0A%0A    private static final String TAG = %22ThumbnailDownloader%22;%0A%0A    public ThumbnailDownloader() %7B%0A        super(TAG);%0A    %7D%0A%0A    public void queueThumbnail(T target, String url) %7B%0A        Log.i(TAG, %22Gor a URL: %22 + url
+graphics.Bitmap;%0Aimport android.graphics.BitmapFactory;%0Aimport android.os.Handler;%0Aimport android.os.HandlerThread;%0Aimport android.util.Log;%0A%0Aimport java.io.IOException;%0Aimport java.util.concurrent.ConcurrentHashMap;%0Aimport java.util.concurrent.ConcurrentMap;%0A%0Apublic class ThumbnailDownloader%3CT%3E extends HandlerThread %7B%0A%0A    private static final String TAG = %22ThumbnailDownloader%22;%0A%0A    private static final int MESSAGE_DOWNLOAD = 0;%0A%0A    private Handler mRequestHandler;%0A    private ConcurrentMap%3CT, String%3E mRequestMap = new ConcurrentHashMap%3CT, String%3E();%0A    private Handler mResponseHandler;%0A    private ThumbnailDownloadListener%3CT%3E mThumbnailDownloadListener;%0A%0A    public interface ThumbnailDownloadListener%3CT%3E %7B%0A        void onThumbnailDownload(T target, Bitmap thumbnail);%0A    %7D%0A%0A    public void setThumbnailDownloadListener(ThumbnailDownloadListener%3CT%3E listener) %7B%0A        mThumbnailDownloadListener = listener;%0A    %7D%0A%0A    public ThumbnailDownloader(Handler responseHandler) %7B%0A        super(TAG);%0A        mRequestHandler = responseHandler;%0A    %7D%0A%0A    public void queueThumbnail(T target, String url) %7B%0A        Log.i(TAG, %22Gor a URL: %22 + url);%0A%0A        if (url == null) %7B%0A            mRequestMap.remove(target);%0A        %7D%0A        else %7B%0A            mRequestMap.put(target, url);%0A            mRequestHandler.obtainMessage(MESSAGE_DOWNLOAD, target).sendToTarget();%0A        %7D%0A    %7D%0A%0A    private void handleRequest(final T target) %7B%0A        try %7B%0A            final String url = mRequestMap.get(target);%0A%0A            if (url == null) %7B%0A                return;%0A            %7D%0A%0A            byte%5B%5D bitmapBytes = new FlickrFetcher().getUrlBytes(url);%0A%0A            final Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapBytes, 0, bitmapBytes.length);%0A            Log.i(TAG, %22Bitmap created%22);%0A%0A            mResponseHandler.post(new Runnable() %7B%0A                @Override%0A                public void run() %7B%0A                    if (mRequestMap.get(target) != url) %7B%0A                        return;%0A                    %7D%0A%0A                    mRequestMap.remove(target);%0A                    mThumbnailDownloadListener.onThumbnailDownload(target, bitmap);%0A                %7D%0A            %7D);%0A%0A        %7D%0A        catch (IOException ioe) %7B%0A            Log.e(TAG, %22Error downloading image%22, ioe);%0A        %7D%0A    %7D%0A%0A    public void clearQueue() %7B%0A        mRequestHandler.removeMessages(MESSAGE_DOWNLOAD
 );%0A 

Complete the implementation of the Downloader, what a horrible thing :facepalm: