360手机助手 v3.3.0版本的 MD5 值为:127c345ad16bbebee6e347381328afd0
以下内容为反编译后的 FriendAppPageActivity.java 源代码,内容仅作参考
package com.qihoo.appstore.personnalcenter.friends;
import android.content.SharedPreferences;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.webkit.WebBackForwardList;
import android.widget.CheckBox;
import android.widget.FrameLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import android.widget.Toast;
import com.qihoo.appstore.activities.MainActivity;
import com.qihoo.appstore.activities.StatFragmentActivity;
import com.qihoo.appstore.utils.bk;
import com.qihoo.appstore.utils.dc;
import com.qihoo.appstore.webview.MyWebView;
import com.qihoo.freewifi.push.R;
import com.qihoo.speedometer.Config;
import java.util.Set;
public class FriendAppPageActivity extends StatFragmentActivity implements View.OnClickListener {
private MyWebView f2920a;
private View f2921b;
private View c;
private View d;
private FrameLayout e;
private PopupWindow f;
private ViewStub g;
private CheckBox h;
private TextView i;
private String m;
private String n;
private String o;
private am p;
private boolean j = false;
private boolean k = false;
private long l = 0;
private Handler q = new n(this);
public void a(int i) {
new Thread(new m(this, i)).start();
}
private void a(View view) {
if (this.f == null) {
View inflate = LayoutInflater.from(this).inflate(R.layout.friend_app_page_setting, (ViewGroup) null);
this.f = new PopupWindow(inflate, -2, -2);
this.f.setBackgroundDrawable(new BitmapDrawable(getResources()));
this.f.setOutsideTouchable(true);
this.f.setFocusable(true);
inflate.setOnKeyListener(new s(this));
this.h = (CheckBox) inflate.findViewById(R.id.switch_check);
this.h.setChecked(l());
this.i = (TextView) inflate.findViewById(R.id.care_friend_entrance);
this.i.setOnClickListener(new t(this));
this.h.setOnTouchListener(new u(this, view));
this.h.setOnCheckedChangeListener(new v(this));
}
if (!this.f.isShowing() || !this.f.isShowing()) {
this.f.showAsDropDown(view, 0, 10);
} else {
this.f.dismiss();
this.f = null;
}
}
public void a(boolean z) {
new Thread(new k(this)).start();
}
private boolean a(int i, int i2) {
if (this.p == null) {
return true;
}
boolean z = (i == this.p.f && i2 == this.p.g) ? false : true;
if (MainActivity.e().b() && !TextUtils.isEmpty(this.n)) {
z |= (this.m.equals(this.p.f2944a) && this.n.equals(this.p.c)) ? false : true;
}
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("FriendAppPageActivity", "contactCount = " + i + ", mRemoteFriendCount = " + this.p.f + ", appCount = " + i2 + ", mRemoteAppCount = " + this.p.g + ", qid = " + this.m + ", mRemoteQid = " + this.p.f2944a + ", mobile = " + this.n + ", mRemoteMobile = " + this.p.c + " ------> return " + z);
}
return z;
}
private void c() {
this.m = com.qihoo.appstore.personnalcenter.g.b(this, "qid");
String b2 = com.qihoo.appstore.personnalcenter.g.b(this, "mobile");
String b3 = x.b(b2);
this.n = com.qihoo.appstore.e.d.f.a(b3);
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("FriendAppPageActivity", "gen my mobile: originMobile = " + b2 + ", trimMobile = " + b3 + ", mobile = " + this.n + " , qid:" + this.m);
}
if (getIntent() == null) {
return;
}
int intExtra = getIntent().getIntExtra("FriendAppPageActivity_ROUTE", -1);
if (intExtra == 1) {
com.qihoo.appstore.r.d.a("onestepfriend", 1);
} else if (intExtra == 2) {
com.qihoo.appstore.r.d.a("nomalloginfriend", 1);
} else if (intExtra == 3) {
com.qihoo.appstore.r.d.a("loginbindfriend", 1);
}
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("FriendAppPageActivity", "initParams, route= " + intExtra);
}
}
private void d() {
this.g = (ViewStub) findViewById(R.id.confirm_view);
this.f2921b = findViewById(R.id.loading);
findViewById(R.id.back).setOnClickListener(this);
this.d = findViewById(R.id.setting);
this.d.setVisibility(8);
this.d.setOnClickListener(this);
this.c = findViewById(R.id.retry);
this.e = (FrameLayout) findViewById(R.id.webview_container);
this.f2920a = new MyWebView(this);
this.e.addView(this.f2920a, 0);
this.f2920a.a(this.f2921b, this.c, (View) null);
this.f2920a.g.setActivity(this);
this.f2920a.setActivity(this);
this.f2920a.clearHistory();
this.f2920a.setNeedCookie(true);
this.f2921b.setVisibility(0);
}
private void e() {
if (this.j) {
f();
this.j = false;
} else if (this.k) {
a(true);
this.k = false;
}
if (this.f2920a != null) {
this.f2920a.requestFocus();
}
this.f2920a.f();
}
private void f() {
this.o = i();
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("FriendAppPageActivity", this.o);
}
if (am.a() == null) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("FriendAppPageActivity", "startPreparePage, FriendRuntimeConfig.getConfig() == null, getRemoteInfo()");
}
m();
} else {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("FriendAppPageActivity", "startPreparePage, FriendRuntimeConfig.getConfig() != null, preloadContactsAndApps directly");
}
this.d.setVisibility(0);
a(false);
}
}
public void g() {
Set b2 = x.b();
Set a2 = x.a();
boolean a3 = a(b2.size(), a2.size());
if (FriendRelationshipActivity.f2922a) {
FriendRelationshipActivity.f2922a = false;
w.a(this.m, this.n, b2, a2);
this.q.sendEmptyMessage(1);
} else if (!a3) {
this.q.sendEmptyMessage(1);
} else {
w.a(this.m, this.n, b2, a2);
this.q.sendEmptyMessage(1);
}
}
private void h() {
this.q.sendEmptyMessage(0);
}
private String i() {
StringBuilder sb = new StringBuilder();
sb.append(dc.g).append("user/check?");
if (!MainActivity.e().b() || TextUtils.isEmpty(this.n)) {
sb.append("sign=").append(w.a(com.qihoo.appstore.r.g.f, Config.INVALID_IP));
sb.append("&nc=1");
sb.append("&nm=1");
} else {
sb.append("sign=").append(w.a(this.m, this.n));
a aVar = new a(this.n);
if (!aVar.a()) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.c("FriendAppPageActivity", "genFriendPageUrl.isSucceed() returns false");
}
return Config.INVALID_IP;
}
sb.append("&mb=").append(aVar.c()[0]).append("&dkey=").append(aVar.b());
}
sb.append("&titlebar_space=1").append("&fsf=1").append("&addr_show_type=").append(af.f2935a).append("&show_by_app_type=").append(af.f2936b).append("×tramp=").append(System.currentTimeMillis());
return com.qihoo.appstore.r.g.a(sb.toString(), MainActivity.g(), true);
}
public void j() {
p pVar = new p(this);
q qVar = new q(this);
String string = MainActivity.e().getString(R.string.personnal_center_friend_init_contacts_fail_dialog_msg_other);
if (com.qihoo.appstore.utils.t.a()) {
string = MainActivity.e().getString(R.string.personnal_center_friend_init_contacts_fail_dialog_msg_meizu);
}
com.qihoo.appstore.d.e.a(MainActivity.e(), R.drawable.dialog_icon_info, MainActivity.e().getString(R.string.personnal_center_friend_init_contacts_fail_dialog_title), string, new String[]{MainActivity.e().getString(R.string.personnal_center_friend_init_contacts_fail_dialog_left), MainActivity.e().getString(R.string.personnal_center_friend_init_contacts_fail_dialog_right)}, new int[]{R.drawable.btn_dialog_pos, R.drawable.btn_dialog_neg}, new int[]{R.color.new_ui_color_blue_style, R.color.black}, pVar, null, null, false, qVar, null, null);
}
private void k() {
this.g.setVisibility(0);
findViewById(R.id.confirm_page_back).setOnClickListener(this);
findViewById(R.id.confirm_btn).setOnClickListener(this);
com.qihoo.appstore.r.d.a("followpage", 1);
}
private boolean l() {
am a2 = am.a();
return (a2 == null || a2.e == 1) ? false : true;
}
private void m() {
new Thread(new l(this)).start();
}
public String n() {
StringBuilder sb = new StringBuilder(com.qihoo.appstore.personnalcenter.q.g());
if (!MainActivity.e().b() || TextUtils.isEmpty(this.n)) {
sb.append("sign=").append(w.a(com.qihoo.appstore.r.g.f, Config.INVALID_IP));
sb.append("&nc=1");
sb.append("&nm=1");
sb.append("&m2=").append(com.qihoo.appstore.r.g.f);
} else {
sb.append("sign=").append(w.a(this.m, this.n));
a aVar = new a(this.n);
if (!aVar.a()) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.c("FriendAppPageActivity", "genFriendPageUrl.isSucceed() returns false");
}
return Config.INVALID_IP;
}
sb.append("&mb=").append(aVar.c()[0]);
sb.append("&dkey=").append(aVar.b());
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("FriendAppPageActivity", "getRemoteInfoUrl(), url:" + sb.toString());
}
}
return sb.toString();
}
protected boolean a() {
if (!this.f2920a.i()) {
try {
WebBackForwardList copyBackForwardList = this.f2920a.copyBackForwardList();
if (copyBackForwardList != null) {
String url = copyBackForwardList.getCurrentItem().getUrl();
String url2 = copyBackForwardList.getItemAtIndex(0).getUrl();
if (url != null && url.equals(url2)) {
this.f2920a.clearHistory();
}
}
} catch (Exception e) {
}
if (!this.f2920a.canGoBack() || System.currentTimeMillis() - this.l <= 500) {
if (this.f2920a != null) {
this.f2920a.clearHistory();
this.f2920a.goBack();
this.f2920a.loadUrl("javascript:void document.body.innerHTML = '';");
}
new Handler().postDelayed(new r(this), 500L);
} else {
this.l = System.currentTimeMillis();
this.f2920a.goBack();
}
}
return true;
}
public boolean b() {
return this.f2920a.d();
}
@Override
public String getStatTag() {
return "friendapp";
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.back:
case R.id.confirm_page_back:
if (b()) {
return;
}
onkeyBack();
return;
case R.id.confirm_btn:
SharedPreferences i = com.qihoo.appstore.personnalcenter.a.a.i();
if (!MainActivity.e().b() || TextUtils.isEmpty(this.n)) {
com.qihoo360.mobilesafe.util.ag.a(i.edit().putBoolean("PREF_KEY_FRIEND_ASSOCIATION_CONFIRMED_NO_BIND", true));
} else {
com.qihoo360.mobilesafe.util.ag.a(i.edit().putBoolean(com.qihoo.appstore.personnalcenter.a.a.e("PREF_KEY_FRIEND_ASSOCIATION_CONFIRMED_"), true));
}
com.qihoo.appstore.personnalcenter.a.a.f(Config.INVALID_IP);
this.g.setVisibility(8);
e();
com.qihoo.appstore.r.d.a("followok", 1);
return;
case R.id.setting:
a(view);
return;
default:
return;
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.personnal_center_friends_page);
this.j = true;
this.mStatTag = getStatTag();
c();
d();
b.c();
}
@Override
public void onDestroy() {
if (this.f2920a != null) {
this.f2920a.b();
this.f2920a.loadUrl("javascript:document.body.innerHTML = '';");
this.f2920a.destroy();
}
super.onDestroy();
}
@Override
public boolean onKeyDown(int i, KeyEvent keyEvent) {
return i == 4 ? a() : super.onKeyDown(i, keyEvent);
}
@Override
public void onPause() {
super.onPause();
if (this.f2920a != null) {
this.f2920a.clearFocus();
this.f2920a.g();
}
}
@Override
public void onResume() {
super.onResume();
SharedPreferences i = com.qihoo.appstore.personnalcenter.a.a.i();
boolean z = i.getBoolean("PREF_KEY_FRIEND_FORCE_NOT_SHOW_ASSOCIATION_CONFIRMED", false);
if (MainActivity.e().b() && !TextUtils.isEmpty(this.n)) {
boolean z2 = i.getBoolean(com.qihoo.appstore.personnalcenter.a.a.e("PREF_KEY_FRIEND_ASSOCIATION_CONFIRMED_"), false);
boolean z3 = i.getBoolean(com.qihoo.appstore.personnalcenter.a.a.e("PREF_KEY_NO_SHOW_FRIEND_ASSOCIATION_CONFIRMED_FROM_FRIEND_FEED_"), false);
if (z2 || z || z3) {
e();
return;
} else {
k();
return;
}
}
if (!com.qihoo.appstore.utils.f.c("can_get_mobile_by_m2", false)) {
if (MainActivity.e().b()) {
Toast.makeText(this, R.string.personnal_friend_bind_phone, 1).show();
} else {
Toast.makeText(this, R.string.personnal_friend_login_first, 1).show();
}
h();
return;
}
if (i.getBoolean("PREF_KEY_FRIEND_ASSOCIATION_CONFIRMED_NO_BIND", false) || z) {
e();
} else {
k();
}
}
}