WebSafe v1.1.41版本的 MD5 值为:96ed6df40dd84513ac3690256a6d64c4
以下内容为反编译后的 LoginActivity.java 源代码,内容仅作参考
package com.at.wwka.installer;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.provider.Browser;
import android.text.Editable;
import android.text.Html;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.LinkMovementMethod;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.at.wwka.R;
import com.at.wwka.client.s;
import com.at.wwka.common.Globals;
import com.at.wwka.common.d;
import com.at.wwka.common.e;
import com.at.wwka.common.h;
import com.at.wwka.common.i;
import com.at.wwka.common.j;
import com.at.wwka.common.k;
import com.at.wwka.parent.RegisterParentDeviceService;
import java.util.regex.Pattern;
public class LoginActivity extends b implements Handler.Callback, View.OnClickListener, View.OnLongClickListener {
public static final Pattern a = Pattern.compile("^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$");
static LoginActivity b = null;
TextView A;
a B;
Typeface C;
Typeface D;
Typeface E;
private j J;
TextView c;
TextView d;
TextView e;
TextView f;
TextView g;
TextView h;
EditText i;
EditText k;
EditText l;
EditText m;
Button n;
TextView o;
TextView p;
TextView q;
TextView r;
TextView s;
LinearLayout u;
LinearLayout v;
TextView w;
TextView x;
TextView y;
TextView z;
boolean j = true;
String t = "";
private String F = null;
private String G = null;
private Handler H = null;
private Thread I = null;
private void a(Context context) {
try {
this.J.a("ws_parent_login", "ws_onclick");
if (!new s(getApplicationContext()).f(false)) {
startService(new Intent(context, RegisterParentDeviceService.class));
}
new e(context).a();
startActivity(new Intent("android.intent.action.VIEW", Uri.parse(i.d())));
} catch (Exception e) {
}
}
private void a(com.at.wwka.common.a aVar) {
if (!aVar.a) {
if (TextUtils.isEmpty(aVar.b)) {
return;
}
a(aVar.b, R.string.registration_error);
return;
}
Intent intent = new Intent(this, DeviceSelectionActivity.class);
intent.putExtra("AuthToken", aVar.c);
startActivityForResult(intent, 3001);
f();
}
private void a(h.b bVar) {
boolean z = false;
String str = null;
if (bVar != null) {
if (!bVar.a || bVar.d != 200) {
str = bVar.a();
} else if (bVar.e != null) {
try {
String b2 = h.b(bVar.e);
k kVar = new k();
if (kVar.a(b2)) {
String b3 = kVar.b("code");
String b4 = kVar.b("message");
String b5 = kVar.b("name");
if (b3 != null) {
b3 = b3.trim();
if (b3.length() > 0 && Integer.parseInt(b3) == 0 && !TextUtils.isEmpty(b5)) {
z = true;
}
}
if (!z) {
if (b4 != null && b4.length() > 0) {
str = b4;
} else if (b3 != null && b3.length() > 0) {
str = getString(R.string.error_title) + " " + b3;
}
}
a(false);
}
} catch (Exception e) {
}
}
}
if (z) {
p();
} else {
a(str, R.string.registration_error);
}
}
public static void a(Object obj) {
if (b == null || obj == null) {
return;
}
try {
b.a("Debug", obj.toString());
} catch (Exception e) {
}
}
private void a(final String str) {
b(R.string.contacting_server);
final com.at.wwka.common.a aVar = new com.at.wwka.common.a(this);
new Thread(new Runnable() {
@Override
public void run() {
try {
LoginActivity.a(1004, 0, 0, Boolean.valueOf(aVar.a(aVar.b(str))).booleanValue() ? "" : aVar.b);
} catch (Exception e) {
Globals.a(e.getMessage());
}
}
}).start();
}
private void a(boolean z) {
findViewById(R.id.submit_button).setEnabled(z);
}
static boolean a(int i, int i2, int i3, Object obj) {
if (b == null || b.H == null) {
return false;
}
return b.H.sendMessage(b.H.obtainMessage(i, i2, i3, obj));
}
private void b(String str) {
if (TextUtils.isEmpty(str)) {
b(new s(getApplicationContext()).q(), "welcome1");
} else {
b((Object) str);
}
}
public void b(String str, int i) {
try {
startActivityForResult(new Intent("android.intent.action.DELETE", Uri.fromParts("package", str, null)), i);
} catch (Exception e) {
}
}
private void b(final String str, final String str2) {
a(false);
b(R.string.contacting_server);
this.I = new Thread() {
@Override
public void run() {
try {
LoginActivity.a(1001, 0, 0, h.a(LoginActivity.b, str, str2));
} catch (Exception e) {
Globals.a(e.getMessage());
}
}
};
this.I.start();
}
private boolean b(boolean z) {
EditText editText = (EditText) findViewById(R.id.username_field);
this.F = editText.getText().toString().trim();
editText.setText(this.F);
if (this.E != null) {
editText.setTypeface(this.E);
}
if (this.F.length() > 0) {
return true;
}
if (!z) {
a(R.string.credentials_notice);
}
return false;
}
@SuppressLint({"WrongConstant"})
private boolean c(String str) {
if (str == null || str.length() <= 0) {
return false;
}
try {
Intent intent = new Intent(str + ".client.action.START");
intent.addFlags(32);
getApplicationContext().sendBroadcast(intent);
return true;
} catch (Exception e) {
a(e);
return false;
}
}
private boolean c(boolean z) {
this.G = this.i.getText().toString();
if (this.G.length() > 0) {
return true;
}
if (z) {
return false;
}
a(R.string.credentials_notice);
return false;
}
private boolean d(String str) {
try {
return getPackageManager().getPackageInfo(str, 0) != null;
} catch (Exception e) {
return false;
}
}
private void h() {
try {
this.B = a.a(getApplicationContext());
this.C = this.B.a("fonts/roboto_medium.ttf");
this.D = this.B.a("fonts/roboto_bold.ttf");
this.E = this.B.a("fonts/roboto_regular.ttf");
if (this.C != null) {
this.c.setTypeface(this.C);
this.d.setTypeface(this.C);
this.p.setTypeface(this.C);
this.q.setTypeface(this.C);
this.o.setTypeface(this.C);
}
if (this.E != null) {
this.k.setTypeface(this.E);
this.l.setTypeface(this.E);
this.m.setTypeface(this.E);
this.h.setTypeface(this.E);
}
if (this.D != null) {
this.r.setTypeface(this.D);
this.e.setTypeface(this.D);
this.f.setTypeface(this.D);
this.g.setTypeface(this.D);
this.w.setTypeface(this.D);
this.y.setTypeface(this.D);
this.z.setTypeface(this.D);
this.x.setTypeface(this.D);
this.A.setTypeface(this.D);
this.n.setTypeface(this.D);
}
} catch (Exception e) {
}
}
private void i() {
f();
c(getPackageName());
setResult(-1);
finish();
Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME");
startActivity(intent);
}
private void j() {
this.J.a("ws_already_have_an_account", "ws_onclick");
new s(getApplicationContext()).e("");
startActivityForResult(new Intent(this, DeviceSelectionActivity.class), 3001);
}
private void k() {
try {
startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://login.webwatcher.com/en/account/ForgotPassword")));
} catch (Exception e) {
Globals.a(e.getMessage());
}
}
private void l() {
String d;
String str;
String e;
String g;
d dVar = new d(this);
if (dVar.d() != null) {
str = ("".length() > 0 ? "\n\n" : "") + "DID:\t\t" + h.a(d, 4);
}
if (dVar.e() != null) {
if (str.length() > 0) {
str = str + "\n\n";
}
str = str + "TID:\t\t" + h.a(e, 4);
}
if (dVar.g() != null) {
if (str.length() > 0) {
str = str + "\n\n";
}
str = str + "AID:\t\t" + h.a(g, 4);
}
String f = dVar.f();
if (f != null) {
if (str.length() > 0) {
str = str + "\n\n";
}
str = str + "MAC:\t" + f;
}
a("Model: " + d.a(), str);
}
private void m() {
n();
boolean b2 = b(false);
if (b2) {
b2 = c(false);
}
if (b2) {
b2 = o();
}
if (b2) {
b(this.F, this.G);
}
}
private void n() {
try {
((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 2);
} catch (Exception e) {
}
}
private boolean o() {
CheckBox checkBox = (CheckBox) findViewById(R.id.terms_check);
boolean z = checkBox.isChecked() || checkBox.getVisibility() == 8;
if (!z) {
a(R.string.notice_title, R.string.terms_notice);
}
return z;
}
private void p() {
if (d("com.ati.client")) {
q();
} else {
s();
}
}
private void q() {
a(R.string.notice_title, R.string.uninstall_previous_notice, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
LoginActivity.this.r();
LoginActivity.this.b("com.ati.client", 2002);
}
});
}
@SuppressLint({"NewApi", "WrongConstant"})
public void r() {
if (Build.VERSION.SDK_INT >= 8) {
try {
Intent intent = new Intent("com.ati.client.action.START");
intent.putExtra("action", "deactivatedeviceadmin");
intent.addFlags(32);
getApplicationContext().sendBroadcast(intent);
Thread.sleep(500L);
} catch (Exception e) {
}
}
}
private void s() {
b(R.string.purge_notice);
new Thread() {
@Override
public void run() {
try {
Looper.prepare();
LoginActivity.a(1002, 0, LoginActivity.this.t() ? 1 : 0, null);
} catch (Exception e) {
Globals.a(e.getMessage());
}
}
}.start();
}
public boolean t() {
String[] strArr = {"webwatcher", "sonarcentral", "interguard", "laptopcop", "awarenesstech", "mycontrolconsole", "getati"};
try {
ContentResolver contentResolver = getContentResolver();
Cursor allVisitedUrls = Browser.getAllVisitedUrls(contentResolver);
if (allVisitedUrls != null) {
int columnIndex = allVisitedUrls.getColumnIndex("url");
boolean z = false;
for (boolean moveToFirst = allVisitedUrls.moveToFirst(); moveToFirst; moveToFirst = allVisitedUrls.moveToNext()) {
try {
String string = allVisitedUrls.getString(columnIndex);
if (string != null) {
String lowerCase = string.toLowerCase();
for (String str : strArr) {
if (lowerCase.contains(str)) {
Browser.deleteFromHistory(contentResolver, string);
z = true;
break;
}
}
}
} catch (Exception e) {
}
try {
} catch (Exception e2) {
return z;
}
}
return z;
}
return false;
} catch (Exception e3) {
return false;
}
}
private boolean u() {
boolean z;
boolean a2 = Globals.a();
if (!a2) {
a2 = b(true);
if (a2) {
a2 = c(true);
}
if (a2) {
a2 = this.F.equalsIgnoreCase("qa");
}
if (a2) {
z = this.G.equalsIgnoreCase("qamode");
if (z) {
String string = getString(R.string.submit_label);
((TextView) findViewById(R.id.tv_submit_button)).setText(Globals.b() ? string + " (QA Mode)" : string);
}
return z;
}
}
z = a2;
if (z) {
}
return z;
}
private void v() {
this.k.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
if (editable != null) {
if (TextUtils.isEmpty(editable.toString().trim())) {
LoginActivity.this.o.setVisibility(0);
LoginActivity.this.k.setBackgroundResource(R.drawable.edit_text_error);
return;
}
LoginActivity.this.o.setVisibility(8);
LoginActivity.this.k.setBackgroundResource(R.drawable.edit_text);
}
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
});
}
private void w() {
this.l.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
if (editable != null) {
String trim = editable.toString().trim();
if (TextUtils.isEmpty(trim)) {
LoginActivity.this.p.setVisibility(0);
LoginActivity.this.l.setBackgroundResource(R.drawable.edit_text_error);
} else if (!LoginActivity.a.matcher(trim).matches()) {
LoginActivity.this.p.setVisibility(0);
LoginActivity.this.l.setBackgroundResource(R.drawable.edit_text_error);
} else {
LoginActivity.this.t = trim;
LoginActivity.this.p.setVisibility(8);
LoginActivity.this.l.setBackgroundResource(R.drawable.edit_text);
}
}
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
});
}
private void x() {
this.m.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
if (editable != null) {
String trim = editable.toString().trim();
if (TextUtils.isEmpty(trim)) {
LoginActivity.this.q.setText(R.string.please_provide_confirmation_email);
LoginActivity.this.q.setVisibility(0);
LoginActivity.this.m.setBackgroundResource(R.drawable.edit_text_error);
} else if (trim.equals(LoginActivity.this.t)) {
LoginActivity.this.q.setVisibility(8);
LoginActivity.this.m.setBackgroundResource(R.drawable.edit_text);
} else {
LoginActivity.this.q.setText(R.string.email_doesn_t_matches);
LoginActivity.this.q.setVisibility(0);
LoginActivity.this.m.setBackgroundResource(R.drawable.edit_text_error);
}
}
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
});
}
void a() {
this.v = (LinearLayout) findViewById(R.id.view_createAccount);
this.k = (EditText) findViewById(R.id.ed_enter_name);
this.l = (EditText) findViewById(R.id.ed_create);
this.m = (EditText) findViewById(R.id.ed_confirm);
this.n = (Button) findViewById(R.id.btn_submit);
this.o = (TextView) findViewById(R.id.tvNewUserNameError);
this.p = (TextView) findViewById(R.id.tvEmailError);
this.q = (TextView) findViewById(R.id.tvConfirmEmailError);
this.w = (TextView) findViewById(R.id.tvTitleCreateAccount);
this.x = (TextView) findViewById(R.id.tv_name);
this.y = (TextView) findViewById(R.id.tv_create);
this.z = (TextView) findViewById(R.id.tv_confirm);
this.A = (TextView) findViewById(R.id.tvNote);
v();
w();
x();
this.n.setOnClickListener(this);
}
void a(final String str, final String str2, final String str3) {
b.b(R.string.create_account_status);
new Thread(new Runnable() {
@Override
public void run() {
try {
com.at.wwka.common.a aVar = new com.at.wwka.common.a(LoginActivity.b);
aVar.a(str, str2, str3);
if (aVar.a) {
LoginActivity.this.J.a("ws_signup", "ws_ontaskcomplete");
new s(LoginActivity.b).d(str3);
}
LoginActivity.a(1003, 0, 0, aVar);
} catch (Exception e) {
Globals.a(e.getMessage());
}
}
}).start();
}
@Override
public AlertDialog b(Object obj) {
AlertDialog b2 = super.b(obj);
a(true);
return b2;
}
void b() {
n();
this.u.setVisibility(8);
this.v.setVisibility(0);
}
void c() {
n();
this.u.setVisibility(0);
this.v.setVisibility(8);
}
void d() {
String str;
n();
String trim = this.k.getText().toString().trim();
String trim2 = this.l.getText().toString().trim();
String trim3 = this.m.getText().toString().trim();
String[] split = trim.split(" ");
boolean z = true;
if (trim.equals("") || split.length < 2) {
this.o.setVisibility(0);
this.k.setBackgroundResource(R.drawable.edit_text_error);
z = false;
}
if (trim2.equals("") || !a.matcher(trim2).matches()) {
this.p.setVisibility(0);
this.l.setBackgroundResource(R.drawable.edit_text_error);
z = false;
}
if (trim3.equals("")) {
this.q.setVisibility(0);
this.m.setBackgroundResource(R.drawable.edit_text_error);
z = false;
}
if (!trim2.equals(trim3)) {
z = false;
}
if (z) {
String str2 = "";
int indexOf = trim.indexOf(32);
if (indexOf != -1) {
str = trim.substring(0, indexOf);
if (trim.length() > indexOf) {
str2 = trim.substring(indexOf + 1, trim.length());
}
} else {
str = trim;
}
a(str, str2, trim2);
}
}
public void e() {
startActivity(new Intent(this, UninstallInstructionActivity.class));
finish();
}
@Override
public boolean handleMessage(Message message) {
try {
switch (message.what) {
case 1001:
a((h.b) message.obj);
return true;
case 1002:
f();
a(true);
if (new s(this).c(false)) {
e();
return true;
}
startActivityForResult(Build.VERSION.SDK_INT >= 8 ? Build.VERSION.SDK_INT >= 22 ? new Intent(this, AppMonitoringSetupActivity.class) : Build.VERSION.SDK_INT >= 14 ? new Intent(this, WebMonitoringSetupActivity.class) : new Intent(this, DeviceAdminSetupActivity.class) : new Intent(this, UninstallInstructionActivity.class), 2001);
return true;
case 1003:
a((com.at.wwka.common.a) message.obj);
return true;
case 1004:
b((String) message.obj);
return true;
default:
return false;
}
} catch (Exception e) {
a(e);
return false;
}
}
@Override
protected void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i == 2001 && i2 == -1) {
if (intent == null || !intent.hasExtra("HideIntent")) {
return;
}
i();
} else if (i == 2002) {
s();
} else if (i == 3001 && i2 == -1) {
s sVar = new s(getApplicationContext());
if (sVar.j(false)) {
a(getApplicationContext());
finish();
return;
}
this.J.a("ws_sel_child_device", "ws_onclick");
String r = sVar.r();
if (TextUtils.isEmpty(r)) {
c();
return;
}
this.J.a("ws_sel_child_device_after_signup", "ws_onclick");
a(r);
}
}
@Override
public void onBackPressed() {
if (new s(this).c(false) || this.u.getVisibility() != 0) {
super.onBackPressed();
return;
}
startActivity(new Intent(this, DeviceSelectionActivity.class));
this.u.setVisibility(8);
this.v.setVisibility(0);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.submit_button:
m();
return;
case R.id.tvforgotpassword_link:
k();
return;
case R.id.singup_link:
b();
return;
case R.id.btn_submit:
d();
return;
case R.id.tvAlreadyHaveAnAccount:
j();
return;
default:
return;
}
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.J = new j(this);
if (new s(getApplicationContext()).j(false)) {
a(getApplicationContext());
finish();
return;
}
setContentView(R.layout.login_signup);
b = this;
this.H = new Handler(this);
final View findViewById = findViewById(R.id.submit_button);
findViewById.setOnClickListener(this);
findViewById.setOnLongClickListener(this);
new e(getApplicationContext()).a("");
this.i = (EditText) findViewById(R.id.password_field);
this.i.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
if (!LoginActivity.this.r.hasFocus() && LoginActivity.this.j) {
LoginActivity.this.r.setFocusableInTouchMode(true);
LoginActivity.this.r.requestFocus();
LoginActivity.this.j = false;
}
if (!LoginActivity.this.r.hasFocus() || LoginActivity.this.j) {
return;
}
LoginActivity.this.r.setFocusableInTouchMode(false);
LoginActivity.this.i.setFocusableInTouchMode(true);
LoginActivity.this.i.requestFocus();
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
if (LoginActivity.this.j || findViewById.hasFocus()) {
return;
}
LoginActivity.this.j = true;
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
});
this.r = (TextView) findViewById(R.id.tvforgotpassword_link);
this.r.setOnClickListener(this);
this.h = (TextView) findViewById(R.id.terms_link);
this.h.setMovementMethod(LinkMovementMethod.getInstance());
this.e = (TextView) findViewById(R.id.singup_link);
this.e.setText(Html.fromHtml(getString(R.string.signup_link)));
this.e.setOnClickListener(this);
this.s = (TextView) findViewById(R.id.tvAlreadyHaveAnAccount);
this.s.setOnClickListener(this);
this.u = (LinearLayout) findViewById(R.id.lllogin);
this.c = (TextView) findViewById(R.id.tvLogin_Info);
this.d = (TextView) findViewById(R.id.tvSignUp_info);
this.f = (TextView) findViewById(R.id.tv_submit_button);
this.g = (TextView) findViewById(R.id.tvLoginTitle);
if (Build.VERSION.SDK_INT >= 21) {
Window window = getWindow();
window.addFlags(Integer.MIN_VALUE);
window.setStatusBarColor(Color.rgb(153, 0, 51));
}
a();
h();
if (new s(this).c(false)) {
c();
this.d.setVisibility(8);
this.e.setVisibility(8);
this.g.setText(getText(R.string.log_in));
this.c.setVisibility(8);
findViewById(R.id.imageView).setVisibility(8);
this.h.setVisibility(8);
CheckBox checkBox = (CheckBox) findViewById(R.id.terms_check);
checkBox.setChecked(true);
checkBox.setVisibility(8);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onLongClick(View view) {
if (view.getId() == R.id.submit_button) {
return u();
}
return false;
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.info:
c(getPackageName());
l();
break;
}
return false;
}
@Override
public void onResume() {
if (new s(getApplicationContext()).j(false)) {
a(getApplicationContext());
finish();
}
super.onResume();
}
}