TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

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


package com.tencent.mobileqq.activity.specialcare;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.Toast;
import com.tencent.mobileqq.activity.QQBrowserActivity;
import com.tencent.mobileqq.app.FriendListHandler;
import com.tencent.mobileqq.app.FriendListObserver;
import com.tencent.mobileqq.app.FriendsManager;
import com.tencent.mobileqq.app.IphoneTitleBarActivity;
import com.tencent.mobileqq.app.QvipSpecialCareObserver;
import com.tencent.mobileqq.data.SpecialCareInfo;
import com.tencent.mobileqq.utils.NetworkUtil;
import com.tencent.mobileqq.vaswebviewplugin.VasWebviewConstants;
import com.tencent.mobileqq.widget.FormCommonSingleLineItem;
import com.tencent.mobileqq.widget.FormCommonSwitchItem;
import com.tencent.mobileqq.widget.QQProgressDialog;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
public class QQSpecialCareSettingActivity extends IphoneTitleBarActivity implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
    private static final int f86897a = 1;
    public static final String f16859a = "key_friend_uin";
    private static final int f86898b = 0;
    public static final String f16860b = "key_is_from_management_activity";
    private static final int f86899c = 8193;
    private static final String f16861c = "QQSpecialCareSettingActivity";
    private static final int d = 8194;
    private static final int e = 8195;
    private Toast f16863a;
    private QvipSpecialSoundManager f16864a;
    private FriendListHandler f16865a;
    private FriendsManager f16867a;
    private SpecialCareInfo f16869a;
    private FormCommonSingleLineItem f16870a;
    private FormCommonSwitchItem f16871a;
    private QQProgressDialog f16872a;
    private FormCommonSwitchItem f16873b;
    private FormCommonSwitchItem f16874c;
    private String f16875d;
    public final Handler f16862a = new oix(this);
    private FriendListObserver f16866a = new oiy(this);
    private QvipSpecialCareObserver f16868a = new oiz(this);

    @Override
    public boolean doOnCreate(Bundle bundle) {
        super.doOnCreate(bundle);
        setContentView(R.layout.f57625name_res_0x7f030500);
        setTitle(R.string.f65509name_res_0x7f0a1bc9);
        setLeftViewName(R.string.f63667button_back);
        this.f16871a = (FormCommonSwitchItem) findViewById(R.id.f53268name_res_0x7f091831);
        this.f16871a.setOnCheckedChangeListener(this);
        this.f16873b = (FormCommonSwitchItem) findViewById(R.id.f53269name_res_0x7f091832);
        this.f16873b.setOnCheckedChangeListener(this);
        this.f16874c = (FormCommonSwitchItem) findViewById(R.id.f53271name_res_0x7f091834);
        this.f16874c.setOnCheckedChangeListener(this);
        this.f16870a = (FormCommonSingleLineItem) findViewById(R.id.f53270name_res_0x7f091833);
        this.f16870a.setOnClickListener(this);
        this.f16875d = getIntent().getStringExtra(f16859a);
        if (this.app != null) {
            this.f16865a = (FriendListHandler) this.app.getBusinessHandler(1);
            this.f16867a = (FriendsManager) this.app.getManager(50);
            this.app.addObserver(this.f16866a);
            this.app.addObserver(this.f16868a);
        }
        this.f16864a = new QvipSpecialSoundManager(this, this.app);
        if (!this.f16864a.m4081a()) {
            if (QLog.isColorLevel()) {
                QLog.d(f16861c, 2, "QvipSpecialSoundManager no cache data.");
            }
            b();
        }
        if (QLog.isColorLevel()) {
            QLog.d(f16861c, 2, "doOnCreate mFriUin: " + this.f16875d);
        }
        return true;
    }

    @Override
    public void doOnResume() {
        super.doOnResume();
        a();
    }

    public void a() {
        int i = 0;
        this.f16869a = this.f16867a.m4325a(this.f16875d);
        if (QLog.isColorLevel()) {
            QLog.d(f16861c, 2, "showItems mSpecInfo: " + this.f16869a);
        }
        if (this.f16869a == null) {
            if (!this.f16867a.m4370f()) {
                this.f16871a.setVisibility(8);
                this.f16873b.setVisibility(8);
                this.f16874c.setVisibility(8);
                this.f16870a.setVisibility(8);
                return;
            }
            this.f16871a.setVisibility(0);
            this.f16873b.setVisibility(8);
            this.f16874c.setVisibility(8);
            this.f16870a.setVisibility(8);
            this.f16871a.setChecked(false);
            return;
        }
        this.f16871a.setVisibility(0);
        this.f16871a.setChecked(this.f16869a.globalSwitch != 0);
        this.f16873b.setChecked(this.f16869a.specialRingSwitch != 0);
        this.f16874c.setChecked(this.f16869a.qzoneSwitch != 0);
        boolean m9765a = this.f16871a.m9765a();
        this.f16873b.setVisibility(m9765a ? 0 : 8);
        this.f16874c.setVisibility(m9765a ? 0 : 8);
        FormCommonSingleLineItem formCommonSingleLineItem = this.f16870a;
        if (!m9765a || !this.f16873b.m9765a()) {
            i = 8;
        }
        formCommonSingleLineItem.setVisibility(i);
        c();
    }

    @Override
    public void doOnDestroy() {
        super.doOnDestroy();
        if (this.app != null) {
            this.app.removeObserver(this.f16868a);
            this.app.removeObserver(this.f16866a);
        }
    }

    private void b() {
        if (QLog.isColorLevel()) {
            QLog.d(f16861c, 2, "loadSpecialSoundConfig start loading...");
        }
        startTitleProgress();
        this.f16864a.a(new oiw(this));
    }

    public void c() {
        if (QvipSpecialCareManager.m4073a(this.f16875d, this.app)) {
            if (!this.f16864a.m4081a()) {
                b();
            }
            int a2 = QvipSpecialCareManager.a(this.f16875d, this.app);
            String a3 = this.f16864a.a(a2);
            if (QLog.isColorLevel()) {
                QLog.d(f16861c, 2, "updatePersonalVoice mFriUin: " + this.f16875d + ", soundId: " + a2 + ", soundName: " + a3);
            }
            FormCommonSingleLineItem formCommonSingleLineItem = this.f16870a;
            if (TextUtils.isEmpty(a3)) {
                a3 = getString(R.string.f64153name_res_0x7f0a1678);
            }
            formCommonSingleLineItem.setRightText(a3);
            return;
        }
        if (QLog.isColorLevel()) {
            QLog.d(f16861c, 2, "updatePersonalVoice not contain friend: " + this.f16875d);
        }
        this.f16870a.setRightText(getString(R.string.f64153name_res_0x7f0a1678));
    }

    @Override
    public void onClick(View view) {
        switch (view == null ? 0 : view.getId()) {
            case R.id.f53270name_res_0x7f091833:
                Intent intent = new Intent(this, QQBrowserActivity.class);
                intent.putExtra("url", "http://imgcache.qq.com/club/client/specialRing/rel/index.html?_wv=1027&suin=" + this.f16875d + "&uin=" + this.app.getCurrentAccountUin() + "&_bid=279");
                intent.putExtra("uin", this.f16875d);
                intent.putExtra(VasWebviewConstants.KEY_OPEN_PAGE_TIME, System.currentTimeMillis());
                startActivity(intent);
                return;
            default:
                return;
        }
    }

    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
        FormCommonSwitchItem formCommonSwitchItem;
        int i = 2;
        if (!compoundButton.isPressed()) {
            if (QLog.isColorLevel()) {
                QLog.d(f16861c, 2, "onCheckedChanged isCheck: " + z + ", NOT switched by user.");
                return;
            }
            return;
        }
        if (QLog.isColorLevel()) {
            QLog.d(f16861c, 2, "onCheckedChanged isCheck: " + z + ", switched by user.");
        }
        if (compoundButton == this.f16871a.m9763a()) {
            if (NetworkUtil.h(this)) {
                this.f16865a.a(1, new String[]{this.f16875d}, new boolean[]{z});
                this.f16862a.sendMessage(this.f16862a.obtainMessage(f86899c));
                return;
            }
            Message obtainMessage = this.f16862a.obtainMessage(e);
            obtainMessage.arg1 = 0;
            obtainMessage.arg2 = R.string.f63198name_res_0x7f0a12bb;
            this.f16862a.sendMessage(obtainMessage);
            this.f16871a.setChecked(this.f16871a.m9765a() ? false : true);
        } else if (compoundButton == this.f16873b.m9763a() || compoundButton == this.f16874c.m9763a()) {
            if (compoundButton == this.f16873b.m9763a()) {
                formCommonSwitchItem = this.f16873b;
            } else if (compoundButton == this.f16874c.m9763a()) {
                i = 3;
                formCommonSwitchItem = this.f16874c;
            } else {
                return;
            }
            if (NetworkUtil.h(this)) {
                this.f16865a.a(i, new String[]{this.f16875d}, new boolean[]{z});
            } else {
                Message obtainMessage2 = this.f16862a.obtainMessage(e);
                obtainMessage2.arg1 = 0;
                obtainMessage2.arg2 = R.string.f63198name_res_0x7f0a12bb;
                this.f16862a.sendMessage(obtainMessage2);
                formCommonSwitchItem.setChecked(formCommonSwitchItem.m9765a() ? false : true);
            }
            this.f16870a.setVisibility(this.f16873b.m9765a() ? 0 : 8);
        }
    }

    @Override
    public void finish() {
        if (getIntent().getBooleanExtra(f16860b, false)) {
            setResult(-1);
        }
        super.finish();
    }
}