4399游戏盒 v7.2.1.31版本的 MD5 值为:951717f45e3fda95c8a358caf4ca93e1
以下内容为反编译后的 GameHubQaPublishFragment.java 源代码,内容仅作参考
package com.m4399.gamecenter.plugin.main.controllers.gamehub;
import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Keep;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import com.dialog.DialogResult;
import com.dialog.c;
import com.dialog.theme.DialogTwoButtonTheme;
import com.framework.net.ILoadPageEventListener;
import com.framework.rxbus.annotation.Subscribe;
import com.framework.rxbus.annotation.Tag;
import com.framework.utils.ActivityStateUtils;
import com.framework.utils.JSONUtils;
import com.framework.utils.KeyboardUtils;
import com.framework.utils.UMengEventUtils;
import com.m4399.gamecenter.plugin.main.PluginApplication;
import com.m4399.gamecenter.plugin.main.R;
import com.m4399.gamecenter.plugin.main.manager.router.GameCenterRouterManager;
import com.m4399.gamecenter.plugin.main.manager.stat.TraceHelper;
import com.m4399.gamecenter.plugin.main.manager.user.UserCenterManager;
import com.m4399.gamecenter.plugin.main.models.gamehub.GameHubPostEditModel;
import com.m4399.gamecenter.plugin.main.models.gamehub.GameHubQaAssociateModel;
import com.m4399.gamecenter.plugin.main.models.gamehub.PostDraftModel;
import com.m4399.gamecenter.plugin.main.providers.gamehub.PostPublishCheckDataProvider;
import com.m4399.gamecenter.plugin.main.utils.bc;
import com.m4399.gamecenter.plugin.main.views.zone.ZoneExpandableTextView;
import com.m4399.support.quick.RecyclerQuickAdapter;
import com.m4399.support.utils.HttpResultTipUtils;
import com.m4399.support.utils.ToastUtils;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.json.JSONObject;
public class GameHubQaPublishFragment extends GameHubPublishBaseFragment implements View.OnClickListener {
private static int aPm = 1;
private static Handler aPn;
private a aRA;
private String aRB = "";
private boolean aRC = true;
private RecyclerView.OnScrollListener aRD;
private com.m4399.gamecenter.plugin.main.providers.gamehub.ag aRE;
private ILoadPageEventListener aRF;
private boolean aRG;
private boolean aRx;
private View aRy;
private RecyclerView aRz;
@Override
protected String getPostTypeTitle() {
return "提问帖";
}
@Override
protected int getLayoutID() {
return R.layout.m4399_fragment_gamehub_qa_publish;
}
@Override
public View initMenuView(LayoutInflater layoutInflater) {
View initMenuView = super.initMenuView(layoutInflater);
initMenuView.findViewById(R.id.rl_draft).setVisibility(8);
return initMenuView;
}
@Override
public void initTextBoldView() {
super.initTextBoldView();
this.mBottomBar.textBoldNeedShow(false);
}
@Override
public void initBottomBar() {
super.initBottomBar();
this.mBottomBar.setmIsSelectedQa(true);
this.mBottomBar.setMoreFuncCanUse();
this.mBottomBar.getTvHowQuestion().setVisibility(0);
this.mBottomBar.getTvHowQuestion().setOnClickListener(this);
}
@Override
protected void focusEditText() {
this.mPanelKeyboard.bindEditText(this.mHeader.getPostAddTitle());
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (this.mHeader != null && this.mHeader.getPostAddTitle() != null && view == this.mHeader.getPostAddTitle() && this.aRx) {
view.getParent().requestDisallowInterceptTouchEvent(true);
}
return super.onTouch(view, motionEvent);
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
changeRightMenuUI();
final String trim = charSequence.toString().trim();
if ((this.aRB.length() < 1) && !TextUtils.isEmpty(trim) && !trim.endsWith("?") && !trim.endsWith("?")) {
this.mHeader.getPostAddTitle().post(new Runnable() {
@Override
public void run() {
GameHubQaPublishFragment.this.mHeader.getPostAddTitle().setText(trim + "?");
GameHubQaPublishFragment.this.mHeader.getPostAddTitle().setSelection(trim.length());
}
});
}
if (this.aRC) {
ct(trim);
}
if (this.mHeader != null) {
this.mHeader.setCharNumTip(trim.length(), false);
this.mHeader.setTvQuestionSimpleVisible();
}
if (this.mPublishAdapter != null) {
this.mPublishAdapter.setQaDescGuideVisible(trim.length() > 30, true, false);
}
}
@Override
public void doAfterInsertPicOrVideo() {
super.doAfterInsertPicOrVideo();
if (this.mPublishAdapter != null) {
this.mPublishAdapter.setQaDescGuideVisible(false, false, true);
}
}
@Override
public void initHeaderView(LayoutInflater layoutInflater) {
super.initHeaderView(layoutInflater);
this.mHeader.getPostAddTitle().setHint(R.string.gamehub_post_add_title_hint_selected);
this.mHeader.getPostAddTitle().setTypeface(Typeface.DEFAULT_BOLD);
if (this.mIsPostModify) {
return;
}
this.mHeader.getPostAddTitle().requestFocus();
}
@Override
protected int getHeaderViewLayoutId() {
return R.layout.m4399_view_gamehub_qa_post_publish_header;
}
@Override
public void initRecycleView() {
super.initRecycleView();
this.mPublishAdapter.setIsSelectedQa(true);
}
@Override
public void initView(ViewGroup viewGroup, Bundle bundle) {
super.initView(viewGroup, bundle);
this.aRz = (RecyclerView) this.mainView.findViewById(R.id.qa_associate_recycler_view);
this.aRz.setLayoutManager(new LinearLayoutManager(getContext()));
this.aRA = new a(this.aRz);
this.aRA.setOnItemClickListener(new RecyclerQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, final Object obj, int i) {
GameHubQaPublishFragment.this.mHeader.getPostAddTitle().clearFocus();
GameHubQaPublishFragment.this.mHeader.getPostAddTitle().setCursorVisible(false);
KeyboardUtils.hideKeyboard(GameHubQaPublishFragment.this.getActivity(), GameHubQaPublishFragment.this.mHeader.getPostAddTitle());
com.m4399.gamecenter.plugin.main.utils.e.postDelayed(new Runnable() {
@Override
public void run() {
GameHubQaAssociateModel gameHubQaAssociateModel = (GameHubQaAssociateModel) obj;
Bundle bundle2 = new Bundle();
bundle2.putInt("intent.extra.gamehub.forums.id", gameHubQaAssociateModel.getQaForumsId());
bundle2.putInt("intent.extra.gamehub.post.id", gameHubQaAssociateModel.getQaThreadId());
bundle2.putInt("intent.extra.gamehub.topic.is.show.gamehub.entry", 0);
bundle2.putInt("intent.extra.gamehub.id", gameHubQaAssociateModel.getQaQuanId());
bundle2.putInt("intent.extra.is.qa.answer", 1);
GameCenterRouterManager.getInstance().openGameHubPostDetail(GameHubQaPublishFragment.this.getActivity(), bundle2, new int[0]);
}
}, 100L);
UMengEventUtils.onEvent("ad_gamehub_detail_ask_association_click", String.valueOf(i + 1));
}
});
this.aRz.setAdapter(this.aRA);
this.aRy = this.mainView.findViewById(R.id.rl_qa_associate_root);
this.mainView.findViewById(R.id.tv_hide).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
GameHubQaPublishFragment.this.aRC = false;
GameHubQaPublishFragment.this.aK(false);
GameHubQaPublishFragment.this.y((List<GameHubQaAssociateModel>) null);
UMengEventUtils.onEvent("ad_gamehub_detail_ask_association_click", "隐藏");
}
});
}
@Override
protected void uMengEventStatics(String str) {
UMengEventUtils.onEvent("ad_gamehub_detail_ask_edit", str);
}
@Override
protected int getToolBarTitleResId() {
if (this.mIsPostModify) {
return R.string.game_hub_post_modify;
}
return R.string.add_post_q_and_a;
}
@Override
public PostPublishCheckDataProvider getCheckDp() {
PostPublishCheckDataProvider checkDp = super.getCheckDp();
checkDp.setQa(true);
return checkDp;
}
@Override
public void checkPublishConditions() {
if (isContentTooShort()) {
return;
}
String trim = getUserWriteTitle().trim();
if (trim.length() > 30) {
if (this.mHeader != null) {
this.mHeader.setCharNumTip(trim.length(), true);
return;
}
return;
}
new com.m4399.gamecenter.plugin.main.providers.gamehub.j(trim, 4).loadData(new AnonymousClass4(trim));
}
class AnonymousClass4 implements ILoadPageEventListener {
final String wT;
@Override
public void onBefore() {
}
AnonymousClass4(String str) {
this.wT = str;
}
@Override
public void onSuccess() {
if (ActivityStateUtils.isDestroy((Activity) GameHubQaPublishFragment.this.getActivity())) {
return;
}
if (GameHubQaPublishFragment.this.mHeader != null) {
GameHubQaPublishFragment.this.mHeader.setTvQuestionSimpleVisible(false);
}
GameHubQaPublishFragment.super.checkPublishConditions();
}
@Override
public void onFailure(Throwable th, int i, String str, int i2, JSONObject jSONObject) {
if (ActivityStateUtils.isDestroy((Activity) GameHubQaPublishFragment.this.getActivity())) {
return;
}
if (i == 104) {
if (GameHubQaPublishFragment.this.mHeader != null) {
GameHubQaPublishFragment.this.mHeader.setTvQuestionSimpleVisible(true);
GameHubQaPublishFragment.this.mHeader.getPostAddTitle().clearFocus();
GameHubQaPublishFragment.this.mHeader.getPostAddTitle().setCursorVisible(false);
KeyboardUtils.hideKeyboard(GameHubQaPublishFragment.this.getActivity(), GameHubQaPublishFragment.this.mHeader.getPostAddTitle());
}
com.dialog.c cVar = new com.dialog.c(GameHubQaPublishFragment.this.getContext());
cVar.setDialogTwoButtomTheme(DialogTwoButtonTheme.Horizontal_Default);
cVar.setOnDialogTwoHorizontalBtnsClickListener(new c.b() {
@Override
public DialogResult onLeftBtnClick() {
GameHubQaPublishFragment.super.checkPublishConditions();
UMengEventUtils.onEvent("ad_circle_ask_edit_question_easy_window", "继续发布");
return DialogResult.Cancel;
}
@Override
public DialogResult onRightBtnClick() {
com.m4399.gamecenter.plugin.main.utils.e.postDelayed(new Runnable() {
@Override
public void run() {
if (GameHubQaPublishFragment.this.mHeader == null || GameHubQaPublishFragment.this.mHeader.getPostAddTitle() == null || ActivityStateUtils.isDestroy((Activity) GameHubQaPublishFragment.this.getActivity())) {
return;
}
GameHubQaPublishFragment.this.mHeader.getPostAddTitle().requestFocus();
GameHubQaPublishFragment.this.mHeader.getPostAddTitle().setCursorVisible(true);
GameHubQaPublishFragment.this.mPanelKeyboard.bindEditText(GameHubQaPublishFragment.this.mHeader.getPostAddTitle());
GameHubQaPublishFragment.this.mPanelKeyboard.showSoftInput();
UMengEventUtils.onEvent("ad_circle_ask_edit_question_easy_window", "完善问题");
}
}, 300L);
return DialogResult.OK;
}
});
StringBuffer stringBuffer = new StringBuffer();
if (this.wT.length() > 6) {
stringBuffer.append(this.wT.substring(0, 6));
stringBuffer.append(ZoneExpandableTextView.ELLIPSIS);
} else {
stringBuffer.append(this.wT);
}
cVar.show(GameHubQaPublishFragment.this.getContext().getString(R.string.game_hub_qa_publish_simple_dialog_title, new Object[]{stringBuffer.toString()}), GameHubQaPublishFragment.this.getContext().getString(R.string.game_hub_qa_publish_simple_dialog_msg), GameHubQaPublishFragment.this.getContext().getString(R.string.continue_publish), GameHubQaPublishFragment.this.getContext().getString(R.string.game_hub_qa_publish_simple_dialog_right_button_text));
return;
}
ToastUtils.showToast(PluginApplication.getApplication(), HttpResultTipUtils.getFailureTip(PluginApplication.getApplication(), th, i, str));
}
}
@Override
public boolean isContentTooShort() {
boolean isEmpty = TextUtils.isEmpty(getUserWriteTitle().trim().replace("\n", "<br>"));
if (isEmpty) {
ToastUtils.showToast(getContext(), getResources().getString(R.string.gamehub_qa_post_publish_toast_content_least_num));
}
return isEmpty;
}
@Override
public void onBackPress() {
boolean z = this.mIsPreviewMode;
super.onBackPress();
if (z) {
return;
}
if (this.mIsPostModify) {
showExitPostModify();
} else {
getContext().finish();
}
}
@Override
public void initDraftAndSetValue(boolean z) {
super.initDraftAndSetValue(z);
this.mDraftModel.setmKindId(this.mEditConfigProvider.getQaKindId());
this.mDraftModel.setIsAQ(1);
}
private void ct(String str) {
if (this.aRB.equals(str)) {
return;
}
if (str == null) {
str = "";
}
this.aRB = str;
if (TextUtils.isEmpty(this.aRB)) {
if (aPn.hasMessages(aPm)) {
aPn.removeMessages(aPm);
}
y((List<GameHubQaAssociateModel>) null);
return;
}
if (aPn == null) {
aPn = new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == GameHubQaPublishFragment.aPm) {
if (GameHubQaPublishFragment.this.aRE == null) {
GameHubQaPublishFragment.this.aRE = new com.m4399.gamecenter.plugin.main.providers.gamehub.ag();
}
if (GameHubQaPublishFragment.this.aRF == null) {
GameHubQaPublishFragment.this.aRF = new ILoadPageEventListener() {
@Override
public void onBefore() {
}
@Override
public void onFailure(Throwable th, int i, String str2, int i2, JSONObject jSONObject) {
}
@Override
public void onSuccess() {
if (TextUtils.isEmpty(GameHubQaPublishFragment.this.aRB)) {
return;
}
GameHubQaPublishFragment.this.y(GameHubQaPublishFragment.this.aRE.getAssociateList());
}
};
}
GameHubQaPublishFragment.this.aRE.setRequestParams(GameHubQaPublishFragment.this.aRB, GameHubQaPublishFragment.this.mEditConfigProvider.getQaKindId(), GameHubQaPublishFragment.this.mForumId);
GameHubQaPublishFragment.this.aRE.reloadData(GameHubQaPublishFragment.this.aRF);
}
}
};
}
if (aPn.hasMessages(aPm)) {
aPn.removeMessages(aPm);
}
if (this.mHeader.getPostAddTitle().isFocused()) {
aPn.sendEmptyMessageDelayed(aPm, 500L);
}
}
public void y(List<GameHubQaAssociateModel> list) {
if (ActivityStateUtils.isDestroy((Activity) getContext())) {
return;
}
boolean z = false;
if (list == null || list.isEmpty()) {
this.aRx = false;
com.m4399.gamecenter.plugin.main.providers.gamehub.ag agVar = this.aRE;
if (agVar != null) {
agVar.clearAllData();
}
a aVar = this.aRA;
if (aVar != null) {
aVar.replaceAll(Collections.EMPTY_LIST);
}
aK(false);
return;
}
if (this.aRD == null) {
this.aRD = new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int i, int i2) {
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int i) {
GameHubQaPublishFragment.this.mHeader.getPostAddTitle().clearFocus();
GameHubQaPublishFragment.this.mHeader.getPostAddTitle().setCursorVisible(false);
KeyboardUtils.hideKeyboard(GameHubQaPublishFragment.this.getActivity(), GameHubQaPublishFragment.this.mHeader.getPostAddTitle());
}
};
this.aRz.addOnScrollListener(this.aRD);
}
this.aRx = true;
this.aRA.replaceAll(list);
if (!this.mIsHaveContent && this.aRx) {
z = true;
}
aK(z);
}
@Override
public void changeRightMenuUI() {
super.changeRightMenuUI();
aK(!this.mIsHaveContent && this.aRx);
}
public void aK(boolean z) {
View view = this.aRy;
if (view == null) {
return;
}
if (z) {
if (this.mHeader != null) {
this.aRy.setVisibility(0);
return;
}
return;
}
view.setVisibility(8);
}
@Override
public Bundle getOpenGameDetailBundle() {
Bundle openGameDetailBundle = super.getOpenGameDetailBundle();
openGameDetailBundle.putInt("intent.extra.game.hub.tab.id", 3);
return openGameDetailBundle;
}
@Override
public Bundle getBackToGameHubListBundle(Bundle bundle) {
Bundle backToGameHubListBundle = super.getBackToGameHubListBundle(bundle);
backToGameHubListBundle.putInt("intent.extra.tab.selected_kind_id", bc.toInt(this.mEditConfigProvider.getQaKindId()));
backToGameHubListBundle.putInt("intent.extra.game.hub.tab.id", 3);
return backToGameHubListBundle;
}
@Override
public void onFinishPostPublish(Bundle bundle) {
boolean z = this.mFrom != 2 && bundle.getBoolean("intent.extra.gamehub.continue.invite.answer") && this.mEditConfigProvider.getPostQA() == 1 && !this.mEditConfigProvider.getInvitationList().isEmpty() && (this.mBottomBar.getInviteData() == null || this.mBottomBar.getInviteData().isEmpty());
super.onFinishPostPublish(bundle);
if (z) {
Bundle bundle2 = new Bundle();
bundle2.putInt("intent.extra.gamehub.post.id", bundle.getInt("intent.extra.gamehub.post.id"));
bundle2.putParcelableArrayList("intent.extra.invitation.models", this.mEditConfigProvider.getInvitationList());
bundle2.putBoolean("intent.extra.is.publish.success", true);
bundle2.putParcelableArrayList("intent.extra.invited.models", null);
bundle2.putString(GameHubDetailForumStyleActivity.INTENT_EXTRA_GAMEHUB_NAME, this.mGameHubName);
bundle2.putBoolean("intent.extra.is.jump.forum.detail", this.mIsJumpForumDetail);
bundle2.putInt("intent.extra.gamehub.id", bc.toInt(this.mGameHubId));
bundle2.putInt("intent.extra.game.forums.id", this.mForumId);
GameCenterRouterManager.getInstance().openInviteAnswerList(getContext(), bundle2, true);
this.mPanelKeyboard.hideAll(true);
getContext().finishWithoutTransition();
return;
}
finishActivity();
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.player.video.cover.edit.finish")})
public void onModifyLocalVideoCoverFinish(Bundle bundle) {
super.onModifyLocalVideoCoverFinish(bundle);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.request.youpai.info")})
public void getYouPaiInfo(String str) {
super.getYouPaiInfo(str);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.get.youpai.info")})
public void onGetYouPaiInfo(Bundle bundle) {
super.onGetYouPaiInfo(bundle);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.gamehub.post.publish.youpai.url")})
public void onVideoYouPaiSelected(String str) {
super.onVideoYouPaiSelected(str);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.gamehub.post.publish.modify.video.cover")})
public void onModifyLocalVideoCoverClick(String str) {
super.onModifyLocalVideoCoverClick(str);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.gamehub.post.publish.upload.video")})
public void uploadLocalVideo(GameHubPostEditModel gameHubPostEditModel) {
super.uploadLocalVideo(gameHubPostEditModel);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.user.nick.modify.success")})
public void onNickModifySuccess(String str) {
super.onNickModifySuccess(str);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.user.nick.modify.fail")})
public void onNickModifyFail(Bundle bundle) {
super.onNickModifyFail(bundle);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.post.draft.selected")})
public void onDraftSelected(PostDraftModel postDraftModel) {
super.onDraftSelected(postDraftModel);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.user.nick.suggest.success")})
public void onNickSuggestSuccess(Bundle bundle) {
super.onNickSuggestSuccess(bundle);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.user.nick.suggest.fail")})
public void onNickSuggestFail(Bundle bundle) {
super.onNickSuggestFail(bundle);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.gamehub.post.publish.image.post.success")})
public void onImagePostSuccess(Boolean bool) {
super.onImagePostSuccess(bool);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.gamehub.captcha.check.success")})
public void onCheckCaptchaSuccess(String str) {
super.onCheckCaptchaSuccess(str);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.gamehub.publish.edit.delete.item")})
public void deleteItem(Integer num) {
super.deleteItem(num);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.zone.topic.select.topic.result")})
public void onTopicSelect(Bundle bundle) {
super.onTopicSelect(bundle);
}
@Override
@Keep
@Subscribe(tags = {@Tag("tag.youpai.video.edit.finish")})
public void onYoupaiVideoEditFinish(Bundle bundle) {
super.onYoupaiVideoEditFinish(bundle);
}
@Override
public void onSuccess() {
super.onSuccess();
if (this.mBottomBar == null) {
return;
}
if (this.mEditConfigProvider.getPostQA() == 0) {
this.mHeader.getPostAddTitle().setHint(R.string.gamehub_post_add_title_hint);
}
if (!this.mEditConfigProvider.getInvitationList().isEmpty()) {
this.mBottomBar.getInviteAnswerBtn().setVisibility(0);
}
this.mBottomBar.getCbBlock().setVisibility(8);
this.mBottomBar.getBlockLine().setVisibility(8);
}
@Override
public void textSelectionChange(EditText editText, GameHubPostEditModel gameHubPostEditModel, int i, int i2, int i3) {
super.textSelectionChange(editText, gameHubPostEditModel, i, i2, i3);
if (this.mPublishAdapter.getData().size() > 1 || !editText.getText().toString().isEmpty()) {
return;
}
editText.setHint(R.string.gamehub_post_qa_add_content_hint);
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.tv_how_question) {
KeyboardUtils.hideKeyboard(getContext(), this.mBottomBar);
com.m4399.gamecenter.plugin.main.utils.e.postDelayed(new Runnable() {
@Override
public void run() {
com.m4399.gamecenter.plugin.main.manager.ae.a.getInstance().showWebPanelDialog(GameHubQaPublishFragment.this.getContext(), "https://www.4399.cn/help/threadHowToAsk.html");
}
}, 210L);
}
}
@Override
public void onFocusChange(View view, boolean z) {
super.onFocusChange(view, z);
if (z) {
String userWriteTitle = getUserWriteTitle();
if (TextUtils.isEmpty(userWriteTitle)) {
return;
}
new com.m4399.gamecenter.plugin.main.providers.gamehub.j(userWriteTitle, 2).loadData(new ILoadPageEventListener() {
@Override
public void onBefore() {
}
@Override
public void onSuccess() {
if (ActivityStateUtils.isDestroy((Activity) GameHubQaPublishFragment.this.getActivity()) || GameHubQaPublishFragment.this.mHeader == null) {
return;
}
GameHubQaPublishFragment.this.mHeader.setTvQuestionSimpleVisible(false);
}
@Override
public void onFailure(Throwable th, int i, String str, int i2, JSONObject jSONObject) {
if (ActivityStateUtils.isDestroy((Activity) GameHubQaPublishFragment.this.getActivity()) || GameHubQaPublishFragment.this.mHeader == null || i != 104) {
return;
}
GameHubQaPublishFragment.this.mHeader.setTvQuestionSimpleVisible(true);
}
});
}
}
public static class a extends RecyclerQuickAdapter<GameHubQaAssociateModel, com.m4399.gamecenter.plugin.main.viewholder.gamehub.x> {
@Override
protected int getViewType(int i) {
return 0;
}
public a(RecyclerView recyclerView) {
super(recyclerView);
}
@Override
protected int getItemLayoutID(int i) {
return R.layout.m4399_cell_gamehub_publish_title_associate;
}
@Override
public com.m4399.gamecenter.plugin.main.viewholder.gamehub.x createItemViewHolder(View view, int i) {
return new com.m4399.gamecenter.plugin.main.viewholder.gamehub.x(getContext(), view);
}
@Override
public int getItemCount() {
return super.getItemCount();
}
@Override
public void onBindItemViewHolder(com.m4399.gamecenter.plugin.main.viewholder.gamehub.x xVar, int i, int i2, boolean z) {
xVar.bindView(getData().get(i2));
}
}
@Override
public JSONObject getPreviewMessagesJson() {
JSONObject previewMessagesJson = super.getPreviewMessagesJson();
JSONUtils.putObject("isQA", 1, JSONUtils.getJSONObject("otherInfo", previewMessagesJson));
return previewMessagesJson;
}
@Override
public void onDestroy() {
super.onDestroy();
Handler handler = aPn;
if (handler != null) {
handler.removeCallbacksAndMessages(null);
aPn = null;
}
}
@Override
public void onPublishClick() {
HashMap hashMap = new HashMap();
hashMap.put("uid", UserCenterManager.getPtUid());
hashMap.put("intent_from", getIntentFrom());
hashMap.put("trace", TraceHelper.getTrace(getActivity()));
hashMap.put("choice", tc());
hashMap.put("words_number", Integer.valueOf(this.mDraftModel.getContent().length() + this.mDraftModel.getTitle().length()));
com.m4399.gamecenter.plugin.main.helpers.t.onEvent("askpost_edit_send", hashMap);
}
private String tc() {
StringBuilder sb = new StringBuilder();
if (this.isDraftClick) {
sb.append("草稿箱 ");
}
if (this.isPreviewClick) {
sb.append("预览 ");
}
if (this.isEmojiClick) {
sb.append("插入表情 ");
}
if (!TextUtils.isEmpty(this.mDraftModel.getImages())) {
sb.append("插入图片 ");
}
if (this.mDraftModel.getUploadVideoInfoModel() != null) {
sb.append("插入视频 ");
}
if (!TextUtils.isEmpty(this.mDraftModel.getTopicName())) {
sb.append("参与话题 ");
}
if (!TextUtils.isEmpty(this.mDraftModel.getAtFriend())) {
sb.append("@ ");
}
List<GameHubPostEditModel> gameHubPublishModelsArr = this.mDraftModel.getGameHubPublishModelsArr();
Iterator<GameHubPostEditModel> it = gameHubPublishModelsArr.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
if (it.next().getType() == 6) {
sb.append("插入帖子 ");
break;
}
}
Iterator<GameHubPostEditModel> it2 = gameHubPublishModelsArr.iterator();
while (true) {
if (!it2.hasNext()) {
break;
}
if (it2.next().getType() == 2) {
sb.append("插入游戏 ");
break;
}
}
if (this.aRG) {
sb.append("如何提问 ");
}
return sb.toString();
}
}