4399游戏盒 v7.2.1.31版本的 MD5 值为:951717f45e3fda95c8a358caf4ca93e1
以下内容为反编译后的 SpecialDetailWebActivity.java 源代码,内容仅作参考
package com.m4399.gamecenter.plugin.main.controllers.special;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Keep;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.MenuItem;
import com.framework.net.ILoadPageEventListener;
import com.framework.rxbus.RxBus;
import com.framework.rxbus.annotation.Subscribe;
import com.framework.rxbus.annotation.Tag;
import com.framework.rxbus.thread.EventThread;
import com.framework.utils.JSONUtils;
import com.framework.utils.UMengEventUtils;
import com.m4399.gamecenter.plugin.main.R;
import com.m4399.gamecenter.plugin.main.controllers.web.BaseWebViewActivity;
import com.m4399.gamecenter.plugin.main.controllers.web.GameCommentJsInterface;
import com.m4399.gamecenter.plugin.main.helpers.k;
import com.m4399.gamecenter.plugin.main.manager.share.ShareItemKind;
import com.m4399.gamecenter.plugin.main.models.share.ShareDataModel;
import com.m4399.gamecenter.plugin.main.models.zone.ZoneType;
import com.m4399.gamecenter.plugin.main.providers.g.f;
import com.m4399.gamecenter.plugin.main.providers.special.SpecialDetailBrowseDataProvider;
import com.m4399.gamecenter.plugin.main.widget.web.WebViewLayout;
import com.m4399.support.utils.HttpResultTipUtils;
import com.m4399.support.utils.ToastUtils;
import org.json.JSONObject;
public class SpecialDetailWebActivity extends BaseWebViewActivity implements Toolbar.OnMenuItemClickListener, com.m4399.gamecenter.plugin.main.manager.favorites.b, com.m4399.gamecenter.plugin.main.manager.task.a {
private String aAT;
private String aDV;
private boolean aKG;
private int apb;
private int apm;
private int apn;
private String apo;
private String apq;
private GameCommentJsInterface bKY;
private f bKZ;
private ShareDataModel bLa;
private SpecialDetailBrowseDataProvider bLb;
private ILoadPageEventListener apu = new ILoadPageEventListener() {
@Override
public void onBefore() {
}
@Override
public void onSuccess() {
ToastUtils.showToast(SpecialDetailWebActivity.this, R.string.reply_comment_success);
k.executeReplyCommentJs(SpecialDetailWebActivity.this.mWebView, SpecialDetailWebActivity.this.apo, SpecialDetailWebActivity.this.apn);
}
@Override
public void onFailure(Throwable th, int i, String str, int i2, JSONObject jSONObject) {
SpecialDetailWebActivity specialDetailWebActivity = SpecialDetailWebActivity.this;
ToastUtils.showToast(specialDetailWebActivity, HttpResultTipUtils.getFailureTip(specialDetailWebActivity, th, i, str));
}
};
private ILoadPageEventListener apt = new ILoadPageEventListener() {
@Override
public void onBefore() {
}
@Override
public void onSuccess() {
ToastUtils.showToast(SpecialDetailWebActivity.this, R.string.publish_comment_success);
k.executeAddCommentJs(SpecialDetailWebActivity.this.mWebView, SpecialDetailWebActivity.this.apm, SpecialDetailWebActivity.this.apo);
}
@Override
public void onFailure(Throwable th, int i, String str, int i2, JSONObject jSONObject) {
SpecialDetailWebActivity specialDetailWebActivity = SpecialDetailWebActivity.this;
ToastUtils.showToast(specialDetailWebActivity, HttpResultTipUtils.getFailureTip(specialDetailWebActivity, th, i, str));
}
};
@Override
protected boolean isRefreshTitleWithWeb() {
return false;
}
@Override
public String getInstallTaskFlag() {
return this.aAT;
}
@Override
protected String getWebUrl() {
return this.aDV;
}
@Override
protected int getLayoutID() {
return R.layout.m4399_activity_webview;
}
@Override
public void initData(Intent intent) {
super.initData(intent);
this.apq = intent.getStringExtra("intent.extra.webview.title");
this.aAT = intent.getStringExtra("intent.extra.game.task.flag");
this.aDV = intent.getStringExtra("intent.extra.webview.url");
this.apb = intent.getIntExtra("intent.extra.special.id", 0);
u(intent);
}
private void u(Intent intent) {
String stringExtra = intent.getStringExtra("intent.extra.share.content");
if (TextUtils.isEmpty(stringExtra)) {
return;
}
JSONObject parseJSONObjectFromString = JSONUtils.parseJSONObjectFromString(stringExtra);
this.bLa = new ShareDataModel();
this.bLa.parse(parseJSONObjectFromString);
}
@Override
public void initToolBar() {
super.initToolBar();
setTitle(this.apq);
getToolBar().setTag(R.id.toolbar_umeng_download_param, "找游戏");
getToolBar().setOnMenuItemClickListener(this);
}
@Override
public void initJavascriptInterface(WebViewLayout webViewLayout) {
super.initJavascriptInterface(webViewLayout);
this.bKY = new GameCommentJsInterface(webViewLayout, this);
this.bKY.setSpecialId(this.apb);
this.bKY.setFrom("special_detail_web");
this.bKY.setSpecialName(this.apq);
this.mWebView.addJavascriptInterface(this.bKY, "android");
}
@Keep
@Subscribe(tags = {@Tag("tag.common.comment.reply")})
public void onCommonCmtReplySuccess(String str) {
E(k.JS_REPLY_COMMON_CMT_SUCCESS, str);
}
@Keep
@Subscribe(tags = {@Tag("tag.common.comment.del")})
public void removeCommonComment(String str) {
E(k.JS_DEL_COMMON_CMT, str);
}
private void E(String str, String str2) {
k.executeJs(this.mWebView, str + "('" + str2 + "')");
}
@Keep
@Subscribe(tags = {@Tag("fragment.add.comment")})
public void processNewlyAddComment(Bundle bundle) {
if (bundle.getInt("intent.extra.special.id") != this.apb) {
return;
}
if (this.bKZ == null) {
this.bKZ = new f();
}
this.bKZ.setCommentType(2);
this.bKZ.setCommentTargetId(this.apb);
this.apo = bundle.getString("intent.extra.comment.content");
int i = bundle.getInt("intent.extra.comment.action.type", 1);
this.bKZ.setCommentAction(i);
this.bKZ.setCommentContent(this.apo);
if (i == 2) {
this.apn = bundle.getInt("intent.extra.comment.id");
this.bKZ.setCommentId(this.apn);
this.bKZ.loadData(this.apu);
} else {
this.apm = bundle.getInt("intent.extra.comment.rating", 3);
this.mWebView.scrollTo(0, 0);
this.bKZ.loadData(this.apt);
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
RxBus.register(this);
DB();
xg();
}
@Keep
@Subscribe(tags = {@Tag("tag.common.comment.praise")}, thread = EventThread.MAIN_THREAD)
public void praiseCommonComment(Bundle bundle) {
String string = bundle.getString("intent.extra.from.key");
if (TextUtils.isEmpty(string) || string.equals("special_detail_web")) {
return;
}
int i = bundle.getInt("intent.extra.comment.id");
k.executeJs(this.mWebView, "javascript:m_common.praiseSuccess(" + i + ")");
}
@Keep
@Subscribe(tags = {@Tag("tag.Favorite.completed")})
public void onFavoriteCompleted(Bundle bundle) {
if (J(bundle)) {
this.aKG = bundle.getBoolean("intent.extra.is.favorite");
xm();
}
}
private boolean J(Bundle bundle) {
int i;
return bundle.getInt("intent.action.share.success") == 5 && (i = bundle.getInt("intent.extra.favorite.id")) != 0 && i == this.apb;
}
private void DB() {
if (this.bLb == null) {
this.bLb = new SpecialDetailBrowseDataProvider();
this.bLb.setSpecialId(this.apb);
}
this.bLb.loadData(null);
}
@Override
public void onDestroy() {
super.onDestroy();
RxBus.unregister(this);
GameCommentJsInterface gameCommentJsInterface = this.bKY;
if (gameCommentJsInterface != null) {
gameCommentJsInterface.onDestroy();
}
}
@Override
public int getMenuID() {
return R.menu.m4399_menu_special_detail;
}
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == R.id.m4399_menu_share) {
ShareDataModel shareDataModel = this.bLa;
if (shareDataModel != null && !shareDataModel.isEmpty()) {
com.m4399.gamecenter.plugin.main.manager.share.d.openShareDialog(this, com.m4399.gamecenter.plugin.main.manager.share.d.buildShareItemKind(ZoneType.ZONE_SHARE_COMMON, this.bLa.getShareItemKinds()), new com.m4399.gamecenter.plugin.main.controllers.share.b() {
@Override
public void onShareItemClick(ShareItemKind shareItemKind) {
SpecialDetailWebActivity specialDetailWebActivity = SpecialDetailWebActivity.this;
com.m4399.gamecenter.plugin.main.manager.share.d.share(specialDetailWebActivity, specialDetailWebActivity.bLa, shareItemKind);
}
}, "", "");
UMengEventUtils.onEvent("ad_album_details_collect_share", "分享");
}
return true;
}
if (itemId != R.id.m4399_menu_favorite) {
return false;
}
com.m4399.gamecenter.plugin.main.manager.favorites.c.getInstance().setFavorite(this, 5, this.aKG, this.apb, true, true, new Object[0]);
UMengEventUtils.onEvent("ad_album_details_collect_share", this.aKG ? "取消收藏" : "收藏");
return true;
}
private void xg() {
com.m4399.gamecenter.plugin.main.manager.favorites.c.getInstance().checkIsFavorites(5, this.apb, null, this);
}
@Override
public void onChecked(boolean z) {
this.aKG = z;
if (getToolBar() != null) {
xm();
}
}
private void xm() {
MenuItem findItem = getToolBar().getMenu().findItem(R.id.m4399_menu_favorite);
if (findItem == null) {
return;
}
findItem.setTitle(this.aKG ? R.string.cancel_favorite : R.string.favorite);
findItem.setIcon(this.aKG ? R.mipmap.m4399_png_menubar_collect_icon_hl : R.mipmap.m4399_png_menubar_collect_icon_nl);
}
}