柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b

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


package net.duohuo.magappx.specialcolumn.fragment;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.ListAdapter;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jianpuzhaitong.forum.R;
import java.util.Objects;
import net.duohuo.core.adapter.DataPage;
import net.duohuo.core.dataview.DataView;
import net.duohuo.core.net.Task;
import net.duohuo.core.util.SafeJsonUtil;
import net.duohuo.magappx.API;
import net.duohuo.magappx.circle.show.dataview.LookAllCommentDataView;
import net.duohuo.magappx.circle.show.dataview.ShowCommentChoiceDataView;
import net.duohuo.magappx.collection.ContentCollectionActivity;
import net.duohuo.magappx.common.adapter.IncludeEmptyAdapter;
import net.duohuo.magappx.common.base.BaseFragment;
import net.duohuo.magappx.common.comp.comment.CommentApplaudView;
import net.duohuo.magappx.common.comp.comment.CommentInfo;
import net.duohuo.magappx.common.dataview.model.Comment;
import net.duohuo.magappx.common.view.MagListView;
import net.duohuo.magappx.specialcolumn.dataview.ColumnCommentDataView;

public class ColumnCommentFragment extends BaseFragment {
    public IncludeEmptyAdapter adapter;
    CommentApplaudView commentApplaudView;
    ShowCommentChoiceDataView commentChoiceDataView;
    String comment_id;
    String contentId;
    JSONObject jsonObject;

    @BindView(R.id.listview)
    MagListView listView;
    LookAllCommentDataView lookAllCommentDataView;

    @BindView(R.id.empty_box)
    ViewStub stub;
    public CommentInfo commentInfo = new CommentInfo();
    boolean isFirst = true;

    public void setCommentApplaudView(CommentApplaudView commentApplaudView) {
        this.commentApplaudView = commentApplaudView;
    }

