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

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


package com.kugou.android.app.home.channel.protocol;

import android.support.v4.app.NotificationCompat;
import c.a.a.i;
import c.c.f;
import c.c.u;
import c.t;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.kugou.android.app.home.channel.entity.CommonResponse;
import com.kugou.android.app.home.channel.f.c;
import com.kugou.common.network.w;
import com.kugou.framework.database.channel.entity.ChannelEntity;
import com.kugou.framework.netmusic.topic.TopicEntity;
import com.qq.e.comm.constants.TangramHippyConstants;
import d.ab;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONObject;
import rx.e;

@Metadata(bv = {1, 0, 3}, d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\bÆ\u0002\u0018\u00002\u00020\u0001:\u0001\u0011B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0018\u0010\u0003\u001a\u0014\u0012\u0010\u0012\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00070\u00060\u00050\u0004J0\u0010\b\u001a\u0014\u0012\u0010\u0012\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00070\u00060\u00050\u00042\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\fJ\"\u0010\u000e\u001a\u0014\u0012\u0010\u0012\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00070\u00060\u00050\u00042\u0006\u0010\u000f\u001a\u00020\u0010H\u0002¨\u0006\u0012"}, d2 = {"Lcom/kugou/android/app/home/channel/protocol/TopicListProtocol;", "", "()V", "getDiscoveryTopicList", "Lrx/Observable;", "Lcom/kugou/android/app/home/channel/entity/CommonResponse;", "", "Lcom/kugou/framework/netmusic/topic/TopicEntity;", "getList", RemoteMessageConst.Notification.CHANNEL_ID, "", "page", "", "pageSize", "parseBody", "responseBody", "Lokhttp3/ResponseBody;", "ChannelTopicInterface", "androidkugou_release"}, k = 1, mv = {1, 1, 15})
public final class TopicListProtocol {

    public static final TopicListProtocol f11504a = new TopicListProtocol();

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010$\n\u0002\u0010\u000e\n\u0000\bf\u0018\u00002\u00020\u0001J$\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u00032\u0014\b\u0001\u0010\u0005\u001a\u000e\u0012\u0004\u0012\u00020\u0007\u0012\u0004\u0012\u00020\u00070\u0006H'¨\u0006\b"}, d2 = {"Lcom/kugou/android/app/home/channel/protocol/TopicListProtocol$ChannelTopicInterface;", "", "getList", "Lrx/Observable;", "Lokhttp3/ResponseBody;", TangramHippyConstants.PARAMS, "", "", "androidkugou_release"}, k = 1, mv = {1, 1, 15})
    public interface a {
        @f
        @NotNull
        e<ab> a(@u @NotNull Map<String, String> map);
    }

    private TopicListProtocol() {
    }

