4399游戏盒 v7.2.1.31版本的 MD5 值为:951717f45e3fda95c8a358caf4ca93e1
以下内容为反编译后的 WeeklyReportActivity.java 源代码,内容仅作参考
package com.m4399.gamecenter.plugin.main.controllers.message.box;
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.database.tables.CachesTable;
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.DeviceUtils;
import com.framework.utils.UMengEventUtils;
import com.m4399.gamecenter.plugin.main.PluginApplication;
import com.m4399.gamecenter.plugin.main.R;
import com.m4399.gamecenter.plugin.main.controllers.web.BaseWebViewActivity;
import com.m4399.gamecenter.plugin.main.controllers.web.CommentJsInterface;
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.manager.v;
import com.m4399.gamecenter.plugin.main.models.share.ShareDataModel;
import com.m4399.gamecenter.plugin.main.providers.message.w;
import com.m4399.gamecenter.plugin.main.utils.bc;
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 WeeklyReportActivity extends BaseWebViewActivity implements Toolbar.OnMenuItemClickListener {
public static final String MODULE_WEEKLY_CONTENT = "weekly_content";
private int aoI;
private int boe;
private w bof = new w();
private int mCommentId;
private boolean mIsFavorite;
private int mReplyId;
@Override
protected String getWebUrl() {
return null;
}
@Override
protected int getLayoutID() {
return R.layout.m4399_activity_weekly_report;
}
@Override
public void initData(Intent intent) {
super.initData(intent);
this.boe = intent.getIntExtra("weekly.report.page", 1);
this.aoI = intent.getIntExtra("intent.extra.weekly.report.id", 0);
this.mCommentId = intent.getIntExtra("intent.extra.comment.id", 0);
this.mReplyId = intent.getIntExtra("intent.extra.reply.id", 0);
if (this.aoI == 0) {
String stringExtra = intent.getStringExtra("intent.extra.weekly.report.id");
if (TextUtils.isEmpty(stringExtra) || "0".equals(stringExtra)) {
return;
}
this.aoI = bc.toInt(stringExtra);
}
}
@Override
public void initToolBar() {
super.initToolBar();
setTitle(getString(R.string.weekly_report));
getToolBar().setOnMenuItemClickListener(this);
}
@Override
public int getMenuID() {
return R.menu.m4399_menu_activities_detail;
}
@Override
public void initView(Bundle bundle) {
super.initView(bundle);
this.mWebView.getLayoutParams().width = DeviceUtils.getDeviceWidthPixelsAbs(PluginApplication.getApplication());
kN();
loadData();
com.m4399.gamecenter.plugin.main.manager.activities.a.getInstance().onTaskFinish("task_type_goto_weekly_report");
RxBus.register(this);
}
@Override
public void onDestroy() {
super.onDestroy();
RxBus.unregister(this);
}
private void loadData() {
onWebViewPageStart(this.mWebView, "", null);
v.getInstance().loadTemplate(3, this.mWebView, null, new v.b(this, this.mWebView, 3));
}
@Override
public void initJavascriptInterface(WebViewLayout webViewLayout) {
super.initJavascriptInterface(webViewLayout);
this.mAndroidJsInterface = new GameCommentJsInterface(webViewLayout, this);
((GameCommentJsInterface) this.mAndroidJsInterface).setFrom(MODULE_WEEKLY_CONTENT);
((CommentJsInterface) this.mAndroidJsInterface).setWeeklyReportId(this.aoI);
this.mAndroidJsInterface.addWebRequestParam("positionPage", Integer.valueOf(this.boe));
this.mAndroidJsInterface.addWebRequestParam(CachesTable.COLUMN_KEY, Integer.valueOf(this.aoI));
if (this.mCommentId != 0) {
this.mAndroidJsInterface.addWebRequestParam("commentId", Integer.valueOf(this.mCommentId));
}
if (this.mReplyId != 0) {
this.mAndroidJsInterface.addWebRequestParam("replyId", Integer.valueOf(this.mReplyId));
}
this.mWebView.addJavascriptInterface(this.mAndroidJsInterface, "android");
}
@Keep
@Subscribe(tags = {@Tag("fragment.add.comment")})
public void processAddNewComment(Bundle bundle) {
if (D(bundle)) {
int i = bundle.getInt("intent.extra.comment.action.type");
E(i == 1 ? k.JS_ADD_WEEKLY_REPORT_CMT : k.JS_REPLY_COMMON_CMT_SUCCESS, k.buildWeeklyReportParamsJsonStr(bundle));
}
}
@Keep
@Subscribe(tags = {@Tag("tag.common.comment.del")})
public void removeWeeklyReportComment(String str) {
E(k.JS_DEL_COMMON_CMT, str);
}
@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(MODULE_WEEKLY_CONTENT)) {
return;
}
int i = bundle.getInt("intent.extra.comment.id");
k.executeJs(this.mWebView, "javascript:m_common.praiseSuccess(" + i + ")");
}
@Keep
@Subscribe(tags = {@Tag("tag.common.comment.reply")})
public void onCommonCmtReplySuccess(String str) {
E(k.JS_REPLY_COMMON_CMT_SUCCESS, str);
}
private void E(String str, String str2) {
k.executeJs(this.mWebView, str + "('" + str2 + "')");
}
private boolean D(Bundle bundle) {
int i;
return (bundle == null || (i = bundle.getInt("intent.extra.weekly.report.id")) == 0 || i != this.aoI) ? false : true;
}
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == R.id.m4399_menu_activities_favorite) {
bj(this.mIsFavorite);
return true;
}
if (itemId != R.id.m4399_menu_activities_share) {
return true;
}
ve();
return true;
}
@Subscribe(tags = {@Tag("tag.Favorite.completed")})
public void onFavoriteCompleted(Bundle bundle) {
if (E(bundle)) {
boolean z = bundle.getBoolean("intent.extra.is.favorite");
this.mIsFavorite = z;
changeFavoriteState(z);
}
}
private boolean E(Bundle bundle) {
return bundle != null && bundle.getInt("intent.extra.favorite.id") == this.aoI && bundle.getInt("intent.action.share.success") == 2 && bundle.getInt("subtype") == 21;
}
public void changeFavoriteState(boolean z) {
MenuItem findItem = getToolBar().getMenu().findItem(R.id.m4399_menu_activities_favorite);
if (findItem != null) {
findItem.setIcon(z ? R.mipmap.m4399_png_menubar_collect_icon_hl : R.mipmap.m4399_png_menubar_collect_icon_nl);
}
}
private void bj(boolean z) {
String[] strArr = new String[4];
strArr[0] = "ID";
strArr[1] = String.valueOf(this.aoI);
strArr[2] = "action";
strArr[3] = this.mIsFavorite ? "取消收藏" : "收藏";
UMengEventUtils.onEvent("ad_one_week_hotspot_detail_collect_click", strArr);
com.m4399.gamecenter.plugin.main.manager.favorites.c.getInstance().setFavorite(this, 2, z, this.aoI, true, true, 21);
}
private void kN() {
com.m4399.gamecenter.plugin.main.manager.favorites.c.getInstance().checkIsFavorites(2, this.aoI, new Object[]{21}, new com.m4399.gamecenter.plugin.main.manager.favorites.b() {
@Override
public void onChecked(boolean z) {
WeeklyReportActivity.this.changeFavoriteState(z);
WeeklyReportActivity.this.mIsFavorite = z;
}
});
}
private void ve() {
UMengEventUtils.onEvent("ad_one_week_hotspot_detail_share_click", "from", String.valueOf(this.aoI));
if (this.bof.isDataLoaded() && !this.bof.isEmpty()) {
b(this.bof.getShareDataModel());
} else {
this.bof.setWeeklyReportId(this.aoI);
this.bof.loadData(new com.m4399.gamecenter.plugin.main.providers.bb.a() {
@Override
public void onBefore() {
}
public void onProgress(long j, long j2) {
}
@Override
public void onSuccess() {
WeeklyReportActivity weeklyReportActivity = WeeklyReportActivity.this;
weeklyReportActivity.b(weeklyReportActivity.bof.getShareDataModel());
}
@Override
public void onFailure(Throwable th, int i, String str, int i2, JSONObject jSONObject) {
WeeklyReportActivity weeklyReportActivity = WeeklyReportActivity.this;
ToastUtils.showToast(weeklyReportActivity, HttpResultTipUtils.getFailureTip(weeklyReportActivity, th, i, str));
}
});
}
}
@Override
public void onNetErrorViewClick() {
super.onNetErrorViewClick();
loadData();
}
public void b(final ShareDataModel shareDataModel) {
com.m4399.gamecenter.plugin.main.manager.share.d.openShareDialog(this, com.m4399.gamecenter.plugin.main.manager.share.d.buildWeekReportShareChannelList(shareDataModel.getShareChannelsConfig()), new com.m4399.gamecenter.plugin.main.controllers.share.b() {
@Override
public void onShareItemClick(ShareItemKind shareItemKind) {
com.m4399.gamecenter.plugin.main.manager.share.d.share(WeeklyReportActivity.this, shareDataModel, shareItemKind);
UMengEventUtils.onEvent("ad_one_week_hotspot_detail_share_channel", "from", String.valueOf(WeeklyReportActivity.this.aoI), "type", WeeklyReportActivity.this.getString(shareItemKind.getTitleResId()));
}
}, "", "");
}
@Override
public void onWebTitleChange(String str) {
super.onWebTitleChange(str);
if (TextUtils.isEmpty(str)) {
return;
}
UMengEventUtils.onEvent("ad_msgbox_week_click", "type", str);
}
}