4399游戏盒 v7.2.1.31版本的 MD5 值为:951717f45e3fda95c8a358caf4ca93e1
以下内容为反编译后的 GameHubForumPostFragment.java 源代码,内容仅作参考
package com.m4399.gamecenter.plugin.main.controllers.gamehub;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Keep;
import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Pair;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewStub;
import android.view.ViewTreeObserver;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.dialog.DialogResult;
import com.dialog.c;
import com.dialog.theme.DialogTwoButtonTheme;
import com.download.database.tables.DownloadTable;
import com.framework.config.Config;
import com.framework.config.SysConfigKey;
import com.framework.helpers.IntentHelper;
import com.framework.manager.network.NetworkStatusManager;
import com.framework.net.HttpHeaderKey;
import com.framework.net.ILoadPageEventListener;
import com.framework.providers.IHaveResponseDataListener;
import com.framework.providers.NetworkDataProvider;
import com.framework.rxbus.RxBus;
import com.framework.rxbus.annotation.Subscribe;
import com.framework.rxbus.annotation.Tag;
import com.framework.utils.ActivityStateUtils;
import com.framework.utils.BundleUtils;
import com.framework.utils.DateUtils;
import com.framework.utils.DensityUtils;
import com.framework.utils.DeviceUtils;
import com.framework.utils.JSONUtils;
import com.framework.utils.KeyboardUtils;
import com.framework.utils.ObjectPersistenceUtils;
import com.framework.utils.UMengEventUtils;
import com.huawei.hms.framework.common.ContainerUtils;
import com.huawei.hms.framework.common.hianalytics.CrashHianalyticsData;
import com.igexin.sdk.PushConsts;
import com.m4399.framework.BaseApplication;
import com.m4399.gamecenter.plugin.main.R;
import com.m4399.gamecenter.plugin.main.config.GameCenterConfigKey;
import com.m4399.gamecenter.plugin.main.controllers.gamehub.GameHubPostActivity;
import com.m4399.gamecenter.plugin.main.controllers.reward.RewardDialog;
import com.m4399.gamecenter.plugin.main.controllers.web.BaseWebViewActivity;
import com.m4399.gamecenter.plugin.main.helpers.bq;
import com.m4399.gamecenter.plugin.main.helpers.bz;
import com.m4399.gamecenter.plugin.main.listeners.OnCheckListener;
import com.m4399.gamecenter.plugin.main.livedata.LiveDataBus;
import com.m4399.gamecenter.plugin.main.manager.authentication.ContentPublishAuthManagerProxy;
import com.m4399.gamecenter.plugin.main.manager.medal.MedalPushDialogManager;
import com.m4399.gamecenter.plugin.main.manager.router.GameCenterRouterManager;
import com.m4399.gamecenter.plugin.main.manager.stat.StatManager;
import com.m4399.gamecenter.plugin.main.manager.stat.TraceHelper;
import com.m4399.gamecenter.plugin.main.manager.task.TaskManager;
import com.m4399.gamecenter.plugin.main.manager.user.LocalAuthStatusManager;
import com.m4399.gamecenter.plugin.main.manager.user.UserAccountType;
import com.m4399.gamecenter.plugin.main.manager.user.UserCenterManager;
import com.m4399.gamecenter.plugin.main.manager.v;
import com.m4399.gamecenter.plugin.main.manager.video.CustomVideoManager;
import com.m4399.gamecenter.plugin.main.models.gamehub.PostRootType;
import com.m4399.gamecenter.plugin.main.models.gamehub.PostVideoModel;
import com.m4399.gamecenter.plugin.main.models.mycenter.BrowseRecordPostModel;
import com.m4399.gamecenter.plugin.main.models.statistic.video.VideoExposeModel;
import com.m4399.gamecenter.plugin.main.models.statistic.video.VideoPlayOrEndStatisticModel;
import com.m4399.gamecenter.plugin.main.models.task.TaskActions;
import com.m4399.gamecenter.plugin.main.models.user.UserFriendModel;
import com.m4399.gamecenter.plugin.main.providers.gamehub.GameHubPostJsonBasicProvider;
import com.m4399.gamecenter.plugin.main.utils.PostTrackHelper;
import com.m4399.gamecenter.plugin.main.utils.at;
import com.m4399.gamecenter.plugin.main.utils.bc;
import com.m4399.gamecenter.plugin.main.utils.bp;
import com.m4399.gamecenter.plugin.main.utils.cd;
import com.m4399.gamecenter.plugin.main.views.PraiseAnimLoadedListener;
import com.m4399.gamecenter.plugin.main.views.PraiseView;
import com.m4399.gamecenter.plugin.main.views.VerifiedDialog;
import com.m4399.gamecenter.plugin.main.views.gamehub.PostReplyBottomBar;
import com.m4399.gamecenter.plugin.main.widget.NestScrollView;
import com.m4399.gamecenter.plugin.main.widget.VideoPostScrollView;
import com.m4399.gamecenter.plugin.main.widget.video.NewFullControlPanel;
import com.m4399.gamecenter.plugin.main.widget.video.NewSmallControlPanel;
import com.m4399.gamecenter.plugin.main.widget.video.NewSmallVideoPlayer;
import com.m4399.gamecenter.plugin.main.widget.web.BaseWebViewLayout;
import com.m4399.gamecenter.plugin.main.widget.web.RecycleWebView;
import com.m4399.gamecenter.plugin.main.widget.web.ScrollWebView;
import com.m4399.gamecenter.plugin.main.widget.web.WebViewLayout;
import com.m4399.support.controllers.BaseToolBarActivity;
import com.m4399.support.utils.HttpResultTipUtils;
import com.m4399.support.utils.StatusBarHelper;
import com.m4399.support.utils.ToastUtils;
import com.m4399.support.widget.dialog.CommonLoadingDialog;
import com.tencent.smtt.sdk.TbsListener;
import com.tencent.smtt.utils.TbsLog;
import com.xiaomi.mipush.sdk.Constants;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONObject;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import timber.log.Timber;
public class GameHubForumPostFragment extends i implements View.OnClickListener, GameHubPostActivity.a, ao, com.m4399.gamecenter.plugin.main.views.gamehub.o {
public static String KEY_UPLOAD_FILE_NAME = "fileName";
public static final int LAYOUT_TOP_VIDEO = 1;
public static final int LAYOUT_UNDEFINED = -1;
public static final int LAYOUT_WEB_VIDEO = 0;
public static final int POST_ADD_COMMENT_SUCCESS = 2;
public static final int POST_ADD_REPLY_SUCCESS = 1;
public static final int POST_DELETE_COMMENT_SUCCESS = 4;
public static final int POST_DELETE_REPLY_SUCCESS = 3;
public static final int POST_LIKE_COMMENT_SUCCESS = 5;
private static final int aJU = (int) (DeviceUtils.getDeviceWidthPixelsAbs(BaseApplication.getApplication()) * 0.5625f);
private static final int aJV = (int) (DeviceUtils.getDeviceWidthPixelsAbs(BaseApplication.getApplication()) * 1.3333f);
private PostReplyBottomBar aJK;
private RelativeLayout aJL;
private boolean aJM;
private int aJN;
private int aJO;
private int aJP;
private VideoPostScrollView aJT;
private String aJY;
private String aJZ;
private Runnable aKA;
private com.m4399.gamecenter.plugin.main.views.user.i aKB;
private GameHubPostJsonBasicProvider aKC;
private com.m4399.gamecenter.plugin.main.providers.gamehub.y aKD;
private com.m4399.gamecenter.plugin.main.utils.at aKE;
private boolean aKG;
private boolean aKH;
private boolean aKI;
private ArrayList aKK;
private long aKM;
private TextView aKP;
private TextView aKS;
private PraiseView aKT;
private View aKU;
private View aKV;
private View aKW;
private View aKX;
private View aKY;
private String aKa;
private GameHubPostActivity aKb;
private long aKg;
private long aKh;
private boolean aKm;
private boolean aKn;
private boolean aKo;
private boolean aKp;
private View aKq;
private View aKr;
private ViewStub aKs;
private NewSmallVideoPlayer aKt;
private String aKu;
private int aKv;
private boolean aKz;
private CommonLoadingDialog adZ;
protected RelativeLayout mContentView;
private View mCoverView;
private boolean mDataLoaded;
private String mFrom;
private com.m4399.gamecenter.plugin.main.views.d.a mPanelKeyboard;
private int mVideoHeight;
private long mViewStart;
private int aJQ = 1;
private boolean aJR = false;
private boolean isLoading = true;
private boolean aJS = true;
private String aJW = "";
private String aJX = "TopicApp.editorSubmit";
private int aKc = -1;
private int aKd = this.aKc;
private int aKe = 1;
private int mVideoId = 0;
private String aKf = "";
private String mVideoUrl = "";
private String mVideoPic = "";
private final int aKi = 1;
private final int aKj = 2;
private final int aKk = 8;
private String aKl = "";
private int aKw = 0;
private int aKx = 0;
private boolean aKy = true;
public final Integer NICK_NAME_REPEAT_CODE = Integer.valueOf(TbsLog.TBSLOG_CODE_SDK_LOAD_ERROR);
public final Integer NICK_NAME_USER_CENTER_CLOSE_CODE = Integer.valueOf(TbsListener.ErrorCode.INFO_CORE_EXIST_NOT_LOAD);
private boolean aKF = false;
private long aKJ = -1;
private boolean aKL = true;
private JSONObject aKN = null;
private String aKO = "";
private int aKQ = 0;
private boolean aKR = true;
private boolean aKZ = true;
private String aLa = "";
private String aLb = "";
private boolean aLc = false;
private boolean aLd = true;
private boolean aLe = true;
private boolean aLf = false;
private int aLg = 0;
private boolean aLh = false;
private boolean aLi = false;
@Override
public boolean isSupportToolBar() {
return false;
}
public void logJs(String str) {
}
public void setEssenceBtn(boolean z, int i) {
}
public String getUserWriteContent() {
return this.aJK.getMessageInputView().getText().toString();
}
public EditText getUserWriteEditText() {
return this.aJK.getMessageInputView();
}
@Override
public void initData(Bundle bundle) {
super.initData(bundle);
this.mForumsId = bundle.getInt("intent.extra.gamehub.forums.id", 0);
this.mPostId = bundle.getInt("intent.extra.gamehub.post.id", 0);
this.mGameHubId = bundle.getInt("intent.extra.gamehub.id", 0);
this.aJM = bundle.getBoolean("intent.extra.gamehub.is.my", false);
this.aJQ = bundle.getInt("intent.extra.gamehub.topic.is.show.gamehub.entry", 1);
this.aJN = bundle.getInt("intent.extra.is.qa.answer", 0);
this.aJO = bundle.getInt("intent.extra.is.bbs.auto.push.qa.post", 0);
this.mFrom = bundle.getString("intent.extra.gamehub.forum.from");
this.aKM = bundle.getLong("intent.extra.gamehub.post.new.reply.num", 0L);
x(bundle);
if (IntentHelper.isStartByWeb(getActivity().getIntent())) {
Map<String, String> uriParams = IntentHelper.getUriParams(getActivity().getIntent());
this.mGameHubId = bc.toInt(uriParams.get("gameHubId"));
this.mPostId = bc.toInt(uriParams.get("topicId"));
this.mForumsId = bc.toInt(uriParams.get("forumsId"));
}
if (this.mPostId <= 0) {
getActivity().finish();
Timber.e("post id invalid", new Object[0]);
return;
}
this.aJP = bundle.getInt("intent.extra.gamehub.post.reply.id", 0);
this.mAppendParam = bundle.getString("intent_extra_gamehub_append_param_key");
String string = bundle.getString("post_comment_params");
if (!TextUtils.isEmpty(string) && this.aJP == 0) {
this.aKN = JSONUtils.parseJSONObjectFromString(string);
if (JSONUtils.getInt("type", this.aKN) == 3) {
this.aJP = JSONUtils.getInt(PushConsts.KEY_SERVICE_PIT, this.aKN);
}
}
this.aKC = new GameHubPostJsonBasicProvider();
this.aKC.setPid(this.aJP);
si();
sE();
sG();
}
private void si() {
if (this.aKD == null) {
this.aKD = new com.m4399.gamecenter.plugin.main.providers.gamehub.y();
}
}
private void x(Bundle bundle) {
if (bundle == null) {
return;
}
Object obj = bundle.get("intent.extra.gamehub.post.is.need.set.top.video.style");
if (obj instanceof Boolean) {
this.aKc = ((Boolean) obj).booleanValue() ? 1 : 0;
return;
}
if (obj instanceof Integer) {
int intValue = ((Integer) obj).intValue();
if (intValue == 1 || intValue == 0) {
this.aKc = intValue;
}
}
}
public void onCaptchaDialogShowOrDismiss(boolean z) {
View view = this.mCoverView;
if (view == null) {
return;
}
view.setVisibility(z ? 0 : 8);
}
@Override
protected int getLayoutID() {
return R.layout.m4399_fragment_gamehub_post;
}
@Override
@SuppressLint({"ClickableViewAccessibility"})
protected void initView(ViewGroup viewGroup, Bundle bundle) {
this.aKb = (GameHubPostActivity) getActivity();
this.aKv = com.m4399.gamecenter.plugin.main.utils.t.getRealHeight(getContext());
RxBus.register(this);
this.aJL = (RelativeLayout) this.mainView.findViewById(R.id.mLockLayout);
this.mCoverView = this.mainView.findViewById(R.id.v_cover);
this.aKq = this.mainView.findViewById(R.id.videoReserveView);
this.mContentView = (RelativeLayout) this.mainView.findViewById(R.id.contentView);
this.aKr = this.mainView.findViewById(R.id.videoPadding);
this.aJT = (VideoPostScrollView) this.mainView.findViewById(R.id.scrollView);
this.aJK = (PostReplyBottomBar) this.mainView.findViewById(R.id.postReplyBar);
this.aKS = (TextView) this.mainView.findViewById(R.id.tv_praise_guide);
this.aKT = (PraiseView) this.mainView.findViewById(R.id.custom_praise_view);
this.aKU = this.mainView.findViewById(R.id.rl_praise_root);
this.aKU.setOnClickListener(this);
this.aKV = this.mainView.findViewById(R.id.v_top_line);
this.aKW = this.mainView.findViewById(R.id.iv_top_bg);
this.aKX = this.mainView.findViewById(R.id.v_bottom_bar_loading);
this.aKY = this.mainView.findViewById(R.id.statusPaddingView);
bu(this.aKc);
this.mWebView.setDownloadListener(new com.m4399.gamecenter.plugin.main.controllers.web.i(getActivity()));
sk();
this.aKb.setOnPostDetailMoreActionListener(this);
this.adZ = new CommonLoadingDialog(this.aKb);
this.aJK.setOnReplyBarClickListener(this);
this.aKP = (TextView) this.mainView.findViewById(R.id.sm_toast);
loadTemplate();
((GameHubPostActivity) getActivity()).setOnWebViewReloadListener(this);
this.mWebView.setVideoDouClickCallBack(new NewFullControlPanel.a() {
@Override
public void longClick() {
}
@Override
public void oneClick() {
}
@Override
public void doubleClick() {
GameHubForumPostFragment.this.doLike();
}
});
this.aJK.getMessageInputView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (GameHubForumPostFragment.this.getActivity() == null) {
return;
}
Rect rect = new Rect();
GameHubForumPostFragment.this.getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
int i = 0;
if (GameHubForumPostFragment.this.aJK != null) {
int[] iArr = new int[2];
GameHubForumPostFragment.this.aJK.getLocationInWindow(iArr);
i = iArr[1] + DensityUtils.dip2px(GameHubForumPostFragment.this.getContext(), 128.1f);
}
if (GameHubForumPostFragment.this.aKv == rect.bottom) {
return;
}
GameHubForumPostFragment.this.aKw = rect.bottom;
GameHubForumPostFragment gameHubForumPostFragment = GameHubForumPostFragment.this;
gameHubForumPostFragment.aKx = gameHubForumPostFragment.x(rect.bottom, i);
}
});
initPanelKeyBord();
this.aKE = new com.m4399.gamecenter.plugin.main.utils.at();
this.aKE.registerActivity(getActivity());
this.aKE.setVisibilityListener(new at.a() {
@Override
public void onVisibilityChanged(final boolean z) {
GameHubForumPostFragment.this.aLh = z;
if (z) {
if (GameHubForumPostFragment.this.aJK != null && GameHubForumPostFragment.this.aJK.getStyle() == 0 && GameHubForumPostFragment.this.aJK.getIsExpanded() && !GameHubForumPostFragment.this.aJK.isClickBtnHideKeyboard()) {
GameHubForumPostFragment.this.aJK.showExpandUI(true);
}
} else {
if (GameHubForumPostFragment.this.aJK != null && GameHubForumPostFragment.this.aJK.getStyle() == 0 && GameHubForumPostFragment.this.aJK.getIsExpanded() && !GameHubForumPostFragment.this.aJK.isClickBtnHideKeyboard()) {
GameHubForumPostFragment.this.aJK.showExpandUI(false);
}
com.m4399.gamecenter.plugin.main.utils.e.postDelayed(new Runnable() {
@Override
public void run() {
if (GameHubForumPostFragment.this.getContext() == null || GameHubForumPostFragment.this.getContext().isFinishing() || GameHubForumPostFragment.this.aJK.isPanpelShown()) {
return;
}
GameHubForumPostFragment.this.onBackKeyPreIme();
}
}, 120L);
}
if (GameHubForumPostFragment.this.getWebViewLayout() != null) {
Observable.timer(300L, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {
@Override
public void call(Long l) {
if (GameHubForumPostFragment.this.getWebViewLayout() != null) {
GameHubForumPostFragment.this.getWebViewLayout().loadUrl("javascript:window.TopicApp.keyBoardShow(" + z + ")");
}
}
});
}
}
});
lockEditorJs(InputLockEventType.SEND_BTN_DISABLE.getType());
}
boolean sj() {
int i = this.aKc;
return i == 1 || i == 0;
}
private void sk() {
ScrollWebView webView = this.mWebView.getWebView();
if (webView == null) {
return;
}
webView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() != 1 || GameHubForumPostFragment.this.aJK == null || !GameHubForumPostFragment.this.aJK.isPanpelOrKeyBoardShow()) {
return false;
}
GameHubForumPostFragment.this.onBackKeyPreIme();
return false;
}
});
}
void bp(int i) {
if (i == 1) {
ViewGroup viewGroup = (ViewGroup) this.mainView.findViewById(R.id.webViewContainer);
sl();
if (this.mWebView != null && viewGroup != null) {
viewGroup.addView(this.mWebView, 1);
}
this.mContentView.setFocusable(true);
this.mContentView.setFocusableInTouchMode(true);
this.mContentView.requestFocus();
sp();
return;
}
if (i == 0) {
ViewParent parent = this.mWebView.getParent();
if (parent == null || parent != this.mContentView) {
sl();
if (this.mWebView != null) {
this.mContentView.addView(this.mWebView, 1);
}
this.mContentView.removeView(this.aJT);
}
com.m4399.gamecenter.plugin.main.utils.e.postDelayed(getContext(), new Runnable() {
@Override
public void run() {
GameHubForumPostFragment gameHubForumPostFragment = GameHubForumPostFragment.this;
gameHubForumPostFragment.w(gameHubForumPostFragment.so(), -1);
GameHubForumPostFragment.this.bq(-2);
}
}, 0L);
return;
}
ViewParent parent2 = this.mWebView.getParent();
if (parent2 == null || parent2 != this.mContentView) {
sl();
if (this.mWebView != null) {
this.mContentView.addView(this.mWebView, 1);
}
}
com.m4399.gamecenter.plugin.main.utils.e.postDelayed(getContext(), new Runnable() {
@Override
public void run() {
GameHubForumPostFragment gameHubForumPostFragment = GameHubForumPostFragment.this;
gameHubForumPostFragment.w(gameHubForumPostFragment.so(), -1);
GameHubForumPostFragment.this.bq(-2);
}
}, 0L);
}
private void sl() {
if (this.mWebView == null || this.mWebView.getParent() == null) {
return;
}
((ViewGroup) this.mWebView.getParent()).removeView(this.mWebView);
}
void bq(int i) {
ViewGroup.LayoutParams layoutParams = this.mContentView.getLayoutParams();
layoutParams.height = i;
this.mContentView.setLayoutParams(layoutParams);
}
boolean sm() {
return this.aKc == 1 || this.aKd == 1;
}
public void handleTopVideoStuff() {
if (this.aKt == null) {
sn();
bs(aJU);
}
int i = this.mVideoHeight;
if (i != 0) {
br(i);
}
}
private void sn() {
this.aKs = (ViewStub) this.mainView.findViewById(R.id.videoPostViewStub);
this.aKt = (NewSmallVideoPlayer) this.aKs.inflate().findViewById(R.id.videoView);
this.aKs.setVisibility(0);
this.aKt.setVisibility(0);
ViewGroup.LayoutParams layoutParams = this.aKY.getLayoutParams();
layoutParams.height = StatusBarHelper.getStatusBarHeight(getContext());
this.aKY.setLayoutParams(layoutParams);
}
public int so() {
Toolbar toolBar = this.aKb.getToolBar();
if (toolBar.getMeasuredHeight() == 0) {
toolBar.measure(View.MeasureSpec.makeMeasureSpec(0, 0), View.MeasureSpec.makeMeasureSpec(0, 0));
}
return toolBar.getMeasuredHeight();
}
void w(int i, int i2) {
if (this.mWebView != null) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.mWebView.getLayoutParams();
marginLayoutParams.topMargin = i;
marginLayoutParams.height = i2;
this.mWebView.setLayoutParams(marginLayoutParams);
}
}
private void br(int i) {
ViewGroup.LayoutParams layoutParams = this.aKr.getLayoutParams();
layoutParams.height = i;
this.aKr.setLayoutParams(layoutParams);
}
private void sp() {
View view = this.aKU;
if (view == null) {
return;
}
view.post(new Runnable() {
@Override
public void run() {
GameHubForumPostFragment.this.w(0, GameHubForumPostFragment.this.sq());
}
});
}
int sq() {
int[] iArr = new int[2];
this.aKU.getLocationOnScreen(iArr);
return ((iArr[1] - aJU) + DensityUtils.dip2px(BaseApplication.getApplication(), 27.0f)) - StatusBarHelper.getStatusBarHeight(getContext());
}
void initVideoPlayer() {
st();
sr();
sw();
int aB = aB(this.aLc);
this.mVideoHeight = aB;
bs(aB);
}
private void sr() {
NewSmallVideoPlayer newSmallVideoPlayer = this.aKt;
if (newSmallVideoPlayer == null) {
return;
}
NewSmallControlPanel controlPanel = newSmallVideoPlayer.getControlPanel();
controlPanel.getTrafficPanel().setIsToastSetSameBottomMargin(true);
controlPanel.setOnVideoActionListener(new com.m4399.gamecenter.plugin.main.widget.video.d() {
@Override
public void startVideo(boolean z) {
if (GameHubForumPostFragment.this.mVideoId > 0) {
StatManager.youpaiVideoPlayCount(String.valueOf(GameHubForumPostFragment.this.mVideoId), String.valueOf(GameHubForumPostFragment.this.mPostId), GameHubForumPostFragment.this.aKf);
}
}
@Override
public void oneClick() {
Bundle bundle = new Bundle();
bundle.putParcelable("intent.extra.report.model.contain", com.m4399.gamecenter.plugin.main.manager.chat.a.getHubReport(GameHubForumPostFragment.this.mPostId, GameHubForumPostFragment.this.getUserName(), GameHubForumPostFragment.this.getUserPtuid(), GameHubForumPostFragment.this.mVideoPic));
bz.openContinueVideoPlayActivity(GameHubForumPostFragment.this.getContext(), GameHubForumPostFragment.this.aKt, bundle);
}
});
}
void ss() {
if (this.aKt != null && NetworkStatusManager.checkIsWifi() && this.aKt.getCurrentVideoState() == 0) {
this.aKt.getControlPanel().callStartBtnClick(false);
}
}
private void st() {
NewSmallVideoPlayer newSmallVideoPlayer = this.aKt;
if (newSmallVideoPlayer != null) {
newSmallVideoPlayer.getControlPanel().getVideoPlayOrEndStatisticModel().setBaseData(this.mVideoId, this.aKf, "玩家发布");
this.aKt.setUp(this.mVideoUrl);
this.aKt.setThumbImageUrl(this.mVideoPic);
NewSmallControlPanel controlPanel = this.aKt.getControlPanel();
controlPanel.setPlayNum(this.aKg);
controlPanel.setInitVideoDuration(this.aKh * 1000);
}
}
private void su() {
this.aJT.setOnScrollChangeListener(new NestScrollView.a() {
@Override
public void onScrollChange(NestScrollView nestScrollView, int i, int i2, int i3, int i4) {
if (GameHubForumPostFragment.this.aKt == null || GameHubForumPostFragment.this.mVideoHeight == 0) {
return;
}
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) GameHubForumPostFragment.this.aKt.getLayoutParams();
int i5 = GameHubForumPostFragment.this.mVideoHeight - i2;
if (i5 > GameHubForumPostFragment.aJU) {
GameHubForumPostFragment.this.aJT.setVideoIsMinHeight(false);
GameHubForumPostFragment.this.aJT.setVideoIsMaxHeight(i5 == GameHubForumPostFragment.aJV);
layoutParams.height = GameHubForumPostFragment.this.mVideoHeight - i2;
GameHubForumPostFragment.this.aKt.setLayoutParams(layoutParams);
return;
}
GameHubForumPostFragment.this.aJT.setVideoIsMinHeight(true);
GameHubForumPostFragment.this.aJT.setVideoIsMaxHeight(false);
layoutParams.height = GameHubForumPostFragment.aJU;
GameHubForumPostFragment.this.aKt.setLayoutParams(layoutParams);
}
});
}
private void sv() {
if (this.mWebView == null || this.mWebView.getWebView() == null) {
return;
}
this.mWebView.getWebView().addOnScrollChangeListener(new com.m4399.gamecenter.plugin.main.widget.web.i() {
@Override
public void onPageEnd(int i, int i2, int i3, int i4) {
}
@Override
public void onPageTop(int i, int i2, int i3, int i4) {
if (GameHubForumPostFragment.this.aJT == null) {
return;
}
GameHubForumPostFragment.this.aJT.setWebViewOnTop(true);
}
@Override
public void onScrollChanged(int i, int i2, int i3, int i4) {
if (i2 != 0) {
GameHubForumPostFragment.this.aJT.setWebViewOnTop(false);
}
}
});
}
private void bs(int i) {
ViewGroup.LayoutParams layoutParams = this.aKq.getLayoutParams();
layoutParams.height = i;
this.aKq.setLayoutParams(layoutParams);
br(i);
}
private void sw() {
NewSmallVideoPlayer newSmallVideoPlayer = this.aKt;
if (newSmallVideoPlayer == null) {
return;
}
VideoPlayOrEndStatisticModel videoPlayOrEndStatisticModel = newSmallVideoPlayer.getControlPanel().getVideoPlayOrEndStatisticModel();
videoPlayOrEndStatisticModel.setBaseData(this.mVideoId, this.aKf, "玩家发布");
videoPlayOrEndStatisticModel.appendExtension("post_type", PostRootType.INSTANCE.getDesc(this.aKC.getANb()));
videoPlayOrEndStatisticModel.appendExtension("post_id", Integer.valueOf(this.mPostId));
videoPlayOrEndStatisticModel.appendExtension("is_ask", this.aKC.getIsQA() ? "是" : "否");
}
private int aB(boolean z) {
return z ? aJV : aJU;
}
public void initPanelKeyBord() {
this.mPanelKeyboard = com.m4399.gamecenter.plugin.main.views.d.a.with(getContext()).bindContent(this.mContentView).build();
this.aJK.setPanelKeyboard(this.mPanelKeyboard);
}
public void reBindPanpelKeyboard() {
PostReplyBottomBar postReplyBottomBar = this.aJK;
if (postReplyBottomBar != null) {
com.m4399.gamecenter.plugin.main.views.d.a aVar = this.mPanelKeyboard;
if (aVar == null) {
initPanelKeyBord();
} else {
postReplyBottomBar.setPanelKeyboard(aVar);
}
}
}
public boolean mIsKeyBoardShown() {
return this.aLh;
}
public PostReplyBottomBar getBottomBar() {
return this.aJK;
}
public void aC(boolean z) {
if (!ActivityStateUtils.isDestroy((Activity) getContext()) && z) {
if (!this.aKH) {
UMengEventUtils.onEvent("ad_circle_post_detail_bottom_reply_like_collect", "type", "点赞");
}
if (this.aKR) {
Object[] objArr = new Object[6];
objArr[0] = "object_name";
objArr[1] = "点赞引导后点赞";
objArr[2] = "gamehub_type";
objArr[3] = PostRootType.INSTANCE.getDesc(this.aKe);
objArr[4] = "gamehub_name";
GameHubPostJsonBasicProvider gameHubPostJsonBasicProvider = this.aKC;
objArr[5] = gameHubPostJsonBasicProvider != null ? gameHubPostJsonBasicProvider.getDvb() : "";
com.m4399.gamecenter.plugin.main.helpers.t.onEvent("post_details_likeguide_click", objArr);
}
}
}
public void cd(String str) {
if (ActivityStateUtils.isDestroy((Activity) getContext())) {
return;
}
HashMap hashMap = new HashMap();
hashMap.put("uid", UserCenterManager.getPtUid());
hashMap.put("postid", String.valueOf(this.mPostId));
hashMap.put("post_type", PostRootType.INSTANCE.getDesc(this.aKe));
hashMap.put("forumid", String.valueOf(this.mForumsId));
hashMap.put("gamehubid", String.valueOf(this.mGameHubId));
hashMap.put("is_ask", String.valueOf(this.aKC.getIsQA()));
hashMap.put("is_video", String.valueOf(this.aKC.getDvc()));
hashMap.put("deviceid", (String) Config.getValue(SysConfigKey.UNIQUEID));
hashMap.put("trace", getPageTracer().getFullTrace());
hashMap.put("passthrough", BundleUtils.getString(getContext().getIntent(), "intent.extra.passthrough"));
String str2 = "post_like_cancel";
if (str.contains(com.m4399.gamecenter.plugin.main.providers.gamehub.aa.PRAISE_URL_SUFFIX)) {
hashMap.put("object_type", "点赞主楼");
} else {
if (str.contains(com.m4399.gamecenter.plugin.main.providers.gamehub.aa.CANCEL_PRAISE_URL_SUFFIX)) {
hashMap.put("object_type", "取消点赞主楼");
} else if (str.contains("declare-reply.html")) {
hashMap.put("object_type", "点赞回复");
} else if (str.contains("declare-replyCancel.html")) {
hashMap.put("object_type", "取消点赞回复");
} else {
str2 = str.contains("thread-delete.html") ? "post_delete" : "";
}
if (str2.isEmpty()) {
com.m4399.gamecenter.plugin.main.helpers.t.onEvent(str2, hashMap);
return;
}
return;
}
str2 = "post_like";
if (str2.isEmpty()) {
}
}
public void onBackKeyPreIme() {
PostReplyBottomBar postReplyBottomBar = this.aJK;
if (postReplyBottomBar == null || postReplyBottomBar.getContentLayout().getVisibility() == 0) {
return;
}
if (this.aJK.getStyle() == 0 && this.aJK.isInputViewEmpty()) {
this.aKy = true;
this.aJK.setAddExtraButtonClick(true);
}
sz();
this.aKl = "{\"type\":1}";
this.aJK.setStyle(0);
this.aJK.clearContent();
this.aJK.getMessageInputView().setText("");
this.aJK.showDefaultView();
sL();
this.aKy = true;
}
private void jS() {
ce(getString(R.string.loading_page));
}
@Override
public void onResume() {
super.onResume();
this.mViewStart = System.currentTimeMillis();
try {
Class.forName("android.webkit.WebView").getMethod("onResume", (Class[]) null).invoke(this.mWebView.getWebView(), (Object[]) null);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onPause() {
NewSmallVideoPlayer newSmallVideoPlayer;
super.onPause();
if (sm() && (newSmallVideoPlayer = this.aKt) != null) {
VideoPlayOrEndStatisticModel videoPlayOrEndStatisticModel = newSmallVideoPlayer.getControlPanel().getVideoPlayOrEndStatisticModel();
VideoExposeModel videoExposeModel = new VideoExposeModel();
videoExposeModel.setPlayType(videoPlayOrEndStatisticModel.getPlayType());
videoExposeModel.setType(videoPlayOrEndStatisticModel.getType());
videoExposeModel.setId(videoPlayOrEndStatisticModel.getId());
if (videoPlayOrEndStatisticModel.getExtensionByKey("game_id") instanceof Integer) {
videoExposeModel.setGameId(((Integer) videoPlayOrEndStatisticModel.getExtensionByKey("game_id")).intValue());
}
if (videoPlayOrEndStatisticModel.getExtensionByKey("order") instanceof Integer) {
videoExposeModel.setOrder(((Integer) videoPlayOrEndStatisticModel.getExtensionByKey("order")).intValue());
}
videoExposeModel.setTrace(videoPlayOrEndStatisticModel.getTrace(getContext()));
videoExposeModel.setVideoExposureTime(System.currentTimeMillis() - this.mViewStart);
CustomVideoManager.getInstance().reportVideoExposureEvent(videoExposeModel);
}
try {
Class.forName("android.webkit.WebView").getMethod("onPause", (Class[]) null).invoke(this.mWebView.getWebView(), (Object[]) null);
} catch (Exception e) {
e.printStackTrace();
}
PostReplyBottomBar postReplyBottomBar = this.aJK;
if (postReplyBottomBar != null) {
postReplyBottomBar.hideKeyboard();
}
int i = BundleUtils.getInt(getContext().getIntent(), "intent.extra.list.position", -1);
String string = BundleUtils.getString(getContext().getIntent(), "intent.extra.passthrough");
HashMap hashMap = new HashMap(4);
hashMap.put("passthrough", string);
hashMap.put("post_type", PostRootType.INSTANCE.getDesc(this.aKC.getANb()));
hashMap.put("is_ask", Boolean.valueOf(this.aKC.getIsQA()));
hashMap.put("is_video", Boolean.valueOf(this.aKC.getDvc()));
com.m4399.gamecenter.plugin.main.manager.stat.e.viewPostDetail(this.aKe, this.mPostId, this.mGameHubId, this.mForumsId, System.currentTimeMillis() - this.mViewStart, i, hashMap);
}
private void ce(String str) {
if (getActivity() == null || getActivity().isFinishing()) {
return;
}
if (this.adZ == null) {
this.adZ = new CommonLoadingDialog(this.aKb);
}
if (!this.adZ.isShowing()) {
this.adZ.show(str);
} else {
if (((TextView) this.adZ.findViewById(R.id.mLoadingText)).getText().toString().equals(str)) {
return;
}
this.adZ.show(str);
}
}
private void sx() {
if (getActivity() == null || getActivity().isFinishing() || !this.adZ.isShowing()) {
return;
}
this.adZ.dismiss();
}
@Override
public void onDestroy() {
HashMap<String, String> hashMap;
super.onDestroy();
PostReplyBottomBar postReplyBottomBar = this.aJK;
if (postReplyBottomBar != null) {
postReplyBottomBar.onDestory();
}
if (!this.aKH) {
Config.setValue(GameCenterConfigKey.POST_DETAIL_NOT_PRAISE_NUM, Integer.valueOf(((Integer) Config.getValue(GameCenterConfigKey.POST_DETAIL_NOT_PRAISE_NUM)).intValue() + 1));
}
RxBus.unregister(this);
if (getActivity() instanceof GameHubPostActivity) {
hashMap = ((GameHubPostActivity) getActivity()).getPostJSInterface().getStatParamsOnDestoryMap();
} else {
hashMap = new HashMap<>();
}
hashMap.put("postid", this.mPostId + "");
hashMap.put("gamehubid", this.mGameHubId + "");
hashMap.put("forumid", this.mForumsId + "");
com.m4399.gamecenter.plugin.main.providers.gamehub.y yVar = this.aKD;
if (yVar != null) {
hashMap.put("object_type", yVar.isRewardOpen() ? "有按钮" : "无按钮");
}
hashMap.put("trace", TraceHelper.filterTrace(getContext().getPageTracer().getFullTrace()));
com.m4399.gamecenter.plugin.main.helpers.t.onEvent("post_reward_btn_exposure", hashMap);
}
private void sy() {
ArrayList arrayList = this.aKK;
if (arrayList == null || arrayList.size() <= 0) {
return;
}
for (int i = 0; i < this.aKK.size(); i++) {
if (JSONUtils.getString(com.m4399.gamecenter.plugin.main.database.tables.d.JSON_DATA, JSONUtils.parseJSONObjectFromString((String) this.aKK.get(i))).equalsIgnoreCase(this.aKO)) {
this.aKK.remove(i);
this.aKO = "";
return;
}
}
}
public void saveCommentToCache() {
sz();
ArrayList arrayList = this.aKK;
if (arrayList == null) {
return;
}
ObjectPersistenceUtils.putObject("pref.gamehub.comment.draft", arrayList);
}
private String cf(String str) {
ArrayList arrayList = this.aKK;
if (arrayList != null && arrayList.size() > 0) {
for (int i = 0; i < this.aKK.size(); i++) {
JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString((String) this.aKK.get(i));
String string = JSONUtils.getString(com.m4399.gamecenter.plugin.main.database.tables.d.JSON_DATA, parseJSONObjectFromString);
int i2 = JSONUtils.getInt("save_times", parseJSONObjectFromString);
if (i2 >= 2) {
JSONUtils.putObject("save_times", Integer.valueOf(i2 + 1), parseJSONObjectFromString);
} else if (string.equalsIgnoreCase(str)) {
return JSONUtils.getString("content", parseJSONObjectFromString);
}
}
}
return "";
}
private void sz() {
if (getBottomBar() == null || getBottomBar().getMessageInputView() == null) {
return;
}
if (TextUtils.isEmpty(getBottomBar().getMessageInputView().getText())) {
this.aKO = this.aKl;
sy();
return;
}
ArrayList arrayList = this.aKK;
if (arrayList == null || arrayList.size() <= 0) {
this.aKK = new ArrayList();
this.aKK.add(sA());
return;
}
if (this.aKK.size() > 5) {
this.aKK.remove(0);
}
String obj = getBottomBar().getMessageInputView().getText().toString();
for (int i = 0; i < this.aKK.size(); i++) {
String str = (String) this.aKK.get(i);
JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(str);
if (JSONUtils.getString(com.m4399.gamecenter.plugin.main.database.tables.d.JSON_DATA, parseJSONObjectFromString).equalsIgnoreCase(this.aKl)) {
int i2 = JSONUtils.getInt("save_times", parseJSONObjectFromString);
String string = JSONUtils.getString("content", parseJSONObjectFromString);
if (i2 >= 2 && string.equalsIgnoreCase(obj)) {
this.aKK.remove(str);
JSONUtils.putObject("save_times", Integer.valueOf(i2 + 1), parseJSONObjectFromString);
this.aKK.add(parseJSONObjectFromString.toString());
return;
} else if (!string.equalsIgnoreCase(obj)) {
this.aKK.remove(str);
this.aKK.add(sA());
return;
} else if (string.equalsIgnoreCase(obj)) {
this.aKK.remove(str);
JSONUtils.putObject("save_times", Integer.valueOf(i2 + 1), parseJSONObjectFromString);
this.aKK.add(parseJSONObjectFromString.toString());
return;
}
}
}
this.aKK.add(sA());
if (this.aKK.size() > 5) {
this.aKK.remove(0);
}
}
private String sA() {
JSONObject jSONObject = new JSONObject();
JSONUtils.putObject("content", getBottomBar().getMessageInputView().getText().toString(), jSONObject);
JSONUtils.putObject(com.m4399.gamecenter.plugin.main.database.tables.d.JSON_DATA, this.aKl, jSONObject);
JSONUtils.putObject("bottom_style ", Integer.valueOf(getBottomBar().getStyle()), jSONObject);
JSONUtils.putObject(CrashHianalyticsData.TIME, Long.valueOf(System.currentTimeMillis()), jSONObject);
JSONUtils.putObject("save_times", 1, jSONObject);
JSONUtils.putObject("tid", this.aKC.getDva(), jSONObject);
return jSONObject.toString();
}
public boolean isSameDay(long j) {
return p(j) < 1;
}
private int p(long j) {
return DateUtils.getBetweenDay(j, System.currentTimeMillis());
}
public void showProgressBarJs(boolean z) {
if (z && !this.isLoading) {
jS();
} else {
sx();
}
}
public void bt(int i) {
if (this.aJR) {
return;
}
this.aJK.setVisibility(0);
this.aJK.setStyle(i == 3 ? 1 : 0);
this.aJK.showRealEditView();
}
private void sB() {
this.aJL.setVisibility(8);
this.aJK.setVisibility(0);
}
private void sC() {
this.aJK.setVisibility(8);
this.aJL.setVisibility(0);
}
private void sD() {
this.aJL.setVisibility(8);
this.aJK.setVisibility(8);
}
public int x(int i, int i2) {
if (this.aJK == null || this.aKb.getToolBar() == null) {
return 0;
}
if (i2 < i && Math.abs((i - i2) - StatusBarHelper.getStatusBarHeight(getContext())) < 5) {
this.aLi = true;
}
return (i - DensityUtils.dip2px(getContext(), 111.76f)) - StatusBarHelper.getStatusBarHeight(getContext());
}
@Override
protected void loadTemplate() {
com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc();
if (this.mWebView.getWebView() instanceof RecycleWebView) {
com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc("reload");
this.aKz = true;
}
com.m4399.gamecenter.plugin.main.manager.v vVar = com.m4399.gamecenter.plugin.main.manager.v.getInstance();
PostTrackHelper.INSTANCE.setLoadTemplateStart(System.currentTimeMillis());
vVar.loadPostTemplate(this.mWebView, new v.c() {
@Override
public void handle(File file) {
GameHubForumPostFragment.this.mWebView.loadUrl("file:///" + file.getAbsolutePath());
com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc("loadUrl");
PostTrackHelper.INSTANCE.setLoadTemplateEnd(System.currentTimeMillis());
}
});
}
private void sE() {
com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc();
LinkedHashMap linkedHashMap = new LinkedHashMap();
linkedHashMap.put("keys", this.mGameHubId + "_" + this.mForumsId + "_" + this.mPostId);
this.aKC.setParams(linkedHashMap);
this.aKC.loadData(new IHaveResponseDataListener() {
@Override
public void onSubBefore() {
Timber.d("Start get data from network", new Object[0]);
GameHubForumPostFragment.this.aKC.setResponseCode(Integer.MAX_VALUE);
GameHubForumPostFragment.this.aKC.setJsonContent(null);
PostTrackHelper.INSTANCE.setLoadPostStart(System.currentTimeMillis());
}
@Override
public void onSubSuccess(JSONObject jSONObject) {
GameHubForumPostFragment.this.sF();
}
@Override
public void onSubFailure(Throwable th, int i, String str, int i2, JSONObject jSONObject) {
if (ActivityStateUtils.isDestroy((Activity) GameHubForumPostFragment.this.getContext())) {
return;
}
PostTrackHelper.INSTANCE.setLoadPostFinish(System.currentTimeMillis());
GameHubForumPostFragment gameHubForumPostFragment = GameHubForumPostFragment.this;
gameHubForumPostFragment.a(th, i, str, gameHubForumPostFragment.aKC);
}
});
}
public void sF() {
if (ActivityStateUtils.isDestroy((Activity) getContext())) {
return;
}
if (getActivity() != null) {
((GameHubPostActivity) getActivity()).commitStat();
}
PostTrackHelper.INSTANCE.setLoadPostFinish(System.currentTimeMillis());
sK();
if (!sj()) {
boolean dvc = this.aKC.getDvc();
this.aKd = dvc ? 1 : 0;
bu(dvc ? 1 : 0);
}
this.aLc = bz.isVerticalVideo(this.mVideoPic);
if (sm()) {
initVideoPlayer();
ss();
}
sJ();
this.mWebView.addOnWebViewScrollChangeListener(new com.m4399.gamecenter.plugin.main.widget.web.i() {
@Override
public void onPageEnd(int i, int i2, int i3, int i4) {
}
@Override
public void onPageTop(int i, int i2, int i3, int i4) {
}
@Override
public void onScrollChanged(int i, int i2, int i3, int i4) {
if (i2 <= 10 || !GameHubForumPostFragment.this.aLe) {
return;
}
GameHubForumPostFragment.this.aLe = false;
int i5 = BundleUtils.getInt(GameHubForumPostFragment.this.getContext().getIntent(), "intent.extra.list.position", -1);
String string = BundleUtils.getString(GameHubForumPostFragment.this.getContext().getIntent(), "intent.extra.passthrough");
HashMap hashMap = new HashMap(4);
hashMap.put("passthrough", string);
hashMap.put("post_type", PostRootType.INSTANCE.getDesc(GameHubForumPostFragment.this.aKC.getANb()));
hashMap.put("is_ask", Boolean.valueOf(GameHubForumPostFragment.this.aKC.getIsQA()));
hashMap.put("is_video", Boolean.valueOf(GameHubForumPostFragment.this.aKC.getDvc()));
hashMap.put("button_status", Boolean.valueOf(GameHubForumPostFragment.this.aKD.isRewardOpen()));
com.m4399.gamecenter.plugin.main.manager.stat.e.postRead(GameHubForumPostFragment.this.getContext(), GameHubForumPostFragment.this.aKe, GameHubForumPostFragment.this.mPostId, GameHubForumPostFragment.this.mGameHubId, GameHubForumPostFragment.this.mForumsId, i5, hashMap);
}
});
synchronized (this) {
this.mDataLoaded = true;
this.aKC.putCommentParams(this.aKN);
com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc("setJsonDataToWebView");
setJsonDataToWebViewBasic(this.aKC.getDT());
}
com.m4399.gamecenter.plugin.main.manager.v.getInstance().checkAllUpdate();
BrowseRecordPostModel browseRecordPostModel = new BrowseRecordPostModel(1, this.aKC.getDva(), "", this.aKC.getSubject(), this.aKC.getDvb());
browseRecordPostModel.setExtQuanId(String.valueOf(this.aKC.getQuanId()));
browseRecordPostModel.setExtForumId(String.valueOf(this.aKC.getForumsId()));
this.aKe = this.aKC.getANb();
browseRecordPostModel.setIsVideo(this.aKC.getDve() == 1);
com.m4399.gamecenter.plugin.main.providers.ad.a.record(browseRecordPostModel, 1, 2, 3);
this.aKJ = this.aKC.getNumReply();
saveReplyNum();
if (this.aKM > 0) {
com.m4399.gamecenter.plugin.main.viewholder.favorite.g.getInstance().addView(this.mWebView);
com.m4399.gamecenter.plugin.main.viewholder.favorite.g.getInstance().showTipWithAnimation(this.aKM);
}
getBottomBar().setmThreadPtuid(this.aKC.getDuZ());
if (getActivity() instanceof GameHubPostActivity) {
((GameHubPostActivity) getActivity()).setPostType(this.aKC.getANb());
((GameHubPostActivity) getActivity()).setForumsName(this.aKC.getDvb());
((GameHubPostActivity) getActivity()).setForumsId(this.aKC.getForumsId());
}
StatManager.getInstance().onPostActionEvent(com.m4399.gamecenter.plugin.main.database.room.b.a.COL_READ, String.valueOf(this.mPostId), String.valueOf(this.mForumsId), String.valueOf(this.mGameHubId), this.aKC.getANb());
}
public void sG() {
String[] split;
String oldAuthCookie = UserCenterManager.getOldAuthCookie();
LinkedHashMap linkedHashMap = new LinkedHashMap();
linkedHashMap.put(NetworkDataProvider.NUM_PER_PAGE_KEY, "20");
linkedHashMap.put("p", "1");
linkedHashMap.put("thread_id", this.mPostId + "");
linkedHashMap.put("view", "1");
linkedHashMap.put(PushConsts.KEY_SERVICE_PIT, this.aJP + "");
linkedHashMap.put("scookie", oldAuthCookie);
linkedHashMap.put("show_image", "1");
linkedHashMap.put("only_host", this.aKF ? "1" : "0");
linkedHashMap.put("ord", com.m4399.gamecenter.plugin.main.manager.post.a.getOrderCache(this.mPostId));
linkedHashMap.put("show_quan", String.valueOf(this.aJQ));
linkedHashMap.put(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_FORUMS_ID, this.mForumsId + "");
linkedHashMap.put(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_QUAN_ID, this.mGameHubId + "");
linkedHashMap.put("auto_push_qa", String.valueOf(this.aJO));
if (this.aJM) {
linkedHashMap.put("isMy", "1");
}
if (!TextUtils.isEmpty(this.mAppendParam) && (split = this.mAppendParam.split(ContainerUtils.FIELD_DELIMITER)) != null && split.length > 0) {
for (String str : split) {
String[] split2 = str.split(ContainerUtils.KEY_VALUE_DELIMITER);
if (split2 != null && split2.length > 0) {
linkedHashMap.put(split2[0], split2.length > 1 ? split2[1] : "");
}
}
}
if (!TextUtils.isEmpty(this.mFrom)) {
linkedHashMap.put("from", this.mFrom);
}
si();
this.aKD.setParams(linkedHashMap);
this.aKD.loadData(new IHaveResponseDataListener() {
@Override
public void onSubBefore() {
}
@Override
public void onSubSuccess(JSONObject jSONObject) {
if (ActivityStateUtils.isDestroy((Activity) GameHubForumPostFragment.this.getContext())) {
return;
}
synchronized (GameHubForumPostFragment.this) {
GameHubForumPostFragment.this.mDataLoaded = true;
GameHubForumPostFragment.this.aKD.putCommentParams(GameHubForumPostFragment.this.aKN);
GameHubForumPostFragment.this.setJsonDataToWebView(GameHubForumPostFragment.this.aKD.getJsonContent());
}
if (GameHubForumPostFragment.this.getActivity() instanceof GameHubPostActivity) {
GameHubPostActivity gameHubPostActivity = (GameHubPostActivity) GameHubForumPostFragment.this.getActivity();
gameHubPostActivity.showToolbarMenu();
gameHubPostActivity.bindMenuItemPostModify(GameHubForumPostFragment.this.aKC.getDuZ(), GameHubForumPostFragment.this.aKD.isCanModifyPost(), GameHubForumPostFragment.this.aKD.isPcEdit(), GameHubForumPostFragment.this.aKD.getPostModifyToast(), GameHubForumPostFragment.this.aKe);
if (GameHubForumPostFragment.this.aKt == null && GameHubForumPostFragment.this.aKe != 3) {
gameHubPostActivity.bindToolBarChildView(GameHubForumPostFragment.this.aKD.getQuanIcon(), GameHubForumPostFragment.this.aKD.getQuanName(), GameHubForumPostFragment.this.aKD.getQuanId(), GameHubForumPostFragment.this.aKD.getForumsId(), GameHubForumPostFragment.this.aKD.isShowQuanEnter());
}
GameHubForumPostFragment.this.sH();
}
}
@Override
public void onSubFailure(Throwable th, int i, String str2, int i2, JSONObject jSONObject) {
if (ActivityStateUtils.isDestroy((Activity) GameHubForumPostFragment.this.getContext())) {
return;
}
GameHubForumPostFragment gameHubForumPostFragment = GameHubForumPostFragment.this;
gameHubForumPostFragment.a(th, i, str2, gameHubForumPostFragment.aKD);
}
});
}
public void sH() {
if (!ActivityStateUtils.isDestroy((Activity) getActivity()) && (getActivity() instanceof GameHubPostActivity)) {
((GameHubPostActivity) getActivity()).setMenuItemAdmin(this.aKD.isAdmin());
}
}
private void sI() {
sD();
View view = this.aKU;
if (view != null) {
view.setVisibility(8);
}
RelativeLayout relativeLayout = this.mContentView;
if (relativeLayout != null) {
cd.setLayoutMarginBottom(relativeLayout, DensityUtils.dip2px(getContext(), 0.0f));
}
View view2 = this.aKX;
if (view2 != null) {
view2.setVisibility(8);
}
}
public void a(Throwable th, int i, String str, com.m4399.gamecenter.plugin.main.providers.c cVar) {
if (this.aLf) {
return;
}
this.aLf = true;
Timber.d(th, "get data from network onFailure", new Object[0]);
bp(0);
synchronized (this) {
this.mDataLoaded = true;
if (cVar.getApiResponseCode() != Integer.MAX_VALUE) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("code", i);
jSONObject.put("message", str);
String jSONObject2 = jSONObject.toString();
if (cVar instanceof com.m4399.gamecenter.plugin.main.providers.gamehub.y) {
((com.m4399.gamecenter.plugin.main.providers.gamehub.y) cVar).setJsonContent(jSONObject2);
setJsonDataToWebView(jSONObject2);
} else if (cVar instanceof GameHubPostJsonBasicProvider) {
((GameHubPostJsonBasicProvider) cVar).setJsonContent(jSONObject2);
setJsonDataToWebViewBasic(jSONObject2);
}
sI();
} catch (JSONException e) {
Timber.w(e);
}
} else {
FragmentActivity activity = getActivity();
if (activity instanceof BaseWebViewActivity) {
((BaseWebViewActivity) activity).onReceivedError(this.mWebView, 2, "", "");
}
}
}
if (!ActivityStateUtils.isDestroy((Activity) getActivity()) && (getActivity() instanceof GameHubPostActivity) && i == 901) {
((GameHubPostActivity) getActivity()).sR();
}
ToastUtils.showToast(getContext(), HttpResultTipUtils.getFailureTip(getContext(), th, i, str));
}
void bu(int i) {
bp(i);
if (sm()) {
handleTopVideoStuff();
this.aKb.setToolBarStyle(true);
}
}
void sJ() {
VideoPostScrollView videoPostScrollView = this.aJT;
if (videoPostScrollView != null) {
videoPostScrollView.setVerticalVideo(this.aLc);
this.aJT.setVideoIsMaxHeight(this.aLc);
su();
}
sv();
}
void sK() {
boolean z = this.aKC.getDvc() && this.aKC.getDvd() != null;
PostVideoModel dvd = this.aKC.getDvd();
this.mVideoId = z ? dvd.getId() : 0;
this.aKf = z ? dvd.getAuthorUid() : "";
this.mVideoUrl = z ? dvd.getUrl() : "";
this.mVideoPic = z ? dvd.getCover() : "";
this.aKg = z ? dvd.getBrowseNum() : 0L;
this.aKh = z ? dvd.getDuration() : 0L;
}
@Override
public String getConfig() {
String str = "";
try {
JSONObject baseConfig = getBaseConfig();
baseConfig.put("uid", UserCenterManager.getPtUid());
baseConfig.put("base_url", BaseApplication.getApplication().getServerHostManager().getHost(2));
baseConfig.put("tid", this.mPostId);
baseConfig.put(HttpHeaderKey.TOKEN, UserCenterManager.getToken());
baseConfig.put("cookie", "");
baseConfig.put("show_image", "true");
str = baseConfig.toString();
} catch (JSONException e) {
e.printStackTrace();
}
Timber.d("getConfig result=" + str, new Object[0]);
return str;
}
@Override
public void postAddEssence(int i) {
a aVar = new a(i);
String string = getString(R.string.js_prefix, this.aJY + "(" + aVar.toJson() + ")");
this.mWebView.loadUrl(string);
StringBuilder sb = new StringBuilder();
sb.append("加/取消 精华 url=");
sb.append(string);
Timber.d(sb.toString(), new Object[0]);
}
@Override
public void postOperate(final String str, final int i) {
com.m4399.gamecenter.plugin.main.utils.e.runOnUiThread(new Runnable() {
@Override
public void run() {
GameHubForumPostFragment.this.mWebView.loadUrl(GameHubForumPostFragment.this.getString(R.string.js_prefix, GameHubForumPostFragment.this.aKa + "(\"" + str + "\"," + i + ")"));
}
});
}
@Override
public void switchOrder(int i, String str) {
if (this.aKn) {
com.m4399.gamecenter.plugin.main.manager.post.a.setOrderCache(i, str);
}
String string = getString(R.string.js_prefix, this.aJW + "(" + f(ListTriggerEventType.ORDER.getListTriggerEventTypeCode(), str) + ")");
this.mWebView.loadUrl(string);
StringBuilder sb = new StringBuilder();
sb.append("切换排序 url=");
sb.append(string);
Timber.d(sb.toString(), new Object[0]);
}
@Override
public void onWebViewPageStart(BaseWebViewLayout baseWebViewLayout, String str, Bitmap bitmap) {
super.onWebViewPageStart(baseWebViewLayout, str, bitmap);
com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc("url:" + str);
this.isLoading = true;
}
@Override
public void onWebViewPageFinished(BaseWebViewLayout baseWebViewLayout, String str) {
super.onWebViewPageFinished(baseWebViewLayout, str);
com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc("url:" + str);
this.isLoading = false;
lockEditorJs(InputLockEventType.SEND_BTN_ENABLE.getType());
Timber.d("onWebViewPageFinished", new Object[0]);
}
public void onJsFinished() {
this.aKK = (ArrayList) ObjectPersistenceUtils.getObject("pref.gamehub.comment.draft");
ArrayList arrayList = this.aKK;
if (arrayList == null) {
this.aKK = new ArrayList();
return;
}
Iterator it = arrayList.iterator();
while (it.hasNext()) {
JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString((String) it.next());
long j = JSONUtils.getLong(CrashHianalyticsData.TIME, parseJSONObjectFromString);
int i = JSONUtils.getInt("save_times", parseJSONObjectFromString);
if (!isSameDay(j)) {
it.remove();
} else if (i >= 3) {
it.remove();
}
}
sL();
}
private void sL() {
ArrayList arrayList = this.aKK;
if (arrayList == null || arrayList.size() <= 0) {
return;
}
for (int i = 0; i < this.aKK.size(); i++) {
String str = (String) this.aKK.get(i);
if (str.contains(this.aKC.getDva())) {
JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(str);
String string = JSONUtils.getString(com.m4399.gamecenter.plugin.main.database.tables.d.JSON_DATA, parseJSONObjectFromString);
if (JSONUtils.getInt("save_times", parseJSONObjectFromString) >= 3) {
continue;
} else {
String string2 = JSONUtils.getString("content", parseJSONObjectFromString);
int i2 = JSONUtils.getInt("bottom_style", parseJSONObjectFromString);
if (JSONUtils.getInt("type", JSONUtils.parseJSONObjectFromString(string)) == 1) {
getBottomBar().setStyle(i2);
getBottomBar().setDraftComment(true);
getBottomBar().getMessageInputView().setText(string2);
getBottomBar().showDefaultView();
this.aKl = string;
return;
}
}
}
}
}
@Override
public void onContentSwitch(boolean z) {
this.aKZ = z;
View view = this.aKU;
if (view != null) {
view.setVisibility(z ? 0 : 8);
}
TextView textView = this.aKS;
if (textView != null) {
if (z) {
if (this.aKR) {
return;
}
showPraiseGuide();
} else if (textView.getVisibility() == 0) {
this.aKS.setVisibility(8);
}
}
}
@Override
public void onShowHideBottomTopLine(boolean z) {
View view = this.aKV;
if (view != null) {
view.setVisibility(z ? 0 : 8);
}
}
@Override
public void onMessageSend() {
if (cg(this.aKl)) {
this.aLa = this.aJK.getMessageInputView().getText().toString().replaceAll("\n", "<br>");
this.aLb = this.aKl;
} else {
this.aLa = "";
this.aLb = "";
}
ContentPublishAuthManagerProxy.INSTANCE.getInstance().check(getContext(), "quan_comment_reply", new com.m4399.gamecenter.plugin.main.listeners.f<Integer>() {
@Override
public void onChecking() {
}
@Override
public void onCheckFinish(Integer num, Object... objArr) {
GameHubForumPostFragment.this.sM();
}
});
}
private boolean cg(String str) {
return !TextUtils.isEmpty(str) && str.contains("\"type\":3");
}
public void sM() {
String str;
String replaceAll = this.aJK.getMessageInputView().getText().toString().replaceAll("\n", "<br>");
if (TextUtils.isEmpty(replaceAll) && !TextUtils.isEmpty(this.aLa) && !TextUtils.isEmpty(this.aLb) && cg(this.aLb)) {
replaceAll = this.aLa;
this.aKl = this.aLb;
}
String str2 = "";
this.aLa = "";
this.aLb = "";
String replaceAll2 = replaceAll.replaceAll("\"", "\\\\\"");
this.aKu = null;
if (this.aKy) {
str = JSONUtils.toJsonString((ArrayList<String>) this.aJK.getUploadFilePathList(), KEY_UPLOAD_FILE_NAME);
if (this.aJK.getSelectedFriendsData() != null) {
Iterator<UserFriendModel> it = this.aJK.getSelectedFriendsData().iterator();
while (it.hasNext()) {
str2 = (str2 + it.next().getPtUid()) + ",";
}
com.m4399.gamecenter.plugin.main.manager.m.b.getInstance().saveAction(2, this.aJK.getSelectedFriendsData());
}
} else {
str = "";
}
if (!TextUtils.isEmpty(str2)) {
str2 = str2.substring(0, str2.length() - 1);
}
b bVar = new b(replaceAll2, str, str2, this.aKl);
this.aKu = str;
if (this.aKl.contains("\"type\":1")) {
StatManager.getInstance().onPostActionEvent(com.m4399.gamecenter.plugin.main.providers.special.b.VALUE_COMMENT, String.valueOf(this.mPostId), String.valueOf(this.mForumsId), String.valueOf(this.mGameHubId), this.aKC.getANb());
aD(false);
} else if (this.aKl.contains("\"type\":3")) {
StatManager.getInstance().onPostActionEvent("reply", String.valueOf(this.mPostId), String.valueOf(this.mForumsId), String.valueOf(this.mGameHubId), this.aKC.getANb());
aD(true);
}
this.aKO = this.aKl;
if (this.mWebView != null && this.mWebView.getWebView() != null) {
this.mWebView.getWebView().evaluateJavascript(getString(R.string.js_prefix, this.aJX + "(" + bVar.toJson() + ")"));
}
onBackKeyPreIme();
UMengEventUtils.onEvent("ad_circle_post_comment", "发送");
}
private void aD(boolean z) {
if (ActivityStateUtils.isDestroy((Activity) getContext())) {
return;
}
String str = z ? "post_comment" : "post_reply";
HashMap hashMap = new HashMap(8);
hashMap.put("uid", UserCenterManager.getPtUid());
hashMap.put("postid", Integer.valueOf(this.mPostId));
hashMap.put("post_type", PostRootType.INSTANCE.getDesc(this.aKe));
hashMap.put("forumid", Integer.valueOf(this.mForumsId));
hashMap.put("gamehubid", Integer.valueOf(this.mGameHubId));
hashMap.put("deviceid", (String) Config.getValue(SysConfigKey.UNIQUEID));
hashMap.put("is_ask", Boolean.valueOf(this.aKC.getIsQA()));
hashMap.put("is_video", Boolean.valueOf(this.aKC.getDvc()));
hashMap.put("trace", com.m4399.gamecenter.plugin.main.base.utils.a.c.getFullTrace(this.mainView));
hashMap.put("passthrough", BundleUtils.getString(getContext().getIntent(), "intent.extra.passthrough"));
com.m4399.gamecenter.plugin.main.helpers.t.onEvent(str, hashMap);
}
public void doCollection() {
if (this.aKQ >= 5) {
ToastUtils.showToast(getContext(), R.string.poster_not_support_collection);
} else {
com.m4399.gamecenter.plugin.main.manager.favorites.c.getInstance().setFavorite(getContext(), 3, this.aKG, this.mPostId, false, false, Integer.valueOf(this.mForumsId), Integer.valueOf(this.mGameHubId));
}
}
@Override
public void onWebViewReload() {
getActivity().setTitle(getString(R.string.gamehub_post_detail));
loadTemplate();
sG();
}
public boolean isOffsetExist() {
return this.aLi;
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.rl_praise_root) {
doLike();
}
}
public void setPraise(boolean z, int i, boolean z2) {
this.aKH = z;
if (this.aKC.getIsQA()) {
this.aKT.bindView(this.aKH, z2, i, R.mipmap.m4399_png_game_hub_post_detail_qa_praise_nor, R.mipmap.m4399_png_game_hub_post_detail_qa_praise_pressed, "animation/gamehub_post_detail_qa_praise", "animation/gamehub_post_detail_qa_praise/data.json", new PraiseAnimLoadedListener() {
@Override
public void onAnimEnd() {
GameHubForumPostFragment.this.aLd = true;
}
});
} else {
this.aKT.bindView(this.aKH, z2, i, R.mipmap.m4399_png_toolbar_icon_like_nor, R.mipmap.m4399_png_toolbar_icon_like_pressed, "animation/gamehub_post_detail_praise", "animation/gamehub_post_detail_praise/data.json", new PraiseAnimLoadedListener() {
@Override
public void onAnimEnd() {
GameHubForumPostFragment.this.aLd = true;
}
});
}
if (this.aKH || ((Integer) Config.getValue(GameCenterConfigKey.POST_DETAIL_NOT_PRAISE_NUM)).intValue() < 3 || this.aKA != null) {
return;
}
this.aKA = new Runnable() {
@Override
public void run() {
if (((Integer) Config.getValue(GameCenterConfigKey.POST_DETAIL_NOT_PRAISE_NUM)).intValue() >= 3) {
if (!GameHubForumPostFragment.this.getUserVisible() || !GameHubForumPostFragment.this.aKZ) {
GameHubForumPostFragment.this.aKR = false;
} else {
GameHubForumPostFragment.this.showPraiseGuide();
}
}
Config.setValue(GameCenterConfigKey.POST_DETAIL_NOT_PRAISE_NUM, 0);
}
};
com.m4399.gamecenter.plugin.main.utils.e.postDelayed(getContext(), this.aKA, com.igexin.push.config.c.i);
}
public void showPraiseGuide() {
this.aKS.setVisibility(0);
com.m4399.gamecenter.plugin.main.utils.e.postDelayed(getContext(), new Runnable() {
@Override
public void run() {
GameHubForumPostFragment.this.aKS.setVisibility(8);
}
}, 3000L);
this.aKR = true;
Object[] objArr = new Object[6];
objArr[0] = "object_name";
objArr[1] = "点赞引导";
objArr[2] = "object_type";
objArr[3] = PostRootType.INSTANCE.getDesc(this.aKe);
objArr[4] = "bbs_name";
GameHubPostJsonBasicProvider gameHubPostJsonBasicProvider = this.aKC;
objArr[5] = gameHubPostJsonBasicProvider != null ? gameHubPostJsonBasicProvider.getDvb() : "";
com.m4399.gamecenter.plugin.main.helpers.t.onEvent("post_details_likeguide_exposure", objArr);
}
public void setPostId(int i) {
this.mPostId = i;
}
public void showBottomLoading() {
this.aKG = false;
View view = this.aKX;
if (view != null) {
view.setVisibility(0);
}
View view2 = this.aKW;
if (view2 != null) {
view2.setVisibility(4);
}
View view3 = this.aKV;
if (view3 != null) {
view3.setVisibility(8);
}
}
public void hideBottomLoading() {
View view = this.aKX;
if (view != null) {
view.setVisibility(8);
}
View view2 = this.aKW;
if (view2 != null) {
view2.setVisibility(0);
}
View view3 = this.aKV;
if (view3 != null) {
view3.setVisibility(0);
}
}
public void doLike() {
if (cd.isFastClick()) {
return;
}
if (!NetworkStatusManager.checkIsAvalible()) {
ToastUtils.showToast(getContext(), R.string.network_error);
} else {
UserCenterManager.checkIsLogin(getContext(), new com.m4399.gamecenter.plugin.main.listeners.f<Boolean>() {
@Override
public void onChecking() {
}
@Override
public void onCheckFinish(Boolean bool, Object... objArr) {
if (bool.booleanValue() && GameHubForumPostFragment.this.aLd) {
((GameHubPostActivity) GameHubForumPostFragment.this.getContext()).doPraise();
}
}
});
}
}
class a {
int mType;
a(int i) {
this.mType = i;
}
String toJson() {
return "{\"type\" : \"" + this.mType + "\"}";
}
public String toString() {
return "message=" + this.mType;
}
}
public class b {
String aLF;
String aLG;
String aLH;
String mImages;
b(String str, String str2, String str3, String str4) {
this.aLF = str;
this.mImages = str2;
this.aLG = str3;
this.aLH = str4;
}
String toJson() {
return "{\"message\" : \"" + this.aLF + "\",\"file\":'" + this.mImages + "', \"at\":\"" + this.aLG + "\", \"data\" : '" + this.aLH + "'}";
}
public String toString() {
return "message=" + this.aLF + " image=" + this.mImages + " friends=" + this.aLG + " data=" + this.aLH;
}
}
private String f(int i, String str) {
JSONObject jSONObject;
StringBuilder sb = new StringBuilder();
JSONObject jSONObject2 = null;
try {
int postId = this.aKb.getPostId();
sb.append("{");
sb.append(ListUpdateEventParamType.TYPE.getListUpdateParamType() + Constants.COLON_SEPARATOR + i + ",");
sb.append(ListUpdateEventParamType.FILTER.getListUpdateParamType() + ":\"" + (this.aKF ? DownloadTable.COLUMN_DOWNLOAD_HOST : "all") + "\",");
sb.append(ListUpdateEventParamType.ORDER.getListUpdateParamType() + ":\"" + str + "\",");
StringBuilder sb2 = new StringBuilder();
sb2.append("");
sb2.append(postId);
String totalPage = com.m4399.gamecenter.plugin.main.manager.post.a.getTotalPage(sb2.toString());
if (TextUtils.isEmpty(totalPage)) {
sb.append(ListUpdateEventParamType.PAGECOUNT.getListUpdateParamType() + ":\"\"");
} else {
sb.append(ListUpdateEventParamType.PAGECOUNT.getListUpdateParamType() + Constants.COLON_SEPARATOR + totalPage);
}
sb.append("}");
Timber.d("getListUpdateParamJsonData = " + sb.toString(), new Object[0]);
jSONObject = new JSONObject(sb.toString());
} catch (JSONException e) {
e = e;
}
try {
Timber.d("getListUpdateParamJsonData = " + jSONObject.toString(), new Object[0]);
} catch (JSONException e2) {
jSONObject2 = jSONObject;
e = e2;
e.printStackTrace();
jSONObject = jSONObject2;
return jSONObject.toString();
}
return jSONObject.toString();
}
private void sN() {
this.aKB = new com.m4399.gamecenter.plugin.main.views.user.i(getContext());
this.aKB.getUserChangeNickNameSuggest().setVisibility(8);
this.aKB.getUserChangeNickNameSuggest().setListen(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (view instanceof TextView) {
TextView textView = (TextView) view;
GameHubForumPostFragment.this.aKB.getEditText().setText(textView.getText());
GameHubForumPostFragment.this.aKB.getEditText().setSelection(textView.getText().length());
GameHubForumPostFragment.this.aKB.getUserChangeNickNameSuggest().bindView(null);
GameHubForumPostFragment.this.aKB.getUserChangeNickNameSuggest().setVisibility(8);
}
}
});
this.aKB.getCancleBtn().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
GameHubForumPostFragment.this.aKB.dismiss();
}
});
this.aKB.getEnsureBtn().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String obj = GameHubForumPostFragment.this.aKB.getEditText().getText().toString();
if (TextUtils.isEmpty(obj)) {
GameHubForumPostFragment.this.aKB.getUserChangeNickNameSuggest().setVisibility(0);
GameHubForumPostFragment.this.aKB.getUserChangeNickNameSuggest().bindView(null);
GameHubForumPostFragment.this.aKB.getUserChangeNickNameSuggest().getAlertText().setText(GameHubForumPostFragment.this.getContext().getString(R.string.alert_null_nickname));
return;
}
GameHubForumPostFragment.this.setNickNameChangeDialogStatus(false);
GameHubForumPostFragment.this.aKB.getEnsureBtn().setText("");
GameHubForumPostFragment.this.aKB.getProgressBar().setVisibility(0);
Bundle bundle = new Bundle();
bundle.putString("intent.extra.user.info.modify.type", "1");
bundle.putString("intent.extra.user.nick", obj);
GameCenterRouterManager.getInstance().modifyUserInfo(GameHubForumPostFragment.this.getContext(), bundle);
}
});
this.aKB.show();
int i = AnonymousClass29.$SwitchMap$com$m4399$gamecenter$plugin$main$manager$user$UserAccountType[UserAccountType.clientCodeOf(UserCenterManager.getLoginFrom()).ordinal()];
if (i == 1 || i == 2 || i == 3) {
Bundle bundle = new Bundle();
bundle.putInt("intent.extra.user.nick.suggest.from.type", 1);
GameCenterRouterManager.getInstance().getUserNickSuggest(getContext(), bundle);
}
}
@Override
public void onUserVisible(boolean z) {
super.onUserVisible(z);
NewSmallVideoPlayer newSmallVideoPlayer = this.aKt;
if (newSmallVideoPlayer != null) {
newSmallVideoPlayer.onUserVisible(z);
}
if (z && !this.aKR) {
showPraiseGuide();
}
if (z) {
PostTrackHelper.INSTANCE.setOnVisible(System.currentTimeMillis());
}
}
public void onUserStatusChanged(boolean z) {
if (!z) {
sD();
}
Observable.timer(3L, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {
@Override
public void call(Long l) {
GameHubForumPostFragment.this.sG();
GameHubForumPostFragment.this.clearWebViewHistory();
}
});
}
public void clearWebViewHistory() {
if (this.mWebView != null) {
this.mWebView.clearHistory();
}
}
private void e(String str, final String str2, String str3, String str4) {
com.dialog.c cVar = new com.dialog.c(getContext());
cVar.setDialogTwoButtomTheme(DialogTwoButtonTheme.Horizontal_Default);
cVar.setOnDialogTwoHorizontalBtnsClickListener(new c.b() {
@Override
public DialogResult onLeftBtnClick() {
return null;
}
@Override
public DialogResult onRightBtnClick() {
if (!TextUtils.isEmpty(str2)) {
com.m4399.gamecenter.plugin.main.manager.gamehub.d.getInstance().forumSubscribe(GameHubForumPostFragment.this.aKb, str2, true);
return null;
}
ToastUtils.showToast(GameHubForumPostFragment.this.getContext(), R.string.gamehub_id_is_null);
return null;
}
});
cVar.showDialog((String) null, str, getContext().getString(R.string.cancel), getContext().getString(R.string.join));
}
public void hideKeyboard() {
if (this.aJK != null) {
KeyboardUtils.hideKeyboard(getActivity(), this.aJK.getMessageInputView());
}
}
public void triggerJs(String str, String str2) {
Timber.d("trigger jsonData = " + str2, new Object[0]);
try {
JSONObject jSONObject = new JSONObject(str2);
if (this.aJW.equals(str)) {
int i = JSONUtils.getInt(ListUpdateEventParamType.TYPE.getListUpdateParamType(), jSONObject);
String string = JSONUtils.getString(ListUpdateEventParamType.FILTER.getListUpdateParamType(), jSONObject);
String string2 = JSONUtils.getString(ListUpdateEventParamType.ORDER.getListUpdateParamType(), jSONObject);
String string3 = JSONUtils.getString(ListUpdateEventParamType.PAGECOUNT.getListUpdateParamType(), jSONObject);
if (i == ListTriggerEventType.FILTER.getListTriggerEventTypeCode() && this.aKm) {
g(string, string2, string3);
}
if (i == ListTriggerEventType.ORDER.getListTriggerEventTypeCode() && this.aKn) {
g(string, string2, string3);
}
if (i == ListTriggerEventType.GOTO.getListTriggerEventTypeCode() && this.aKo) {
g(string, string2, string3);
}
if (i == ListTriggerEventType.PREV_NEXT.getListTriggerEventTypeCode() && this.aKp) {
g(string, string2, string3);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
private void g(String str, String str2, String str3) {
this.aKF = DownloadTable.COLUMN_DOWNLOAD_HOST.equals(str);
com.m4399.gamecenter.plugin.main.manager.post.a.setOrderCache(this.aKb.getPostId(), str2);
com.m4399.gamecenter.plugin.main.manager.post.a.setTotalPage("" + this.mPostId, str3);
Timber.d("set pageCount :" + str3, new Object[0]);
((GameHubPostActivity) getActivity()).setOnlyLandlordEnable(true);
}
public void setListUpdateCallBackFunNameJs(String str) {
this.aJW = str;
}
public void setEditorCommitCallBackFunNameJs(String str) {
this.aJX = str;
}
public void setAddEssenceCallBackFunNameJs(String str) {
this.aJY = str;
}
public void setApplyDialogShowCallBackFunNameJs(String str) {
this.aJZ = str;
}
public void setPostOperateFunctionName(String str) {
this.aKa = str;
}
public boolean isWirtePanShow() {
PostReplyBottomBar postReplyBottomBar = this.aJK;
return postReplyBottomBar != null && postReplyBottomBar.getIsPanelOpen();
}
public void statisticsJs(String str, String str2) {
if (TextUtils.isEmpty(str)) {
return;
}
if (TextUtils.isEmpty(str2)) {
UMengEventUtils.onEvent(str);
return;
}
if (str2 != null) {
if (str2.startsWith("{") && str2.endsWith("}")) {
try {
HashMap hashMap = new HashMap();
JSONObject jSONObject = new JSONObject(str2);
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
hashMap.put(next, jSONObject.get(next).toString());
}
UMengEventUtils.onEvent(str, hashMap);
return;
} catch (JSONException e) {
e.printStackTrace();
return;
}
}
UMengEventUtils.onEvent(str, str2);
}
}
public void setEditorJs(int i, String str, String str2, String str3, String str4, boolean z) {
JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(str4);
if (JSONUtils.getBoolean("enable_write", parseJSONObjectFromString, true)) {
getBottomBar().enableInput(true, str2);
JSONUtils.getString("pt_uid", parseJSONObjectFromString);
final int i2 = JSONUtils.getInt("type", parseJSONObjectFromString);
this.aKQ = JSONUtils.getInt("old_thread_status", parseJSONObjectFromString, 0);
if (!z && !this.aKL && this.aJK.getStyle() != 0) {
sz();
}
this.aKL = false;
if (getContext() != null && (getContext() instanceof GameHubPostActivity)) {
((GameHubPostActivity) getContext()).setPostYears(this.aKQ);
}
if (this.aKQ >= 5 && !UserCenterManager.getPtUid().equals(this.aKC.getDuZ())) {
getBottomBar().setVisibility(8);
sO();
return;
}
getBottomBar().setTimeForYear(this.aKQ, str2);
if (!(i == 1)) {
this.aJP = 0;
Timber.d(" setEditor replayId=" + this.aJP, new Object[0]);
PostReplyBottomBar postReplyBottomBar = this.aJK;
if (postReplyBottomBar != null) {
postReplyBottomBar.clearExtraPanelData();
}
this.aJK.hideAllPanels();
this.mPanelKeyboard.hideAll(true);
} else {
UserCenterManager.checkIsLogin(getContext(), new com.m4399.gamecenter.plugin.main.listeners.f<Boolean>() {
@Override
public void onChecking() {
}
@Override
public void onCheckFinish(Boolean bool, Object... objArr) {
if (!bool.booleanValue() || GameHubForumPostFragment.this.aJK.isFocusable()) {
return;
}
GameHubForumPostFragment.this.bt(i2);
}
});
}
if (!z && !TextUtils.isEmpty(cf(str4))) {
getBottomBar().getMessageInputView().setHtmlText(cf(str4), 20);
} else if (!z) {
this.aJK.getMessageInputView().setText("");
}
if (z) {
sy();
if (i2 == 1) {
this.aJK.getMessageInputView().setText("");
}
}
if (TextUtils.isEmpty(str3)) {
if (!TextUtils.isEmpty(str2)) {
this.aJK.setMessageInputHint(str2);
}
} else {
this.aJK.getMessageInputView().setHtmlText(str3, 20);
}
this.aKl = str4;
int i3 = bc.toInt(str);
this.aKy = false;
if ((i3 & 2) == 2) {
this.aKy = true;
}
if ((i3 & 8) == 8) {
this.aKy = true;
}
sB();
return;
}
getBottomBar().enableInput(false, str2);
}
private void sO() {
if (getActivity() == null || ActivityStateUtils.isDestroy((Activity) getActivity()) || !(getActivity() instanceof GameHubPostActivity)) {
return;
}
((GameHubPostActivity) getActivity()).clearToolbarMenuAndView();
}
public void ajaxJs(final String str, String str2, final String str3, String str4, final String str5, final String str6) {
if ("[]".equals(this.aKu) || TextUtils.isEmpty(this.aKu)) {
final com.m4399.gamecenter.plugin.main.providers.gamehub.u uVar = new com.m4399.gamecenter.plugin.main.providers.gamehub.u(str, str2, str3);
uVar.loadData(new ILoadPageEventListener() {
@Override
public void onBefore() {
if (GameHubForumPostFragment.this.aJN == 1 && str.contains("thread-reply.html")) {
MedalPushDialogManager.INSTANCE.saveTime("5");
}
c(1, 0, "");
}
private void c(int i, int i2, String str7) {
Boolean ck = ck(str);
if (ck == null) {
return;
}
boolean booleanValue = ck.booleanValue();
int cj = cj(str3);
if (i == 1) {
PostPraiseNotifyHelper.postBefore(cj, booleanValue);
GameHubForumPostFragment.this.aLd = false;
} else if (i == 2) {
PostPraiseNotifyHelper.postSuccess(cj, booleanValue, null);
GameHubForumPostFragment.this.aC(booleanValue);
} else if (i == 3) {
PostPraiseNotifyHelper.postFail(cj, booleanValue, Integer.valueOf(i2), str7);
}
}
private int cj(String str7) {
return JSONUtils.getInt("threadId", JSONUtils.parseJSONObjectFromString(str7));
}
private Boolean ck(String str7) {
if (str7.contains(com.m4399.gamecenter.plugin.main.providers.gamehub.aa.PRAISE_URL_SUFFIX)) {
return true;
}
return str7.contains(com.m4399.gamecenter.plugin.main.providers.gamehub.aa.CANCEL_PRAISE_URL_SUFFIX) ? false : null;
}
@Override
public void onSuccess() {
String str7 = "";
int i = 0;
c(2, 0, "");
GameHubForumPostFragment.this.cd(str);
if (!ActivityStateUtils.isDestroy((Activity) GameHubForumPostFragment.this.getContext()) && GameHubForumPostFragment.this.isAdded()) {
try {
str7 = str5 + "(" + uVar.getResultJson() + ")";
} catch (OutOfMemoryError e) {
e.printStackTrace();
}
Timber.d("ajax onSuccess loadUrl = " + str7, new Object[0]);
GameHubForumPostFragment.this.mWebView.loadJs(com.m4399.gamecenter.plugin.main.utils.aq.buildSafeFuncCallJs(str7));
if (JSONUtils.getInt("code", JSONUtils.parseJSONObjectFromString(uVar.getResultJson())) == 100) {
JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(str3);
int i2 = JSONUtils.getInt("quanId", parseJSONObjectFromString);
int i3 = JSONUtils.getInt("threadId", parseJSONObjectFromString);
int i4 = JSONUtils.getInt(PushConsts.KEY_SERVICE_PIT, parseJSONObjectFromString);
int i5 = JSONUtils.getInt("requestType", parseJSONObjectFromString);
if (i5 == 1 || i5 == 2) {
Bundle bundle = new Bundle();
bundle.putInt("game.hub.behavior.action", 2);
bundle.putString("intent.extra.gamehub.id", String.valueOf(i2));
RxBus.get().post("tag.game.hub.behavior", bundle);
com.m4399.gamecenter.plugin.main.manager.aa.a.getInstance().showNotifyTipWithType(3, 2100L);
if (i5 != 1 || GameHubForumPostFragment.this.aJK == null) {
if (i5 == 2 && GameHubForumPostFragment.this.aJK != null) {
GameHubForumPostFragment.this.aJK.showDefaultView();
}
} else {
GameHubForumPostFragment.this.aJK.clearContent();
}
}
Bundle bundle2 = new Bundle();
bundle2.putInt("intent.extra.gamehub.post.id", i3);
bundle2.putInt("intent.extra.gamehub.post.reply.id", i4);
bundle2.putInt("intent.extra.gamehub.post.is.qa", GameHubForumPostFragment.this.aJN);
if (str.contains("thread-reply.html")) {
i = 1;
} else if (str.contains("thread-sendComment.html")) {
i = 2;
} else if (str.contains("thread-deleteReply")) {
i = 3;
} else if (str.contains("thread-delComment")) {
i = 4;
} else if (str.contains("declare-reply.html")) {
i = 5;
}
bundle2.putInt("gamehub.thread.detail.action.code", i);
bundle2.putInt("intent.extra.gamehub.post.root.tyoe", GameHubForumPostFragment.this.aKe);
RxBus.get().post("tag.game.hub.post.data.result", bundle2);
}
}
}
@Override
public void onFailure(Throwable th, int i, String str7, int i2, JSONObject jSONObject) {
String str8;
c(2, i, str7);
if (!ActivityStateUtils.isDestroy((Activity) GameHubForumPostFragment.this.getContext()) && GameHubForumPostFragment.this.isAdded()) {
if (uVar.getApiResponseCode() == 795) {
str8 = "{code:795}";
} else if (th != null) {
str8 = "{code:-404}";
} else {
str8 = "{code:" + i + "}";
}
String string = GameHubForumPostFragment.this.getString(R.string.js_prefix, str6 + "(" + str8 + ")");
StringBuilder sb = new StringBuilder();
sb.append("ajax onFailure loadUrl = ");
sb.append(string);
Timber.d(sb.toString(), new Object[0]);
GameHubForumPostFragment.this.mWebView.loadUrl(string);
}
}
});
return;
}
Bundle bundle = new Bundle();
bundle.putString("intent.extra.upload.image.success.js", str5);
bundle.putString("intent.extra.upload.image.failed.js", str6);
bundle.putString("intent.extra.icon.local", this.aKu);
GameCenterRouterManager.getInstance().doPictureUpload(getContext(), bundle);
}
public void loadingJs(boolean z, String str) {
this.aJS = z;
Timber.d("loadingJs pageIsLoading=" + z + " msg=" + str, new Object[0]);
if (z) {
ce(str);
} else {
this.adZ.dismiss();
}
}
public void confirmJs(String str, final String str2, final String str3) {
com.dialog.c cVar = new com.dialog.c(getActivity()) {
@Override
public void setContentView(View view) {
super.setContentView(view);
((ViewGroup) view.getParent()).setBackgroundDrawable(getContext().getResources().getDrawable(R.drawable.m4399_xml_shape_8dp_ffffff));
this.mLeftButton.setBackgroundDrawable(getContext().getResources().getDrawable(R.drawable.m4399_xml_shape_dialog_left_r_8_fffff));
this.mRightButton.setBackgroundDrawable(getContext().getResources().getDrawable(R.drawable.m4399_xml_shape_dialog_right_r_8_fffff));
}
};
cVar.setDialogTwoButtomTheme(DialogTwoButtonTheme.Horizontal_Red);
cVar.setOnDialogTwoHorizontalBtnsClickListener(new c.b() {
@Override
public DialogResult onLeftBtnClick() {
GameHubForumPostFragment.this.mWebView.loadUrl(GameHubForumPostFragment.this.getString(R.string.js_prefix, str2 + "()"));
return null;
}
@Override
public DialogResult onRightBtnClick() {
GameHubForumPostFragment.this.mWebView.loadUrl(GameHubForumPostFragment.this.getString(R.string.js_prefix, str3 + "()"));
return null;
}
});
cVar.showDialog(str, "", getString(R.string.delete), getString(R.string.cancel));
}
public void exitJs(boolean z) {
if (z) {
RxBus.get().post("tag.gamehub_post_delete_success", new Pair(Integer.valueOf(this.mPostId), Integer.valueOf(this.aKe)));
LiveDataBus.INSTANCE.get(com.m4399.gamecenter.plugin.main.manager.message.h.PUSH_ACTION_DELETE).postValue(String.valueOf(this.mPostId));
if (this.mPostId > 0) {
RxBus.get().post("tag.zone.delete.type.post.zone", String.valueOf(this.mPostId));
}
}
getContext().finish();
}
public void gotoActivityJs(String str, String str2) {
try {
JSONObject jSONObject = new JSONObject(str2);
if ("pluginone.controllers.user.UserHomePageActivity".equals(str)) {
String string = JSONUtils.getString("uid", jSONObject);
String string2 = JSONUtils.getString("nickName", jSONObject);
Timber.d("gotoActivityJs ptUid=" + string + " userName=" + string2, new Object[0]);
if (!TextUtils.isEmpty(string)) {
UMengEventUtils.onEvent("ad_circle_details_topic_user");
Bundle bundle = new Bundle();
bundle.putString("intent.extra.goto.user.homepage.username", string2);
bundle.putString("intent.extra.goto.user.homepage.user.ptuid", string);
GameCenterRouterManager.getInstance().openUserHomePage(getContext(), bundle);
}
} else if ("pluginone.controllers.gamehub.GameHubDetailForumStyleActivity".equals(str)) {
String string3 = JSONUtils.getString("groupId", jSONObject);
String string4 = JSONUtils.getString("forumsId", jSONObject);
Timber.d("gotoActivityJs groupId=" + string3 + " forumsId=" + string4, new Object[0]);
this.mForumsId = bc.toInt(string4);
Bundle bundle2 = new Bundle();
bundle2.putString(GameHubDetailForumStyleActivity.INTENT_EXTRA_GAMEHUB_NAME, "");
bundle2.putInt("intent.extra.gamehub.id", bc.toInt(string3));
bundle2.putInt("intent.extra.gamehub.forums.id", this.mForumsId);
bundle2.putInt("intent.extra.gamehub.game.id", 0);
GameCenterRouterManager.getInstance().openGameHubDetail(getContext(), bundle2, false, new int[0]);
UMengEventUtils.onEvent("app_gamehub_detail_topic_goto_gamehub");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
public void followGroupDialogJs(String str, String str2, String str3, String str4) {
e(str, str2, str3, str4);
}
public String getUuidJs() {
return UUID.randomUUID() + UserCenterManager.getPtUid();
}
public WebViewLayout getWebViewLayout() {
return this.mWebView;
}
public int getWebVisibleHeightJs() {
int deviceHeightPixels = DeviceUtils.getDeviceHeightPixels(getActivity());
int measuredHeight = getToolBar() != null ? getToolBar().getMeasuredHeight() : 0;
if (measuredHeight == 0) {
measuredHeight = DensityUtils.dip2px(getContext(), 48.0f);
}
return (deviceHeightPixels - measuredHeight) - DensityUtils.dip2px(getContext(), 48.66f);
}
public int getScreenUsableHeight() {
return this.aKw;
}
public int getMessageViewUsableHeight() {
return this.aKx;
}
public static class AnonymousClass29 {
static final int[] $SwitchMap$com$m4399$gamecenter$plugin$main$manager$user$UserAccountType;
static final int[] aLv = new int[InputLockEventType.values().length];
static {
try {
aLv[InputLockEventType.EDIT.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
aLv[InputLockEventType.LOCK.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
aLv[InputLockEventType.SEND_BTN_DISABLE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
aLv[InputLockEventType.SEND_BTN_ENABLE.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
$SwitchMap$com$m4399$gamecenter$plugin$main$manager$user$UserAccountType = new int[UserAccountType.values().length];
try {
$SwitchMap$com$m4399$gamecenter$plugin$main$manager$user$UserAccountType[UserAccountType.TENCENT.ordinal()] = 1;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$m4399$gamecenter$plugin$main$manager$user$UserAccountType[UserAccountType.WECHAT.ordinal()] = 2;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$com$m4399$gamecenter$plugin$main$manager$user$UserAccountType[UserAccountType.SINA.ordinal()] = 3;
} catch (NoSuchFieldError unused7) {
}
}
}
public void lockEditorJs(int i) {
int i2 = AnonymousClass29.aLv[InputLockEventType.bv(i).ordinal()];
if (i2 == 1) {
sB();
return;
}
if (i2 == 2) {
sC();
} else if (i2 == 3) {
this.aJK.lockMessageSendBtn(true);
} else {
if (i2 != 4) {
return;
}
this.aJK.lockMessageSendBtn(false);
}
}
public void checkTaskFinishJs(String str) {
if (this.mWebView != null) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (GameHubForumPostFragment.this.mWebView != null) {
GameHubForumPostFragment.this.mWebView.requestLayout();
GameHubForumPostFragment.this.mWebView.invalidate();
}
}
}, 1000L);
}
try {
JSONObject jSONObject = new JSONObject(str);
int i = JSONUtils.getInt("type", jSONObject);
String string = JSONUtils.getString("status", jSONObject);
if (EditorCommitTriggerEventType.REPLY_POST.getEditorCommitTriggerEventTypeCode() == i && "1".equals(string)) {
TaskManager.getInstance().checkTask(TaskActions.REPLY_THREAD);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
public void setNickDialogJs() {
sN();
}
@Keep
@Subscribe(tags = {@Tag("tag.zs.examine.push.result")})
public void onSmExaminePushResult(final JSONObject jSONObject) {
if (this.mWebView == null) {
return;
}
com.m4399.gamecenter.plugin.main.utils.e.runOnUiThread(new Runnable() {
@Override
public void run() {
GameHubForumPostFragment.this.mWebView.loadUrl(GameHubForumPostFragment.this.getString(R.string.js_prefix, GameHubPostJsInterface.SM_EXAMINE_PUSH_RESULT_JS + "(" + jSONObject.toString() + ")"));
}
});
}
@Keep
@Subscribe(tags = {@Tag("tag.gamehub.post.publish.event")})
public void onPostPublishCallback(Bundle bundle) {
if (bundle == null) {
return;
}
if (this.mPostId == bundle.getInt("intent.extra.gamehub.post.id") && "com.m4399.gamecenter.controllers.gamehub.post.add".equals(bundle.getString("intent.extra.post.publish.callback.rxkey")) && Boolean.valueOf(bundle.getBoolean("com.m4399.gamecenter.controllers.gamehub.post.add.is.success")).booleanValue()) {
this.mWebView.loadUrl("javascript:window.TopicApp.reload()");
loadTemplate();
sG();
}
}
@Keep
@Subscribe(tags = {@Tag("tag.user.nick.modify.success")})
public void onNickModifySuccess(String str) {
if (this.aKB == null) {
return;
}
setNickNameChangeDialogStatus(true);
this.aKB.getEnsureBtn().setText("确定");
this.aKB.getProgressBar().setVisibility(8);
if (getContext() != null && !getContext().isFinishing()) {
ToastUtils.showToast(getContext(), getContext().getString(R.string.loading_fixinfo_success));
}
this.aKB.dismiss();
UserCenterManager.setNick(str);
}
@Keep
@Subscribe(tags = {@Tag("tag.user.nick.modify.fail")})
public void onNickModifyFail(Bundle bundle) {
if (this.aKB == null) {
return;
}
int i = bundle.getInt("code");
if (i == this.NICK_NAME_REPEAT_CODE.intValue() || i == this.NICK_NAME_USER_CENTER_CLOSE_CODE.intValue()) {
com.m4399.gamecenter.plugin.main.views.user.i iVar = this.aKB;
if (iVar != null) {
String fliterString = fliterString(iVar.getEditText().getText().toString());
Bundle bundle2 = new Bundle();
if (i == this.NICK_NAME_REPEAT_CODE.intValue()) {
bundle2.putInt("intent.extra.user.nick.suggest.from.type", 0);
} else if (i == this.NICK_NAME_USER_CENTER_CLOSE_CODE.intValue()) {
bundle2.putInt("intent.extra.user.nick.suggest.from.type", 2);
}
bundle2.putString("intent.extra.user.nick.suggest", fliterString);
GameCenterRouterManager.getInstance().getUserNickSuggest(getContext(), bundle2);
return;
}
return;
}
setNickNameChangeDialogStatus(true);
this.aKB.getEnsureBtn().setText("确定");
this.aKB.getProgressBar().setVisibility(8);
this.aKB.getUserChangeNickNameSuggest().setVisibility(0);
this.aKB.getUserChangeNickNameSuggest().bindView(null);
this.aKB.getUserChangeNickNameSuggest().getAlertText().setText(bundle.getString("message"));
}
@Keep
@Subscribe(tags = {@Tag("tag.gamehub.post.reply.upload.picture.event")})
public void onPictureUploadFinish(Bundle bundle) {
if (bundle.getBoolean("intent.extra.is.post.reply.upload.image.success")) {
String string = bundle.getString("intent.extra.upload.image.success.js");
String string2 = bundle.getString("intent.extra.upload.image.retry");
Timber.d(getString(R.string.js_prefix, string + "({code:100,result:{data:\"" + string2 + "\"}})"), new Object[0]);
this.mWebView.loadUrl(getString(R.string.js_prefix, string + "({code:100,result:{data:\"" + string2 + "\"}})"));
} else {
String string3 = bundle.getString("intent.extra.upload.image.failed.js");
String string4 = bundle.getString("intent.extra.upload.image.failed.content");
if (!bundle.getBoolean("intent.extra.upload.image.failed.iserror")) {
string3 = bundle.getString("intent.extra.upload.image.success.js");
}
this.mWebView.loadUrl(getString(R.string.js_prefix, string3 + "(" + string4 + ")"));
}
this.aKu = null;
}
public void setListCacheJs(int i) {
this.aKm = false;
this.aKn = false;
this.aKo = false;
this.aKp = false;
if ((ListTriggerEventType.FILTER.getListTriggerEventTypeCode() & i) == ListTriggerEventType.FILTER.getListTriggerEventTypeCode()) {
this.aKm = true;
}
if ((ListTriggerEventType.ORDER.getListTriggerEventTypeCode() & i) == ListTriggerEventType.ORDER.getListTriggerEventTypeCode()) {
this.aKn = true;
}
if ((ListTriggerEventType.GOTO.getListTriggerEventTypeCode() & i) == ListTriggerEventType.GOTO.getListTriggerEventTypeCode()) {
this.aKo = true;
}
if ((i & ListTriggerEventType.PREV_NEXT.getListTriggerEventTypeCode()) == ListTriggerEventType.PREV_NEXT.getListTriggerEventTypeCode()) {
this.aKp = true;
}
}
public enum InputLockEventType {
DEFAULT(-1),
EDIT(0),
LOCK(1),
SEND_BTN_DISABLE(2),
SEND_BTN_ENABLE(3);
private int mType;
public int getType() {
return this.mType;
}
InputLockEventType(int i) {
this.mType = i;
}
public static InputLockEventType bv(int i) {
if (i == 0) {
return EDIT;
}
if (i == 1) {
return LOCK;
}
if (i == 2) {
return SEND_BTN_DISABLE;
}
if (i == 3) {
return SEND_BTN_ENABLE;
}
return DEFAULT;
}
}
public enum ListTriggerEventType {
FILTER(1),
ORDER(2),
GOTO(4),
PREV_NEXT(8);
private int mTypeCode;
ListTriggerEventType(int i) {
this.mTypeCode = i;
}
public int getListTriggerEventTypeCode() {
return this.mTypeCode;
}
}
public enum EditorCommitTriggerEventType {
REPLY_POST(1),
COMMENT_POST(2),
REPLY_COMMENT(3),
QUOTE_POST(4);
private int mTypeCode;
EditorCommitTriggerEventType(int i) {
this.mTypeCode = i;
}
public int getEditorCommitTriggerEventTypeCode() {
return this.mTypeCode;
}
}
public enum ListUpdateEventParamType {
TYPE("type"),
FILTER("filter"),
ORDER("order"),
PAGECOUNT("pagecount");
private String mType;
ListUpdateEventParamType(String str) {
this.mType = str;
}
public String getListUpdateParamType() {
return this.mType;
}
}
public String fliterString(String str) {
return str != null ? Pattern.compile("\\s*|\t|\r|\n").matcher(str).replaceAll("") : str;
}
@Keep
@Subscribe(tags = {@Tag("tag.user.nick.suggest.success")})
public void onNickSuggestSuccess(Bundle bundle) {
if (this.aKB == null) {
return;
}
ArrayList<String> stringArrayList = bundle.getStringArrayList(com.m4399.gamecenter.plugin.main.database.tables.u.COLUMN_NICK);
if (bundle.getInt("intent.extra.user.nick.suggest.from.type") == 1) {
if (!TextUtils.isEmpty(this.aKB.getEditText().getText()) || stringArrayList == null || stringArrayList.size() <= 0) {
return;
}
this.aKB.getEditText().setText(stringArrayList.get(0));
this.aKB.getEditText().setSelection(this.aKB.getEditText().getText().length());
return;
}
setNickNameChangeDialogStatus(true);
this.aKB.getEnsureBtn().setText("确定");
this.aKB.getProgressBar().setVisibility(8);
this.aKB.getEditText().setSelection(0, this.aKB.getEditText().getText().length());
this.aKB.getUserChangeNickNameSuggest().setVisibility(0);
this.aKB.getUserChangeNickNameSuggest().bindView(bundle.getStringArrayList(com.m4399.gamecenter.plugin.main.database.tables.u.COLUMN_NICK));
this.aKB.getUserChangeNickNameSuggest().getAlertText().setText(bundle.getString("message"));
}
@Keep
@Subscribe(tags = {@Tag("tag.user.nick.suggest.fail")})
public void onNickSuggestFail(Bundle bundle) {
if (this.aKB == null) {
return;
}
setNickNameChangeDialogStatus(true);
this.aKB.getEnsureBtn().setText("确定");
this.aKB.getProgressBar().setVisibility(8);
this.aKB.getUserChangeNickNameSuggest().getAlertText().setText(bundle.getString("message"));
}
public void setNickNameChangeDialogStatus(boolean z) {
this.aKB.getDeleteBtn().setEnabled(z);
this.aKB.getEnsureBtn().setEnabled(z);
this.aKB.getCancleBtn().setEnabled(z);
this.aKB.getEditText().setEnabled(z);
}
public void setJsonDataToWebView(String str) {
if (getActivity() == null || ActivityStateUtils.isDestroy((Activity) getActivity()) || str == null || this.mWebView == null) {
return;
}
Timber.d("get data from server finish", new Object[0]);
if (this.aKz) {
String escapeChar = bp.escapeChar(str);
this.mWebView.loadJs(com.m4399.gamecenter.plugin.main.utils.aq.buildSafeFuncCallJs("setJsonData(" + escapeChar + ")"));
}
}
public void setJsonDataToWebViewBasic(String str) {
if (getActivity() == null || ActivityStateUtils.isDestroy((Activity) getActivity()) || str == null || this.mWebView == null || !this.aKz) {
return;
}
PostTrackHelper.INSTANCE.setSetJsonDataStart(System.currentTimeMillis());
Timber.d("set data to webview ", new Object[0]);
String escapeChar = bp.escapeChar(str);
com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc("setJsonData");
this.mWebView.loadJs(com.m4399.gamecenter.plugin.main.utils.aq.buildSafeFuncCallJs("setJsonDataNew(" + escapeChar + ")"));
com.m4399.gamecenter.plugin.main.utils.aw.logTraceFunc("setJsonData end");
PostTrackHelper.INSTANCE.setSetJsonDataEnd(System.currentTimeMillis());
}
public synchronized String getJsonData() {
Timber.d("webview js load finish ", new Object[0]);
this.aKz = true;
if (this.aKD.getJsonContent() == null || !this.mDataLoaded) {
return "";
}
Timber.d("return json data to webview", new Object[0]);
JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(this.aKD.getJsonContent());
try {
parseJSONObjectFromString.put("code", this.aKD.getApiResponseCode());
parseJSONObjectFromString.put("message", this.aKD.getResopnseMessage());
} catch (JSONException e) {
e.printStackTrace();
}
return parseJSONObjectFromString.toString();
}
public synchronized String getJsonBasicData() {
Timber.d("webview js load finish ", new Object[0]);
this.aKz = true;
if (this.aKC.getDT() == null || !this.mDataLoaded) {
return "";
}
Timber.d("return json data to webview", new Object[0]);
JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(this.aKC.getDT());
try {
parseJSONObjectFromString.put("code", this.aKC.getApiResponseCode());
parseJSONObjectFromString.put("message", this.aKC.getResopnseMessage());
} catch (JSONException e) {
e.printStackTrace();
}
return parseJSONObjectFromString.toString();
}
public void bindFavoriteView(boolean z) {
Toolbar toolBar;
MenuItem findItem;
this.aKI = true;
this.aKG = z;
saveReplyNum();
if (!(getContext() instanceof BaseToolBarActivity) || (toolBar = ((BaseToolBarActivity) getContext()).getToolBar()) == null || (findItem = toolBar.getMenu().findItem(R.id.m4399_menu_favorite)) == null) {
return;
}
findItem.setIcon(z ? R.mipmap.m4399_png_game_detail_tooltip_icon_collect_pressed : R.mipmap.m4399_png_game_detail_tooltip_icon_collect_nor);
findItem.setTitle(z ? R.string.menu_un_favorite : R.string.menu_favorite);
}
public void saveReplyNum() {
if (this.aKI && this.aKG && this.aKJ >= 0) {
com.m4399.gamecenter.plugin.main.manager.post.c.getInstance().saveSingleMsg(this.mPostId, this.aKJ);
}
}
public void applyDialogCallBack(String str, String str2, String str3) {
String string = getString(R.string.js_prefix, this.aJZ + "(" + str + "," + str2 + "," + str3 + ")");
this.mWebView.loadUrl(string);
StringBuilder sb = new StringBuilder();
sb.append("只看楼主 url=");
sb.append(string);
Timber.d(sb.toString(), new Object[0]);
}
public int getIsQAAnswer() {
return this.aJN;
}
public void showExameToast(boolean z, String str) {
if (z) {
this.aKP.setText(str);
this.aKP.setVisibility(0);
cd.setLayoutMarginTop(this.aKP, bq.getToolbarHeight());
cd.setPaddingTop(this.mContentView, DensityUtils.dip2px(getContext(), 40.0f));
getWebViewLayout().setTopDivisionStyle(0);
return;
}
this.aKP.setVisibility(8);
getWebViewLayout().setTopDivisionStyle(1);
}
public String getUserName() {
GameHubPostJsonBasicProvider gameHubPostJsonBasicProvider = this.aKC;
return gameHubPostJsonBasicProvider != null ? gameHubPostJsonBasicProvider.getUserName() : "";
}
public String getUserPtuid() {
GameHubPostJsonBasicProvider gameHubPostJsonBasicProvider = this.aKC;
return gameHubPostJsonBasicProvider != null ? gameHubPostJsonBasicProvider.getDuZ() : "";
}
public int getmQuanId() {
GameHubPostJsonBasicProvider gameHubPostJsonBasicProvider = this.aKC;
if (gameHubPostJsonBasicProvider != null) {
return gameHubPostJsonBasicProvider.getQuanId();
}
return 0;
}
public int getmForumsId() {
GameHubPostJsonBasicProvider gameHubPostJsonBasicProvider = this.aKC;
if (gameHubPostJsonBasicProvider != null) {
return gameHubPostJsonBasicProvider.getForumsId();
}
return 0;
}
public String getTid() {
GameHubPostJsonBasicProvider gameHubPostJsonBasicProvider = this.aKC;
return gameHubPostJsonBasicProvider != null ? gameHubPostJsonBasicProvider.getDva() : "";
}
public String getmQuanName() {
GameHubPostJsonBasicProvider gameHubPostJsonBasicProvider = this.aKC;
return gameHubPostJsonBasicProvider != null ? gameHubPostJsonBasicProvider.getDvb() : "";
}
public int getmKindId() {
GameHubPostJsonBasicProvider gameHubPostJsonBasicProvider = this.aKC;
if (gameHubPostJsonBasicProvider != null) {
return gameHubPostJsonBasicProvider.getKindId();
}
return 0;
}
public boolean isVideo() {
GameHubPostJsonBasicProvider gameHubPostJsonBasicProvider = this.aKC;
return gameHubPostJsonBasicProvider != null && gameHubPostJsonBasicProvider.getDvc();
}
public boolean isIsQa() {
GameHubPostJsonBasicProvider gameHubPostJsonBasicProvider = this.aKC;
if (gameHubPostJsonBasicProvider != null) {
return gameHubPostJsonBasicProvider.getIsQA();
}
return false;
}
public int getPostRootType() {
return this.aKe;
}
public String getTrackTime() {
return PostTrackHelper.INSTANCE.getTrackJson();
}
public String getFullRequestParam() {
String[] split;
JSONObject jSONObject = new JSONObject();
String oldAuthCookie = UserCenterManager.getOldAuthCookie();
try {
jSONObject.put(NetworkDataProvider.NUM_PER_PAGE_KEY, "20");
jSONObject.put("p", "1");
jSONObject.put("thread_id", this.mPostId + "");
jSONObject.put("view", "1");
jSONObject.put(PushConsts.KEY_SERVICE_PIT, this.aJP + "");
jSONObject.put("scookie", oldAuthCookie);
jSONObject.put("show_image", "1");
jSONObject.put("only_host", this.aKF ? "1" : "0");
jSONObject.put("ord", com.m4399.gamecenter.plugin.main.manager.post.a.getOrderCache(this.mPostId));
jSONObject.put("show_quan", String.valueOf(this.aJQ));
jSONObject.put(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_FORUMS_ID, this.mForumsId + "");
jSONObject.put(com.m4399.gamecenter.plugin.main.database.tables.m.COLUMN_MSG_QUAN_ID, this.mGameHubId + "");
jSONObject.put("auto_push_qa", String.valueOf(this.aJO));
if (this.aJM) {
jSONObject.put("isMy", "1");
}
if (!TextUtils.isEmpty(this.mAppendParam) && (split = this.mAppendParam.split(ContainerUtils.FIELD_DELIMITER)) != null && split.length > 0) {
for (String str : split) {
String[] split2 = str.split(ContainerUtils.KEY_VALUE_DELIMITER);
if (split2 != null && split2.length > 0) {
jSONObject.put(split2[0], split2.length > 1 ? split2[1] : "");
}
}
}
if (!TextUtils.isEmpty(this.mFrom)) {
jSONObject.put("from", this.mFrom);
}
} catch (JSONException e) {
e.printStackTrace();
}
return jSONObject.toString();
}
@Keep
@Subscribe(tags = {@Tag("tag.user.follow.success")})
public void onFollowSuccess(Bundle bundle) {
bundle.getString("intent.extra.user.uid");
this.aKD.getPostUserModel().setFollowHe(bundle.getBoolean("intent.extra.is.follow"));
}
public void openRewardDialog(final String str) {
if (getContext() != null && this.aKD.isRewardOpen()) {
com.m4399.gamecenter.plugin.main.helpers.t.onEvent("post_reward_btn_click", "postid", Integer.valueOf(this.mPostId), "forumid", Integer.valueOf(getmForumsId()), "gamehubid", Integer.valueOf(getmQuanId()), "times", this.aLg + "", "trace", getPageTracer().getFullTrace());
if (!NetworkStatusManager.checkIsAvalible()) {
ToastUtils.showToast(getContext(), R.string.network_error);
return;
}
if (this.aKD.isNeedRealName() || this.aKD.isNeedUnderage()) {
if (UserCenterManager.getAuthStatus() != 1) {
LocalAuthStatusManager.INSTANCE.get().requestUserAuthStatus(2, new OnCheckListener<Boolean>() {
@Override
public void onCheckFinish(Boolean bool) {
int authStatus = UserCenterManager.getAuthStatus();
if (authStatus == 1) {
GameHubForumPostFragment.this.ch(str);
} else {
GameHubForumPostFragment gameHubForumPostFragment = GameHubForumPostFragment.this;
gameHubForumPostFragment.b(authStatus, gameHubForumPostFragment.aKD.getAuthRoute(), true);
}
}
});
return;
} else {
ch(str);
return;
}
}
ci(str);
}
}
public void ch(String str) {
if (this.aKD.isNeedUnderage()) {
if (!com.m4399.gamecenter.plugin.main.utils.s.checkAdult(UserCenterManager.getBirthDate())) {
b(UserCenterManager.getAuthStatus(), this.aKD.getAuthRoute(), false);
return;
} else {
ci(str);
return;
}
}
ci(str);
}
private void ci(final String str) {
this.aLg++;
RewardDialog rewardDialog = new RewardDialog(getContext());
rewardDialog.setRequestParameter(this.aKD.getPostUserModel().getUid(), this.aKD.getTid(), this.aKD.getQuanId(), this.aKD.getForumsId());
rewardDialog.setRequstSuccessModel(this.aKD.getPostUserModel());
rewardDialog.setRewardListener(new RewardDialog.b() {
@Override
public void onSuccess() {
if (TextUtils.isEmpty(str)) {
return;
}
GameHubForumPostFragment.this.mWebView.loadJs(com.m4399.gamecenter.plugin.main.utils.aq.buildSafeFuncCallJs(str + "()"));
}
});
rewardDialog.display();
}
public void b(int i, String str, boolean z) {
if (getContext() == null) {
return;
}
VerifiedDialog verifiedDialog = new VerifiedDialog(getContext());
verifiedDialog.setType(i);
verifiedDialog.setAdult(z);
verifiedDialog.setDetailRout(str);
verifiedDialog.show();
}
}