    @NotNull
    public final e<CommonResponse<List<TopicEntity>>> a() {
        a aVar = (a) new t.a().b("DiscoveryTopicList").a(i.a()).a(w.a(com.kugou.android.app.a.a.fs, "https://youth.kugou.com/api/topic/v1/get_new_topic_list")).a(c.b.a.a.a()).a().b().a(a.class);
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        w.b(linkedHashMap, "");
        e c2 = aVar.a(linkedHashMap).c(b.f11505a);
        kotlin.jvm.internal.i.a((Object) c2, "topicInterface.getList(m…ponseBody)\n            })");
        return c2;
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u001c\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u0014\u0012\u0010\u0012\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00040\u00030\u00020\u00012\u000e\u0010\u0005\u001a\n \u0007*\u0004\u0018\u00010\u00060\u0006H\n¢\u0006\u0002\b\b"}, d2 = {"<anonymous>", "Lrx/Observable;", "Lcom/kugou/android/app/home/channel/entity/CommonResponse;", "", "Lcom/kugou/framework/netmusic/topic/TopicEntity;", "responseBody", "Lokhttp3/ResponseBody;", "kotlin.jvm.PlatformType", NotificationCompat.CATEGORY_CALL}, k = 3, mv = {1, 1, 15})
    static final class b<T, R> implements rx.b.e<ab, e<CommonResponse<List<TopicEntity>>>> {

        public static final b f11505a = new b();

        b() {
        }

        @Override
        @NotNull
        public final e<CommonResponse<List<TopicEntity>>> call(ab abVar) {
            TopicListProtocol topicListProtocol = TopicListProtocol.f11504a;
            kotlin.jvm.internal.i.a((Object) abVar, "responseBody");
            return topicListProtocol.a(abVar);
        }
    }

    public final e<CommonResponse<List<TopicEntity>>> a(ab abVar) {
        String str = (String) null;
        try {
            CommonResponse commonResponse = new CommonResponse(0, 0, null, false, null, 31, null);
            str = abVar.f();
            JSONObject jSONObject = new JSONObject(str);
            commonResponse.a(jSONObject.optInt("status"));
            commonResponse.b(jSONObject.optInt("error_code"));
            String optString = jSONObject.optString("error_msg");
            kotlin.jvm.internal.i.a((Object) optString, "jsonObject.optString(\"error_msg\")");
            commonResponse.a(optString);
            commonResponse.a(jSONObject.optInt("is_end") == 1);
            if (commonResponse.getStatus() == 1) {
                ArrayList arrayList = new ArrayList();
                JSONObject optJSONObject = jSONObject.optJSONObject("data");
                JSONArray optJSONArray = optJSONObject != null ? optJSONObject.optJSONArray("list") : null;
                if (optJSONArray != null) {
                    int length = optJSONArray.length();
                    int i = 0;
                    while (i < length) {
                        JSONObject jSONObject2 = optJSONArray.getJSONObject(i);
                        kotlin.jvm.internal.i.a((Object) jSONObject2, "getJSONObject(index)");
                        TopicEntity topicEntity = new TopicEntity(0, null, null, null, null, 0, null, 0, 0, 0, 1023, null);
                        topicEntity.a(jSONObject2.optInt("topic_id"));
                        String optString2 = jSONObject2.optString("topic_name");
                        kotlin.jvm.internal.i.a((Object) optString2, "it.optString(\"topic_name\")");
                        topicEntity.a(optString2);
                        String optString3 = jSONObject2.optString("add_time");
                        kotlin.jvm.internal.i.a((Object) optString3, "it.optString(\"add_time\")");
                        topicEntity.b(optString3);
                        String optString4 = jSONObject2.optString(RemoteMessageConst.Notification.ICON);
                        kotlin.jvm.internal.i.a((Object) optString4, "it.optString(\"icon\")");
                        topicEntity.d(optString4);
                        String optString5 = jSONObject2.optString("brief");
                        kotlin.jvm.internal.i.a((Object) optString5, "it.optString(\"brief\")");
                        topicEntity.c(optString5);
                        topicEntity.b(jSONObject2.optInt("type"));
                        topicEntity.e(jSONObject2.optInt("sort"));
                        topicEntity.d(jSONObject2.optInt("special_show"));
                        ArrayList arrayList2 = new ArrayList();
                        JSONArray optJSONArray2 = jSONObject2.optJSONArray("channel_list");
                        kotlin.jvm.internal.i.a((Object) optJSONArray2, "jsonArray");
                        int length2 = optJSONArray2.length();
                        int i2 = 0;
                        while (i2 < length2) {
                            JSONObject jSONObject3 = optJSONArray2.getJSONObject(i2);
                            kotlin.jvm.internal.i.a((Object) jSONObject3, "getJSONObject(index)");
                            ChannelEntity channelEntity = new ChannelEntity();
                            channelEntity.f57741d = jSONObject3.optString("channel_name");
                            channelEntity.f57740c = jSONObject3.optString("global_collection_id");
                            channelEntity.f57738a = jSONObject3.optLong("channel_creator");
                            arrayList2.add(channelEntity);
                            i2++;
                            i = i;
                        }
                        topicEntity.a(arrayList2);
                        arrayList.add(topicEntity);
                        i++;
                    }
                }
                commonResponse.a((CommonResponse) arrayList);
            }
            e<CommonResponse<List<TopicEntity>>> a2 = e.a(commonResponse);
            kotlin.jvm.internal.i.a((Object) a2, "Observable.just(commonResponse)");
            return a2;
        } catch (Exception unused) {
            e<CommonResponse<List<TopicEntity>>> a3 = e.a((Throwable) new c(str));
            kotlin.jvm.internal.i.a((Object) a3, "Observable.error<CommonR…lParseException(content))");
            return a3;
        }
    }
}