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

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


package com.kugou.android.netmusic.bills.rankinglist.musicRecommend;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.bumptech.glide.g;
import com.huawei.hms.framework.common.ContainerUtils;
import com.kugou.android.app.NavigationUtils;
import com.kugou.android.common.delegate.DelegateFragment;
import com.kugou.android.common.widget.wheel.b;
import com.kugou.android.lite.R;
import com.kugou.android.netmusic.bills.rankinglist.musicRecommend.c;
import com.kugou.android.netmusic.bills.rankinglist.musicRecommend.d;
import com.kugou.android.netmusic.bills.rankinglist.musicRecommend.e;
import com.kugou.common.utils.br;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class FansListFragment extends DelegateFragment {

    private String f33064c;

    private ListView f33065d;

    private String f33066e;
    private LinearLayout f;
    private LinearLayout g;
    private Button h;
    private View i;
    private int j;
    private b k;
    private boolean l;
    private a m;
    private TextView n;
    private View o;
    private View p;
    private View q;
    private com.kugou.android.common.widget.wheel.b r;
    private LinearLayout s;
    private boolean t;
    private int v;

    protected int f33062a = 0;

    protected int f33063b = 15;
    private final Handler u = new com.kugou.framework.common.utils.stacktrace.e() {
        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i != 1) {
                if (i == 2) {
                    FansListFragment.this.h();
                    return;
                }
                if (i == 4) {
                    FansListFragment.this.ao_();
                    c.a aVar = (c.a) message.obj;
                    if (aVar != null) {
                        if (aVar.c() != 0) {
                            FansListFragment.this.a(aVar.d(), aVar.a(), aVar.b());
                            return;
                        } else {
                            FansListFragment.this.a_("网络问题,请重试");
                            return;
                        }
                    }
                    FansListFragment.this.a_("网络问题,请重试");
                    return;
                }
                if (i != 5) {
                    return;
                }
                e.c cVar = (e.c) message.obj;
                if (cVar != null) {
                    int a2 = cVar.a();
                    if (a2 == -1) {
                        FansListFragment.this.a_("今天的路人票已用完,每人每天只有一张路人票哦");
                        return;
                    } else if (a2 == 0) {
                        FansListFragment.this.a_("成功投票");
                        return;
                    } else {
                        FansListFragment.this.a_("网络问题,请重试");
                        return;
                    }
                }
                FansListFragment.this.a_("网络问题,请重试");
                return;
            }
            d.a aVar2 = (d.a) message.obj;
            if (aVar2 != null) {
                if (aVar2.c() <= 0) {
                    FansListFragment.this.j();
                    return;
                }
                FansListFragment.this.j = aVar2.c();
                FansListFragment.this.a(false);
                if (!FansListFragment.this.l) {
                    FansListFragment.this.l = true;
                    FansListFragment.this.f33065d.setAdapter(FansListFragment.this.c());
                }
                ArrayList<d.a.C0577a> b2 = aVar2.b();
                if (b2 != null && b2.size() > 0) {
                    System.out.println("handleMessage ---> 条件1");
                    if (FansListFragment.this.f33062a == 1) {
                        FansListFragment.this.k.clearData();
                    }
                    FansListFragment.this.k.addData((List) b2);
                    FansListFragment.this.k.notifyDataSetChanged();
                    if (FansListFragment.this.j > FansListFragment.this.f33063b * FansListFragment.this.f33062a) {
                        FansListFragment.this.a(true);
                    }
                    FansListFragment.this.n.setText(Html.fromHtml("<font color=#FF000000>共</font><font color=#4bb4ff>" + aVar2.c() + "</font><font color=#FF000000>位铁杆粉丝</font>"));
                    FansListFragment.this.g();
                    return;
                }
                if (b2 != null && b2.size() == 0 && FansListFragment.this.f33062a == 1) {
                    System.out.println("handleMessage ---> 条件2");
                    FansListFragment.this.j();
                    FansListFragment.this.f33062a--;
                    return;
                }
                System.out.println("handleMessage ---> 条件3");
                FansListFragment.this.k.notifyDataSetChanged();
                return;
            }
            FansListFragment.this.f33062a--;
            FansListFragment.this.h();
        }
    };

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        return layoutInflater.inflate(R.layout.j_, viewGroup, false);
    }

    @Override
    public void onViewCreated(View view, Bundle bundle) {
        super.onViewCreated(view, bundle);
        e();
        enableTitleDelegate();
        initDelegates();
        getTitleDelegate().a("粉丝榜");
        getTitleDelegate().f(false);
        this.f33066e = com.kugou.common.constant.c.aw;
        this.i = d();
        this.f33065d = (ListView) view.findViewById(R.id.a0y);
        this.k = new b(this);
        this.f33065d.setOnScrollListener(new com.kugou.android.netmusic.discovery.ui.a() {
            @Override
            public void a(int i) {
                if (i == 2) {
                    g.a(FansListFragment.this).c();
                } else if (i == 1) {
                    g.a(FansListFragment.this).b();
                }
            }
        });
        this.f = (LinearLayout) view.findViewById(R.id.b35);
        this.g = (LinearLayout) view.findViewById(R.id.bpt);
        this.h = (Button) view.findViewById(R.id.it);
        this.q = view.findViewById(R.id.ca8);
        this.s = (LinearLayout) view.findViewById(R.id.bqt);
        this.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view2) {
                if (br.aj(FansListFragment.this.getActivity())) {
                    FansListFragment.this.i();
                    FansListFragment.this.b();
                }
            }
        });
        this.p = findViewById(R.id.b01);
        this.n = (TextView) view.findViewById(R.id.cab);
        this.o = view.findViewById(R.id.hn);
        this.o.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view2) {
                if (br.aj(FansListFragment.this.getActivity())) {
                    if (!com.kugou.common.environment.a.u()) {
                        NavigationUtils.startLoginFragment(FansListFragment.this);
                        return;
                    }
                    FansListFragment.this.D_();
                    FansListFragment.this.m.removeMessages(4);
                    FansListFragment.this.m.sendEmptyMessageDelayed(4, 50L);
                }
            }
        });
        this.f33065d.addFooterView(this.i);
        this.v = (int) getResources().getDimension(R.dimen.h4);
        this.f33065d.setOnScrollListener(new AbsListView.OnScrollListener() {
            @Override
            public void onScroll(AbsListView absListView, int i, int i2, int i3) {
            }

            @Override
            public void onScrollStateChanged(AbsListView absListView, int i) {
                if ((i == 2 || i == 0) && absListView.getLastVisiblePosition() >= absListView.getCount() - 1) {
                    if (br.a(FansListFragment.this.getApplicationContext())) {
                        br.T(FansListFragment.this.aN_());
                    } else {
                        FansListFragment.this.b();
                    }
                }
            }
        });
    }

    @Override
    public void onActivityCreated(Bundle bundle) {
        super.onActivityCreated(bundle);
        this.m = new a(getWorkLooper(), this);
        i();
    }

    @Override
    public void onFragmentFirstStart() {
        super.onFragmentFirstStart();
        b();
        i();
    }

    private void e() {
        this.f33064c = getArguments().getString("song_hash");
    }

    @Override
    public void onFragmentResume() {
        super.onFragmentResume();
        if (this.t) {
            this.f33062a = 0;
            this.s.setVisibility(0);
            b();
        }
    }

    @Override
    public void onFragmentPause() {
        super.onFragmentPause();
        this.t = true;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        cancleHandler(this.m);
        a();
    }

    public void a() {
        Handler handler = this.u;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
        }
    }

    public void g() {
        this.p.setVisibility(0);
        this.f.setVisibility(8);
        this.g.setVisibility(8);
        this.f33065d.setVisibility(0);
        this.q.setVisibility(8);
        this.s.setVisibility(8);
    }

    public void h() {
        this.p.setVisibility(8);
        this.f.setVisibility(8);
        this.g.setVisibility(0);
        this.f33065d.setVisibility(8);
        this.q.setVisibility(8);
        this.s.setVisibility(8);
    }

    public void i() {
        this.p.setVisibility(8);
        this.f.setVisibility(0);
        this.g.setVisibility(8);
        this.f33065d.setVisibility(8);
        this.q.setVisibility(8);
        this.s.setVisibility(8);
    }

    public void j() {
        this.p.setVisibility(0);
        this.f.setVisibility(8);
        this.g.setVisibility(8);
        this.f33065d.setVisibility(8);
        this.q.setVisibility(0);
        this.s.setVisibility(8);
        int a2 = com.kugou.common.skinpro.d.b.a().a(com.kugou.common.skinpro.shadowframe.c.PRIMARY_TEXT);
        int a3 = com.kugou.common.skinpro.d.b.a().a(com.kugou.common.skinpro.shadowframe.c.COMMON_WIDGET);
        this.n.setText(Html.fromHtml("<font color=" + a2 + ">共</font><font color=" + a3 + ">0</font><font color=" + a2 + "> 位铁杆粉丝</font>"));
    }

    public static class a extends com.kugou.framework.common.utils.stacktrace.e {

        private final WeakReference<FansListFragment> f33074a;

        public a(Looper looper, FansListFragment fansListFragment) {
            super(looper);
            this.f33074a = new WeakReference<>(fansListFragment);
        }

        @Override
        public void handleMessage(Message message) {
            FansListFragment fansListFragment = this.f33074a.get();
            int i = message.what;
            if (i == 3) {
                if (fansListFragment == null || !fansListFragment.isAlive() || fansListFragment.u == null) {
                    return;
                }
                try {
                    fansListFragment.f33062a++;
                    d.a a2 = fansListFragment.a(fansListFragment.f33062a);
                    if (a2 != null && a2.a() == 0) {
                        fansListFragment.f33062a--;
                        fansListFragment.u.removeMessages(2);
                        fansListFragment.u.sendEmptyMessage(2);
                        return;
                    } else {
                        Message message2 = new Message();
                        fansListFragment.u.removeMessages(1);
                        message2.obj = a2;
                        message2.what = 1;
                        fansListFragment.u.sendMessage(message2);
                        return;
                    }
                } catch (Exception unused) {
                    fansListFragment.f33062a--;
                    fansListFragment.u.removeMessages(2);
                    fansListFragment.u.sendEmptyMessage(2);
                    return;
                }
            }
            if (i == 4) {
                if (fansListFragment == null || !fansListFragment.isAlive() || fansListFragment.u == null) {
                    return;
                }
                c.a a3 = new c(fansListFragment.f33064c).a();
                fansListFragment.u.removeMessages(4);
                Message message3 = new Message();
                message3.obj = a3;
                message3.what = 4;
                fansListFragment.u.sendMessage(message3);
                return;
            }
            if (i == 5 && fansListFragment != null && fansListFragment.isAlive() && fansListFragment.u != null) {
                e.c a4 = new e(fansListFragment.f33064c).a();
                fansListFragment.u.removeMessages(5);
                Message message4 = new Message();
                message4.obj = a4;
                message4.what = 5;
                fansListFragment.u.sendMessage(message4);
            }
        }
    }

    protected void b() {
        this.m.removeMessages(3);
        this.m.sendEmptyMessageDelayed(3, 50L);
    }

    public ListAdapter c() {
        return this.k;
    }

    public d.a a(int i) {
        return new d(this.f33064c).a(i);
    }

    protected View d() {
        return ((LayoutInflater) aN_().getSystemService("layout_inflater")).inflate(R.layout.aq5, (ViewGroup) null);
    }

    public void a(String str, int i, final int i2) {
        if (this.r == null) {
            this.r = new com.kugou.android.common.widget.wheel.b(aN_(), "投票歌曲:" + str, i, i2);
        }
        if (i2 == 0) {
            i2 = 100;
        }
        this.r.a(new b.a() {
            @Override
            public void a() {
                if (br.aj(FansListFragment.this.getActivity())) {
                    if (!FansListFragment.this.r.f24184b) {
                        FansListFragment.this.m.removeMessages(5);
                        FansListFragment.this.m.sendEmptyMessageDelayed(5, 50L);
                    } else {
                        HashMap hashMap = new HashMap();
                        hashMap.put("songhash", FansListFragment.this.f33064c.toUpperCase());
                        hashMap.put("kugouid", String.valueOf(com.kugou.common.environment.a.Y()));
                        hashMap.put("paynum", String.valueOf(i2));
                        Bundle bundle = new Bundle();
                        bundle.putString("web_url", FansListFragment.this.a((HashMap<String, String>) hashMap));
                        bundle.putString("web_title", "支付铁粉票");
                        FansListFragment.this.startFragment(FGFelxoPayWebFragment.class, bundle);
                    }
                    FansListFragment.this.r.b();
                }
            }
        });
        this.r.a();
    }

    public void a(boolean z) {
        if (z) {
            this.i.setVisibility(0);
            this.i.setPadding(0, 0, 0, 0);
        } else {
            this.i.setPadding(0, -this.v, 0, 0);
            this.i.setVisibility(8);
        }
    }

    public String a(HashMap<String, String> hashMap) {
        if (hashMap == null) {
            return "http://www2.kugou.com/yueku/k8v1/static/html/indexH5.html";
        }
        StringBuffer stringBuffer = null;
        for (String str : hashMap.keySet()) {
            String str2 = hashMap.get(str);
            if (stringBuffer == null) {
                stringBuffer = new StringBuffer();
                stringBuffer.append("?");
            } else {
                stringBuffer.append(ContainerUtils.FIELD_DELIMITER);
            }
            stringBuffer.append(str);
            stringBuffer.append(ContainerUtils.KEY_VALUE_DELIMITER);
            stringBuffer.append(str2);
        }
        return "http://www2.kugou.com/yueku/k8v1/static/html/indexH5.html" + stringBuffer.toString();
    }
}