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

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


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

import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.bumptech.glide.g;
import com.kugou.android.app.flexowebview.KGFelxoWebFragment;
import com.kugou.android.app.flexowebview.KugouWebUtils;
import com.kugou.android.common.delegate.DelegateFragment;
import com.kugou.android.common.delegate.f;
import com.kugou.android.common.delegate.q;
import com.kugou.android.common.delegate.s;
import com.kugou.android.common.widget.KGScrollHeadListener;
import com.kugou.android.common.widget.KGScrollRelateLayout;
import com.kugou.android.lite.R;
import com.kugou.android.netmusic.bills.classfication.AlbumDetailFragment;
import com.kugou.android.netmusic.bills.rankinglist.albumrank.a;
import com.kugou.android.netmusic.bills.rankinglist.albumrank.b;
import com.kugou.android.netmusic.bills.rankinglist.albumrank.b.a;
import com.kugou.android.netmusic.bills.rankinglist.albumrank.b.b;
import com.kugou.android.netmusic.bills.rankinglist.albumrank.entity.ListEntity;
import com.kugou.android.netmusic.discovery.e.m;
import com.kugou.android.netmusic.e;
import com.kugou.common.app.KGCommonApplication;
import com.kugou.common.player.manager.Initiator;
import com.kugou.common.share.model.ShareCustomContent;
import com.kugou.common.utils.bc;
import com.kugou.common.utils.br;
import com.kugou.common.widget.ViewUtils;
import com.kugou.framework.service.util.BackgroundServiceUtil;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

@com.kugou.common.base.e.c(a = 936906682)
public class RankingAlbumSongFragment extends DelegateFragment implements View.OnClickListener, q.a, s.n {
    private int C;
    private m[] E;
    private ImageView F;
    private Button G;
    private View H;
    private View I;
    private int J;
    private int K;
    private com.kugou.android.netmusic.bills.rankinglist.albumrank.b.a L;
    private com.kugou.android.netmusic.bills.rankinglist.albumrank.b.b M;

    protected com.kugou.android.common.widget.a f32971b;

    protected String f32972c;

    protected String f32973d;

    f[] f32974e;
    private View g;
    private com.kugou.android.netmusic.bills.rankinglist.albumrank.a[] h;
    private ListView[] i;
    private View[] j;
    private KGScrollRelateLayout k;
    private TextView l;
    private ImageView m;
    private boolean n;
    private int o;
    private int p;
    private String q;
    private String r;
    private int s;
    private String t;
    private String u;
    private String w;
    private b[] z;

    protected String f32970a = "day";
    private boolean v = false;
    private int x = 0;
    List<String> f = new ArrayList();
    private boolean y = false;
    private com.kugou.android.common.widget.c.a B = new com.kugou.android.common.widget.c.a();
    private b.a N = new b.a() {
        @Override
        public void a(int i, List<ListEntity> list) {
            RankingAlbumSongFragment.this.a(list);
        }
    };
    private f.d A = new f.d() {
        @Override
        public void a(int i) {
        }

        @Override
        public void a(MenuItem menuItem, int i, View view) {
        }

        @Override
        public boolean b(int i) {
            return false;
        }

        @Override
        public void a(ListView listView, View view, int i, long j) {
            if (listView.getAdapter() != null) {
                RankingAlbumSongFragment.this.a((ListEntity) listView.getAdapter().getItem(i), false);
            }
        }
    };
    private com.kugou.android.netmusic.b.d D = new com.kugou.android.netmusic.b.d();

    public void a(int i) {
    }

    @Override
    public void a(int i, float f, int i2) {
    }

    @Override
    public void b_(int i) {
    }

    @Override
    public void c(int i) {
    }

    public RankingAlbumSongFragment() {
        this.D.a();
    }

    public com.kugou.android.netmusic.b.d a() {
        return this.D;
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
    }

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

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