    public void setJSONObject(JSONObject jSONObject) {
        this.jsonObject = jSONObject;
    }

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View inflate = layoutInflater.inflate(R.layout.fragment_buy_content, (ViewGroup) null);
        ButterKnife.bind(this, inflate);
        return inflate;
    }

    @Override
    public void onActivityCreated(Bundle bundle) {
        super.onActivityCreated(bundle);
        this.contentId = getArguments().getString("contentId");
        this.comment_id = getArguments().getString("comment_id");
        this.listView.isRefreshAble(false);
        ShowCommentChoiceDataView showCommentChoiceDataView = new ShowCommentChoiceDataView(getContext());
        this.commentChoiceDataView = showCommentChoiceDataView;
        showCommentChoiceDataView.setData("video");
        this.listView.addHeaderView(this.commentChoiceDataView.getRootView());
        LookAllCommentDataView lookAllCommentDataView = new LookAllCommentDataView(getContext());
        this.lookAllCommentDataView = lookAllCommentDataView;
        this.listView.addFooterView(lookAllCommentDataView.getRootView());
        IncludeEmptyAdapter includeEmptyAdapter = new IncludeEmptyAdapter(getActivity(), API.SpecialColumn.commentList + "?type=1", Comment.class, (Class<? extends DataView>) ColumnCommentDataView.class);
        this.adapter = includeEmptyAdapter;
        includeEmptyAdapter.param("type_id", this.contentId);
        if (!TextUtils.isEmpty(this.comment_id)) {
            this.adapter.param("comment_id", this.comment_id);
        }
        IncludeEmptyAdapter includeEmptyAdapter2 = this.adapter;
        Objects.requireNonNull(includeEmptyAdapter2);
        includeEmptyAdapter2.set("EMPTY_KEY_HINT", "暂无回复");
        IncludeEmptyAdapter includeEmptyAdapter3 = this.adapter;
        Objects.requireNonNull(includeEmptyAdapter3);
        includeEmptyAdapter3.set("EMPTY_KEY_PIC", Integer.valueOf(R.drawable.exception_no_content));
        this.adapter.set("commenttag", this.commentInfo);
        this.listView.setAdapter((ListAdapter) this.adapter);
        this.adapter.next();
        this.adapter.addOnLoadSuccessCallBack(new DataPage.OnLoadSuccessCallBack() {
            @Override
            public void onLoadSuccess(Task task, int i) {
                if (task == null || task.getResult() == null) {
                    return;
                }
                if (((String) ColumnCommentFragment.this.adapter.get("isDelete")) != null) {
                    ColumnCommentFragment.this.commentInfo.setCommentCount(ColumnCommentFragment.this.commentInfo.getCommentCount() < 1 ? 0 : ColumnCommentFragment.this.commentInfo.getCommentCount() - 1);
                    ColumnCommentFragment.this.commentApplaudView.notifyChange();
                    ColumnCommentFragment.this.adapter.set("isDelete", null);
                }
                if (i == 1 && task.getResult().success()) {
                    ColumnCommentFragment.this.adapter.set("is_open_comment_lzl", "1");
                    ColumnCommentFragment.this.adapter.param("comment_id", null);
                    JSONArray list = task.getResult().getList();
                    if (list != null && list.size() > 0) {
                        if (!TextUtils.isEmpty(ColumnCommentFragment.this.comment_id)) {
                            ColumnCommentFragment.this.comment_id = null;
                            ColumnCommentFragment.this.lookAllCommentDataView.setData(true);
                            if (ColumnCommentFragment.this.isFirst) {
                                ColumnCommentFragment.this.listView.post(new Runnable() {
                                    @Override
                                    public void run() {
                                        ColumnCommentFragment.this.listView.smoothScrollToPosition(ColumnCommentFragment.this.listView.getBottom());
                                        ColumnCommentFragment.this.isFirst = false;
                                    }
                                });
                                return;
                            }
                            return;
                        }
                        ColumnCommentFragment.this.lookAllCommentDataView.setData(false);
                        return;
                    }
                    ColumnCommentFragment.this.lookAllCommentDataView.setData(false);
                }
            }
        });
        this.commentChoiceDataView.setCommentChoiceCallback(new ShowCommentChoiceDataView.CommentChoiceCallback() {
            @Override
            public void isPoster(boolean z) {
                ColumnCommentFragment.this.adapter.param("poster", Boolean.valueOf(z));
                ColumnCommentFragment.this.adapter.refresh();
            }

            @Override
            public void isHot(boolean z) {
                ColumnCommentFragment.this.adapter.param("sort", "hot");
                ColumnCommentFragment.this.adapter.refresh();
            }

            @Override
            public void order(boolean z) {
                ColumnCommentFragment.this.adapter.param("sort", z ? ContentCollectionActivity.ASC : "desc");
                ColumnCommentFragment.this.adapter.refresh();
            }
        });
        setDataComment();
    }

    public void setDataComment() {
        this.commentInfo.setCommentUrl(API.SpecialColumn.commentReply + "?type=1");
        this.commentInfo.addCommentExtra("content_id", this.contentId);
        this.commentInfo.setApplaudAddUrl(API.SpecialColumn.applaud + "?type=1");
        this.commentInfo.setApplaudCancelUrl(API.SpecialColumn.cancelApplaud + "?type=1");
        this.commentInfo.setApplaudKey("type_id");
        this.commentInfo.setApplaudValue(this.contentId);
        this.commentInfo.setApplaud(SafeJsonUtil.getBoolean(SafeJsonUtil.getJSONObject(this.jsonObject, "data"), "is_applaud"));
        this.commentInfo.setShareUrl("http://baidu.com");
        this.commentInfo.setApplaudCount(SafeJsonUtil.getInteger(this.jsonObject, "data.applaud_count"));
        this.commentInfo.setCommentCount(SafeJsonUtil.getInteger(this.jsonObject, "data.comment_count"));
        this.commentInfo.setCommentApplaudAddUrl(API.SpecialColumn.applaud + "?type=2");
        this.commentInfo.setCommentApplaudCancelUrl(API.SpecialColumn.cancelApplaud + "?type=2");
        this.commentApplaudView.setData(this.commentInfo);
    }

    public void setSelection() {
        if (this.listView.getHeaderViewsCount() + this.listView.getFooterViewsCount() == this.listView.getCount()) {
            MagListView magListView = this.listView;
            magListView.setSelection(magListView.getBottom());
        } else {
            this.listView.setSelection(9);
        }
    }

    public void onRefresh(String str) {
        IncludeEmptyAdapter includeEmptyAdapter = this.adapter;
        if (includeEmptyAdapter != null) {
            includeEmptyAdapter.param("type_id", str);
            ShowCommentChoiceDataView showCommentChoiceDataView = this.commentChoiceDataView;
            if (showCommentChoiceDataView != null) {
                showCommentChoiceDataView.selecttOrder();
            }
        }
    }
}