酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319

以下内容为反编译后的 SearchTagListProtocol.java 源代码,内容仅作参考


package com.kugou.android.netmusic.search.protocol;

import android.support.v4.app.NotificationCompat;
import c.t;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.kugou.android.app.KGApplication;
import com.kugou.android.app.home.channel.f.c;
import com.kugou.android.app.home.channel.protocol.bi;
import com.kugou.android.lite.R;
import com.kugou.android.netmusic.discovery.f;
import com.kugou.common.network.w;
import com.kugou.common.utils.as;
import com.kugou.common.utils.br;
import com.kugou.common.utils.l;
import d.ab;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import kotlin.collections.x;
import kotlin.jvm.internal.i;
import kotlin.p;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import rx.e;

@Metadata(bv = {1, 0, 3}, d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010$\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010!\n\u0002\b\u0002\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u001a\u0010\u0006\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\t0\b0\u00072\u0006\u0010\n\u001a\u00020\u0005J&\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\f\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\t0\u00102\u0006\u0010\u0011\u001a\u00020\fH\u0002R\u001a\u0010\u0003\u001a\u000e\u0012\u0004\u0012\u00020\u0005\u0012\u0004\u0012\u00020\u00050\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0012"}, d2 = {"Lcom/kugou/android/netmusic/search/protocol/SearchTagListProtocol;", "", "()V", "targetIds", "", "", "getList", "Lrx/Observable;", "", "Lcom/kugou/android/netmusic/discovery/DiscoveryTagDetailEntity$ParentTag$ChildTag;", "pid", "parseAllTag", "", "jsonString", "", "childList", "", "isSpecialTag", "androidkugou_release"}, k = 1, mv = {1, 1, 15})
public final class SearchTagListProtocol {

    public static final SearchTagListProtocol f37403a = new SearchTagListProtocol();

    private static final Map<Integer, Integer> f37404b;

    static {
        Integer valueOf = Integer.valueOf(R.drawable.zj);
        f37404b = x.a(p.a(1921, valueOf), p.a(1707, valueOf), p.a(2509, valueOf), p.a(1715, valueOf), p.a(2219, valueOf), p.a(2121, valueOf), p.a(279, valueOf), p.a(2143, valueOf), p.a(1743, valueOf));
    }

    private SearchTagListProtocol() {
    }

    public static final Map a(SearchTagListProtocol searchTagListProtocol) {
        return f37404b;
    }

    @NotNull
    public final e<List<f.a.C0610a>> a(int i) {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        String E = br.E(KGApplication.getContext());
        i.a((Object) E, "SystemUtils.getPlatform(…Application.getContext())");
        linkedHashMap.put("plat", E);
        linkedHashMap.put("apiver", 2);
        linkedHashMap.put("pid", Integer.valueOf(i));
        e c2 = ((bi) new t.a().b("DiscoveryAllTagDetail").a(c.a.a.i.a()).a(w.a(com.kugou.android.app.a.a.C, "http://mobilecdn.kugou.com/api/v3/tag/list")).a(c.b.a.a.a()).a().b().a(bi.class)).a(linkedHashMap).c(a.f37405a);
        i.a((Object) c2, "simpleRequest.create(ICh…         }\n            })");
        return c2;
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0018\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a>\u0012\u0018\u0012\u0016\u0012\u0004\u0012\u00020\u0003 \u0004*\n\u0012\u0004\u0012\u00020\u0003\u0018\u00010\u00020\u0002 \u0004*\u001e\u0012\u0018\u0012\u0016\u0012\u0004\u0012\u00020\u0003 \u0004*\n\u0012\u0004\u0012\u00020\u0003\u0018\u00010\u00020\u0002\u0018\u00010\u00010\u00012\u000e\u0010\u0005\u001a\n \u0004*\u0004\u0018\u00010\u00060\u0006H\n¢\u0006\u0002\b\u0007"}, d2 = {"<anonymous>", "Lrx/Observable;", "", "Lcom/kugou/android/netmusic/discovery/DiscoveryTagDetailEntity$ParentTag$ChildTag;", "kotlin.jvm.PlatformType", "it", "Lokhttp3/ResponseBody;", NotificationCompat.CATEGORY_CALL}, k = 3, mv = {1, 1, 15})
    static final class a<T, R> implements rx.b.e<ab, e<List<? extends f.a.C0610a>>> {

        public static final a f37405a = new a();

        a() {
        }

        @Override
        public final e<List<f.a.C0610a>> call(ab abVar) {
            ArrayList<f.a.C0610a> arrayList = new ArrayList();
            String f = abVar.f();
            SearchTagListProtocol searchTagListProtocol = SearchTagListProtocol.f37403a;
            i.a((Object) f, "jsonString");
            if (searchTagListProtocol.a(f, arrayList, false)) {
                LinkedHashMap linkedHashMap = new LinkedHashMap();
                for (f.a.C0610a c0610a : arrayList) {
                    Integer num = (Integer) SearchTagListProtocol.a(SearchTagListProtocol.f37403a).get(Integer.valueOf(c0610a.l));
                    c0610a.s = num != null ? num.intValue() : 0;
                    if (c0610a.s != 0) {
                        linkedHashMap.put(Integer.valueOf(c0610a.l), c0610a);
                    }
                }
                ArrayList arrayList2 = new ArrayList();
                boolean b2 = l.b(false);
                Iterator<T> it = SearchTagListProtocol.a(SearchTagListProtocol.f37403a).keySet().iterator();
                while (it.hasNext()) {
                    int intValue = ((Number) it.next()).intValue();
                    if (!b2 || (intValue != 2509 && intValue != 1715)) {
                        f.a.C0610a c0610a2 = (f.a.C0610a) linkedHashMap.get(Integer.valueOf(intValue));
                        if (c0610a2 != null) {
                            arrayList2.add(c0610a2);
                        }
                    }
                }
                arrayList2.add(0, new f.a.C0610a(-1, "歌手分类"));
                return e.a(arrayList2);
            }
            return e.a((Throwable) new c(f));
        }
    }

    public final boolean a(String str, List<f.a.C0610a> list, boolean z) {
        JSONObject jSONObject;
        int optInt;
        try {
            jSONObject = new JSONObject(str);
            optInt = jSONObject.optInt("status");
        } catch (JSONException e2) {
            as.e(e2);
        }
        if (optInt != 1) {
            return false;
        }
        f fVar = new f();
        fVar.f34588a = optInt;
        fVar.f34589b = jSONObject.optInt("errcode");
        fVar.f34590c = jSONObject.optString("error", "");
        JSONObject optJSONObject = jSONObject.optJSONObject("data");
        if (optJSONObject != null) {
            fVar.f34591d = optJSONObject.optInt("timestamp");
            JSONArray optJSONArray = optJSONObject.optJSONArray("info");
            if (optJSONArray != null && optJSONArray.length() > 0) {
                fVar.f34592e = new ArrayList();
                for (int i = 0; i < optJSONArray.length(); i++) {
                    JSONObject optJSONObject2 = optJSONArray.optJSONObject(i);
                    if (optJSONObject2 != null && optJSONObject2.has("id")) {
                        f.a aVar = new f.a();
                        aVar.l = optJSONObject2.optInt("id", 0);
                        aVar.m = optJSONObject2.optString("name", "");
                        aVar.n = optJSONObject2.optInt("has_child", 0);
                        aVar.o = optJSONObject2.optString(RemoteMessageConst.Notification.ICON);
                        JSONArray optJSONArray2 = optJSONObject2.optJSONArray("children");
                        for (int i2 = 0; optJSONArray2 != null && i2 < optJSONArray2.length(); i2++) {
                            JSONObject optJSONObject3 = optJSONArray2.optJSONObject(i2);
                            if (optJSONObject3 != null && optJSONObject3.has("id")) {
                                f.a.C0610a c0610a = new f.a.C0610a();
                                c0610a.l = optJSONObject3.optInt("id", 0);
                                c0610a.m = optJSONObject3.optString("name", "");
                                c0610a.f34597d = optJSONObject3.optString("bannerurl", "");
                                c0610a.f = optJSONObject3.optInt("song_tag_id", 0);
                                c0610a.g = optJSONObject3.optInt("special_tag_id", 0);
                                c0610a.h = optJSONObject3.optInt("album_tag_id", 0);
                                c0610a.i = optJSONObject3.optInt("is_new", 0);
                                c0610a.j = optJSONObject3.optInt("is_hot", 0);
                                c0610a.n = optJSONObject3.optInt("has_child", 0);
                                c0610a.f34598e = optJSONObject3.optString("imgurl", "");
                                c0610a.k = optJSONObject3.optString("jump_url", "");
                                c0610a.o = optJSONObject3.optString(RemoteMessageConst.Notification.ICON, "");
                                c0610a.q = aVar.l;
                                c0610a.r = aVar;
                                list.add(c0610a);
                            }
                        }
                    }
                }
                return true;
            }
        }
        return false;
    }
}