    @Override
    public void onViewCreated(View view, Bundle bundle) {
        super.onViewCreated(view, bundle);
        this.K = br.a(KGCommonApplication.getContext(), 225.0f);
        this.J = (int) (br.p() + this.K);
        c();
        enableTitleDelegate();
        enableSwipeViewDelegate(this);
        initDelegates();
        getTitleDelegate().r(false);
        getTitleDelegate().f(false);
        if (com.kugou.common.config.c.a().a(com.kugou.common.config.a.HD, false)) {
            getTitleDelegate().a((s.n) this);
        }
        getTitleDelegate().a((CharSequence) this.q);
        getTitleDelegate().k(8);
        getTitleDelegate().a(new s.o() {
            @Override
            public void b_(View view2) {
                if (RankingAlbumSongFragment.this.i[RankingAlbumSongFragment.this.x] == null || RankingAlbumSongFragment.this.i[RankingAlbumSongFragment.this.x].getCount() <= 0) {
                    return;
                }
                RankingAlbumSongFragment.this.i[RankingAlbumSongFragment.this.x].setSelection(0);
            }
        });
        d();
        getSwipeViewDelegate().a(this.j);
        getSwipeViewDelegate().k().setTabArray(this.f);
        getSwipeViewDelegate().f(this.f.size());
        this.z[this.x].a();
        BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(aN_(), com.kugou.framework.statistics.easytrace.a.bI));
        f(0);
        h();
        f();
    }

    private void f() {
        getTitleDelegate().G();
        int a2 = br.a((Context) aN_(), 100.0f);
        this.C = a2;
        this.B.a(this.K - a2);
        this.B.b(getTitleDelegate().E());
        this.B.a(getTitleDelegate().F());
    }

    private void c() {
        this.q = getArguments().getString("rank_name");
        this.s = getArguments().getInt("rank_id");
        this.w = getArguments().getString(DelegateFragment.KEY_IDENTIFIER) + "/" + this.q;
        this.r = getArguments().getString("rank_description_intro");
        this.f32973d = getArguments().getString("detail_image_url");
        this.t = getArguments().getString("extra_rank_jump_title");
        this.u = getArguments().getString("extra_rank_jump_url");
        this.v = getArguments().getBoolean("extra_from_myasset");
        this.f.add("日榜");
        this.f.add("周榜");
        this.f.add("年榜");
        this.f.add("总榜");
        this.o = getResources().getDimensionPixelSize(R.dimen.a25) + br.A(KGCommonApplication.getContext());
        this.p = getResources().getDimensionPixelSize(R.dimen.a27) + br.A(KGCommonApplication.getContext());
        this.f32971b = new com.kugou.android.common.widget.a(aN_());
    }

    private void d() {
        this.k = (KGScrollRelateLayout) findViewById(R.id.boj);
        this.k.setLimitHeight(this.K);
        this.m = (ImageView) findViewById(R.id.boh);
        this.F = (ImageView) findViewById(R.id.f5f);
        this.m.setImageResource(R.drawable.ajl);
        String[] split = com.kugou.common.config.c.a().b(com.kugou.common.config.a.HE).split(",");
        if (split != null && split.length == 2) {
            g.a(this).a(split[1]).d(R.color.of).a(this.F);
        }
        this.l = (TextView) findViewById(R.id.boq);
        findViewById(R.id.c1i).setOnClickListener(this);
        this.G = (Button) findViewById(R.id.c1g);
        this.H = findViewById(R.id.c1h);
        this.G.setOnClickListener(this);
        this.H.setOnClickListener(this);
        this.g = findViewById(R.id.bog);
        this.g.setOnClickListener(this);
        this.I = findViewById(R.id.xt);
        ViewUtils.a(this.g, -1, this.J);
        int size = this.f.size();
        this.j = new View[size];
        this.i = new ListView[size];
        this.h = new com.kugou.android.netmusic.bills.rankinglist.albumrank.a[size];
        this.z = new b[size];
        this.f32974e = new f[size];
        LayoutInflater from = LayoutInflater.from(aN_());
        for (int i = 0; i < size; i++) {
            this.j[i] = from.inflate(R.layout.ae9, (ViewGroup) null);
            this.f32974e[i] = new f(this, this.A);
            this.f32974e[i].c(this.j[i]);
            this.f32974e[i].k();
            this.i[i] = (ListView) this.j[i].findViewById(android.R.id.list);
            this.h[i] = new com.kugou.android.netmusic.bills.rankinglist.albumrank.a(aN_());
            this.h[i].a(i);
            this.h[i].a(new a.InterfaceC0574a() {
                @Override
                public void a(ListEntity listEntity) {
                    RankingAlbumSongFragment.this.a(listEntity, true);
                }
            });
            View view = new View(aN_());
            view.setLayoutParams(new AbsListView.LayoutParams(-1, this.J + br.a((Context) aN_(), 42.0f)));
            this.i[i].addHeaderView(view);
            this.i[i].setAdapter((ListAdapter) this.h[i]);
            this.i[i].setVisibility(0);
            this.i[i].setOnScrollListener(new a(i, this.k));
            if (i == 1) {
                this.z[i] = new c(this.h[i], this, i, this.w, this.j[i]) {
                    @Override
                    public void a(ArrayList<String> arrayList, ArrayList<ArrayList<String>> arrayList2) {
                        RankingAlbumSongFragment.this.a(arrayList, arrayList2);
                    }
                };
            } else if (i == 2) {
                this.z[i] = new d(this.h[i], this, i, this.w, this.j[i]) {
                    @Override
                    public void a(ArrayList<String> arrayList) {
                        RankingAlbumSongFragment.this.a(arrayList);
                    }
                };
            } else {
                this.z[i] = new b(this.h[i], this, i, this.w, this.j[i]);
            }
            this.z[i].a(this.i[i], from);
            this.z[i].a(this.N);
        }
    }

    public void a(List<ListEntity> list) {
        if (com.kugou.ktv.framework.common.b.a.a((Collection) list)) {
            return;
        }
        g.a(this).a(list.get(0).getImg()).d(R.drawable.ajl).a(this.m);
    }

    public void a(ListEntity listEntity, boolean z) {
        if (listEntity == null) {
            return;
        }
        if (listEntity.getIs_can_goto_buy_page() == 1 && !TextUtils.isEmpty(listEntity.getTopic_url())) {
            String topic_url = listEntity.getTopic_url();
            if (z) {
                if (topic_url.contains("?")) {
                    topic_url = topic_url + "&kgautopay=1";
                } else {
                    topic_url = topic_url + "?kgautopay=1";
                }
            }
            KugouWebUtils.a(this, listEntity.getAlbumname(), topic_url);
            if (z) {
                com.kugou.common.statistics.e.a.a(new com.kugou.framework.statistics.easytrace.task.d(com.kugou.framework.statistics.easytrace.c.dx).setSvar1(listEntity.getAlbumid() + "").setSvar2(this.f.get(this.x)).setAbsSvar3(this.z[this.x].k()));
                return;
            }
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putInt("albumid", listEntity.getAlbumid());
        bundle.putString("singer", listEntity.getSingername());
        bundle.putString("description", listEntity.getIntro());
        bundle.putString("mTitle", listEntity.getAlbumname());
        bundle.putString("mTitleClass", listEntity.getAlbumname());
        bundle.putInt("singerid", listEntity.getSingerid());
        bundle.putString("imageurl", listEntity.getImg());
        bundle.putInt("album_count", listEntity.getBuy_count());
        startFragment(AlbumDetailFragment.class, bundle);
    }

    public void b() {
        b[] bVarArr = this.z;
        this.l.setText((bVarArr == null || bVarArr.length != 4) ? "" : bVarArr[this.x].l());
    }

    @Override
    public void onDestroyView() {
        com.kugou.android.common.widget.a aVar = this.f32971b;
        if (aVar != null) {
            aVar.a();
        }
        for (b bVar : this.z) {
            bVar.b();
        }
        super.onDestroyView();
        e.a(this.E);
    }

    @Override
    public void onSkinAllChanged() {
        super.onSkinAllChanged();
        getTitleDelegate().p((int) (this.B.b() * 255.0f));
        com.kugou.android.netmusic.bills.rankinglist.albumrank.a[] aVarArr = this.h;
        if (aVarArr != null) {
            for (com.kugou.android.netmusic.bills.rankinglist.albumrank.a aVar : aVarArr) {
                if (aVar != null) {
                    aVar.notifyDataSetChanged();
                }
            }
        }
    }

    @Override
    public f getListDelegate() {
        return this.f32974e[this.x];
    }

    private void d_(final View view) {
        if (view != null) {
            view.setEnabled(false);
            view.postDelayed(new Runnable() {
                @Override
                public void run() {
                    view.setEnabled(true);
                }
            }, 400L);
        }
    }

    @Override
    public void onClick(View view) {
        d_(view);
        int id = view.getId();
        if (id == R.id.bog) {
            BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.b(getIdentifier(), getSourcePath(), com.kugou.framework.statistics.easytrace.a.bv));
            a(false);
            return;
        }
        switch (id) {
            case R.id.c1g:
            case R.id.c1h:
                e();
                return;
            case R.id.c1i:
                BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.b(getIdentifier(), getSourcePath(), com.kugou.framework.statistics.easytrace.a.bv));
                a(true);
                return;
            default:
                return;
        }
    }

    private void a(boolean z) {
        if (!z && !TextUtils.isEmpty(this.t) && !TextUtils.isEmpty(this.u)) {
            Bundle bundle = new Bundle();
            bundle.putString("web_url", this.u);
            bundle.putString("web_title", this.t);
            if (getCurrentFragment() != null) {
                getCurrentFragment().startFragment(KGFelxoWebFragment.class, bundle);
                return;
            }
            return;
        }
        if (TextUtils.isEmpty(this.r)) {
            return;
        }
        Bundle bundle2 = new Bundle();
        bundle2.putString("rank_title", this.q);
        bundle2.putString("description", this.r);
        bundle2.putString("imageurl", this.f32973d);
        bundle2.putString("path", this.f32972c);
        bundle2.putInt("type", com.kugou.android.netmusic.bills.singer.e.a.f33368c);
        new com.kugou.android.netmusic.bills.singer.e.a(this, bundle2, getSourcePath()).show();
    }

    private void e() {
        com.kugou.android.netmusic.bills.rankinglist.albumrank.b.a aVar;
        if (bc.u(aN_())) {
            int i = this.x;
            if (i == 1) {
                com.kugou.android.netmusic.bills.rankinglist.albumrank.b.b bVar = this.M;
                if (bVar != null) {
                    bVar.a();
                    return;
                }
                return;
            }
            if (i != 2 || (aVar = this.L) == null) {
                return;
            }
            aVar.b();
        }
    }

    public void a(ArrayList<String> arrayList, ArrayList<ArrayList<String>> arrayList2) {
        if (com.kugou.ktv.framework.common.b.a.a((Collection) arrayList) || com.kugou.ktv.framework.common.b.a.a((Collection) arrayList2)) {
            return;
        }
        this.M = new com.kugou.android.netmusic.bills.rankinglist.albumrank.b.b(aN_(), arrayList, arrayList2);
        this.M.a(new b.a() {
            @Override
            public void a(int i, int i2) {
                if (RankingAlbumSongFragment.this.z[1] instanceof c) {
                    ((c) RankingAlbumSongFragment.this.z[1]).a(i, i2);
                    RankingAlbumSongFragment.this.h();
                    com.kugou.common.statistics.e.a.a(new com.kugou.framework.statistics.easytrace.task.d(com.kugou.framework.statistics.easytrace.c.dy).setSvar2(RankingAlbumSongFragment.this.f.get(RankingAlbumSongFragment.this.x)));
                }
            }
        });
        h();
    }

    public void a(ArrayList<String> arrayList) {
        if (com.kugou.ktv.framework.common.b.a.a((Collection) arrayList) || this.L != null) {
            return;
        }
        this.L = new com.kugou.android.netmusic.bills.rankinglist.albumrank.b.a(aN_(), arrayList);
        this.L.a(new a.InterfaceC0575a() {
            @Override
            public void a(int i) {
                if (RankingAlbumSongFragment.this.z[2] instanceof d) {
                    ((d) RankingAlbumSongFragment.this.z[2]).b(i);
                    RankingAlbumSongFragment.this.h();
                    com.kugou.common.statistics.e.a.a(new com.kugou.framework.statistics.easytrace.task.d(com.kugou.framework.statistics.easytrace.c.dy).setSvar2(RankingAlbumSongFragment.this.f.get(RankingAlbumSongFragment.this.x)));
                }
            }
        });
        h();
    }

    public m i(int i) {
        if (this.E == null) {
            this.E = new m[this.i.length];
        }
        if (this.E[i] == null) {
            this.E[i] = new m(new com.kugou.framework.statistics.easytrace.a(12086, "乐库排行榜-内页", "曝光", this.q + com.kugou.framework.statistics.kpi.bc.g + this.f.get(i)), this.h[i]);
            this.E[i].a(getWorkLooper());
        }
        return this.E[i];
    }

    private String g() {
        if (com.kugou.ktv.framework.common.b.a.a((Collection) this.z[0].j())) {
            return !com.kugou.ktv.framework.common.b.a.a((Collection) this.z[this.x].j()) ? this.z[this.x].j().get(0).getImg() : "";
        }
        return this.z[0].j().get(0).getImg();
    }

    @Override
    public void b(View view) {
        if (bc.u(aN_())) {
            ShareCustomContent shareCustomContent = new ShareCustomContent();
            shareCustomContent.a("酷狗概念版专辑畅销榜");
            shareCustomContent.d("https://ep.kugou.com/apps/rankPage/dist/index.html");
            shareCustomContent.c(g());
            shareCustomContent.b("基于酷狗概念版庞大用户群,以用户购买操作真实数据生成的综合性榜单。");
            shareCustomContent.e("专辑畅销榜");
            new com.kugou.framework.share.delegateImpl.b(shareCustomContent).a(aN_(), Initiator.a(getPageKey()));
            com.kugou.common.statistics.e.a.a(com.kugou.framework.statistics.easytrace.c.dE);
        }
    }

    public class a extends KGScrollHeadListener {

        int f32983d;

        public a(int i, KGScrollRelateLayout kGScrollRelateLayout) {
            super(kGScrollRelateLayout);
            this.f32983d = i;
        }

        @Override
        public void onScroll(AbsListView absListView, int i, int i2, int i3) {
            super.onScroll(absListView, i, i2, i3);
            RankingAlbumSongFragment.this.i(this.f32983d).onScroll(absListView, i, i2, i3);
            if (RankingAlbumSongFragment.this.k.getScrollY() > RankingAlbumSongFragment.this.C) {
                RankingAlbumSongFragment.this.B.b(RankingAlbumSongFragment.this.k.getScrollY() - RankingAlbumSongFragment.this.C);
            } else {
                RankingAlbumSongFragment.this.B.c(0.0f);
            }
            if (i > 0 || RankingAlbumSongFragment.this.k.getScrollY() >= RankingAlbumSongFragment.this.p) {
                RankingAlbumSongFragment.this.getTitleDelegate().k(0);
                RankingAlbumSongFragment.this.getTitleDelegate().g(false);
                RankingAlbumSongFragment.this.n = true;
            } else {
                View childAt = absListView.getChildAt(0);
                if (childAt != null && childAt.getTop() < (-RankingAlbumSongFragment.this.o) && RankingAlbumSongFragment.this.o != 0 && RankingAlbumSongFragment.this.k.getScrollY() >= RankingAlbumSongFragment.this.p) {
                    RankingAlbumSongFragment.this.getTitleDelegate().k(0);
                    RankingAlbumSongFragment.this.getTitleDelegate().g(false);
                    RankingAlbumSongFragment.this.n = true;
                } else {
                    RankingAlbumSongFragment.this.getTitleDelegate().g(false);
                    RankingAlbumSongFragment.this.getTitleDelegate().k(8);
                    RankingAlbumSongFragment.this.n = false;
                }
            }
            if (this.f32983d == RankingAlbumSongFragment.this.x) {
                RankingAlbumSongFragment.this.g(this.f32983d);
            }
        }

        @Override
        public void onScrollStateChanged(AbsListView absListView, int i) {
            super.onScrollStateChanged(absListView, i);
            RankingAlbumSongFragment.this.i(this.f32983d).onScrollStateChanged(absListView, i);
        }
    }

    @Override
    public void d_(int i) {
        if (this.x == i) {
            return;
        }
        this.x = i;
        this.z[this.x].a();
        f(i);
        a(this.z[this.x].j());
        h();
        b();
    }

    public void h() {
        if (this.x == 1 && this.M != null) {
            this.H.setVisibility(0);
            this.I.setVisibility(0);
            this.G.setText(this.z[1].k());
        } else if (this.x == 2 && this.L != null) {
            this.H.setVisibility(0);
            this.I.setVisibility(0);
            this.G.setText(this.z[2].k());
        } else {
            this.H.setVisibility(8);
            this.I.setVisibility(8);
        }
        b();
    }

    private void f(int i) {
        if (i == 0) {
            BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(aN_(), com.kugou.framework.statistics.easytrace.c.dB));
            return;
        }
        if (i == 1) {
            BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(aN_(), com.kugou.framework.statistics.easytrace.c.dC));
        } else if (i == 2) {
            com.kugou.common.statistics.e.a.a(com.kugou.framework.statistics.easytrace.c.dA);
        } else {
            if (i != 3) {
                return;
            }
            BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(aN_(), com.kugou.framework.statistics.easytrace.c.dD));
        }
    }

    public void a(ListView listView) {
        this.k.setListViewPositon(listView);
    }

    public void g(int i) {
        if (this.k == null) {
            return;
        }
        for (int i2 = 0; i2 < this.f.size(); i2++) {
            b[] bVarArr = this.z;
            if (bVarArr[i2] == null) {
                return;
            }
            bVarArr[i2].a(this.k.getScrollY());
            if (i2 != i && this.z[i2].c()) {
                h(i2);
            }
        }
    }

    private void h(int i) {
        if (i < 0) {
            return;
        }
        ListView listView = this.i[i];
        KGScrollRelateLayout kGScrollRelateLayout = this.k;
        if (kGScrollRelateLayout == null || listView == null) {
            return;
        }
        boolean z = kGScrollRelateLayout.getScrollY() < this.k.getLimmitHeight();
        if (listView.getFirstVisiblePosition() <= 0 && listView.getChildAt(0) != null && (-this.k.getScrollY()) <= listView.getChildAt(0).getTop()) {
            z = true;
        }
        if (z) {
            listView.setSelectionFromTop(0, -this.k.getScrollY());
        }
    }
}