换机精灵 v2.5.4版本的 MD5 值为:79a45ef9a3e238691e836db31e5f23f0

以下内容为反编译后的 CloudCalllogActivity.java 源代码,内容仅作参考


package com.cx.launcher.cloud.ui;

import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;
import com.cx.huanji.R;
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.Locale;
import java.util.Map;
import org.apache.http.HttpStatus;

public class CloudCalllogActivity extends BaseCloudActivity implements com.cx.launcher.cloud.d.n, com.cx.launcher.cloud.t, com.cx.launcher.cloud.w {
    private static final String s = CloudCalllogActivity.class.getSimpleName();
    com.cx.launcher.cloud.d.p r;
    private ListView t = null;
    private com.cx.launcher.cloud.a.g u = null;
    private List v = null;
    private List w = null;
    private g x = null;
    private com.cx.launcher.cloud.c.j y;

    public void a(com.cx.launcher.cloud.c.d dVar) {
        File f = this.n.f();
        if (f.exists()) {
            f.delete();
        }
        String absolutePath = f.getAbsolutePath();
        StringBuilder sb = new StringBuilder();
        sb.append("http://yun.goyihu.com/cloud/api/V1.0/backup/calls");
        sb.append("?params=");
        try {
            sb.append(URLEncoder.encode(this.m.a(dVar).toString(), "utf-8"));
            String a2 = com.cx.launcher.cloud.f.a.a(this.k);
            com.cx.launcher.cloud.c.g gVar = new com.cx.launcher.cloud.c.g(com.cx.base.f.i.CALLLOG);
            gVar.a(com.cx.launcher.cloud.c.h.DOWNLOAD);
            gVar.z = this.f996b.getString(R.string.launcher_call_log);
            gVar.f1083b = sb.toString();
            gVar.e(System.currentTimeMillis());
            gVar.e(absolutePath);
            this.r = this.o.b(a2);
            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(a2);
            } else {
                this.r.a(this);
            }
            this.o.a(this.r, dVar);
        } catch (Exception e) {
            e.printStackTrace();
            this.m.c(false);
        }
    }

    private void a(com.cx.launcher.cloud.c.g gVar, boolean z) {
        if (z) {
            i();
            this.m.c(false);
            com.cx.tools.e.a.c(s, "handleDownloadData download error");
        } else {
            com.cx.tools.e.a.c(s, "handleDownloadData download success,start parse xml");
            this.l.a((com.cx.launcher.cloud.w) this);
            this.l.b(gVar.h());
        }
    }

    private void b(CharSequence charSequence) {
        this.v.clear();
        String charSequence2 = charSequence.toString();
        String str = "";
        if (com.cx.huanji.h.be.a(charSequence2)) {
            this.v.addAll(this.w);
            this.u.a(this.v, "", "");
            return;
        }
        if (this.w != null && this.w.size() > 0) {
            for (com.cx.huanji.b.a aVar : this.w) {
                String trim = aVar.f().trim();
                if (!com.cx.huanji.h.be.a(trim) && trim.indexOf(charSequence2) != -1) {
                    this.v.add(aVar);
                    str = "phone";
                }
                String lowerCase = com.cx.huanji.tel.n.a().a(trim).toLowerCase(Locale.CHINA);
                com.cx.huanji.tel.e.c a2 = com.cx.huanji.tel.f.a.a().a(trim);
                String str2 = a2 != null ? a2.f1828c : null;
                if (!com.cx.huanji.h.be.a(lowerCase) && lowerCase.indexOf(charSequence2.toLowerCase(Locale.CHINA)) != -1) {
                    this.v.add(aVar);
                    str = SocializeProtocolConstants.PROTOCOL_KEY_FRIENDS_NAME;
                }
                if (!com.cx.huanji.h.be.a(str2) && str2.toLowerCase(Locale.CHINA).indexOf(charSequence2.toLowerCase(Locale.CHINA)) != -1) {
                    this.v.add(aVar);
                    str = SocializeProtocolConstants.PROTOCOL_KEY_FRIENDS_NAME;
                }
            }
        }
        if (this.v.size() > 0) {
            this.u.a(this.v, charSequence2, str);
        } else {
            this.u.a(this.v, "", "");
        }
        com.cx.tools.e.a.c(s, "Search size:" + this.v.size() + ",type:" + str);
    }

    private void c(boolean z) {
        i();
        this.m.c(false);
    }

    private void h() {
        b(8);
        this.g.setVisibility(8);
        this.h.setVisibility(8);
        b(R.drawable.contact_nodata_call, R.string.tel_calllog_nodata);
    }

    public void i() {
        b();
        if (this.w == null || this.w.size() == 0) {
            h();
        }
    }

    private void j() {
        ArrayList c2 = this.u.c();
        com.cx.tools.e.a.c(s, "handleDeleteResult()-->" + c2.size());
        if (this.w == null || c2 == null) {
            return;
        }
        ArrayList arrayList = new ArrayList();
        arrayList.addAll(c2);
        boolean z = arrayList.size() == this.w.size();
        int size = c2.size();
        for (int i = 0; i < size; i++) {
            com.cx.huanji.b.a aVar = (com.cx.huanji.b.a) c2.get(i);
            if (this.w.contains(aVar)) {
                this.w.remove(aVar);
            }
        }
        if (this.w != null) {
            this.u.a(this.w);
            a(0, false);
            this.n.c(arrayList, this.k, z);
        }
    }

    private void k() {
        this.x = new g(this, null);
        this.x.execute("");
    }

    private void l() {
        com.cx.launcher.cloud.d.p b2 = this.o.b(com.cx.launcher.cloud.f.a.a(this.k));
        if (b2 != null) {
            this.o.a(b2, true);
        }
        if (this.x != null && this.x.getStatus() == AsyncTask.Status.RUNNING) {
            this.x.cancel(true);
        }
        this.m.a(com.cx.base.f.i.CALLLOG.a());
        com.cx.tools.e.a.c(s, "Cancel call record request thread!");
    }

    public void m() {
        this.u.a(this.w);
        b(0);
        this.t.setVisibility(0);
        this.g.setVisibility(0);
        this.h.setVisibility(0);
    }

    @Override
    public void a() {
    }

    @Override
    protected void a(byte b2) {
        if (b2 == 1) {
            this.l.b(this.u.c());
            Intent intent = new Intent();
            intent.putExtra("dataType", com.cx.base.f.i.CALLLOG.a());
            intent.setClass(this, CloudDataImportActivity.class);
            startActivityForResult(intent, HttpStatus.SC_PROCESSING);
            return;
        }
        if (b2 == 2) {
            this.j = com.cx.base.widgets.l.a(this.f996b, String.format(getString(R.string.cloud_delete_callog_tip), Integer.valueOf(this.u.c().size())), this.f996b.getString(R.string.cancel), new e(this), this.f996b.getString(R.string.confirm), new f(this));
            if (this.j != null) {
                this.j.show();
            }
        }
    }

    @Override
    public void a(int i) {
        switch (i) {
            case 100002:
            default:
                com.cx.tools.e.a.c(s, "onParseFileError-->" + i);
                i();
                return;
        }
    }

    @Override
    public void a(int i, int i2) {
        com.cx.tools.e.a.c(s, "onDeleteResult-->type:" + i + ",result:" + i2);
        if (i2 == 10001) {
            Toast.makeText(this, getString(R.string.cloud_call_record_delete_success), 0).show();
            j();
        } else {
            Toast.makeText(this, getString(R.string.cloud_call_record_delete_failed), 0).show();
        }
        i();
    }

    @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) {
        if (this.w == null || this.w.size() <= 0) {
            return;
        }
        b(charSequence);
    }

    @Override
    public void a(Map map) {
        this.w = (List) map.get("_key_calllog_data");
        if (this.w != null) {
            if (this.w.size() > 0) {
                m();
            } else {
                h();
            }
            this.n.c(this.w, this.k);
            if (this.y != null) {
                this.y.f(this.y.e());
                this.n.a(this.y);
            }
            com.cx.tools.e.a.c(s, "onParseFileFinished-->" + this.k.w() + ",size:" + this.w.size() + "," + this.k.s());
        } else {
            h();
        }
        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.u.b();
        } else {
            this.u.a();
        }
    }

    @Override
    protected int c() {
        return R.layout.cloud_calllog_list_layout;
    }

    @Override
    protected String d() {
        return getString(R.string.launcher_call_log);
    }

    @Override
    protected void e() {
        finish();
    }

    @Override
    public void f() {
        l();
        if (this.w == null || this.w.size() == 0) {
            h();
        }
    }

    @Override
    protected void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i == 102 && i2 == -1) {
            a(0, false);
            this.u.a();
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.v = new ArrayList();
        this.t = (ListView) findViewById(R.id.lv_cloud_calllog);
        this.u = new com.cx.launcher.cloud.a.g(this);
        this.t.setAdapter((ListAdapter) this.u);
        this.p.setVisibility(8);
        this.u.a(new d(this));
        k();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.l.k();
        if (this.r != null) {
            this.r.b(this);
        }
        l();
    }
}