和通讯录 v4.2.0版本的 MD5 值为:f213fa766dccbfebde0dd8add5534518

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


package com.chinamobile.contacts.im.mms2.ui;

import android.content.ContentProviderOperation;
import android.content.ContentProviderResult;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ExpandableListView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.chinamobile.contacts.im.C0019R;
import com.chinamobile.contacts.im.Main;
import com.chinamobile.contacts.im.config.LoginInfoSP;
import com.chinamobile.contacts.im.data.MediaPlatformDBManager;
import com.chinamobile.contacts.im.data.simcard.MultiSimCardAccessor;
import com.chinamobile.contacts.im.login.SettingNewLoginMainActivity;
import com.chinamobile.contacts.im.mms2.data.ContactList;
import com.chinamobile.contacts.im.mms2.data.Conversation;
import com.chinamobile.contacts.im.mms2.data.SimpleSmsData;
import com.chinamobile.contacts.im.mms2.utils.AddressUtils;
import com.chinamobile.contacts.im.mms2.utils.MessageUtils;
import com.chinamobile.contacts.im.setting.BrowserActivity;
import com.chinamobile.contacts.im.sync.SmsRecycleBinActivity;
import com.chinamobile.contacts.im.ui.ICloudActivity;
import com.chinamobile.contacts.im.utils.ApplicationUtils;
import com.chinamobile.contacts.im.view.ProgressDialog;
import com.chinamobile.contacts.im.view.RoundProgressBar;
import com.chinamobile.contacts.im.view.actionbar.IcloudActionBar;
import com.chinamobile.contacts.im.view.actionbar.IcloudActionBarPopAdapter;
import com.chinamobile.contacts.im.view.actionbar.IcloudActionBarPopNavi;
import com.google.android.mms.pdu.EncodedStringValue;
import com.google.android.mms.pdu.PduPersister;
import com.huawei.mcs.cloud.msg.base.mms.Telephony;
import com.umeng.analytics.AspMobclickAgent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class SmsMmsClearActivity extends ICloudActivity implements View.OnClickListener, com.chinamobile.contacts.im.mms2.a.ay, IcloudActionBarPopNavi.OnPopNaviItemClickListener {
    private RoundProgressBar d;
    private RelativeLayout e;
    private TextView f;
    private TextView g;
    private FrameLayout h;
    private FrameLayout i;
    private IcloudActionBar j;
    private IcloudActionBarPopNavi k;
    private ArrayList<String> l;
    private List<String> m;
    private List<List<SimpleSmsData>> n;
    private ExpandableListView o;
    private com.chinamobile.contacts.im.mms2.a.au p;
    private ImageView q;
    private ImageView r;
    private ImageView s;
    private ProgressDialog u;
    private int z;
    private int t = 6;
    private final String v = "SmsMmsClearActivity";

    int f2807a = 0;

    int f2808b = 0;
    private int w = -1;
    private int x = 0;
    private boolean y = false;
    private String A = "扫描发现%d条垃圾短信!快快一键清理,坐等提速%d%%吧!";
    Handler c = new dz(this);

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        requestWindowFeature(1);
        setContentView(C0019R.layout.sms_mms_clear);
        e();
        b();
        f();
    }

    @Override
    public void onDestroy() {
        this.p.a((com.chinamobile.contacts.im.mms2.a.ay) null);
        super.onDestroy();
    }

    private void b() {
        this.e = (RelativeLayout) findViewById(C0019R.id.up_part);
        this.h = (FrameLayout) findViewById(C0019R.id.clearFL);
        this.i = (FrameLayout) findViewById(C0019R.id.recyclebinFL);
        this.d = (RoundProgressBar) findViewById(C0019R.id.roundProgressBar);
        this.q = (ImageView) findViewById(C0019R.id.buttonClear);
        this.s = (ImageView) findViewById(C0019R.id.buttonClearProgress);
        this.r = (ImageView) findViewById(C0019R.id.recyclebinButton);
        this.f = (TextView) findViewById(C0019R.id.promptText);
        this.g = (TextView) findViewById(C0019R.id.progressText);
        this.o = (ExpandableListView) findViewById(C0019R.id.expandableListView);
        this.p = new com.chinamobile.contacts.im.mms2.a.au(this);
        this.o.setAdapter(this.p);
        this.p.a(this);
        this.q.setOnClickListener(new dn(this));
        this.r.setOnClickListener(new dq(this));
        this.o.setOnGroupClickListener(new dr(this));
        this.o.setOnChildClickListener(new ds(this));
    }

    public int a(StringBuffer stringBuffer, StringBuffer stringBuffer2) {
        int i;
        String str = stringBuffer.length() > 0 ? " ( _id in ( " + stringBuffer.toString().substring(0, stringBuffer.length() - 1) + ") ) " : null;
        String str2 = stringBuffer2.length() > 0 ? " ( _id in ( " + stringBuffer2.toString().substring(0, stringBuffer2.length() - 1) + ") ) " : null;
        if (str == null) {
            i = -1;
        } else {
            com.chinamobile.contacts.im.utils.bm.b("SmsMmsClearActivity", "whereSms: " + str);
            i = getContentResolver().delete(com.chinamobile.contacts.im.mms2.h.o.f2709a, str, null);
        }
        if (str2 != null) {
            com.chinamobile.contacts.im.utils.bm.b("SmsMmsClearActivity", "whereMms: " + str2);
            return getContentResolver().delete(com.chinamobile.contacts.im.mms2.h.f.f2698a, str2, null);
        }
        return i;
    }

    public int a(List<Uri> list) {
        ContentProviderResult[] contentProviderResultArr;
        ContentProviderResult[] contentProviderResultArr2 = new ContentProviderResult[list.size()];
        ArrayList arrayList = new ArrayList();
        if (list.size() > 0) {
            com.chinamobile.contacts.im.utils.bm.b("SmsMmsClearActivity", "apply batch delete sizes: " + list.size());
            ArrayList<ContentProviderOperation> arrayList2 = new ArrayList<>();
            String authority = list.get(0).getAuthority();
            contentProviderResultArr = contentProviderResultArr2;
            for (int i = 0; i < list.size(); i++) {
                arrayList2.add(ContentProviderOperation.newDelete(list.get(i)).withSelection(null, null).build());
                try {
                    if (arrayList2.size() % 20 == 0 && i != 0) {
                        contentProviderResultArr = getContentResolver().applyBatch(authority, arrayList2);
                        arrayList2.clear();
                    } else if (i == list.size() - 1) {
                        contentProviderResultArr = getContentResolver().applyBatch(authority, arrayList2);
                    }
                } catch (Exception e) {
                    com.chinamobile.contacts.im.utils.bm.b("SmsMmsClearActivity", e.getMessage() + " ");
                }
            }
        } else {
            contentProviderResultArr = contentProviderResultArr2;
        }
        if (contentProviderResultArr != null) {
            for (ContentProviderResult contentProviderResult : contentProviderResultArr) {
                if (contentProviderResult != null) {
                    int intValue = contentProviderResult.count.intValue();
                    if (contentProviderResult.count.intValue() > 0) {
                        arrayList.add(Integer.valueOf(intValue));
                    }
                }
            }
        }
        return arrayList.size();
    }

    public int c() {
        int i = (int) (this.f2807a * 0.02d);
        if (i < 2) {
            return 2;
        }
        if (i < 30) {
            return i;
        }
        return 30;
    }

    public void a(int i) {
        runOnUiThread(new dt(this, i));
    }

    public void a(boolean z) {
        this.f.setText(String.format(this.A, Integer.valueOf(this.f2807a), Integer.valueOf(c())));
        int width = this.q.getWidth();
        a(0);
        Main.c.execute(new du(this, z, width));
    }

    private void d() {
        if (this.l == null) {
            this.l = new ArrayList<>();
            this.l.add("信息回收站");
            this.l.add("帮助");
        }
    }

    private void e() {
        this.j = getIcloudActionBar();
        this.j.setNavigationMode(3);
        this.j.setDisplayAsUpTitle("短信清理");
        this.j.setDisplayAsUpBack(C0019R.drawable.iab_green_back, this);
        d();
        this.k = new IcloudActionBarPopNavi(this, new IcloudActionBarPopAdapter(this, this.l));
        this.k.setOnPopNaviItemClickListener(this);
        this.j.setDisplayAsUpTitleIBMore(C0019R.drawable.iab_green_more, new dw(this));
    }

    private void f() {
        Main.c.execute(new dx(this));
    }

    public boolean a(Cursor cursor, boolean z) {
        String str;
        int i;
        long j;
        long j2;
        String str2;
        com.chinamobile.contacts.im.contacts.c.d a2;
        try {
            str = "";
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (cursor.getInt(cursor.getColumnIndex("locked")) != 0) {
            return false;
        }
        boolean z2 = cursor.getInt(cursor.getColumnIndex("read")) != 0;
        long j3 = cursor.getLong(cursor.getColumnIndex("_id"));
        if (z) {
            long j4 = cursor.getLong(cursor.getColumnIndex("thread_id"));
            long j5 = cursor.getLong(cursor.getColumnIndex("date")) * 1000;
            int i2 = cursor.getInt(cursor.getColumnIndex(Telephony.BaseMmsColumns.MESSAGE_BOX));
            String string = cursor.getString(cursor.getColumnIndex(Telephony.BaseMmsColumns.SUBJECT));
            if (!TextUtils.isEmpty(string)) {
                EncodedStringValue encodedStringValue = new EncodedStringValue(cursor.getInt(cursor.getColumnIndex(Telephony.BaseMmsColumns.SUBJECT_CHARSET)), PduPersister.getBytes(string));
                if (ApplicationUtils.isGarbled(encodedStringValue.getString())) {
                    str = ApplicationUtils.getStringOfGarbled(string, 6);
                } else {
                    str = encodedStringValue.getString();
                }
            }
            i = i2;
            j = j5;
            j2 = j4;
            str2 = str;
        } else {
            long j6 = cursor.getLong(cursor.getColumnIndex("thread_id"));
            long j7 = cursor.getLong(cursor.getColumnIndex("date"));
            String string2 = cursor.getString(cursor.getColumnIndex("body"));
            i = cursor.getInt(cursor.getColumnIndex("type"));
            j = j7;
            j2 = j6;
            str2 = string2;
        }
        if (str2 != null && (str2.contains("兑换码") || str2.contains("密码") || str2.contains("激活码") || str2.contains("预约") || str2.contains("券号"))) {
            return false;
        }
        if (j2 > 0) {
            com.chinamobile.contacts.im.contacts.c.d dVar = null;
            Conversation conversation = Conversation.get((Context) this, MultiSimCardAccessor.getInstance().getRealThreadID(j2), true);
            ContactList recipients = conversation.getRecipients();
            if (recipients.size() > 1 && z) {
                String from = AddressUtils.getFrom(this, com.chinamobile.contacts.im.mms2.h.f.f2698a.buildUpon().appendPath(Long.toString(j3)).build());
                if (!TextUtils.isEmpty(from) && !from.equals(getString(C0019R.string.hidden_sender_address))) {
                    dVar = com.chinamobile.contacts.im.contacts.c.d.a(from);
                }
                a2 = dVar;
            } else if (recipients.size() == 1) {
                a2 = recipients.get(0);
            } else if (z) {
                String from2 = AddressUtils.getFrom(this, com.chinamobile.contacts.im.mms2.h.f.f2698a.buildUpon().appendPath(Long.toString(j3)).build());
                if (!TextUtils.isEmpty(from2) && !from2.equals(getString(C0019R.string.hidden_sender_address))) {
                    dVar = com.chinamobile.contacts.im.contacts.c.d.a(from2);
                }
                a2 = dVar;
            } else {
                a2 = com.chinamobile.contacts.im.contacts.c.d.a(cursor.getString(cursor.getColumnIndex("address")));
            }
            if (a2 != null) {
                long date = conversation.getDate();
                long currentTimeMillis = System.currentTimeMillis();
                if (date <= 0) {
                    date = currentTimeMillis;
                }
                long j8 = currentTimeMillis - j;
                String f = a2.f();
                if (j8 >= 2592000000L && f != null && f.startsWith("106")) {
                    SimpleSmsData simpleSmsData = new SimpleSmsData();
                    simpleSmsData.mAddress = a2.f();
                    simpleSmsData.mName = a2.g();
                    simpleSmsData.mID = j3;
                    simpleSmsData.mThreadID = j2;
                    simpleSmsData.mDate = MessageUtils.getFormatClearDate(j);
                    simpleSmsData.mSubject = str2;
                    simpleSmsData.isSelected = true;
                    simpleSmsData.mType = z ? 1 : 0;
                    simpleSmsData.mBoxType = i;
                    simpleSmsData.isRead = z2;
                    simpleSmsData.time = j;
                    this.n.get(0).add(simpleSmsData);
                    return true;
                }
                if (j8 >= 5184000000L && f != null && f.startsWith("9")) {
                    SimpleSmsData simpleSmsData2 = new SimpleSmsData();
                    simpleSmsData2.mAddress = a2.f();
                    simpleSmsData2.mName = a2.g();
                    simpleSmsData2.mID = j3;
                    simpleSmsData2.mThreadID = j2;
                    simpleSmsData2.mDate = MessageUtils.getFormatClearDate(j);
                    simpleSmsData2.mSubject = str2;
                    simpleSmsData2.isSelected = true;
                    simpleSmsData2.mType = z ? 1 : 0;
                    simpleSmsData2.mBoxType = i;
                    simpleSmsData2.isRead = z2;
                    simpleSmsData2.time = j;
                    this.n.get(0).add(simpleSmsData2);
                    return true;
                }
                if (i == 1 && j8 >= 259200000 && str2 != null && (str2.contains("你的朋友来电,号码为") || str2.contains("电话,请方便时回复。"))) {
                    SimpleSmsData simpleSmsData3 = new SimpleSmsData();
                    simpleSmsData3.mAddress = a2.f();
                    simpleSmsData3.mName = a2.g();
                    simpleSmsData3.mID = j3;
                    simpleSmsData3.mThreadID = j2;
                    simpleSmsData3.mDate = MessageUtils.getFormatClearDate(j);
                    simpleSmsData3.mSubject = str2;
                    simpleSmsData3.isSelected = true;
                    simpleSmsData3.mType = z ? 1 : 0;
                    simpleSmsData3.mBoxType = i;
                    simpleSmsData3.isRead = z2;
                    simpleSmsData3.time = j;
                    this.n.get(0).add(simpleSmsData3);
                    return true;
                }
                long j9 = currentTimeMillis - date;
                if (a2.b()) {
                    if (j9 > 7776000000L) {
                        SimpleSmsData simpleSmsData4 = new SimpleSmsData();
                        simpleSmsData4.mAddress = a2.f();
                        simpleSmsData4.mName = a2.g();
                        simpleSmsData4.mID = j3;
                        simpleSmsData4.mDate = MessageUtils.getFormatClearDate(j);
                        simpleSmsData4.mSubject = str2;
                        simpleSmsData4.mThreadID = j2;
                        simpleSmsData4.isSelected = false;
                        simpleSmsData4.mType = z ? 1 : 0;
                        simpleSmsData4.mBoxType = i;
                        simpleSmsData4.isRead = z2;
                        simpleSmsData4.time = j;
                        this.n.get(2).add(simpleSmsData4);
                        return true;
                    }
                } else if (j9 > 2592000000L) {
                    SimpleSmsData simpleSmsData5 = new SimpleSmsData();
                    simpleSmsData5.mAddress = a2.f();
                    simpleSmsData5.mName = a2.g();
                    simpleSmsData5.mID = j3;
                    simpleSmsData5.mDate = MessageUtils.getFormatClearDate(j);
                    simpleSmsData5.mSubject = str2;
                    simpleSmsData5.isSelected = true;
                    simpleSmsData5.mThreadID = j2;
                    simpleSmsData5.mType = z ? 1 : 0;
                    simpleSmsData5.isRead = z2;
                    simpleSmsData5.time = j;
                    simpleSmsData5.mBoxType = i;
                    this.n.get(1).add(simpleSmsData5);
                    return true;
                }
                if (j9 >= 15552000000L) {
                    SimpleSmsData simpleSmsData6 = new SimpleSmsData();
                    simpleSmsData6.mAddress = a2.f();
                    simpleSmsData6.mName = a2.g();
                    simpleSmsData6.mID = j3;
                    simpleSmsData6.mDate = MessageUtils.getFormatClearDate(j);
                    simpleSmsData6.mSubject = str2;
                    simpleSmsData6.mThreadID = j2;
                    simpleSmsData6.isSelected = false;
                    simpleSmsData6.mType = z ? 1 : 0;
                    simpleSmsData6.isRead = z2;
                    simpleSmsData6.time = j;
                    simpleSmsData6.mBoxType = i;
                    this.n.get(2).add(simpleSmsData6);
                    return true;
                }
            }
        }
        return false;
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i != 4 || this.w < 0) {
            return super.onKeyDown(i, keyEvent);
        }
        this.o.collapseGroup(this.w);
        this.w = -1;
        this.q.setVisibility(0);
        this.e.setVisibility(0);
        this.f.setVisibility(0);
        return false;
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case C0019R.id.iab_back_area:
                if (this.w >= 0) {
                    this.o.collapseGroup(this.w);
                    this.w = -1;
                    this.q.setVisibility(0);
                    this.e.setVisibility(0);
                    this.f.setVisibility(0);
                    return;
                }
                onBackPressed();
                return;
            default:
                return;
        }
    }

    @Override
    public void OnPopNaviClick(int i) {
        switch (i) {
            case 0:
                AspMobclickAgent.onEvent(this, "msgClean_rightPop_msgRecycle");
                if (LoginInfoSP.isLogin(this)) {
                    startActivity(SmsRecycleBinActivity.a(this));
                    return;
                } else {
                    startActivityForResult(new Intent(this, (Class<?>) SettingNewLoginMainActivity.class), 19);
                    return;
                }
            case 1:
                AspMobclickAgent.onEvent(this, "msgClean_rightmenu_help");
                Intent intent = new Intent(this, (Class<?>) BrowserActivity.class);
                intent.putExtra("url", "http://pim1.10086.cn/getThirdHlp.action?os=android&inSec=4&inThird=8");
                intent.putExtra(MediaPlatformDBManager.KEY_TITLE, "帮助");
                startActivity(intent);
                return;
            default:
                return;
        }
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i == 19 && LoginInfoSP.isLogin(this)) {
            startActivity(SmsRecycleBinActivity.a(this));
        }
    }

    @Override
    public void a() {
        boolean z;
        if (this.y) {
            Iterator<List<SimpleSmsData>> it = this.n.iterator();
            boolean z2 = false;
            while (true) {
                if (!it.hasNext()) {
                    z = z2;
                    break;
                }
                Iterator<SimpleSmsData> it2 = it.next().iterator();
                while (true) {
                    if (!it2.hasNext()) {
                        z = z2;
                        break;
                    } else if (it2.next().isSelected) {
                        z = true;
                        break;
                    }
                }
                if (z) {
                    break;
                } else {
                    z2 = z;
                }
            }
            this.h.setVisibility(z ? 0 : 8);
            this.i.setVisibility(z ? 8 : 0);
        }
    }
}