和通讯录 v3.9.6版本的 MD5 值为:669178e2ee1b2311daf378bd20c6bbe1

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


package com.chinamobile.contacts.im.ringtone;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
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.ContactAccessor;
import com.chinamobile.contacts.im.data.MediaPlatformDBManager;
import com.chinamobile.contacts.im.ringtone.model.MediaManager;
import com.chinamobile.contacts.im.ringtone.model.RingToneInfo;
import com.chinamobile.contacts.im.setting.BrowserActivity;
import com.chinamobile.contacts.im.ui.ICloudActivity;
import com.chinamobile.contacts.im.utils.aq;
import com.chinamobile.contacts.im.view.HintsDialog;
import com.chinamobile.contacts.im.view.ProgressDialog;
import com.chinamobile.contacts.im.view.actionbar.IcloudActionBar;
import com.chinamobile.contacts.im.view.actionbar.IcloudActionBarPopNavi;
import com.huawei.mcs.cloud.msg.base.mms.Telephony;
import com.umeng.analytics.MobclickAgent;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class RingToneMainActivity extends ICloudActivity implements View.OnClickListener, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, IcloudActionBarPopNavi.OnPopNaviItemClickListener {

    private Context f3158b;
    private IcloudActionBar c;
    private ListView d;
    private RelativeLayout e;
    private RelativeLayout f;
    private TextView g;
    private com.chinamobile.contacts.im.ringtone.adapter.a h;
    private Button k;
    private Button l;
    private int n;
    private String o;
    private String p;
    private boolean q;
    private boolean r;
    private String s;
    private List<RingToneInfo> i = new ArrayList();
    private ArrayList<String> j = new ArrayList<>();
    private boolean m = true;
    private ArrayList t = new ArrayList();
    private String u = Environment.getExternalStorageDirectory() + "/M_cloud/DownFile/";
    private int v = 1213;

    ProgressDialog f3157a = null;
    private Handler w = new a(this);

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(C0019R.layout.ringtone_main);
        this.f3158b = this;
        Intent intent = getIntent();
        this.p = intent.getStringExtra("titlename");
        this.q = intent.getBooleanExtra("hasBeenOpen", false);
        this.r = intent.getBooleanExtra("hasBeenOrder", false);
        this.s = intent.getStringExtra("number");
        this.n = intent.getIntExtra(Telephony.Mms.Addr.CONTACT_ID, -1);
        this.o = intent.getStringExtra("name");
        this.m = intent.getBooleanExtra("ismy", true);
        this.t = intent.getStringArrayListExtra("numbers");
        if (this.s == null) {
            com.chinamobile.contacts.im.sync.c.a entity = ContactAccessor.getEntity(this.f3158b);
            this.s = entity.b();
            String c = entity.c();
            if (c.length() > 0) {
                this.s = c;
            }
        }
        this.i = com.chinamobile.contacts.im.ringtone.a.a.b(this.n, null);
        if (this.m) {
            a(0);
        } else {
            a(2);
        }
        a();
        if (!this.q && !this.r) {
            if (this.t == null) {
                new f(this, this.s, 1).executeOnMainExecutor(new Void[0]);
            } else {
                a(this.t);
            }
        }
        MediaManager.init();
        aq.a("hasBeenOpen===" + this.q, "hasBeenOrder===" + this.r);
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    private void a(int i) {
        this.c = getIcloudActionBar();
        switch (i) {
            case 0:
                this.c.setNavigationMode(3);
                this.c.setDisplayAsUpTitle("我的彩铃");
                this.c.setDisplayAsUpBack(C0019R.drawable.iab_green_back, this);
                this.c.setDisplayAsUpTitleIBAction(C0019R.drawable.sync_time_machine_refresh, new b(this));
                this.j.add("彩铃网站");
                this.c.setDisplayAsUpTitleIBMore(0, new c(this));
                return;
            case 1:
                this.c.setNavigationMode(2);
                this.c.setDisplayAsUpTitle("开通彩铃");
                this.c.setDisplayAsUpBack(C0019R.drawable.iab_green_back, this);
                return;
            case 2:
                this.c.setNavigationMode(2);
                this.c.setDisplayAsUpTitle(this.o + "的彩铃");
                this.c.setDisplayAsUpBack(C0019R.drawable.iab_green_back, this);
                return;
            default:
                return;
        }
    }

    private void a() {
        this.d = (ListView) findViewById(C0019R.id.ringtone_list);
        this.h = new com.chinamobile.contacts.im.ringtone.adapter.a(this.f3158b, this.m);
        this.d.setAdapter((ListAdapter) this.h);
        this.h.a(this.i);
        this.e = (RelativeLayout) findViewById(C0019R.id.ringtone_open_layout);
        this.k = (Button) findViewById(C0019R.id.ringtone_open_btn);
        this.k.setOnClickListener(this);
        this.f = (RelativeLayout) findViewById(C0019R.id.ringtone_order_layout);
        this.g = (TextView) findViewById(C0019R.id.ringtone_order);
        int color = getResources().getColor(C0019R.color.contact_list_resutl_high_light);
        String charSequence = this.g.getText().toString();
        SpannableString spannableString = new SpannableString(charSequence);
        int indexOf = charSequence.indexOf("彩铃网站");
        spannableString.setSpan(new ForegroundColorSpan(color), indexOf, indexOf + 4, 33);
        this.g.setText(spannableString);
        this.l = (Button) findViewById(C0019R.id.ringtone_order_btn);
        this.l.setOnClickListener(this);
        if (this.q) {
            a(this.q);
        }
        if (this.r) {
            b(this.r);
        }
    }

    public void a(boolean z) {
        if (z) {
            this.e.setVisibility(0);
            this.k.setVisibility(0);
            this.d.setVisibility(8);
            a(1);
            return;
        }
        this.e.setVisibility(8);
        this.k.setVisibility(8);
        this.d.setVisibility(0);
    }

    public void b(boolean z) {
        if (z) {
            this.f.setVisibility(0);
            this.l.setVisibility(0);
            this.d.setVisibility(8);
            a(1);
            return;
        }
        this.f.setVisibility(8);
        this.l.setVisibility(8);
        this.d.setVisibility(0);
    }

    @Override
    public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long j) {
        return false;
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case C0019R.id.iab_back_area:
                finish();
                return;
            case C0019R.id.ringtone_order_btn:
                MobclickAgent.onEvent(this, "ringTone_toBuy");
                Intent intent = new Intent(getApplicationContext(), (Class<?>) BrowserActivity.class);
                intent.putExtra("url", d());
                intent.putExtra(MediaPlatformDBManager.KEY_TITLE, "彩铃网站");
                startActivityForResult(intent, this.v);
                return;
            case C0019R.id.ringtone_open_btn:
                b();
                return;
            default:
                return;
        }
    }

    private void b() {
        String string = getResources().getString(C0019R.string.ringtone_open);
        int color = getResources().getColor(C0019R.color.red_missing_call);
        SpannableString spannableString = new SpannableString(string);
        int indexOf = string.indexOf("¥");
        spannableString.setSpan(new ForegroundColorSpan(color), indexOf + 1, indexOf + 5, 33);
        HintsDialog hintsDialog = new HintsDialog(this.f3158b, "开通彩铃", "");
        hintsDialog.getTvHints().setText(spannableString);
        hintsDialog.setButton(new d(this), C0019R.string.ringtone_open_btn);
        hintsDialog.setnegativeName(getResources().getString(C0019R.string.cancel));
        hintsDialog.show();
    }

    public void c() {
        HintsDialog hintsDialog = new HintsDialog(this.f3158b, "开通彩铃", "开通彩铃失败,请稍后再试");
        hintsDialog.setStyle(1);
        hintsDialog.show();
    }

    @Override
    public void OnPopNaviClick(int i) {
        switch (i) {
            case 0:
                Intent intent = new Intent(getApplicationContext(), (Class<?>) BrowserActivity.class);
                intent.putExtra("url", d());
                intent.putExtra(MediaPlatformDBManager.KEY_TITLE, "彩铃网站");
                startActivityForResult(intent, this.v);
                return;
            default:
                return;
        }
    }

    public String d() {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("http://m.10086.cn");
        return stringBuffer.toString();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (this.i != null) {
            this.i.clear();
        }
        MediaManager.outit();
        e();
    }

    private void e() {
        File file = new File(this.u);
        if (file.isDirectory()) {
            Date date = new Date();
            System.out.println(date.toString());
            long time = date.getTime() / 1000;
            File[] listFiles = file.listFiles();
            for (int i = 0; i < listFiles.length; i++) {
                long lastModified = listFiles[i].lastModified() / 1000;
                long j = time - lastModified;
                if (time - lastModified > 3600) {
                    System.out.println();
                    System.out.println();
                    listFiles[i].delete();
                }
            }
        }
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i == 1212) {
            if (!LoginInfoSP.isLogin(this.f3158b)) {
                setResult(-1);
                finish();
                return;
            }
            return;
        }
        if (i == 1213) {
            if (this.t == null) {
                new f(this, this.s, 1).executeOnMainExecutor(new Void[0]);
            } else {
                a(this.t);
            }
        }
    }

    public void a(ArrayList arrayList) {
        try {
            this.f3157a = new ProgressDialog(this.f3158b, "正在刷新,请稍候…");
            this.f3157a.setCancelable(true);
            if (!this.f3157a.isShowing()) {
                this.f3157a.show();
            }
        } catch (Exception e) {
        }
        Main.f1278b.execute(new e(this, arrayList));
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }
}