君尽欢.apk(点击下载) / cf.java


package com.amap.api.mapcore.util;

import android.content.Context;
import com.lzy.okgo.cache.CacheEntity;
import com.meizu.cloud.pushsdk.notification.model.TimeDisplaySetting;
import java.util.Hashtable;
import java.util.List;
import java.util.Locale;
import java.util.Map;

/* compiled from: CustomStyleRequest */
public final class cf extends en<String, a> {
    private String j;
    private String k = "1.0";
    private String l = "0";
    private final String m = "lastModified";
    private boolean n = false;
    private String o = null;

    /* compiled from: CustomStyleRequest */
    public static class a {
        public byte[] a;
        public int b = -1;
        public String c = null;
        public boolean d = false;
    }

    /* Return type fixed from 'java.lang.Object' to match base method */
    /* access modifiers changed from: protected */
    @Override // com.amap.api.mapcore.util.en
    public final /* bridge */ /* synthetic */ a a(String str) throws em {
        return null;
    }

    /* access modifiers changed from: protected */
    @Override // com.amap.api.mapcore.util.en
    public final String c() {
        return null;
    }

    @Override // com.amap.api.mapcore.util.hd
    public final boolean isSupportIPV6() {
        return true;
    }

    public cf(Context context, String str) {
        super(context, str);
        this.h = "/map/styles";
        this.i = true;
    }

    public cf(Context context, String str, boolean z) {
        super(context, str);
        this.n = z;
        if (z) {
            this.h = "/sdk/map/styles";
            this.isPostFlag = false;
        } else {
            this.h = "/map/styles";
        }
        this.i = true;
    }

    public final void b(String str) {
        this.o = str;
    }

    /* access modifiers changed from: private */
    /* renamed from: b */
    public a a(he heVar) throws em {
        List<String> list;
        if (heVar == null) {
            return null;
        }
        a b = a(heVar.a);
        b.d = b.a != null;
        if (heVar.b == null || !heVar.b.containsKey("lastModified") || (list = heVar.b.get("lastModified")) == null || list.size() <= 0) {
            return b;
        }
        b.c = list.get(0);
        return b;
    }

    /* access modifiers changed from: private */
    /* renamed from: b */
    public a a(byte[] bArr) throws em {
        a aVar = new a();
        aVar.a = bArr;
        if (this.n && bArr != null) {
            if (bArr.length == 0) {
                aVar.a = null;
            } else if (aVar.a.length <= 1024) {
                try {
                    if (new String(bArr, "utf-8").contains("errcode")) {
                        aVar.a = null;
                    }
                } catch (Exception e) {
                    fz.c(e, "CustomStyleRequest", "loadData");
                }
            }
        }
        return aVar;
    }

    @Override // com.amap.api.mapcore.util.hd, com.amap.api.mapcore.util.en
    public final Map<String, String> getRequestHead() {
        ff a2 = dl.a();
        String b = a2 != null ? a2.b() : null;
        Hashtable hashtable = new Hashtable(16);
        hashtable.put("User-Agent", l.c);
        hashtable.put("Accept-Encoding", "gzip");
        hashtable.put("platinfo", String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s", b, "3dmap"));
        hashtable.put("x-INFO", ey.a(this.g));
        hashtable.put(CacheEntity.KEY, ev.f(this.g));
        hashtable.put("logversion", "2.1");
        return hashtable;
    }

    @Override // com.amap.api.mapcore.util.hd, com.amap.api.mapcore.util.cp
    public final Map<String, String> getParams() {
        Hashtable hashtable = new Hashtable(16);
        hashtable.put(CacheEntity.KEY, ev.f(this.g));
        if (!this.n) {
            hashtable.put("output", "bin");
        } else {
            hashtable.put("sdkType", this.o);
        }
        hashtable.put("styleid", this.j);
        hashtable.put("protocol", this.k);
        hashtable.put("ispublic", "1");
        hashtable.put("lastModified", this.l);
        String a2 = ey.a();
        String a3 = ey.a(this.g, a2, fg.b(hashtable));
        hashtable.put(TimeDisplaySetting.TIME_DISPLAY_SETTING, a2);
        hashtable.put("scode", a3);
        return hashtable;
    }

    @Override // com.amap.api.mapcore.util.hd
    public final String getURL() {
        return "http://restsdk.amap.com/v4" + this.h;
    }

    @Override // com.amap.api.mapcore.util.hd
    public final String getIPV6URL() {
        return dl.a(getURL());
    }

    public final void c(String str) {
        this.j = str;
    }

    public final void d(String str) {
        this.l = str;
    }
}