package com.tencent.mm.plugin.exdevice.f.a;

import android.content.Context;
import android.content.Intent;
import android.widget.ImageView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.al.c;
import com.tencent.mm.al.f;
import com.tencent.mm.bp.d;
import com.tencent.mm.i.a;
import com.tencent.mm.i.g;
import com.tencent.mm.model.r;
import com.tencent.mm.plugin.exdevice.model.ad;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.al;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.ui.MMActivity;
import com.tencent.mm.ui.base.h;
import com.tencent.ytcommon.BuildConfig;
import java.util.ArrayList;
import java.util.LinkedList;
import junit.framework.Assert;

public final class e {
    public static void a(Context context, ImageView imageView, String str) {
        AppMethodBeat.i(19441);
        Assert.assertTrue(imageView != null);
        if (al.isMainThread()) {
            b(imageView, str, 2131689920);
            AppMethodBeat.o(19441);
            return;
        }
        al.d(new 1(context, imageView, str));
        AppMethodBeat.o(19441);
    }

    static void b(ImageView imageView, String str, int i) {
        AppMethodBeat.i(19442);
        if (bo.isNullOrNil(str) || "#".equals(str)) {
            ab.d("MicroMsg.ExdeviceRankUtil", "hy: url is null or nill. set to default picture resource");
            imageView.setImageResource(i);
            AppMethodBeat.o(19442);
            return;
        }
        ab.d("MicroMsg.ExdeviceRankUtil", "hy: set url to %s", new Object[]{str});
        ad.boZ().a(str, imageView, ad.Kk(str));
        AppMethodBeat.o(19442);
    }

    public static void e(MMActivity mMActivity) {
        AppMethodBeat.i(19443);
        LinkedList linkedList = new LinkedList();
        LinkedList linkedList2 = new LinkedList();
        linkedList.add(mMActivity.getString(2131299281));
        linkedList2.add(Integer.valueOf(0));
        h.a(mMActivity, BuildConfig.FLAVOR, linkedList, linkedList2, null, true, new 2(mMActivity));
        AppMethodBeat.o(19443);
    }

    public static boolean a(MMActivity mMActivity, int i, int i2, Intent intent, String str) {
        AppMethodBeat.i(19444);
        if (i == 1001 && i2 == -1) {
            ArrayList stringArrayListExtra = intent.getStringArrayListExtra("CropImage_OutputPath_List");
            if (stringArrayListExtra != null && stringArrayListExtra.size() > 0) {
                String str2 = (String) stringArrayListExtra.get(0);
                Intent intent2 = new Intent();
                intent2.putExtra("CropImageMode", 1);
                intent2.putExtra("CropImage_OutputPath", com.tencent.mm.compatible.util.e.euZ + "temp.cover");
                intent2.putExtra("CropImage_ImgPath", str2);
                d.b(mMActivity, ".ui.tools.CropImageNewUI", intent2, 1002);
                AppMethodBeat.o(19444);
                return true;
            }
        } else if (i == 1002 && i2 == -1) {
            String Km = d.Km(com.tencent.mm.compatible.util.e.euZ + "temp.cover");
            c bpg = ad.bpg();
            bpg.appName = str;
            long currentTimeMillis = System.currentTimeMillis();
            bpg.lvp = c.a("uploadexdeivce", currentTimeMillis, r.Zd().field_username, String.valueOf(currentTimeMillis));
            String str3 = bpg.lvp;
            g gVar = new g();
            gVar.egl = bpg;
            gVar.field_mediaId = str3;
            gVar.field_fullpath = Km;
            gVar.field_thumbpath = BuildConfig.FLAVOR;
            gVar.field_fileType = a.efN;
            gVar.field_talker = BuildConfig.FLAVOR;
            gVar.field_priority = a.efB;
            gVar.field_needStorage = true;
            gVar.field_isStreamMedia = false;
            gVar.field_appType = 200;
            gVar.field_bzScene = 2;
            if (!f.afx().e(gVar)) {
                ab.e("MicroMsg.ExdevicePictureUploader", "hy: cdntra addSendTask failed. clientid:%s", new Object[]{str3});
            }
            AppMethodBeat.o(19444);
            return true;
        }
        AppMethodBeat.o(19444);
        return false;
    }
}
