换机精灵 v2.5.4版本的 MD5 值为:79a45ef9a3e238691e836db31e5f23f0
以下内容为反编译后的 CloudContactActivity.java 源代码,内容仅作参考
package com.cx.launcher.cloud.ui;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.FrameLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.cx.huanji.R;
import com.cx.huanji.localcontacts.util.SideBar;
import com.umeng.socialize.net.utils.SocializeProtocolConstants;
import java.io.File;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.http.HttpStatus;
public class CloudContactActivity extends BaseCloudActivity implements com.cx.launcher.cloud.d.n, com.cx.launcher.cloud.t, com.cx.launcher.cloud.w {
private com.cx.launcher.cloud.c.j A;
com.cx.launcher.cloud.d.p r;
private com.cx.launcher.cloud.a.j s = null;
private ListView t = null;
private FrameLayout u = null;
private TextView v = null;
private SideBar w = null;
private List x = null;
private List y = null;
private l z = null;
public void a(com.cx.launcher.cloud.c.d dVar) {
File e = this.n.e();
if (e.exists()) {
e.delete();
}
String absolutePath = e.getAbsolutePath();
StringBuilder sb = new StringBuilder();
sb.append("http://yun.goyihu.com/cloud/api/V1.0/backup/contacts");
sb.append("?params=");
try {
sb.append(URLEncoder.encode(this.m.a(dVar).toString(), "utf-8"));
String b2 = com.cx.launcher.cloud.f.a.b(this.k);
com.cx.launcher.cloud.c.g gVar = new com.cx.launcher.cloud.c.g(com.cx.base.f.i.CONTACT);
gVar.a(com.cx.launcher.cloud.c.h.DOWNLOAD);
gVar.z = this.f996b.getString(R.string.launcher_contacts);
gVar.f1083b = sb.toString();
gVar.e(System.currentTimeMillis());
gVar.e(absolutePath);
this.r = this.o.b(b2);
if (this.r == null) {
this.r = new com.cx.launcher.cloud.d.p(this.f996b, gVar, absolutePath);
this.r.a(false);
this.r.a(this);
this.r.a(b2);
} else {
this.r.a(this);
}
this.o.a(this.r, dVar);
} catch (Exception e2) {
e2.printStackTrace();
this.m.a(false);
}
}
private void a(com.cx.launcher.cloud.c.g gVar, boolean z) {
if (z) {
h();
this.m.a(false);
com.cx.tools.e.a.c("CloudContactActivity", "handleDownloadData download error");
} else {
com.cx.tools.e.a.c("CloudContactActivity", "handleDownloadData download success,start parse xml");
this.l.a((com.cx.launcher.cloud.w) this);
this.l.a(gVar.h());
}
}
private void b(CharSequence charSequence) {
String str;
this.x.clear();
String charSequence2 = charSequence.toString();
String str2 = "";
if (com.cx.tools.i.k.a(charSequence2)) {
this.x.addAll(this.y);
this.s.a(this.x, "", "");
com.cx.tools.e.a.c("CloudContactActivity", "empty==>");
} else {
if (this.y != null && this.y.size() > 0) {
for (com.cx.huanji.d.a aVar : this.y) {
if (aVar.g() != null && aVar.g().size() > 0) {
ArrayList g = aVar.g();
int i = 0;
while (i < g.size()) {
String c2 = ((com.cx.huanji.d.f) aVar.g().get(i)).c();
if (c2.indexOf(charSequence2) != -1) {
aVar.f1239a = c2;
this.x.add(aVar);
str = "phone";
} else {
str = str2;
}
i++;
str2 = str;
}
}
if (aVar.f() != null && aVar.f().toUpperCase().indexOf(charSequence2.toUpperCase()) > -1) {
if (aVar.g() == null || aVar.g().size() <= 0) {
aVar.f1239a = "";
} else {
aVar.f1239a = ((com.cx.huanji.d.f) aVar.g().get(0)).c();
}
this.x.add(aVar);
str2 = SocializeProtocolConstants.PROTOCOL_KEY_FRIENDS_NAME;
}
}
}
if (this.x.size() > 0) {
this.s.a(this.x, charSequence2, str2);
} else {
this.s.a(this.x, "", "");
}
com.cx.tools.e.a.c("CloudContactActivity", "full==>");
}
com.cx.tools.e.a.c("CloudContactActivity", "result:" + charSequence2 + ",size:" + this.x.size());
}
private void c(boolean z) {
h();
this.m.a(false);
}
private void g() {
this.g.setVisibility(8);
this.h.setVisibility(8);
b(R.drawable.contact_nodata_cantact, R.string.tel_contacts_nodata);
b(8);
}
public void h() {
b();
if (this.y == null || this.y.size() == 0) {
g();
}
com.cx.tools.e.a.c("CloudContactActivity", "handleResultUI-->" + Thread.currentThread().getName());
}
private void i() {
ArrayList c2 = this.s.c();
com.cx.tools.e.a.c("CloudContactActivity", "handleDeleteResult()-->" + c2.size());
if (this.y == null || c2 == null) {
return;
}
ArrayList arrayList = new ArrayList();
arrayList.addAll(c2);
boolean z = arrayList.size() == this.y.size();
int size = c2.size();
for (int i = 0; i < size; i++) {
com.cx.huanji.d.a aVar = (com.cx.huanji.d.a) c2.get(i);
if (this.y.contains(aVar)) {
this.y.remove(aVar);
}
}
if (this.y != null) {
this.s.a(this.y);
a(0, false);
this.n.b(arrayList, this.k, z);
}
}
public void j() {
this.s.a(this.y);
b(0);
this.u.setVisibility(0);
this.g.setVisibility(0);
this.h.setVisibility(0);
}
private void k() {
this.z = new l(this, null);
this.z.execute("");
}
private void l() {
com.cx.launcher.cloud.d.p b2 = this.o.b(com.cx.launcher.cloud.f.a.b(this.k));
if (b2 != null) {
this.o.a(b2, true);
}
if (this.z != null && this.z.getStatus() == AsyncTask.Status.RUNNING) {
this.z.cancel(true);
}
this.m.a(com.cx.base.f.i.CONTACT.a());
com.cx.tools.e.a.c("CloudContactActivity", "Cancel contact request thread!");
}
@Override
public void a() {
}
@Override
protected void a(byte b2) {
if (b2 == 1) {
this.l.a(this.s.c());
Intent intent = new Intent();
intent.putExtra("dataType", com.cx.base.f.i.CONTACT.a());
intent.setClass(this, CloudDataImportActivity.class);
startActivityForResult(intent, HttpStatus.SC_SWITCHING_PROTOCOLS);
return;
}
if (b2 == 2) {
this.j = com.cx.base.widgets.l.a(this.f996b, String.format(getString(R.string.cloud_delete_contact_tip), Integer.valueOf(this.s.c().size())), this.f996b.getString(R.string.cancel), new j(this), this.f996b.getString(R.string.confirm), new k(this));
if (this.j != null) {
this.j.show();
}
}
}
@Override
public void a(int i) {
switch (i) {
case 100001:
com.cx.tools.e.a.c("CloudContactActivity", "Contact xml not exist,parse failed!");
break;
case 100002:
com.cx.tools.e.a.c("CloudContactActivity", "Parse contact xml error!");
break;
}
c(true);
}
@Override
public void a(int i, int i2) {
com.cx.tools.e.a.c("CloudContactActivity", "onDeleteResult-->type:" + i + ",result:" + i2);
if (i2 == 10001) {
Toast.makeText(this, getString(R.string.cloud_contact_delete_success), 0).show();
i();
} else {
Toast.makeText(this, getString(R.string.cloud_contact_delete_failed), 0).show();
}
h();
}
@Override
public void a(com.cx.launcher.cloud.d.o oVar, int i, long j, com.cx.launcher.cloud.c.g gVar) {
}
@Override
public void a(com.cx.launcher.cloud.d.o oVar, int i, com.cx.launcher.cloud.c.g gVar) {
com.cx.launcher.cloud.f.a.a(this.f996b, i);
a(gVar, true);
}
@Override
public void a(CharSequence charSequence) {
b(charSequence);
}
@Override
public void a(Map map) {
this.y = (List) map.get("_key_contact_data");
com.cx.tools.e.a.c("CloudContactActivity", "onParseFileFinished-->list size:" + (this.y != null ? this.y.size() : 0));
if (this.y != null) {
if (this.y.size() > 0) {
j();
} else {
g();
}
this.n.b(this.y, this.k);
if (this.A != null) {
this.A.d(this.A.c());
this.n.a(this.A);
}
com.cx.tools.e.a.c("CloudContactActivity", "onParseFileFinished-->" + this.k.w() + ",size:" + this.y.size() + "," + this.k.s());
} else {
g();
}
c(false);
}
@Override
public boolean a(com.cx.launcher.cloud.c.g gVar) {
a(gVar, false);
return false;
}
@Override
public void b(com.cx.launcher.cloud.d.o oVar, int i, com.cx.launcher.cloud.c.g gVar) {
}
@Override
protected void b(boolean z) {
if (z) {
this.s.b();
} else {
this.s.a();
}
}
@Override
protected int c() {
return R.layout.cloud_contact_list_layout;
}
@Override
protected String d() {
return getString(R.string.launcher_contacts);
}
@Override
protected void e() {
finish();
}
@Override
public void f() {
l();
if (this.y == null || this.y.size() == 0) {
g();
}
}
@Override
protected void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i == 101 && i2 == -1) {
a(0, false);
this.s.a();
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.x = new ArrayList();
this.t = (ListView) findViewById(R.id.lv_cloud_contact);
this.u = (FrameLayout) findViewById(R.id.fl_contact_data);
this.v = (TextView) findViewById(R.id.tv_fast_position);
this.w = (SideBar) findViewById(R.id.letter_searchbar);
this.s = new com.cx.launcher.cloud.a.j(this);
this.t.setAdapter((ListAdapter) this.s);
this.s.a(new h(this));
this.p.setVisibility(8);
this.w.setOnTouchingLetterChangedListener(new i(this));
k();
}
@Override
public void onDestroy() {
super.onDestroy();
this.l.k();
if (this.r != null) {
this.r.b(this);
}
l();
}
}