换机精灵 v2.5.2版本的 MD5 值为:469dcb6202646d6ec40973ea20c8c14b

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


package com.cx.launcher.cloud.ui;

import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Build;
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.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class CloudSMSActivity extends BaseCloudActivity implements com.cx.launcher.cloud.d.n, com.cx.launcher.cloud.t, com.cx.launcher.cloud.w {
    private static final String A = CloudSMSActivity.class.getSimpleName();
    com.cx.launcher.cloud.d.p r;
    private com.cx.launcher.cloud.c.j z;
    private ListView s = null;
    private com.cx.launcher.cloud.a.r t = null;
    private ArrayList u = null;
    private List v = null;
    private Map w = null;
    private com.cx.launcher.cloud.i x = null;
    private az y = null;
    private boolean B = false;

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

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

    public List b(Map map) {
        Iterator it = map.entrySet().iterator();
        ArrayList arrayList = new ArrayList();
        while (it.hasNext()) {
            try {
                ArrayList arrayList2 = (ArrayList) ((Map.Entry) it.next()).getValue();
                if (arrayList2 != null && arrayList2.size() > 0) {
                    com.cx.huanji.f.a aVar = (com.cx.huanji.f.a) arrayList2.get(0);
                    aVar.c(arrayList2.size());
                    arrayList.add(aVar);
                }
            } catch (Exception e) {
                com.cx.tools.e.a.c(A, e.getMessage());
            }
        }
        Collections.sort(arrayList, new ba(this));
        return arrayList;
    }

    private void b(CharSequence charSequence) {
        ArrayList arrayList = new ArrayList();
        String charSequence2 = charSequence.toString();
        String str = "";
        if (com.cx.tools.i.k.a(charSequence2)) {
            arrayList.addAll(this.v);
            this.t.a(arrayList, "", "");
            return;
        }
        if (this.v != null && this.v.size() != 0) {
            for (com.cx.huanji.f.a aVar : this.v) {
                if (aVar.d() != null && aVar.d().length() > 0 && aVar.d().indexOf(charSequence2) != -1) {
                    arrayList.add(aVar);
                    str = "phone";
                } else if (aVar.b() != null && aVar.b().toUpperCase().indexOf(charSequence2.toUpperCase()) > -1) {
                    arrayList.add(aVar);
                    str = SocializeProtocolConstants.PROTOCOL_KEY_FRIENDS_NAME;
                }
                if (aVar.k() != null && aVar.k().toUpperCase().indexOf(charSequence2.toUpperCase()) > -1) {
                    arrayList.add(aVar);
                    str = "body";
                }
            }
        }
        if (arrayList.size() <= 0) {
            this.t.a(arrayList, "", "");
        } else {
            this.s.setVisibility(0);
            this.t.a(arrayList, charSequence2, str);
        }
    }

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

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

    private void i() {
        this.l.c(this.u);
        Intent intent = new Intent();
        intent.putExtra("dataType", com.cx.base.f.i.SMSDATA.a());
        intent.setClass(this, CloudDataImportActivity.class);
        startActivityForResult(intent, 103);
    }

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

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

    private void l() {
        String b2 = com.cx.tools.i.k.b(this, "mOldDefaultSMS", "");
        com.cx.tools.e.a.c(A, com.cx.tools.i.k.a(b2) + "--" + com.cx.huanji.h.be.d(this, getPackageName()));
        if (Build.VERSION.SDK_INT < 19 || com.cx.tools.i.k.a(b2) || !com.cx.huanji.h.be.d(this, getPackageName())) {
            return;
        }
        com.cx.huanji.h.be.a((Context) this, b2);
    }

    private void m() {
        this.t.a(this.v);
        a(0, false);
        if (this.w.size() == 0) {
            h();
        }
    }

    public ArrayList n() {
        ArrayList c2 = this.t.c();
        ArrayList arrayList = new ArrayList();
        if (c2 != null && c2.size() > 0) {
            int size = c2.size();
            for (int i = 0; i < size; i++) {
                String d = ((com.cx.huanji.f.a) c2.get(i)).d();
                if (this.w.get(d) != null) {
                    arrayList.addAll((Collection) this.w.get(d));
                }
            }
        }
        return arrayList;
    }

    private int o() {
        int i = 0;
        if (this.w == null) {
            return 0;
        }
        Iterator it = this.w.entrySet().iterator();
        while (true) {
            int i2 = i;
            if (!it.hasNext()) {
                return i2;
            }
            i = ((ArrayList) ((Map.Entry) it.next()).getValue()).size() + i2;
        }
    }

    public boolean p() {
        return (this.w == null || this.t.c() == null || this.w.size() != this.t.c().size()) ? false : true;
    }

    public void q() {
        this.t.a(this.v);
        b(0);
        this.s.setVisibility(0);
        this.g.setVisibility(0);
        this.h.setVisibility(0);
    }

    private void r() {
        this.y = new az(this, null);
        this.y.execute("");
    }

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

    @Override
    public void a() {
    }

    @Override
    protected void a(byte b2) {
        if (b2 == 1) {
            if (Build.VERSION.SDK_INT < 19 || com.cx.huanji.h.be.d(this, getPackageName())) {
                i();
                return;
            } else {
                com.cx.base.widgets.l.a(this, getString(R.string.tv_sms_prompt), getString(R.string.sms_tidy_content), getResources().getString(R.string.get_sms_authority), new av(this), null, null, new aw(this)).show();
                return;
            }
        }
        if (b2 == 2) {
            this.l.c(this.u);
            this.j = com.cx.base.widgets.l.a(this.f996b, String.format(getString(R.string.cloud_delete_sms_tip), Integer.valueOf(this.u.size())), this.f996b.getString(R.string.cancel), new ax(this), this.f996b.getString(R.string.confirm), new ay(this));
            if (this.j != null) {
                this.j.show();
            }
        }
    }

    @Override
    public void a(int i) {
        switch (i) {
            case 100002:
            default:
                c(true);
                return;
        }
    }

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

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

    @Override
    public void a(Map map) {
        this.w = map;
        if (map != null) {
            this.w = map;
            if (map.size() > 0) {
                this.v = b(map);
                q();
            } else {
                h();
            }
            this.n.a(this.w, this.k);
            if (this.z != null) {
                this.z.h(this.z.g());
                this.n.a(this.z);
            }
        } 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.t.b();
        } else {
            this.t.a();
        }
    }

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

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

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

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

    @Override
    protected void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i != 100) {
            if (i == 103) {
                a(0, false);
                this.t.a();
                return;
            }
            return;
        }
        if (intent == null) {
            com.cx.tools.e.a.c(A, "onActivityResult--> data is null");
            return;
        }
        String string = intent.getExtras().getString("sendNumber");
        ArrayList arrayList = (ArrayList) this.w.get(string);
        ArrayList c2 = this.l.c();
        boolean z = c2.size() == o();
        if (c2 != null && arrayList != null && c2.size() > 0 && arrayList.size() > 0) {
            for (int i3 = 0; i3 < c2.size(); i3++) {
                if (arrayList.contains(c2.get(i3))) {
                    arrayList.remove(c2.get(i3));
                }
            }
            Iterator it = this.v.iterator();
            while (true) {
                if (it.hasNext()) {
                    if (((com.cx.huanji.f.a) it.next()).d().equals(string)) {
                        it.remove();
                        break;
                    }
                } else {
                    break;
                }
            }
            if (arrayList.size() == 0) {
                this.w.remove(string);
            } else {
                Collections.sort(arrayList, new ba(this));
                ((com.cx.huanji.f.a) arrayList.get(0)).c(arrayList.size());
                this.w.put(string, arrayList);
                this.v.add(arrayList.get(0));
                Collections.sort(this.v, new ba(this));
            }
            m();
            this.n.d(c2, this.k, z);
        }
        com.cx.tools.e.a.c(A, "onActivityResult-->" + i + "," + i2 + "," + string + "," + c2.size());
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.x = com.cx.launcher.cloud.i.a((Context) this);
        this.w = new HashMap();
        this.u = new ArrayList();
        this.s = (ListView) findViewById(R.id.lv_cloud_sms);
        this.t = new com.cx.launcher.cloud.a.r(this);
        this.s.setAdapter((ListAdapter) this.t);
        this.p.setVisibility(8);
        this.s.setOnItemClickListener(new at(this));
        this.t.a(new au(this));
        r();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.l.k();
        if (this.r != null) {
            this.r.b(this);
        }
        s();
        if (Build.VERSION.SDK_INT < 19 || !com.cx.huanji.h.be.d(this, getPackageName())) {
            return;
        }
        l();
    }

    @Override
    public void onResume() {
        super.onResume();
        if (Build.VERSION.SDK_INT < 19 || !com.cx.huanji.h.be.d(this, getPackageName()) || !this.B || this.u.size() <= 0) {
            return;
        }
        i();
    }
}