柬埔寨通 v6.1.5版本的 MD5 值为:9b68581ac30883219d6a25858a099d6b
以下内容为反编译后的 TextCourseDetailActivity.java 源代码,内容仅作参考
package net.duohuo.magappx.specialcolumn;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import anet.channel.entity.ConnType;
import butterknife.BindView;
import butterknife.OnClick;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jianpuzhaitong.forum.R;
import com.tencent.open.SocialConstants;
import com.xiaomi.mipush.sdk.Constants;
import java.util.List;
import java.util.Objects;
import net.duohuo.core.ITongdunOperation;
import net.duohuo.core.adapter.DataPage;
import net.duohuo.core.annotation.Extra;
import net.duohuo.core.dataview.DataView;
import net.duohuo.core.dialog.DialogCallBack;
import net.duohuo.core.dialog.IDialog;
import net.duohuo.core.eventbus.Event;
import net.duohuo.core.eventbus.EventBus;
import net.duohuo.core.eventbus.OnEventListener;
import net.duohuo.core.ioc.Ioc;
import net.duohuo.core.net.Net;
import net.duohuo.core.net.Result;
import net.duohuo.core.net.Task;
import net.duohuo.core.util.SafeJsonUtil;
import net.duohuo.magappx.API;
import net.duohuo.magappx.UrlScheme;
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.activity.CommentActivity;
import net.duohuo.magappx.common.activity.CommonCommentActivity;
import net.duohuo.magappx.common.adapter.IncludeEmptyAdapter;
import net.duohuo.magappx.common.base.MagBaseActivity;
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.util.CacheUtils;
import net.duohuo.magappx.common.view.MagListView;
import net.duohuo.magappx.common.view.RichContent;
import net.duohuo.magappx.main.login.UserApi;
import net.duohuo.magappx.specialcolumn.bean.ColumnInfoItem;
import net.duohuo.magappx.specialcolumn.bean.ColumnInforBean;
import net.duohuo.magappx.specialcolumn.dataview.ColumnCommentDataView;
import net.duohuo.magappx.specialcolumn.dataview.ColumnContentListDataView;
import net.duohuo.magappx.specialcolumn.dataview.SpecialColumnInforDataView;
import net.duohuo.magappx.specialcolumn.dataview.SpecialColumnTextHeadDataView;
public class TextCourseDetailActivity extends MagBaseActivity implements DataPage.OnLoadSuccessCallBack {
IncludeEmptyAdapter adapter;
EventBus bus;
CommentApplaudView commentApplaudView;
ShowCommentChoiceDataView commentChoiceDataView;
@Extra
String comment_id;
@Extra
String contentId;
ColumnContentListDataView contentListDataView;
@BindView(R.id.list_empty_image)
ImageView emptyImageV;
@BindView(R.id.listview_empty)
View emptyLayout;
@BindView(R.id.list_empty_text)
TextView emptyTextV;
private boolean isTipPay;
JSONObject jsonObject;
@BindView(R.id.listview)
MagListView listV;
LookAllCommentDataView lookAllCommentDataView;
SpecialColumnInforDataView specialColumnInforDataView;
SpecialColumnTextHeadDataView specialColumnTextHeadDataView;
CommentInfo commentInfo = new CommentInfo();
boolean isFirst = true;
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.specialclumn_viocecouser_detail_layout);
this.emptyImageV.setImageResource(R.drawable.exception_no_content);
this.emptyTextV.setText("内容找不到了,请查看其它精彩内容");
this.specialColumnTextHeadDataView = new SpecialColumnTextHeadDataView(getActivity());
SpecialColumnInforDataView specialColumnInforDataView = new SpecialColumnInforDataView(getActivity());
this.specialColumnInforDataView = specialColumnInforDataView;
this.listV.addHeaderView(specialColumnInforDataView.getRootView());
ColumnContentListDataView columnContentListDataView = new ColumnContentListDataView(getActivity());
this.contentListDataView = columnContentListDataView;
this.listV.addHeaderView(columnContentListDataView.getRootView());
ShowCommentChoiceDataView showCommentChoiceDataView = new ShowCommentChoiceDataView(this);
this.commentChoiceDataView = showCommentChoiceDataView;
this.listV.addHeaderView(showCommentChoiceDataView.getRootView());
this.commentChoiceDataView.setData("video");
this.commentApplaudView = new CommentApplaudView(this, findViewById(R.id.comment_bar));
initcommentApplaudView();
LookAllCommentDataView lookAllCommentDataView = new LookAllCommentDataView(this);
this.lookAllCommentDataView = lookAllCommentDataView;
this.listV.addFooterView(lookAllCommentDataView.getRootView());
this.listV.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.white));
initView();
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_comment));
this.adapter.set("commenttag", this.commentInfo);
this.adapter.addOnLoadSuccessCallBack(this);
this.adapter.refresh();
this.listV.setAdapter((ListAdapter) this.adapter);
this.commentChoiceDataView.setCommentChoiceCallback(new ShowCommentChoiceDataView.CommentChoiceCallback() {
@Override
public void isPoster(boolean z) {
TextCourseDetailActivity.this.adapter.param("poster", Boolean.valueOf(z));
TextCourseDetailActivity.this.adapter.refresh();
}
@Override
public void isHot(boolean z) {
TextCourseDetailActivity.this.adapter.param("sort", "hot");
TextCourseDetailActivity.this.adapter.refresh();
}
@Override
public void order(boolean z) {
TextCourseDetailActivity.this.adapter.param("sort", z ? ContentCollectionActivity.ASC : "desc");
TextCourseDetailActivity.this.adapter.refresh();
}
});
this.bus.registerListener(API.Event.clickAll, getClass().getSimpleName(), new OnEventListener() {
@Override
public boolean doInUI(Event event) {
TextCourseDetailActivity.this.adapter.refresh();
return super.doInUI(event);
}
});
this.bus.registerListener(API.Event.comment_delete, getClass().getSimpleName(), new OnEventListener() {
@Override
public boolean doInUI(Event event) {
TextCourseDetailActivity.this.adapter.refresh();
return super.doInUI(event);
}
});
}
@OnClick({R.id.comment_view})
public void commentLocation() {
if (this.commentInfo.getCommentCount() == 0) {
commentClick();
} else if (this.listV.getHeaderViewsCount() + this.listV.getFooterViewsCount() == this.listV.getCount()) {
MagListView magListView = this.listV;
magListView.setSelection(magListView.getBottom());
} else {
this.listV.setSelection(9);
}
}
private void initcommentApplaudView() {
this.commentApplaudView.setShareListen(new CommentApplaudView.shareListenClick() {
@Override
public void shareClick() {
TextCourseDetailActivity.this.getActivity().findViewById(R.id.navi_action).performClick();
}
});
this.commentApplaudView.setCommentCallBack(new CommentActivity.CommentCallBack() {
@Override
public void onCommentSuccess(String str, String str2) {
TextCourseDetailActivity.this.adapter.refresh();
TextCourseDetailActivity.this.commentInfo.setCommentCount(TextCourseDetailActivity.this.commentInfo.getCommentCount() + 1);
TextCourseDetailActivity.this.commentApplaudView.notifyChange();
}
});
this.commentApplaudView.setApplaudCallback(new CommentApplaudView.ApplaudCallBck() {
@Override
public void onApplaudCallBck(Boolean bool) {
bool.booleanValue();
}
});
}
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 class AnonymousClass7 extends UserApi.LoginCallBack {
AnonymousClass7() {
}
@Override
public void onLogin() {
Intent intent = new Intent(TextCourseDetailActivity.this.getActivity(), (Class<?>) CommonCommentActivity.class);
intent.putExtra("uploadType", "1");
intent.putExtra("picupload", ConnType.PK_OPEN);
if (TextCourseDetailActivity.this.jsonObject != null) {
intent.putExtra("hint", "回复" + SafeJsonUtil.getString(TextCourseDetailActivity.this.jsonObject, "data.user.name") + Constants.COLON_SEPARATOR);
}
CommonCommentActivity.commentCallBack = new CommonCommentActivity.CommentCallBack() {
@Override
public void onCommentSuccess(String str, String str2, String str3, int i, RichContent.Pic pic) {
Net url = Net.url(API.SpecialColumn.commentReply + "?type=1");
url.param("type_id", TextCourseDetailActivity.this.contentId);
url.param("content", str);
if (i == 1) {
url.param(SocialConstants.PARAM_IMAGE, str2);
}
if (i == 2 && pic != null) {
url.param("video", pic.videoAid);
url.param(SocialConstants.PARAM_IMAGE, pic.thumbAid);
}
if (!TextUtils.isEmpty(Ioc.getApplicationContext().getString(R.string.android_partner_key))) {
url.param("auth", ((ITongdunOperation) Ioc.get(ITongdunOperation.class)).onEvent(Ioc.getApplicationContext()));
}
if (!TextUtils.isEmpty(str3)) {
url.param("users", str3);
}
url.post(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
CacheUtils.putString(TextCourseDetailActivity.this.getActivity(), CacheUtils.commentKey, "");
CacheUtils.putString(TextCourseDetailActivity.this.getActivity(), CacheUtils.commentAtUsers, new JSONArray().toJSONString());
TextCourseDetailActivity.this.adapter.notifyDataSetChanged();
TextCourseDetailActivity.this.commentApplaudView.notifyChange();
}
}
});
}
};
TextCourseDetailActivity.this.getActivity().startActivity(intent);
TextCourseDetailActivity.this.overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out);
}
}
@OnClick({R.id.comment})
public void commentClick() {
UserApi.afterLogin(getActivity(), new AnonymousClass7());
}
public void initView() {
Net url = Net.url(API.SpecialColumn.contentView);
url.param("id", this.contentId);
url.showToast(false);
url.get(new Task<Result>() {
@Override
public void onResult(Result result) {
if (result.success()) {
TextCourseDetailActivity.this.jsonObject = result.json();
TextCourseDetailActivity.this.setDataComment();
TextCourseDetailActivity.this.specialColumnTextHeadDataView.setData(SafeJsonUtil.getJSONObject(result.json(), "data"));
TextCourseDetailActivity.this.listV.addHeaderFromBottom(TextCourseDetailActivity.this.specialColumnTextHeadDataView.getRootView());
ColumnInforBean columnInforBean = (ColumnInforBean) JSON.parseObject(SafeJsonUtil.getJSONObject(result.json(), "column").toJSONString(), ColumnInforBean.class);
TextCourseDetailActivity.this.specialColumnTextHeadDataView.set("column_link", columnInforBean.getLink());
TextCourseDetailActivity.this.specialColumnTextHeadDataView.setBuyRefreshCallback(new SpecialColumnTextHeadDataView.BuyRefreshCallback() {
@Override
public void onRefresh() {
TextCourseDetailActivity.this.initView();
}
@Override
public void onBuyUrl(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
TextCourseDetailActivity.this.isTipPay = true;
UrlScheme.toUrl(TextCourseDetailActivity.this.getActivity(), str);
}
});
TextCourseDetailActivity.this.specialColumnInforDataView.setData(columnInforBean);
List parseArray = JSON.parseArray(SafeJsonUtil.getJSONArray(result.json(), "contentList").toJSONString(), ColumnInfoItem.class);
TextCourseDetailActivity.this.contentListDataView.set("column_link", columnInforBean.getLink());
TextCourseDetailActivity.this.contentListDataView.setData(parseArray);
TextCourseDetailActivity.this.getNavigator().setAction(R.drawable.navi_icon_more, new View.OnClickListener() {
@Override
public void onClick(View view) {
if (TextCourseDetailActivity.this.jsonObject != null) {
JSONObject jSONObject = SafeJsonUtil.getJSONObject(SafeJsonUtil.getJSONObject(TextCourseDetailActivity.this.jsonObject, "data"), "sharedata");
Intent intent = new Intent(TextCourseDetailActivity.this.getActivity(), (Class<?>) ColumnShareActivity.class);
intent.putExtra("sharedata", jSONObject.toJSONString());
TextCourseDetailActivity.this.startActivity(intent);
}
}
});
return;
}
TextCourseDetailActivity.this.getActivity().findViewById(R.id.navi_action).setVisibility(8);
TextCourseDetailActivity.this.getActivity().findViewById(R.id.navi_line).setVisibility(0);
TextCourseDetailActivity.this.setTitle("详情");
TextCourseDetailActivity.this.emptyLayout.setVisibility(0);
}
});
}
@Override
public void onLoadSuccess(Task task, int i) {
if (task == null || task.getResult() == null) {
return;
}
if (((String) this.adapter.get("isDelete")) != null) {
CommentInfo commentInfo = this.commentInfo;
commentInfo.setCommentCount(commentInfo.getCommentCount() < 1 ? 0 : this.commentInfo.getCommentCount() - 1);
this.commentApplaudView.notifyChange();
this.adapter.set("isDelete", null);
}
if (i == 1 && task.getResult().success()) {
this.adapter.set("is_open_comment_lzl", "1");
this.adapter.param("comment_id", null);
JSONArray list = task.getResult().getList();
if (list != null && list.size() > 0) {
if (!TextUtils.isEmpty(this.comment_id)) {
this.comment_id = null;
this.lookAllCommentDataView.setData(true);
if (this.isFirst) {
this.listV.post(new Runnable() {
@Override
public void run() {
TextCourseDetailActivity.this.listV.smoothScrollToPosition(TextCourseDetailActivity.this.listV.getBottom());
TextCourseDetailActivity.this.isFirst = false;
}
});
return;
}
return;
}
this.lookAllCommentDataView.setData(false);
return;
}
this.lookAllCommentDataView.setData(false);
}
}
@Override
public void onResume() {
super.onResume();
if (this.isTipPay) {
this.isTipPay = false;
((IDialog) Ioc.get(IDialog.class)).showDialog(getActivity(), "是否支付成功", "请确认订单是否支付成功?", "支付失败", "支付成功", new DialogCallBack() {
@Override
public void onClick(int i) {
if (i == -1) {
TextCourseDetailActivity.this.initView();
}
}
}).show();
}
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus eventBus = this.bus;
if (eventBus != null) {
eventBus.unregisterListener(API.Event.clickAll, getClass().getSimpleName());
this.bus.unregisterListener(API.Event.comment_delete, getClass().getSimpleName());
}
}
}