package com.tencent.mm.plugin.gallery.ui;

import android.graphics.drawable.Drawable;
import android.os.SystemClock;
import android.widget.ImageView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.gallery.model.e;
import com.tencent.mm.sdk.platformtools.ab;
import java.lang.ref.WeakReference;

final class h$b implements Runnable {
    final WeakReference<ImageView> mSg;

    h$b(ImageView imageView) {
        AppMethodBeat.i(138612);
        this.mSg = new WeakReference(imageView);
        AppMethodBeat.o(138612);
    }

    public final void run() {
        Drawable drawable;
        AppMethodBeat.i(21606);
        ImageView imageView = (ImageView) this.mSg.get();
        if (imageView == null) {
            drawable = null;
        } else {
            drawable = imageView.getDrawable();
        }
        if (drawable == null || !(drawable instanceof h)) {
            ab.w("MicroMsg.ThumbDrawable", "[tomys] ownerView is null or not a ThumbDrawable, ignore this task.");
            AppMethodBeat.o(21606);
            return;
        }
        ab.v("MicroMsg.ThumbDrawable", "invalidateSelf");
        h hVar = (h) drawable;
        h.a(hVar, e.bBY().Nz(hVar.mFilePath));
        if (!(hVar.mSc == null || h.a(hVar) == null || h.a(hVar).isRecycled())) {
            hVar.mSc.bCx();
        }
        if (h.a(hVar) == null || h.a(hVar).isRecycled()) {
            e.bBY().b(hVar.mFilePath, hVar.cyQ, hVar.mNC, hVar.mND);
            ab.v("MicroMsg.ThumbDrawable", "invalidateSelf! mBitmap is null! path:%s", new Object[]{hVar.mFilePath});
        }
        hVar.mSd = SystemClock.uptimeMillis();
        hVar.invalidateSelf();
        AppMethodBeat.o(21606);
    }
}
