九游游戏中心HD v4.6.8.1版本的 MD5 值为:78c397802cc5ffdcc7f5502ede90502e
以下内容为反编译后的 InstallResultFragment.java 源代码,内容仅作参考
package cn.ninegame.gamemanager.upgrade;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import cn.ninegame.framework.NineGameClientApplication;
import cn.ninegame.gamemanager.NinegameBizFragment;
import cn.ninegame.gamemanager.download.model.pojo.DownloadRecord;
import cn.ninegame.gamemanager.game.gameinfo.model.InstalledGamesManager;
import cn.ninegame.gamemanager.settings.feedback.FeedbackWebFragment;
import cn.ninegame.gamemanagerhd.R;
import cn.ninegame.library.imageloader.NGImageView;
import cn.ninegame.library.imageloader.a;
import cn.ninegame.library.uilib.adapter.downloadbtn.DownLoadItemDataWrapper;
import cn.ninegame.library.util.bw;
import cn.ninegame.library.util.cc;
import java.io.File;
import java.util.List;
import org.json.JSONException;
import org.json.JSONObject;
@cn.ninegame.library.stat.f(a = "安装结果页")
public class InstallResultFragment extends NinegameBizFragment implements View.OnClickListener {
private static final String K = File.separator + "mnt" + File.separator + "asec" + File.separator;
private a C;
private String D;
private InstallStatWrapper E;
private DownloadRecord F;
private InstallStatItem G;
private int H;
private s I = new s();
private int J = -1;
private boolean L;
private TextView f1594a;
private TextView b;
private TextView c;
private TextView d;
private NGImageView e;
private NGImageView f;
private TextView g;
private RecyclerView h;
private View i;
private List<DownLoadItemDataWrapper> j;
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
if (this.k == null) {
this.k = layoutInflater.inflate(R.layout.install_result, viewGroup, false);
this.f1594a = (TextView) this.k.findViewById(R.id.install_result_tv);
this.b = (TextView) this.k.findViewById(R.id.install_result_detail_tv);
this.f = (NGImageView) this.k.findViewById(R.id.install_result_icon);
this.c = (TextView) this.k.findViewById(R.id.install_result_ok);
this.c.setOnClickListener(this);
this.d = (TextView) this.k.findViewById(R.id.install_result_cancel);
this.d.setOnClickListener(this);
this.g = (TextView) this.k.findViewById(R.id.install_result_game_name);
this.e = (NGImageView) this.k.findViewById(R.id.install_result_game_icon);
this.h = (RecyclerView) this.k.findViewById(R.id.recommend_game_list);
this.h.setLayoutManager(new LinearLayoutManager(getContext(), 0, false));
this.i = d(R.id.recommend_game_container);
View findViewById = this.k.findViewById(R.id.install_result_top);
if (Build.VERSION.SDK_INT >= 19) {
((RelativeLayout.LayoutParams) findViewById.getLayoutParams()).topMargin = bw.a(getResources());
}
String a2 = cn.ninegame.library.dynamicconfig.b.a().a("feed_back_page_id");
if (!TextUtils.isEmpty(a2)) {
try {
JSONObject jSONObject = new JSONObject(a2);
s sVar = new s();
sVar.f1632a = jSONObject.optInt("apk_error_id");
sVar.b = jSONObject.optInt("sd_card_error_id");
sVar.c = jSONObject.optInt("uninstall_remain_id");
this.I = sVar;
} catch (JSONException e) {
cn.ninegame.library.stat.b.b.c(e.toString(), new Object[0]);
}
}
}
return super.onCreateView(layoutInflater, viewGroup, bundle);
}
@Override
public void onViewCreated(View view, Bundle bundle) {
String string;
String str;
boolean z;
super.onViewCreated(view, bundle);
Bundle c_ = c_();
Intent intent = (Intent) c_.getParcelable("intent");
int i = c_.getInt("resultCode");
this.E = (InstallStatWrapper) c_.getParcelable("stat_info");
if (this.L || this.E == null) {
this.k.post(new u(this));
return;
}
int a2 = cc.a(getContext(), 32.0f);
int a3 = cc.a(getContext(), 8.0f);
this.F = this.E.downloadRecord;
this.G = this.E.installStatItem;
this.e.a(this.F.appIconUrl, cn.ninegame.library.imageloader.h.d(a2, a2, a3));
this.g.setText(this.F.appName);
switch (i) {
case -1:
cn.ninegame.library.stat.b.b.a("InstallApp# Success", new Object[0]);
this.f1594a.setText(getContext().getString(R.string.text_install_success));
this.c.setVisibility(0);
this.d.setVisibility(0);
this.H = 1000;
this.G.result = 0;
break;
case 1:
this.f1594a.setText(getContext().getString(R.string.text_install_fail));
this.f.a(cn.ninegame.library.imageloader.l.DRAWABLE.a("2130838079"), cn.ninegame.library.imageloader.h.p());
this.c.setVisibility(8);
this.d.setVisibility(0);
if (intent != null) {
this.H = intent.getIntExtra("android.intent.extra.INSTALL_RESULT", 1004);
cn.ninegame.library.stat.b.b.b("InstallApp# Fail the errorCode is = " + this.H, new Object[0]);
TextView textView = this.b;
int i2 = this.H;
String string2 = getString(R.string.text_install_fail_more);
switch (i2) {
case InstallStatItem.INSTALL_ERROR_CODE_NO_MATCHING_ABIS:
case -16:
case -9:
case -8:
string = getString(R.string.text_install_fail_cpu_abi_incompatible);
str = string2;
z = false;
break;
case InstallStatItem.INSTALL_ERROR_CODE_DUPLICATE_PERMISSION:
case -13:
string = getString(R.string.text_install_fail_pkg_conflict);
str = string2;
z = false;
break;
case InstallStatItem.INSTALL_ERROR_CODE_CERTIFICATE_ENCODING:
case InstallStatItem.INSTALL_ERROR_CODE_NO_CERTIFICATES:
case InstallStatItem.INSTALL_ERROR_CODE_UNEXPECTED_EXCEPTION:
case InstallStatItem.INSTALL_ERROR_CODE_BAD_MANIFEST:
case -100:
case -23:
case -22:
case -2:
String string3 = getString(R.string.text_install_fail_invalid_apk);
this.J = this.I.f1632a;
string = string3;
str = string2;
z = true;
break;
case InstallStatItem.INSTALL_ERROR_CODE_INCONSISTENT_CERTIFICATES:
case -7:
string = getString(R.string.text_install_fail_inconsistent_certificates);
str = string2;
z = false;
break;
case -25:
string = getString(R.string.text_install_fail_older_pkg);
str = string2;
z = false;
break;
case -24:
this.J = this.I.c;
string = getString(R.string.text_install_fail_uid_change);
str = string2;
z = true;
break;
case -20:
case InstallStatItem.INSTALL_ERROR_CODE_NO_SECURE_CONTAINER:
this.J = this.I.b;
if (new File(K + "smdl2tmp1").exists()) {
this.G.hasTempFile = 1;
string = getString(R.string.text_install_fail_no_secure_container);
str = string2;
z = true;
break;
} else {
this.G.hasTempFile = 0;
string = getString(R.string.text_install_fail_no_secure_container);
str = string2;
z = true;
break;
}
case -12:
string = getString(R.string.text_install_fail_older_sdk);
str = string2;
z = false;
break;
case -11:
string = getString(R.string.text_install_fail_odex);
str = string2;
z = false;
break;
case -4:
string = getString(R.string.text_install_fail_insufficient_storage);
str = getString(R.string.clean_data);
z = true;
break;
case -3:
string = getString(R.string.text_install_fail_invalid_uri);
str = string2;
z = false;
break;
case -1:
string = getString(R.string.text_install_fail_already_install);
str = string2;
z = false;
break;
default:
string = getString(R.string.text_install_fail_not_install);
str = string2;
z = false;
break;
}
if (z) {
this.c.setVisibility(0);
this.c.setText(str);
}
textView.setText(string + getString(R.string.install_error_code, Integer.valueOf(i2)));
} else {
cn.ninegame.library.stat.b.b.a("InstallApp# Fail but data is null", new Object[0]);
this.H = 1004;
this.b.setText(getContext().getString(R.string.text_install_fail_not_install));
}
this.G.errorCode = this.H;
this.G.result = 2;
break;
}
if (!(cn.ninegame.library.network.b.a(NineGameClientApplication.a()) != cn.ninegame.library.network.a.UNAVAILABLE && this.H == 1000)) {
return;
}
new cn.ninegame.gamemanager.download.a.a(String.valueOf(this.F.gameId), 240, "", 12).a(new v(this));
}
@Override
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
this.L = true;
}
@Override
public void onDestroyView() {
if (this.G != null) {
cn.ninegame.gamemanager.upgrade.b.a.a(this.G);
cn.ninegame.library.stat.b.b.a("InstallApp# reportWa" + this.G.toString(), new Object[0]);
}
super.onDestroyView();
}
@Override
public void onClick(View view) {
int id = view.getId();
if (this.G != null) {
switch (id) {
case R.id.install_result_cancel:
this.G.userAction = 2;
w();
return;
case R.id.install_result_ok:
if (this.H == -4) {
this.G.userAction = 3;
Intent intent = new Intent("android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS");
if (intent.resolveActivity(getContext().getPackageManager()) != null) {
startActivity(intent);
w();
return;
}
cc.b((int) R.string.text_install_open_clear_fail_tip);
return;
} else if (this.H == 1000) {
this.G.userAction = 1;
Bundle bundle = new Bundle();
bundle.putString(InstalledGamesManager.KEY_PKG_NAME, this.F.pkgName);
cn.ninegame.genericframework.basic.g.a().b().a("base_biz_launch_app", bundle);
w();
return;
} else {
this.G.userAction = 4;
if (this.J != -1) {
int i = this.J;
StringBuilder sb = new StringBuilder();
sb.append("http://kf.9game.cn/selfservices/").append(i).append("?&sceneId=B01&gameId=").append(this.F.gameId);
cn.ninegame.library.util.l.b(sb.toString());
return;
}
cn.ninegame.genericframework.basic.g.a().b().c(FeedbackWebFragment.class.getName(), new Bundle());
return;
}
default:
return;
}
}
}
public class a extends RecyclerView.Adapter<b> {
Context f1595a;
List<DownLoadItemDataWrapper> b;
a.d c = cn.ninegame.library.imageloader.h.m();
@Override
public final void onBindViewHolder(b bVar, int i) {
b bVar2 = bVar;
DownLoadItemDataWrapper downLoadItemDataWrapper = this.b.get(i);
bVar2.b.setText(downLoadItemDataWrapper.getGameName());
bVar2.f1596a.a(downLoadItemDataWrapper.getAppIconUrl(), this.c);
bVar2.f1596a.setOnClickListener(new w(this, i, downLoadItemDataWrapper));
cn.ninegame.library.stat.a.j.b().a("rec_show", InstallResultFragment.this.D, String.valueOf(downLoadItemDataWrapper.getGameId()), "");
}
public a(Context context, List<DownLoadItemDataWrapper> list) {
this.f1595a = context;
this.b = list;
}
@Override
public final int getItemCount() {
return this.b.size();
}
@Override
public final b onCreateViewHolder(ViewGroup viewGroup, int i) {
return new b(LayoutInflater.from(this.f1595a).inflate(R.layout.install_result_simple_recommend_game_item, viewGroup, false));
}
}
class b extends RecyclerView.ViewHolder {
public NGImageView f1596a;
public TextView b;
public b(View view) {
super(view);
this.b = (TextView) view.findViewById(R.id.game_name_tv);
this.f1596a = (NGImageView) view.findViewById(R.id.game_icon_iv);
}
}
public static void b(InstallResultFragment installResultFragment) {
installResultFragment.C = new a(installResultFragment.getContext(), installResultFragment.j);
installResultFragment.h.addItemDecoration(new cn.ninegame.library.uilib.generic.d.b(cc.a(installResultFragment.getContext(), 25.0f), true, true));
installResultFragment.h.setAdapter(installResultFragment.C);
}
}