package com.tencent.mm.plugin.location.ui.impl;

import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.location.model.LocationInfo;
import com.tencent.mm.plugin.location.ui.d;
import com.tencent.mm.sdk.platformtools.g;
import com.tencent.mm.ui.base.l;
import com.tencent.mm.ui.base.n.c;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;

class h$8 implements c {
    final /* synthetic */ h nRb;

    h$8(h hVar) {
        this.nRb = hVar;
    }

    public final void a(l lVar) {
        AppMethodBeat.i(113701);
        if (this.nRb.nRr) {
            lVar.a(1, this.nRb.getString(2131300996), 0);
        }
        h hVar = this.nRb;
        d dVar = this.nRb.nOI;
        LocationInfo locationInfo = this.nRb.nOJ;
        ArrayList arrayList = new ArrayList();
        arrayList.add("com.tencent.map");
        arrayList.add("com.google.android.apps.maps");
        arrayList.add("com.baidu.BaiduMap");
        arrayList.add("com.autonavi.minimap");
        arrayList.add("com.sogou.map.android.maps");
        String str = "android.intent.action.VIEW";
        Intent intent = new Intent(str, Uri.parse(String.format("geo:%f,%f", new Object[]{Double.valueOf(locationInfo.nJu), Double.valueOf(locationInfo.nJv)})));
        PackageManager packageManager = dVar.context.getPackageManager();
        HashMap hashMap = new HashMap();
        for (ResolveInfo resolveInfo : packageManager.queryIntentActivities(intent, 65536)) {
            if (arrayList.contains(resolveInfo.activityInfo.packageName)) {
                hashMap.put(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.loadLabel(dVar.context.getPackageManager()).toString());
            }
        }
        hVar.nQY = hashMap;
        if (!g.dnY() && (this.nRb.nQZ < 4 || h.a(this.nRb))) {
            lVar.ax(2, 2131304042, 0);
        }
        int i = 3;
        Iterator it = this.nRb.nQY.entrySet().iterator();
        while (true) {
            int i2 = i;
            if (it.hasNext()) {
                Entry entry = (Entry) it.next();
                if (!((String) entry.getKey()).equals("com.tencent.map")) {
                    lVar.a(i2, (CharSequence) entry.getValue(), 0);
                }
                i = i2 + 1;
            } else {
                AppMethodBeat.o(113701);
                return;
            }
        }
    }
}
