aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/ui/AsyncDrawable.java
blob: 52a9c74fb28b772a5f6534733c4666ad6726dde3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package de.thedevstack.conversationsplus.ui;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;

import java.lang.ref.WeakReference;

import de.thedevstack.conversationsplus.dto.LoadAvatarFor;
import de.thedevstack.conversationsplus.ui.tasks.AvatarBitmapTask;

public class AsyncDrawable<T extends LoadAvatarFor> extends BitmapDrawable {
    private final WeakReference<AvatarBitmapTask<T>> bitmapWorkerTaskReference;

		public AsyncDrawable(Resources res, Bitmap bitmap, AvatarBitmapTask<T> bitmapWorkerTask) {
			super(res, bitmap);
			bitmapWorkerTaskReference = new WeakReference<>(bitmapWorkerTask);
		}

		public AvatarBitmapTask<T> getBitmapWorkerTask() {
			return bitmapWorkerTaskReference.get();
		}
	}