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

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


package com.kugou.android.app.common.comment;

import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Message;
import android.os.Parcelable;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.widget.AbsListView;
import android.widget.FrameLayout;
import android.widget.ListAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.huawei.hms.framework.common.ContainerUtils;
import com.kugou.android.app.KGApplication;
import com.kugou.android.app.NavigationUtils;
import com.kugou.android.app.ads.AdsCenterMgr;
import com.kugou.android.app.ads.event.RemoveAdItemEvent;
import com.kugou.android.app.common.comment.b;
import com.kugou.android.app.common.comment.c.c;
import com.kugou.android.app.common.comment.entity.CmmExtData;
import com.kugou.android.app.common.comment.entity.CmtKtvOpusEntity;
import com.kugou.android.app.common.comment.entity.CommentContentEntity;
import com.kugou.android.app.common.comment.entity.CommentEntity;
import com.kugou.android.app.common.comment.entity.CommentGDTAdResp;
import com.kugou.android.app.common.comment.entity.CommentTopBannerEntity;
import com.kugou.android.app.common.comment.entity.CommentTopLabelTagEntity;
import com.kugou.android.app.common.comment.entity.PostedCommentEntity;
import com.kugou.android.app.common.comment.j;
import com.kugou.android.app.common.comment.widget.CmtInputAreaBGView;
import com.kugou.android.app.common.comment.widget.CmtMoreMenuView;
import com.kugou.android.app.common.comment.widget.CommentBgRelativeLayout;
import com.kugou.android.app.common.comment.widget.CommentListView;
import com.kugou.android.app.common.comment.widget.CommentPullToRefreshListView;
import com.kugou.android.app.home.channel.ChannelContributionPermissionManager;
import com.kugou.android.app.home.channel.entity.CommonResponse;
import com.kugou.android.app.home.channel.protocol.ContributionUserMuteProtocol;
import com.kugou.android.app.player.NormalPlayerFragment;
import com.kugou.android.app.player.comment.AbsCommentTabMainFragment;
import com.kugou.android.app.player.comment.CommentDetailFragment;
import com.kugou.android.app.player.comment.CommentsListFragment;
import com.kugou.android.app.player.comment.UserCommentFragment;
import com.kugou.android.app.player.comment.views.CmtKtvOpusBoxView;
import com.kugou.android.app.player.comment.views.PinnedSectionListView;
import com.kugou.android.app.player.view.KGMarqueeTextView3;
import com.kugou.android.app.process.EnvManager;
import com.kugou.android.common.delegate.DelegateFragment;
import com.kugou.android.common.delegate.s;
import com.kugou.android.common.entity.ISong;
import com.kugou.android.lite.R;
import com.kugou.common.app.KGCommonApplication;
import com.kugou.common.musicfees.mediastore.entity.TraceSource;
import com.kugou.common.player.manager.Initiator;
import com.kugou.common.statistics.easytrace.CommBIMemoryManager;
import com.kugou.common.statistics.j;
import com.kugou.common.userCenter.UserInfoConstant;
import com.kugou.common.useraccount.event.YVipInfosEvent;
import com.kugou.common.utils.as;
import com.kugou.common.utils.br;
import com.kugou.common.utils.bv;
import com.kugou.common.utils.cv;
import com.kugou.common.utils.cw;
import com.kugou.common.widget.listview.extra.PullToRefreshBase;
import com.kugou.framework.database.channel.entity.ChannelEntity;
import com.kugou.framework.database.contribution.entity.ContributionEntity;
import com.kugou.framework.service.entity.KGMusicWrapper;
import com.kugou.framework.service.util.PlaybackServiceUtil;
import com.kugou.ktv.android.playopus.b.ah;
import com.kugou.ktv.android.playopus.b.v;
import com.kugou.ktv.android.playopus.b.x;
import com.tencent.open.SocialConstants;
import de.greenrobot.event.EventBus;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Locale;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public abstract class CommentsFragment extends AbsListViewLoadMoreFragment implements com.kugou.android.app.player.comment.g {
    private Animation A;
    protected CommentPullToRefreshListView H;
    protected TextView I;
    private ValueAnimator J;
    private ValueAnimator K;
    protected RelativeLayout Q;
    private com.kugou.android.app.common.comment.c.k U;
    private CmtKtvOpusBoxView.a W;
    private ChannelContributionPermissionManager Y;
    protected String af;
    protected int as;
    protected ISong at;
    protected String au;
    protected long av;
    protected long aw;
    protected int l;
    protected com.kugou.android.app.common.comment.a p;
    protected com.kugou.android.app.common.comment.b r;
    protected CommentListView s;
    b u;
    protected View x;
    private static final String w = CommentsFragment.class.getSimpleName();
    private static final int M = br.a(KGCommonApplication.getContext(), 30.0f);
    private static final int N = br.a(KGCommonApplication.getContext(), 8.5f);
    protected boolean aa = false;
    protected long ah = 0;
    protected String i = "";
    protected String j = "";
    protected String k = "";
    protected String m = "";
    protected String n = "";
    protected String o = "";
    protected c q = null;
    public int t = 0;
    private boolean y = true;
    private boolean z = false;
    protected com.kugou.android.app.common.comment.c.e O = null;
    protected View R = null;
    protected KGMarqueeTextView3 S = null;
    protected CmtMoreMenuView ax = null;
    protected com.kugou.android.app.common.comment.c.j al = null;
    protected com.kugou.android.denpant.d.a ak = new com.kugou.android.denpant.d.a();
    private com.kugou.android.app.player.comment.i V = null;
    private CommentPullToRefreshListView.c X = new CommentPullToRefreshListView.c() {
        @Override
        public boolean a(MotionEvent motionEvent) {
            return CommentsFragment.this.V();
        }
    };
    private com.kugou.android.app.common.comment.widget.a L = null;
    protected final com.kugou.android.common.a.i v = new com.kugou.android.common.a.i() {
        @Override
        public void a(MenuItem menuItem, int i, View view) {
            CommentEntity c2 = CommentsFragment.this.p.c(i);
            if (c2 == null) {
                CommentsFragment.this.p.r();
                return;
            }
            switch (menuItem.getItemId()) {
                case R.id.po:
                    com.kugou.common.statistics.e.a.a(com.kugou.framework.statistics.easytrace.c.f);
                    if (g.a(CommentsFragment.this.aN_(), Integer.valueOf(R.string.hr))) {
                        return;
                    }
                    CommentsFragment.this.q.b(c2);
                    CommentsFragment.this.D();
                    return;
                case R.id.pp:
                    if (TextUtils.isEmpty(c2.f5164a)) {
                        bv.a(CommentsFragment.this.getApplicationContext(), "该评论暂不支持此操作");
                        return;
                    }
                    if (!br.Q(CommentsFragment.this.getApplicationContext())) {
                        CommentsFragment.this.showToast(R.string.av3);
                        return;
                    } else if (!EnvManager.isOnline()) {
                        br.T(CommentsFragment.this.aN_());
                        return;
                    } else {
                        CommentsFragment.this.q.a(c2);
                        CommentsFragment.this.a(c2);
                        return;
                    }
                case R.id.pq:
                    CommentsFragment.this.b(c2);
                    return;
                case R.id.pr:
                    CommentsFragment.this.a(c2, (Boolean) true);
                    return;
                case R.id.ps:
                    if (CommentsFragment.this.a(Integer.valueOf(R.string.hy))) {
                        return;
                    }
                    if (TextUtils.isEmpty(c2.f5164a)) {
                        bv.a(CommentsFragment.this.getApplicationContext(), "该评论暂不支持此操作");
                        return;
                    }
                    CommentsFragment.this.r.a(c2);
                    new com.kugou.framework.common.utils.stacktrace.e().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            CommentsFragment.this.r.c_();
                        }
                    }, 50L);
                    CommentsFragment.this.C();
                    return;
                case R.id.pt:
                    CommentsFragment.this.b(c2, true);
                    return;
                case R.id.pu:
                    CommentsFragment.this.b(c2, CommentsFragment.this.W() + "-弹窗分享btn");
                    return;
                case R.id.pv:
                    CommentsFragment.this.a(c2, (Boolean) false);
                    return;
                default:
                    if (as.f54365e) {
                        as.d(CommentsFragment.w, "onAdapterMenuSelected item id err.");
                        return;
                    }
                    return;
            }
        }
    };
    private View.OnTouchListener B = new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (CommentsFragment.this.r == null) {
                return false;
            }
            CommentsFragment.this.aC();
            return false;
        }
    };
    private final b.a C = new b.a() {
        @Override
        public void a(final CommentEntity commentEntity, final CommentContentEntity commentContentEntity, final int i) {
            if (CommentsFragment.this.a(Integer.valueOf(commentEntity == null ? R.string.hw : R.string.hy))) {
                return;
            }
            if (TextUtils.isEmpty(commentContentEntity.getContent()) && !CommentsFragment.this.b() && !CommentsFragment.this.Z()) {
                CommentsFragment.this.a_("评论不能为空");
                return;
            }
            if (TextUtils.isEmpty(commentContentEntity.getContent().trim()) && !CommentsFragment.this.b() && !CommentsFragment.this.Z()) {
                CommentsFragment.this.a_("评论不能全为空格");
                return;
            }
            if (!br.Q(CommentsFragment.this.getApplicationContext())) {
                CommentsFragment.this.showToast(R.string.av3);
                return;
            }
            if (!EnvManager.isOnline()) {
                br.T(CommentsFragment.this.aN_());
                return;
            }
            if (CommentsFragment.this.r != null && CommentsFragment.this.r.L() != null && CommentsFragment.this.r.L().c()) {
                CommentsFragment.this.r.f(CommentsFragment.this.r.L().getUploadStatus());
                return;
            }
            if (!"youngchannelpost".equals(CommentsFragment.this.af)) {
                CommentsFragment.this.a(commentEntity, commentContentEntity, i);
                return;
            }
            CommentsFragment commentsFragment = CommentsFragment.this;
            commentContentEntity.setMixId(commentsFragment.a(commentsFragment.at));
            if (TextUtils.isEmpty(CommentsFragment.this.au)) {
                return;
            }
            ChannelEntity channelEntity = new ChannelEntity();
            channelEntity.f57740c = CommentsFragment.this.au;
            CommentsFragment.this.a(channelEntity);
            CommentsFragment.this.Y.a(2, true, new Runnable() {
                @Override
                public void run() {
                    CommentsFragment.this.a(commentEntity, commentContentEntity, i);
                }
            }, null);
        }
    };
    private final k D = new k() {
        @Override
        public void h(CommentEntity commentEntity) {
            CommentsFragment.this.e(commentEntity);
        }

        @Override
        public void i(CommentEntity commentEntity) {
            CommentsFragment.this.b(commentEntity);
        }

        @Override
        public void a(CommentEntity commentEntity) {
            if (commentEntity == null || TextUtils.isEmpty(commentEntity.ab)) {
                return;
            }
            CommentsFragment commentsFragment = CommentsFragment.this;
            NavigationUtils.a(commentsFragment, commentEntity, commentsFragment.k, CommentsFragment.this.i, CommentsFragment.this.getArguments().getString("cmt_code_generator"));
        }

        @Override
        public void b(CommentEntity commentEntity) {
            long parseLong = Long.parseLong(commentEntity.f5165b);
            CommentsFragment.this.aC();
            CommentsFragment.this.f(commentEntity);
            if (com.kugou.common.environment.a.Y() == parseLong) {
                CommentsFragment.this.g(commentEntity);
            } else {
                com.kugou.android.app.common.comment.c.i.a(CommentsFragment.this, parseLong, commentEntity.f5166c, commentEntity.f5168e, commentEntity.d(), commentEntity.c(), commentEntity);
            }
        }

        @Override
        public void c(CommentEntity commentEntity) {
            long parseLong = Long.parseLong(commentEntity.f5165b);
            CommentsFragment.this.aC();
            CommentsFragment.this.B();
            if (com.kugou.common.environment.a.Y() == parseLong) {
                EventBus.getDefault().post(new com.kugou.android.app.home.channel.event.s());
                CommentsFragment.this.g(commentEntity);
            } else {
                com.kugou.android.app.common.comment.c.i.a(CommentsFragment.this, parseLong, commentEntity.f5166c, commentEntity.f5168e, commentEntity.d(), commentEntity.c(), commentEntity);
            }
        }

        @Override
        public void a(CommentEntity commentEntity, View view) {
            if (CommentsFragment.this.a(Integer.valueOf(R.string.hv))) {
                return;
            }
            if (!br.Q(CommentsFragment.this.getActivity())) {
                bv.b(CommentsFragment.this.getActivity(), "点赞失败,请检查网络");
                return;
            }
            if (!EnvManager.isOnline()) {
                br.T(CommentsFragment.this.aN_());
                return;
            }
            com.kugou.android.app.common.comment.entity.c cVar = commentEntity.k;
            if (cVar == null) {
                return;
            }
            if (!cVar.f5174b && (CommentsFragment.this.as == 1 || CommentsFragment.this.as == 2)) {
                com.kugou.android.app.player.i.a.a(16, PlaybackServiceUtil.getCurKGMusicWrapper(), com.kugou.android.app.player.subview.cardcontent.dataprovider.d.a().b());
            }
            cVar.f5174b = !cVar.f5174b;
            a(commentEntity, cVar);
            CommentsFragment.this.a(commentEntity, view, cVar.f5174b);
            CommentsFragment.this.q.a(commentEntity, view);
        }

        private void a(CommentEntity commentEntity, com.kugou.android.app.common.comment.entity.c cVar) {
            String str = commentEntity.mixid;
            CommentsFragment commentsFragment = CommentsFragment.this;
            String b2 = commentsFragment.b(commentsFragment.at);
            CommentsFragment commentsFragment2 = CommentsFragment.this;
            String c2 = commentsFragment2.c(commentsFragment2.at);
            CommentsFragment commentsFragment3 = CommentsFragment.this;
            String a2 = commentsFragment3.a((Parcelable) commentsFragment3.at);
            if (TextUtils.isEmpty(commentEntity.mixid)) {
                CommentsFragment commentsFragment4 = CommentsFragment.this;
                str = commentsFragment4.a(commentsFragment4.at);
            }
            if (!CommentsFragment.this.Y()) {
                c2 = "";
            }
            ContributionEntity contributionEntity = (ContributionEntity) CommentsFragment.this.getArguments().getParcelable("contribution_data");
            String string = CommentsFragment.this.getArguments().getString("mv_id");
            com.kugou.common.statistics.e.a.a(new com.kugou.common.statistics.easytrace.task.b(11, "click").a("type", (contributionEntity != null && "4".equals(contributionEntity.j)) || !TextUtils.isEmpty(string) ? "4" : "2").a("pdid", b2).a("mvid", string).a(SocialConstants.PARAM_SOURCE, a2).a("tzid", c2).a("mixsongid", str).a("svar2", commentEntity.f5164a).a("tab", cVar.f5174b ? "点赞" : "取消点赞"));
        }

        @Override
        public void d(CommentEntity commentEntity) {
            CommentsFragment.this.b(commentEntity, false);
        }

        @Override
        public void e(CommentEntity commentEntity) {
            if (commentEntity.x >= 1 || !CommentsFragment.this.a(Integer.valueOf(R.string.hy))) {
                CommentsFragment commentsFragment = CommentsFragment.this;
                commentsFragment.a(commentEntity, commentsFragment.q.i());
            }
        }

        @Override
        public boolean a() {
            boolean L_ = CommentsFragment.this.r != null ? CommentsFragment.this.r.L_() : false;
            if (L_) {
                CommentsFragment.this.aC();
            }
            return L_;
        }

        @Override
        public void f(CommentEntity commentEntity) {
            CommentsFragment.this.A();
        }

        @Override
        public void g(CommentEntity commentEntity) {
            CommentsFragment.this.b(commentEntity, "全部评论页-分享btn");
        }
    };
    private BroadcastReceiver E = null;
    private com.kugou.android.app.player.comment.e P = null;
    private boolean T = false;

    public void A() {
    }

    public void B() {
    }

    public void C() {
    }

    public void D() {
    }

    public CommentTopLabelTagEntity G() {
        return null;
    }

    public boolean N() {
        return true;
    }

    protected String W() {
        return "全部评论页";
    }

    protected abstract c a(CommentsFragment commentsFragment, String str, String str2, String str3);

    public void a(int i, int i2) {
    }

    protected void a(Intent intent) {
    }

    public void a(CommentEntity commentEntity) {
    }

    protected void a(CommentEntity commentEntity, int i, String str) {
    }

    protected void a(CommentEntity commentEntity, String str) {
    }

    protected void a(CommentEntity commentEntity, boolean z) {
    }

    protected int aD() {
        return 3;
    }

    public void aH() {
    }

    public void aI() {
    }

    protected void aJ() {
    }

    public boolean aK() {
        return false;
    }

    public boolean ay() {
        return false;
    }

    public void b(com.kugou.android.app.common.comment.entity.d dVar, int i) {
    }

    public void b(ArrayList<CommentTopBannerEntity> arrayList) {
    }

    public void b(boolean z) {
    }

    protected void c(CommentEntity commentEntity) {
    }

    protected void c(CommentEntity commentEntity, boolean z) {
    }

    public void c(com.kugou.android.app.common.comment.entity.d dVar) {
    }

    public void d(com.kugou.android.app.common.comment.entity.d dVar) {
    }

    public void e(com.kugou.android.app.common.comment.entity.d dVar) {
    }

    protected void f(CommentEntity commentEntity) {
    }

    @Override
    public boolean hasNavigationBar() {
        return false;
    }

    @Override
    public boolean hasPlayingBar() {
        return false;
    }

    public void m() {
    }

    public void onEvent(CommentEntity commentEntity) {
    }

    protected boolean r() {
        return false;
    }

    protected String s() {
        return null;
    }

    protected void w() {
    }

    protected void y() {
    }

    protected void z() {
    }

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

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

    @Override
    public void onViewCreated(View view, Bundle bundle) {
        super.onViewCreated(view, bundle);
        this.O = new com.kugou.android.app.common.comment.c.e();
    }

    @Override
    public void onActivityCreated(Bundle bundle) {
        super.onActivityCreated(bundle);
        bR_();
        hT_();
        I();
        em_();
        hR_();
        K();
        L();
        l();
        EventBus.getDefault().register(getActivity().getClassLoader(), CommentsFragment.class.getName(), this);
        E();
        T();
        if (ay() && this.y) {
            setUserVisibleHint(true);
        }
    }

    public void E() {
        br.aj(getActivity());
    }

    public void f() {
        View findViewById = findViewById(R.id.dtv);
        if (findViewById == null || !(findViewById instanceof CmtInputAreaBGView)) {
            return;
        }
        ((CmtInputAreaBGView) findViewById).setShowBlur(true);
    }

    private void I() {
        this.u = new b(this);
    }

    public void l() {
        this.q = a(this, this.i, this.j, this.k);
        this.q.b(this.n, this.o);
        if (Y()) {
            long j = this.aw;
            if (j > 0) {
                ((com.kugou.android.app.player.comment.d) this.q).a(new CmmExtData("", "", j));
            }
        }
    }

    public c S() {
        return this.q;
    }

    @Override
    public void setUserVisibleHint(boolean z) {
        super.setUserVisibleHint(z);
        if (!z || this.q == null) {
            return;
        }
        if (this.r != null && !this.y && this.z) {
            this.z = false;
        } else if (this.y) {
            if (N()) {
                this.q.a();
            }
            this.y = false;
        }
    }

    public int b(com.kugou.android.app.common.comment.entity.d dVar) {
        int b2 = b(dVar.f5177c) - this.p.g();
        if (b2 > 0) {
            return b2;
        }
        return 0;
    }

    public void d(String str) {
        this.j = str;
        getArguments().putString("request_children_id", this.j);
    }

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

        WeakReference<CommentsFragment> f4816a;

        public b(CommentsFragment commentsFragment) {
            this.f4816a = new WeakReference<>(commentsFragment);
        }

        @Override
        public void handleMessage(Message message) {
            CommentsFragment commentsFragment = this.f4816a.get();
            if (commentsFragment != null && message.what == 1) {
                commentsFragment.K.start();
            }
        }
    }

    @Override
    public void onSkinAllChanged() {
        super.onSkinAllChanged();
        com.kugou.android.app.common.comment.b bVar = this.r;
        if (bVar != null) {
            bVar.f();
        }
        com.kugou.android.app.common.comment.a aVar = this.p;
        if (aVar != null) {
            aVar.r();
        }
    }

    @Override
    public void onFragmentResume() {
        super.onFragmentResume();
        this.ak.b();
        com.kugou.android.app.common.comment.a aVar = this.p;
        if (aVar != null) {
            aVar.r();
        }
        com.kugou.android.app.common.comment.b bVar = this.r;
        if (bVar != null) {
            bVar.j(true);
        }
    }

    @Override
    public void onFragmentPause() {
        super.onFragmentPause();
        this.ak.d();
        x();
        com.kugou.android.app.common.comment.b bVar = this.r;
        if (bVar != null) {
            bVar.T();
            this.r.j(false);
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        this.ak.a();
        com.kugou.android.app.common.comment.b bVar = this.r;
        if (bVar != null) {
            bVar.V();
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        this.ak.c();
    }

    @Override
    public void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        com.kugou.android.app.common.comment.b bVar = this.r;
        if (bVar == null || !bVar.L_()) {
            return;
        }
        this.z = true;
    }

    @Override
    public void onDestroyView() {
        Animation animation = this.A;
        if (animation != null) {
            animation.cancel();
        }
        this.q.b();
        this.ak.e();
        com.kugou.common.b.a.b(this.E);
        EventBus.getDefault().unregister(this);
        com.kugou.android.app.common.comment.b bVar = this.r;
        if (bVar != null) {
            bVar.a((b.a) null);
            this.r.l();
        }
        b bVar2 = this.u;
        if (bVar2 != null) {
            bVar2.removeMessages(1);
            this.u.removeCallbacksAndMessages(null);
        }
        com.kugou.android.app.common.comment.c.e eVar = this.O;
        if (eVar != null) {
            eVar.a(this);
        }
        com.kugou.android.app.common.comment.c.k kVar = this.U;
        if (kVar != null) {
            kVar.a();
        }
        super.onDestroyView();
    }

    public CommentListView ax() {
        return this.s;
    }

    @Override
    protected boolean bC_() {
        return this.q.c();
    }

    @Override
    public void a(boolean z) {
        this.q.a(z);
    }

    @Override
    public void d() {
        if (!com.kugou.android.netmusic.musicstore.c.a(aN_())) {
            this.g.setVisibility(8);
            a(true);
        } else {
            this.g.setVisibility(0);
            this.q.d();
        }
    }

    public void O() {
        if (!com.kugou.android.netmusic.musicstore.c.a(aN_())) {
            this.H.onRefreshComplete();
        } else {
            this.q.o();
        }
    }

    @Override
    public void j() {
        super.j();
        this.f4759a.setVisibility(0);
        this.g.setVisibility(8);
        M();
    }

    private void M() {
        Bundle arguments = getArguments();
        if (arguments == null || !arguments.getBoolean("KEY_SHOW_INPUT_KEYBOARD", false)) {
            return;
        }
        arguments.putBoolean("KEY_SHOW_INPUT_KEYBOARD", false);
        this.s.postDelayed(new Runnable() {
            @Override
            public void run() {
                CommentsFragment.this.r.B().requestFocus();
                br.a(CommentsFragment.this.r.B());
            }
        }, 150L);
    }

    @Override
    public void ez_() {
        super.ez_();
        this.f4759a.setVisibility(0);
        this.g.setVisibility(8);
        this.H.setMode(this.as == 1 ? PullToRefreshBase.Mode.DISABLED : PullToRefreshBase.Mode.PULL_FROM_START);
    }

    @Override
    public void g() {
        super.g();
        this.f4759a.setVisibility(4);
        this.g.setVisibility(8);
    }

    @Override
    public void h() {
        super.h();
        this.f4759a.setVisibility(4);
        this.g.setVisibility(8);
    }

    public void a(com.kugou.android.app.common.comment.c.j jVar, boolean z) {
        com.kugou.android.app.common.comment.a aVar = this.p;
        if (aVar == null) {
            return;
        }
        this.al = jVar;
        aVar.a(jVar);
        if (z) {
            return;
        }
        this.p.r();
    }

    public void hT_() {
        enableTitleDelegate();
        initDelegates();
        getTitleDelegate().f(false);
        getTitleDelegate().o(false);
        getTitleDelegate().a(new s.b() {
            @Override
            public void onBackClick(View view) {
                if (CommentsFragment.this.r != null) {
                    CommentsFragment.this.r.ac();
                } else {
                    br.c((Activity) CommentsFragment.this.getActivity());
                    CommentsFragment.this.finish();
                }
            }
        });
        getTitleDelegate().a(new s.o() {
            @Override
            public void b_(View view) {
                if (CommentsFragment.this.s != null) {
                    CommentsFragment.this.s.setSelection(0);
                }
                CommentsFragment.this.aH();
            }
        });
        getTitleDelegate().O().setVisibility(8);
        getTitleDelegate().V().setVisibility(0);
    }

    public void J() {
        long j = getArguments().getLong("key_album_audio_id");
        if (j > 0) {
            this.ah = j;
        }
        this.i = getArguments().getString("request_hash");
        this.j = getArguments().getString("request_children_id");
        this.k = getArguments().getString("request_children_name");
        this.l = getArguments().getInt("from_type");
        this.as = getArguments().getInt("from_page", 0);
        this.m = getArguments().getString("request_comment_id");
        this.n = getArguments().getString("get_one_comment_params", "");
        this.o = getArguments().getString("get_all_comment_params", "");
        this.af = getArguments().getString("cmt_code_generator", "");
        this.V = (com.kugou.android.app.player.comment.i) getArguments().getSerializable("key_cmt_backable");
        this.au = getArguments().getString("channel_id");
        this.aw = getArguments().getLong("to_kugouid", 0L);
        this.av = getArguments().getLong("channel_mixsongid", 0L);
        this.at = (ISong) getArguments().getParcelable("kg_music");
    }

    public void em_() {
        this.x = findViewById(R.id.ask);
        if (ay()) {
            ((CommentBgRelativeLayout) this.x).setSkinEnable(false);
            this.x.setBackgroundDrawable(null);
        }
        this.Q = (RelativeLayout) findViewById(R.id.e9r);
        this.H = (CommentPullToRefreshListView) findViewById(R.id.bmm);
        this.H.setMode(PullToRefreshBase.Mode.DISABLED);
        this.s = (CommentListView) this.H.getRefreshableView();
        CommentListView commentListView = this.s;
        if (commentListView instanceof PinnedSectionListView) {
            commentListView.setShadowVisible(false);
        }
        a(findViewById(R.id.pj), this.s);
        this.I = (TextView) findViewById(R.id.c_y);
        if (!ay()) {
            P();
            this.r.a(3);
            this.r.e(true);
            this.r.f(false);
            this.r.g(true);
            this.r.a(new b.d() {
                @Override
                public void a() {
                    String b2 = com.kugou.common.config.c.a().b(com.kugou.android.app.a.a.ya);
                    if (TextUtils.isEmpty(b2)) {
                        b2 = "http://www2.kugou.kugou.com/apps/commentBlackHouse/index.html";
                    }
                    if (b2.contains("?")) {
                        if (!b2.endsWith("?")) {
                            b2 = b2 + ContainerUtils.FIELD_DELIMITER;
                        }
                    } else {
                        b2 = b2 + "?";
                    }
                    com.kugou.android.app.common.comment.c.c.a(CommentsFragment.this, b2 + "tab=2");
                }
            });
        }
        this.H.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<CommentListView>() {
            @Override
            public void onPullUpToRefresh(PullToRefreshBase<CommentListView> pullToRefreshBase) {
            }

            @Override
            public void onPullDownToRefresh(PullToRefreshBase<CommentListView> pullToRefreshBase) {
                CommentsFragment.this.O();
            }
        });
        this.H.setOnPullEventListener(new PullToRefreshBase.OnPullEventListener<CommentListView>() {
            @Override
            public void onPullEvent(PullToRefreshBase<CommentListView> pullToRefreshBase, PullToRefreshBase.State state, PullToRefreshBase.Mode mode) {
                CommentsFragment.this.V();
            }
        });
        U();
    }

    public boolean V() {
        com.kugou.android.common.delegate.b bVar;
        if (ay()) {
            bVar = ((AbsCommentTabMainFragment) getParentFragment()).o;
        } else {
            bVar = this.r;
        }
        if (bVar == null || !bVar.L_()) {
            return false;
        }
        bVar.i();
        return true;
    }

    public void c(int i) {
        this.Q.setVisibility(i);
    }

    private void U() {
        CommentPullToRefreshListView commentPullToRefreshListView;
        View findViewById = findViewById(R.id.bmm);
        if (!(findViewById instanceof CommentPullToRefreshListView) || (commentPullToRefreshListView = (CommentPullToRefreshListView) findViewById) == null) {
            return;
        }
        commentPullToRefreshListView.setOnLayoutTouchListener(this.X);
    }

    protected void P() {
        if (ay()) {
            return;
        }
        this.r = new com.kugou.android.app.common.comment.b(getActivity(), (ViewGroup) this.x, this);
    }

    public void hR_() {
        q();
        this.p.b(r());
        this.p.a().a(s());
        this.p.a(this.ak);
        this.s.setAdapter((ListAdapter) this.p);
        int i = this.l;
        if (i != 0) {
            this.p.a(i);
        }
        int i2 = this.as;
        if (i2 != 0) {
            this.p.h(i2);
        }
        this.p.a(new l() {
            @Override
            public void a(com.kugou.android.app.common.comment.widget.a aVar) {
                CommentsFragment.this.L = aVar;
            }
        });
        this.p.a(new c.InterfaceC0098c() {
            @Override
            public void a(View view, CommentEntity commentEntity) {
                if (CommentsFragment.this.a(Integer.valueOf(R.string.hu)) || CommentsFragment.this.q == null) {
                    return;
                }
                CommentsFragment.this.q.a(view, commentEntity, view.getContext());
            }
        });
    }

    protected void q() {
        this.p = new com.kugou.android.app.common.comment.a(this, this.s, this.v);
    }

    public com.kugou.android.app.common.comment.a az() {
        return this.p;
    }

    protected void x() {
        com.kugou.android.app.common.comment.widget.a aVar = this.L;
        if (aVar == null || !aVar.isShowing()) {
            return;
        }
        this.L.dismiss();
        this.L = null;
    }

    public void K() {
        this.p.a(this.D);
        aN();
        this.p.a(this.W);
        if (!ay()) {
            this.r.a(this.C);
        }
        this.s.setOnTouchListener(this.B);
        this.U = new com.kugou.android.app.common.comment.c.k();
        this.f4763e.setOnTouchListener(this.B);
    }

    private void T() {
        float textSize = this.I.getTextSize();
        this.J = ValueAnimator.ofFloat(0.0f, 1.2f * textSize, textSize);
        this.J.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                CommentsFragment.this.I.setTextSize(0, ((Float) valueAnimator.getAnimatedValue()).floatValue());
            }
        });
        this.J.setTarget(this.I);
        this.J.setDuration(500L);
        this.K = ValueAnimator.ofInt(br.a((Context) aN_(), 25.0f), 0);
        this.K.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                CommentsFragment.this.I.getLayoutParams().height = ((Integer) valueAnimator.getAnimatedValue()).intValue();
                CommentsFragment.this.I.requestLayout();
            }
        });
        this.K.setTarget(this.I);
        this.K.setDuration(250L);
    }

    private void a(int i) {
        this.K.cancel();
        this.J.cancel();
        this.J.start();
        if (i <= 0) {
            this.I.setVisibility(8);
            return;
        }
        if (i < 100) {
            this.I.setText("评论有" + i + "条更新");
        } else {
            this.I.setText("评论有99+条更新");
        }
        this.I.getLayoutParams().height = br.a((Context) aN_(), 25.0f);
        this.I.setVisibility(0);
        this.I.requestLayout();
        this.u.removeMessages(1);
        this.u.sendEmptyMessageDelayed(1, 2000L);
    }

    private String a() {
        if (this instanceof CommentsListFragment) {
            return getString(R.string.dm);
        }
        if (this instanceof CommentDetailFragment) {
            return getString(R.string.dl);
        }
        return this instanceof UserCommentFragment ? getString(R.string.dn) : "";
    }

    @Override
    public void a(AbsListView absListView, int i) {
        com.kugou.android.denpant.d.a aVar;
        if (this.U == null) {
            return;
        }
        this.U.a(a(), this.af).onScrollStateChanged(absListView, i);
        if (i != 0 || (aVar = this.ak) == null) {
            return;
        }
        aVar.i();
    }

    @Override
    public void a(AbsListView absListView, int i, int i2, int i3) {
        if (this.U == null) {
            return;
        }
        this.U.a(a(), this.af).onScroll(absListView, i, i2, i3);
    }

    public void a(com.kugou.android.app.common.comment.entity.d dVar) {
        ez_();
        if (dVar.f == null || dVar.f.size() < 1) {
            return;
        }
        this.p.k();
        this.p.a(dVar.f);
        this.p.a(dVar.f());
        this.p.b(b(dVar.f5177c));
        this.p.r();
    }

    public void a(com.kugou.android.app.common.comment.entity.d dVar, int i) {
        CommentListView commentListView;
        a(i, dVar);
        if (dVar.g == null || dVar.g.size() < 1) {
            ez_();
            return;
        }
        this.t = b(dVar.f5177c);
        t();
        this.p.b(dVar.g);
        this.p.a(dVar.f());
        this.p.b(b(dVar.f5177c));
        this.p.r();
        y();
        if (com.kugou.android.msgcenter.f.c.a() == 1 && (commentListView = this.s) != null) {
            commentListView.post(new Runnable() {
                @Override
                public void run() {
                    CommentsFragment.this.p.r();
                }
            });
        }
        ez_();
        av();
    }

    private void a(int i, com.kugou.android.app.common.comment.entity.d dVar) {
        if (AdsCenterMgr.f4446a.d().get()) {
            String b2 = com.kugou.common.config.c.a().b(com.kugou.android.app.a.a.FX, "");
            if (TextUtils.isEmpty(b2)) {
                return;
            }
            int parseInt = Integer.parseInt(b2);
            int parseInt2 = Integer.parseInt(dVar.f5177c);
            if (dVar.g == null || parseInt2 <= parseInt || i > 1) {
                return;
            }
            ArrayList<CommentEntity> arrayList = dVar.g;
            CommentEntity commentEntity = new CommentEntity();
            commentEntity.setGdtAd(new CommentGDTAdResp());
            arrayList.add(1, commentEntity);
        }
    }

    public void f_(int i) {
        a(i);
    }

    public void Q() {
        this.H.onRefreshComplete();
    }

    public void R() {
        this.p.h();
        this.p.r();
    }

    public void t() {
        av();
        if (getTitleDelegate() == null) {
            return;
        }
        if (this.t > 0) {
            getTitleDelegate().a((CharSequence) (getString(R.string.agn) + "(" + this.t + ")"));
            return;
        }
        getTitleDelegate().a((CharSequence) getString(R.string.agn));
    }

    public void av() {
        boolean z = this instanceof CommentDetailFragment;
        if (Y() && !z) {
            if (as.f54365e) {
                as.f("CommentsFragment", String.format(Locale.getDefault(), "sendTotalCount. commentId:%s, count: %d", this.i, Integer.valueOf(this.t)));
            }
            EventBus.getDefault().post(new com.kugou.android.app.home.channel.b.a.a("youngchannelpost", this.j, this.t, 0));
        }
        com.kugou.android.app.common.comment.a.e eVar = new com.kugou.android.app.common.comment.a.e(this.af, this.j, this.m, this.t, getContainerId(), z);
        eVar.a(this.i);
        EventBus.getDefault().post(eVar);
    }

    public void u() {
        com.kugou.android.app.common.comment.a aVar = this.p;
        if (aVar != null && !aVar.isEmpty()) {
            if (com.kugou.common.environment.a.o()) {
                showToast(R.string.aar);
            }
            this.g.setVisibility(8);
            return;
        }
        h();
    }

    public void a(CommentEntity commentEntity, boolean z, boolean z2, String str, int i, String str2) {
        if ((getParentFragment() instanceof NormalPlayerFragment) && commentEntity.errorCode == 0) {
            z = false;
        }
        a(z, str);
        if (this.p.isEmpty() || this.f4763e.getVisibility() == 0) {
            ez_();
        }
        if (ay()) {
            ((AbsCommentTabMainFragment) getParentFragment()).a(z2);
        } else {
            n_(z2);
        }
        if (z2) {
            if (i != 3 && commentEntity.errorCode != 10006 && (!commentEntity.isContentContainImg() || commentEntity.errorCode != 10006 || commentEntity.getCmtImageEntities().get(0).getMark() == 2 || commentEntity.getCmtImageEntities().get(0).getMark() == 6)) {
                n(commentEntity);
            }
            t();
            if (i != 3 && commentEntity.errorCode != 10006) {
                o(commentEntity);
            }
            a(commentEntity, i, str2);
            this.p.r();
            aC();
            this.s.a(this.p.d());
            av();
        }
    }

    private void n(CommentEntity commentEntity) {
        boolean z;
        CommentEntity commentEntity2;
        ArrayList<CommentEntity> c2 = this.p.c();
        if (c2 == null || c2.size() <= 0 || (commentEntity2 = c2.get(0)) == null || ((commentEntity2.getDynamicAdvertizement() == null && commentEntity2.u() == null && !this.p.h(commentEntity2)) || c2.size() <= 1)) {
            z = false;
        } else {
            this.p.c().add(aA() + 1, commentEntity);
            z = true;
        }
        if (!z) {
            com.kugou.android.app.common.comment.a aVar = this.p;
            if (aVar instanceof com.kugou.android.app.player.comment.a.g) {
                com.kugou.android.app.player.comment.a.g gVar = (com.kugou.android.app.player.comment.a.g) aVar;
                gVar.c().add(aA(), commentEntity);
                gVar.a(false);
            } else {
                aVar.c().add(aA(), commentEntity);
            }
        }
        this.p.e();
        this.t++;
    }

    private void o(CommentEntity commentEntity) {
        if (Y()) {
            if (TextUtils.isEmpty(commentEntity.getContent() == null ? "" : commentEntity.getContent().getContent())) {
                return;
            }
            EventBus.getDefault().post(new com.kugou.android.app.player.subview.a.a.b(commentEntity, hashCode()));
        }
    }

    public boolean Y() {
        return "youngchannelpost".equals(this.af);
    }

    public int aA() {
        ArrayList<CommentEntity> z = this.p.z();
        if (z == null || z.size() <= 0) {
            return 0;
        }
        return z.size() + 2;
    }

    protected void aC() {
        if (ay()) {
            ((AbsCommentTabMainFragment) getParentFragment()).o.b();
        } else {
            this.r.b();
        }
    }

    public void n_(boolean z) {
        if (!ay() && z) {
            this.r.g();
            this.r.a(false);
            this.r.N();
        }
    }

    public void a(boolean z, String str) {
        com.kugou.android.app.common.comment.c.c.a(z, str);
    }

    public void a(CommentEntity commentEntity, boolean z, boolean z2, String str, int i) {
        a(commentEntity, z, z2, str, i, "");
    }

    public void a(CommentEntity commentEntity, View view, boolean z) {
        if (view != null) {
            j.a(commentEntity, view, z, this.A, new j.a() {
                @Override
                public void a(CommentEntity commentEntity2) {
                    CommentsFragment.this.p.c(commentEntity2);
                    CommentsFragment.this.p.r();
                }
            });
        }
        a(commentEntity, z);
    }

    public void d(CommentEntity commentEntity, String str) {
        this.p.b(commentEntity);
        this.p.f();
        this.t--;
        t();
        c(commentEntity);
        if (this.p.getCount() == 0) {
            j();
        }
        this.p.r();
        if (!TextUtils.isEmpty(str)) {
            bv.b(getApplicationContext(), str);
        } else {
            bv.b(getApplicationContext(), "删除评论成功");
        }
        av();
    }

    public void a(String str) {
        if (!TextUtils.isEmpty(str)) {
            bv.b(getApplicationContext(), str);
        } else {
            bv.b(getApplicationContext(), "删除失败");
        }
    }

    public void v() {
        bv.b(getApplicationContext(), "内容复制成功");
    }

    @Override
    public void k() {
        super.k();
        if (getUserVisibleHint()) {
            if (ay() && !aK() && this.y) {
                return;
            }
            hR_();
            this.p.a(this.D);
            this.q.g();
        }
    }

    public void a(CommentEntity commentEntity, final Boolean bool) {
        com.kugou.common.userCenter.r rVar = new com.kugou.common.userCenter.r();
        rVar.b(Long.parseLong(commentEntity.f5165b));
        ArrayList arrayList = new ArrayList();
        arrayList.add(rVar);
        ContributionUserMuteProtocol.f11444a.a(commentEntity.global_collection_id, arrayList, bool.booleanValue()).b(Schedulers.io()).a(AndroidSchedulers.mainThread()).a(new rx.b.b<CommonResponse<Object>>() {
            @Override
            public void call(CommonResponse<Object> commonResponse) {
                if (commonResponse.a()) {
                    CommentsFragment.this.showSuccessedToast(bool.booleanValue() ? "已禁言" : "已取消禁言");
                    return;
                }
                String str = bool.booleanValue() ? "禁言" : "取消禁言";
                CommentsFragment.this.showFailToast(str + "失败");
            }
        }, new rx.b.b<Throwable>() {
            @Override
            public void call(Throwable th) {
                String str = bool.booleanValue() ? "禁言" : "取消禁言";
                CommentsFragment.this.showFailToast(str + "失败");
            }
        });
    }

    @Override
    public void showSuccessedToast(String str) {
        showToastWithIcon(getResources().getDrawable(R.drawable.baj), str, 0);
    }

    @Override
    public void showFailToast(String str) {
        showToastWithIcon(getResources().getDrawable(R.drawable.bah), str, 0);
    }

    public void b(CommentEntity commentEntity) {
        if (g.a(aN_(), Integer.valueOf(R.string.hx))) {
            return;
        }
        if (TextUtils.isEmpty(commentEntity.f5164a)) {
            bv.a(getApplicationContext(), "该评论暂不支持此操作");
        } else {
            aC();
            d(commentEntity);
        }
    }

    protected void d(CommentEntity commentEntity) {
        c cVar = this.q;
        com.kugou.android.app.common.comment.c.c.b(this, cVar != null ? cVar.i() : this.j, commentEntity.f5164a, null, getArguments().getString("cmt_code_generator"), commentEntity.hash);
    }

    public void b(CommentEntity commentEntity, boolean z) {
        if (a(Integer.valueOf(R.string.hz))) {
            return;
        }
        if (TextUtils.isEmpty(commentEntity.f5164a)) {
            bv.a(getApplicationContext(), "该评论暂不支持此操作");
            return;
        }
        aC();
        e(commentEntity, CommentEntity.REPORT_TYPE_REPORT);
        b(z);
    }

    public void e(CommentEntity commentEntity) {
        if (a(Integer.valueOf(R.string.hs))) {
            return;
        }
        if (TextUtils.isEmpty(commentEntity.f5164a)) {
            bv.a(getApplicationContext(), "该评论暂不支持此操作");
            return;
        }
        aC();
        e(commentEntity, CommentEntity.REPORT_TYPE_DOWN);
        b(false);
    }

    public void b(CommentEntity commentEntity, String str) {
        Initiator a2 = Initiator.a(getPageKey());
        if ("articulossong".equals(getArguments().getString("cmt_code_generator")) && !TextUtils.isEmpty(commentEntity.i) && !"0".equals(commentEntity.i) && !TextUtils.isEmpty(commentEntity.f5164a) && !"0".equals(commentEntity.f5164a)) {
            com.kugou.android.app.player.comment.e.e.a(aN_(), a2, commentEntity, this.i, this.k, commentEntity.i, commentEntity.l, str, getArguments().getString("special_cover"), this.af, commentEntity.mixid);
        } else {
            bv.a(getApplicationContext(), R.string.agd);
        }
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        com.kugou.android.app.common.comment.b bVar = this.r;
        if (bVar == null || !bVar.a(i, keyEvent)) {
            return super.onKeyDown(i, keyEvent);
        }
        return true;
    }

    @Override
    public void finish() {
        com.kugou.android.app.player.comment.i iVar = this.V;
        if (iVar != null) {
            iVar.a(this, false);
        }
        super.finish();
    }

    @Override
    public void onScreenStateChanged(int i) {
        super.onScreenStateChanged(i);
    }

    public void f(int i) {
        com.kugou.android.app.common.comment.c.c.a(this, i, this.r, new c.b() {
            @Override
            public void a() {
                CommentsFragment.this.aa = true;
            }
        });
    }

    public void g(int i) {
        com.kugou.android.app.common.comment.c.c.a(this, i, this.r);
    }

    public boolean b() {
        com.kugou.android.app.common.comment.b bVar = this.r;
        return (bVar == null || bVar.L() == null || !this.r.L().e()) ? false : true;
    }

    public boolean Z() {
        com.kugou.android.app.common.comment.b bVar = this.r;
        return (bVar == null || bVar.L() == null || !this.r.L().j()) ? false : true;
    }

    public ChannelContributionPermissionManager a(ChannelEntity channelEntity) {
        if (this.Y == null) {
            this.Y = new ChannelContributionPermissionManager(aN_(), channelEntity);
        }
        return this.Y;
    }

    public void a(CommentEntity commentEntity, CommentContentEntity commentContentEntity, int i) {
        if (commentEntity == null) {
            this.q.b(commentContentEntity);
        } else {
            this.q.b(commentEntity, commentContentEntity, i);
        }
        KGMusicWrapper a2 = cv.a(this.k);
        if (a2 != null) {
            cv.a(a2.D(), 6, a2.m(), new j.a(a2));
        }
    }

    public String a(Parcelable parcelable) {
        char c2;
        String string = getArguments().getString("cmt_code_generator");
        switch (string.hashCode()) {
            case -757098030:
                if (string.equals("94f1792ced1df89aa68a7939eaf2efca")) {
                    c2 = 3;
                    break;
                }
                c2 = 65535;
                break;
            case 1542938637:
                if (string.equals("articulossong")) {
                    c2 = 0;
                    break;
                }
                c2 = 65535;
                break;
            case 1750837462:
                if (string.equals("ca53b96fe5a1d9c22d71c8f522ef7c4f")) {
                    c2 = 2;
                    break;
                }
                c2 = 65535;
                break;
            case 1939621643:
                if (string.equals("youngchannelpost")) {
                    c2 = 1;
                    break;
                }
                c2 = 65535;
                break;
            default:
                c2 = 65535;
                break;
        }
        if (c2 == 0 || c2 == 1) {
            String a2 = TraceSource.f50286a.a(parcelable);
            return TextUtils.isEmpty(a2) ? "1" : a2;
        }
        if (c2 != 2) {
            return c2 != 3 ? "" : TraceSource.f50286a.a(CommBIMemoryManager.f52239a.b());
        }
        return TraceSource.f50286a.b(CommBIMemoryManager.f52239a.b());
    }

    public String a(ISong iSong) {
        return iSong != null ? String.valueOf(iSong.Q()) : "";
    }

    protected String b(ISong iSong) {
        return iSong != null ? iSong.ce() : "";
    }

    protected String c(ISong iSong) {
        return iSong != null ? iSong.cf() : "";
    }

    @Override
    public void onInitSoftInputMode() {
        getActivity().getWindow().setSoftInputMode(18);
    }

    private void L() {
        this.E = new a(this);
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("com.kugou.android.user_login_success");
        intentFilter.addAction("com.kugou.android.user_logout");
        intentFilter.addAction("com.kugou.android.action.music_package_state_change");
        intentFilter.addAction("com.kugou.android.action.vip_state_change");
        com.kugou.common.b.a.b(this.E, intentFilter);
    }

    public static class a extends BroadcastReceiver {

        private WeakReference<CommentsFragment> f4815a;

        public a(CommentsFragment commentsFragment) {
            this.f4815a = new WeakReference<>(commentsFragment);
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            CommentsFragment commentsFragment = this.f4815a.get();
            if (commentsFragment == null) {
                return;
            }
            String action = intent.getAction();
            if ("com.kugou.android.user_logout".equals(action)) {
                commentsFragment.z();
                commentsFragment.k();
                commentsFragment.a(intent);
            } else {
                if ("com.kugou.android.user_login_success".equals(action)) {
                    commentsFragment.z();
                    commentsFragment.k();
                    commentsFragment.a(intent);
                    com.kugou.android.app.common.comment.c.m.a().a(false);
                    return;
                }
                if ("com.kugou.android.action.vip_state_change".equals(action) || "com.kugou.android.action.music_package_state_change".equals(action)) {
                    commentsFragment.aJ();
                }
            }
        }
    }

    public void g(CommentEntity commentEntity) {
        com.kugou.android.denpant.b.a(UserInfoConstant.LoginSourceType.COMMENT, com.kugou.android.denpant.b.a(commentEntity));
    }

    public void e(CommentEntity commentEntity, String str) {
        this.q.a(commentEntity.f5164a, str);
    }

    public boolean a(Integer num) {
        return g.a(aN_(), num);
    }

    public int b(String str) {
        try {
            return Integer.parseInt(str);
        } catch (Exception e2) {
            as.e(e2);
            return 0;
        }
    }

    public void F() {
        showProgressDialog(true);
    }

    public void onEventMainThread(com.kugou.android.app.common.comment.a.h hVar) {
        CmtMoreMenuView cmtMoreMenuView;
        if (ay() || (cmtMoreMenuView = this.ax) == null) {
            return;
        }
        cmtMoreMenuView.setBadge(com.kugou.android.app.common.comment.c.p.a().e());
    }

    public void onEventMainThread(com.kugou.android.app.common.comment.a.f fVar) {
        com.kugou.android.app.common.comment.a aVar;
        if (fVar == null || (aVar = this.p) == null) {
            return;
        }
        aVar.r();
    }

    public void onEventMainThread(com.kugou.android.userCenter.newest.b.g gVar) {
        com.kugou.android.app.common.comment.a aVar;
        if (gVar == null || gVar.f44805a == null || (aVar = this.p) == null) {
            return;
        }
        aVar.r();
    }

    public void onEventMainThread(com.kugou.android.denpant.c.c cVar) {
        if (cVar == null || this.p == null || !cVar.b()) {
            return;
        }
        this.p.r();
    }

    public void onEventMainThread(YVipInfosEvent yVipInfosEvent) {
        com.kugou.android.app.common.comment.a aVar;
        if (yVipInfosEvent == null || (aVar = this.p) == null) {
            return;
        }
        aVar.r();
    }

    public String X() {
        String string = getArguments() == null ? "" : getArguments().getString(DelegateFragment.KEY_IDENTIFIER, "");
        return string == null ? "" : string;
    }

    public void c(final String str) {
        KGMarqueeTextView3 kGMarqueeTextView3 = this.S;
        if (kGMarqueeTextView3 != null) {
            kGMarqueeTextView3.setText(str);
            return;
        }
        this.R = findViewById(R.id.t1);
        View view = this.R;
        if (view != null) {
            ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
            if (layoutParams != null && (layoutParams instanceof RelativeLayout.LayoutParams)) {
                RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) layoutParams;
                layoutParams2.leftMargin = 0;
                layoutParams2.rightMargin = br.a((Context) aN_(), 15.0f);
                layoutParams2.width = -1;
                this.R.setLayoutParams(layoutParams);
            }
            final TextView textView = (TextView) findViewById(R.id.t0);
            if (textView == null) {
                return;
            }
            textView.setVisibility(8);
            this.R.post(new Runnable() {
                @Override
                public void run() {
                    CommentsFragment commentsFragment = CommentsFragment.this;
                    commentsFragment.S = new KGMarqueeTextView3(commentsFragment.aN_());
                    FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(-2, -1);
                    layoutParams3.gravity = CommentsFragment.this.aD();
                    CommentsFragment.this.S.setLayoutParams(layoutParams3);
                    CommentsFragment.this.S.setBackgroundColor(0);
                    CommentsFragment.this.S.setTextColor(textView.getCurrentTextColor());
                    CommentsFragment.this.S.setTextSize(textView.getTextSize());
                    CommentsFragment.this.S.setMaxWidth(CommentsFragment.this.R.getMeasuredWidth());
                    CommentsFragment.this.S.setOnMarqueeListener(new KGMarqueeTextView3.a() {
                        @Override
                        public void a() {
                        }

                        @Override
                        public void a(boolean z) {
                        }
                    });
                    if (CommentsFragment.this.R instanceof ViewGroup) {
                        ((FrameLayout) CommentsFragment.this.R).addView(CommentsFragment.this.S);
                    }
                    CommentsFragment.this.S.setText(str);
                }
            });
        }
    }

    public void e(boolean z) {
        com.kugou.android.app.common.comment.a aVar = this.p;
        if (aVar != null) {
            aVar.r();
        }
        if (z) {
            if (ay() && getUserVisibleHint()) {
                bv.a((Context) aN_(), "关注成功,音乐圈可看ta的评论");
            } else {
                if (getDelegate().i() != this || this.ax == null) {
                    return;
                }
                bv.a((Context) aN_(), "关注成功,音乐圈可看ta的评论");
            }
        }
    }

    public void aE() {
        if (com.kugou.android.app.player.comment.e.a(getArguments().getString("cmt_code_generator"))) {
            com.kugou.android.app.common.comment.c.p.a().m();
        }
    }

    public CmtMoreMenuView aF() {
        return this.ax;
    }

    @Override
    public void a(View view, CommentEntity commentEntity) {
        c cVar;
        if (a(Integer.valueOf(R.string.hu)) || (cVar = this.q) == null) {
            return;
        }
        cVar.a(view, commentEntity, aN_());
    }

    @Override
    public void h(CommentEntity commentEntity) {
        j(commentEntity);
    }

    @Override
    public void i(CommentEntity commentEntity) {
        j(commentEntity);
    }

    public void j(CommentEntity commentEntity) {
        if (com.kugou.android.netmusic.musicstore.c.a(aN_())) {
            try {
                long parseLong = Long.parseLong(commentEntity.f5165b);
                aC();
                if (com.kugou.common.environment.a.Y() == parseLong) {
                    g(commentEntity);
                } else {
                    com.kugou.android.app.common.comment.c.i.a(this, parseLong, commentEntity.f5166c, commentEntity.f5168e, commentEntity.d(), commentEntity.c(), commentEntity);
                }
            } catch (NumberFormatException unused) {
            }
        }
    }

    @Override
    public void k(CommentEntity commentEntity) {
        if (com.kugou.android.netmusic.musicstore.c.a(aN_())) {
            if (!TextUtils.isEmpty(commentEntity.link)) {
                com.kugou.android.app.common.comment.c.c.a(this, commentEntity.link);
            }
            c(commentEntity, false);
        }
    }

    @Override
    public void l(CommentEntity commentEntity) {
        if (com.kugou.android.netmusic.musicstore.c.a(aN_())) {
            if (!TextUtils.isEmpty(commentEntity.link)) {
                com.kugou.android.app.common.comment.c.c.a(this, commentEntity.link);
            }
            c(commentEntity, true);
        }
    }

    @Override
    public void a(View view, CommentEntity commentEntity, int i) {
        com.kugou.android.app.common.comment.a aVar = this.p;
        if (aVar != null) {
            aVar.a(view, i, commentEntity, false, false, false);
        }
    }

    @Override
    public void b(View view, CommentEntity commentEntity) {
        if ((commentEntity instanceof PostedCommentEntity) && TextUtils.isEmpty(((PostedCommentEntity) commentEntity).q())) {
            bv.a(KGApplication.getContext(), R.string.h7);
            return;
        }
        if (a(Integer.valueOf(R.string.hv))) {
            return;
        }
        if (!br.Q(getActivity())) {
            bv.b(getActivity(), "点赞失败,请检查网络");
            return;
        }
        if (!EnvManager.isOnline()) {
            br.T(aN_());
            return;
        }
        commentEntity.k.f5174b = !commentEntity.k.f5174b;
        a(commentEntity, view, commentEntity.k.f5174b);
        this.q.a(commentEntity, view);
    }

    @Override
    public void m(CommentEntity commentEntity) {
        if (commentEntity == null || TextUtils.isEmpty(commentEntity.ab)) {
            return;
        }
        com.kugou.android.app.common.comment.c.c.a(this, commentEntity.ab);
    }

    public void aM() {
        com.kugou.android.app.common.comment.a aVar = this.p;
        if (aVar != null) {
            aVar.r();
        }
        com.kugou.android.app.common.comment.b bVar = this.r;
        if (bVar == null || !(bVar instanceof o)) {
            return;
        }
        ((o) bVar).s();
    }

    public void onEventMainThread(ah ahVar) {
        if (ahVar == null || ay()) {
            return;
        }
        aM();
        if (hasKtvMiniBar() && getUserVisibleHint()) {
            com.kugou.android.app.common.comment.c.n.b(this);
        }
    }

    public void onEventMainThread(com.kugou.ktv.android.playopus.b.b bVar) {
        if (bVar == null || ay()) {
            return;
        }
        aM();
    }

    public void onEventMainThread(x xVar) {
        if (xVar == null || ay()) {
            return;
        }
        aM();
    }

    public void onEventMainThread(v vVar) {
        if (vVar == null || ay()) {
            return;
        }
        aM();
    }

    public void onEventMainThread(RemoveAdItemEvent removeAdItemEvent) {
        if (!"8033000951875873".equals(removeAdItemEvent.getF4437d()) || removeAdItemEvent.getF4435b() == null) {
            return;
        }
        this.p.c().remove(removeAdItemEvent.getF4435b());
        this.p.r();
        if (removeAdItemEvent.getF4438e()) {
            bv.b(KGApplication.getContext(), "本条广告已关闭");
        }
    }

    protected void aN() {
        if (this.W == null) {
            this.W = new CmtKtvOpusBoxView.a() {
                @Override
                public void b(View view, CommentEntity commentEntity) {
                    com.kugou.android.app.common.comment.c.n.a(true, view, commentEntity.getCmtKtvOpusEntity().convertToGenericOpus(), commentEntity.getCmtKtvOpusEntity().getSongId(), commentEntity);
                }

                @Override
                public void c(View view, CommentEntity commentEntity) {
                    if (commentEntity == null || commentEntity.getCmtKtvOpusEntity() == null) {
                        return;
                    }
                    CmtKtvOpusEntity cmtKtvOpusEntity = commentEntity.getCmtKtvOpusEntity();
                    com.kugou.android.app.common.comment.c.n.a(String.valueOf(cmtKtvOpusEntity.getPlayerId()), commentEntity.mixid);
                    EventBus.getDefault().post(new com.kugou.common.event.j(true));
                    Bundle bundle = new Bundle();
                    bundle.putString("CMT_ID", commentEntity.f5164a);
                    bundle.putString("CMT_SPECIAL_ID", commentEntity.special_id);
                    bundle.putString("CMT_SPECIAL_CHILD_ID", commentEntity.i);
                    com.kugou.ktv.android.common.j.g.a(CommentsFragment.this.getActivity(), cw.b(cmtKtvOpusEntity.getOpusId()), cmtKtvOpusEntity.getOpusName(), cmtKtvOpusEntity.getPlayerId(), cmtKtvOpusEntity.getOpusHash(), 3, CommentsFragment.this.i, CommentsFragment.this.k, bundle);
                }

                @Override
                public void a(View view, CommentEntity commentEntity) {
                    if (CommentsFragment.this.p != null) {
                        if ((CommentsFragment.this.p instanceof com.kugou.android.app.player.comment.a.d) && ((com.kugou.android.app.player.comment.a.d) CommentsFragment.this.p).cB_ != null) {
                            ((com.kugou.android.app.player.comment.a.d) CommentsFragment.this.p).cB_.a(commentEntity);
                        } else {
                            if (!(CommentsFragment.this.p instanceof com.kugou.android.app.player.comment.a.b) || ((com.kugou.android.app.player.comment.a.b) CommentsFragment.this.p).cz_ == null) {
                                return;
                            }
                            ((com.kugou.android.app.player.comment.a.b) CommentsFragment.this.p).cz_.a(commentEntity, 0);
                        }
                    }
                }
            };
        }
    }
}