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

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


package com.tencent.mobileqq.activity.specialcare;

import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
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.ImageView;
import android.widget.TextView;
import com.tencent.common.app.BaseApplicationImpl;
import com.tencent.common.config.AppSetting;
import com.tencent.mobileqq.activity.ForwardFriendListActivity;
import com.tencent.mobileqq.activity.QQBrowserActivity;
import com.tencent.mobileqq.app.AppConstants;
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.Friends;
import com.tencent.mobileqq.data.SpecialCareInfo;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.util.FaceDecoder;
import com.tencent.mobileqq.utils.ImageUtil;
import com.tencent.mobileqq.utils.NetworkUtil;
import com.tencent.mobileqq.utils.ReflectedMethods;
import com.tencent.mobileqq.vaswebviewplugin.VasWebviewConstants;
import com.tencent.mobileqq.widget.FormSimpleItem;
import com.tencent.mobileqq.widget.FormSwitchItem;
import com.tencent.mobileqq.widget.QQProgressDialog;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
public class QQSpecialFriendSettingActivity extends IphoneTitleBarActivity implements View.OnClickListener, CompoundButton.OnCheckedChangeListener, FaceDecoder.DecodeTaskCompletionListener {
    private static final int f86900a = 1;
    private static final String f16876a = "QQSpecialFriendSettingActivity";
    private static final int f86901b = 0;
    private static final int f86902c = 8193;
    private static final int d = 8194;
    private static final int e = 8195;
    private View f16878a;
    private ImageView f16879a;
    private TextView f16880a;
    private QvipSpecialSoundManager f16881a;
    private FriendListHandler f16882a;
    private FriendsManager f16884a;
    private SpecialCareInfo f16886a;
    private FaceDecoder f16887a;
    private FormSimpleItem f16888a;
    private FormSwitchItem f16889a;
    private QQProgressDialog f16890a;
    private boolean f16891a;
    private FormSwitchItem f16892b;
    private String f16893b;
    private int f;
    public final Handler f16877a = new ojc(this);
    private FriendListObserver f16883a = new ojd(this);
    private QvipSpecialCareObserver f16885a = new oje(this);

    @Override
    public boolean doOnCreate(Bundle bundle) {
        super.doOnCreate(bundle);
        setContentView(R.layout.f57626name_res_0x7f030501);
        setTitle(R.string.f65509name_res_0x7f0a1bc9);
        Intent intent = getIntent();
        this.f16893b = intent.getStringExtra(QQSpecialCareSettingActivity.f16859a);
        this.f16891a = intent.getBooleanExtra(ForwardFriendListActivity.i, false);
        a();
        this.f16882a = (FriendListHandler) this.app.getBusinessHandler(1);
        this.f16884a = (FriendsManager) this.app.getManager(50);
        this.app.addObserver(this.f16883a);
        this.app.addObserver(this.f16885a);
        b();
        ReportController.b(null, "dc01331", "", "", "0X80050E5", "0X80050E5", 0, 0, "0", "", "", "");
        if (QLog.isColorLevel()) {
            QLog.d(f16876a, 2, "doOnCreate mFriUin: " + this.f16893b);
        }
        return true;
    }

    private void a() {
        this.f16888a = (FormSimpleItem) findViewById(R.id.f53270name_res_0x7f091833);
        this.f16888a.setOnClickListener(this);
        this.f16889a = (FormSwitchItem) findViewById(R.id.f53269name_res_0x7f091832);
        this.f16889a.setOnCheckedChangeListener(this);
        this.f16892b = (FormSwitchItem) findViewById(R.id.f53271name_res_0x7f091834);
        this.f16892b.setOnCheckedChangeListener(this);
        this.f16878a = findViewById(R.id.f53273name_res_0x7f091836);
        this.f16878a.setOnClickListener(this);
        this.f16879a = (ImageView) findViewById(R.id.f53272name_res_0x7f091835);
        this.f16880a = (TextView) findViewById(R.id.f47911nickname);
        if (this.f16891a) {
            setLeftViewName(R.string.f64061name_res_0x7f0a161c);
            setRightButton(R.string.f64101name_res_0x7f0a1644, new oja(this));
            this.f16878a.setVisibility(8);
        } else {
            setLeftViewName(R.string.f63282name_res_0x7f0a1311);
        }
        if (AppSetting.f7081k) {
            this.f16889a.setContentDescription(getString(R.string.f65510name_res_0x7f0a1bca));
            this.f16892b.setContentDescription(getString(R.string.f65511name_res_0x7f0a1bcb));
        }
    }

    private void b() {
        this.f16881a = new QvipSpecialSoundManager(this, this.app);
        if (!this.f16881a.m4081a()) {
            if (QLog.isColorLevel()) {
                QLog.d(f16876a, 2, "QvipSpecialSoundManager no cache data.");
            }
            d();
        }
        this.f16887a = new FaceDecoder(this, this.app);
        this.f16887a.a(this);
        Bitmap a2 = this.f16887a.a(1, this.f16893b, 0);
        if (a2 == null) {
            if (!this.f16887a.m8991b()) {
                this.f16887a.a(this.f16893b, 1, true);
            }
            this.f16879a.setBackgroundDrawable((BitmapDrawable) ImageUtil.m9196a());
        } else {
            this.f16879a.setBackgroundDrawable(new BitmapDrawable(a2));
        }
        Friends m4323a = this.f16884a.m4323a(this.f16893b);
        if (m4323a == null) {
            this.f16880a.setText(this.f16893b);
        } else {
            this.f16880a.setText(m4323a.getFriendNickWithAlias());
        }
    }

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

    @Override
    public void doOnDestroy() {
        super.doOnDestroy();
        if (this.f16887a != null) {
            this.f16887a.d();
        }
        if (this.app != null) {
            this.app.removeObserver(this.f16885a);
            this.app.removeObserver(this.f16883a);
        }
        if (this.f16891a) {
            ReflectedMethods.a(BaseApplicationImpl.getContext(), AppConstants.Preferences.bX).edit().remove(AppConstants.Preferences.eI + this.f16893b).commit();
        }
    }

    public void c() {
        this.f16886a = this.f16884a.m4325a(this.f16893b);
        if (QLog.isColorLevel()) {
            QLog.d(f16876a, 2, "showItems mSpecInfo: " + this.f16886a);
        }
        if (this.f16886a == null) {
            if (!this.f16891a) {
                this.f16889a.setVisibility(8);
                this.f16892b.setVisibility(8);
                this.f16888a.setVisibility(8);
                this.f16878a.setVisibility(8);
                return;
            }
            this.f16878a.setVisibility(8);
            e();
            return;
        }
        this.f16889a.setVisibility(0);
        this.f16892b.setVisibility(0);
        if (!this.f16891a) {
            this.f16878a.setVisibility(0);
        }
        this.f16889a.setChecked(this.f16886a.specialRingSwitch != 0);
        this.f16892b.setChecked(this.f16886a.qzoneSwitch != 0);
        this.f16888a.setVisibility(this.f16889a.m9777a() ? 0 : 8);
        e();
    }

    private void d() {
        if (QLog.isColorLevel()) {
            QLog.d(f16876a, 2, "loadSpecialSoundConfig start loading...");
        }
        startTitleProgress();
        this.f16881a.a(new ojb(this));
    }

    public void e() {
        if (this.f16891a) {
            this.f = ReflectedMethods.a(BaseApplicationImpl.getContext(), AppConstants.Preferences.bX).getInt(AppConstants.Preferences.eI + this.f16893b, 1);
            String a2 = this.f16881a.a(this.f);
            this.f16888a.setRightText(TextUtils.isEmpty(a2) ? getString(R.string.f64153name_res_0x7f0a1678) : a2);
            if (QLog.isColorLevel()) {
                QLog.d(f16876a, 2, "updatePersonalVoice FromForwardFriendActivity mFriUin: " + this.f16893b + ", soundId: " + this.f + ", soundName: " + a2);
            }
        } else if (QvipSpecialCareManager.m4073a(this.f16893b, this.app)) {
            if (!this.f16881a.m4081a()) {
                d();
            }
            int a3 = QvipSpecialCareManager.a(this.f16893b, this.app);
            String a4 = this.f16881a.a(a3);
            if (QLog.isColorLevel()) {
                QLog.d(f16876a, 2, "updatePersonalVoice mFriUin: " + this.f16893b + ", soundId: " + a3 + ", soundName: " + a4);
            }
            FormSimpleItem formSimpleItem = this.f16888a;
            if (TextUtils.isEmpty(a4)) {
                a4 = getString(R.string.f64153name_res_0x7f0a1678);
            }
            formSimpleItem.setRightText(a4);
        } else {
            if (QLog.isColorLevel()) {
                QLog.d(f16876a, 2, "updatePersonalVoice not contain friend: " + this.f16893b);
            }
            this.f16888a.setRightText(getString(R.string.f64153name_res_0x7f0a1678));
        }
    }

    @Override
    public void a(int i, int i2, String str, Bitmap bitmap) {
        if (QLog.isColorLevel()) {
            QLog.d(f16876a, 2, "uin=" + str + ", type=" + i2 + ",avatar= " + bitmap);
        }
        if (bitmap != null && !this.f16887a.m8991b()) {
            this.f16879a.setBackgroundDrawable(new BitmapDrawable(bitmap));
        }
    }

    @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.f16893b + "&uin=" + this.app.getCurrentAccountUin() + "&_bid=279&lazy=" + this.f16891a);
                intent.putExtra("uin", this.f16893b);
                intent.putExtra(VasWebviewConstants.KEY_OPEN_PAGE_TIME, System.currentTimeMillis());
                startActivity(intent);
                return;
            case R.id.f53271name_res_0x7f091834:
            case R.id.f53272name_res_0x7f091835:
            default:
                return;
            case R.id.f53273name_res_0x7f091836:
                if (NetworkUtil.h(this)) {
                    this.f16882a.a(1, new String[]{this.f16893b}, new boolean[]{false});
                    Message obtainMessage = this.f16877a.obtainMessage(f86902c);
                    obtainMessage.obj = getString(R.string.f65520name_res_0x7f0a1bd4);
                    this.f16877a.sendMessage(obtainMessage);
                } else {
                    Message obtainMessage2 = this.f16877a.obtainMessage(e);
                    obtainMessage2.arg1 = 0;
                    obtainMessage2.arg2 = R.string.f63198name_res_0x7f0a12bb;
                    this.f16877a.sendMessage(obtainMessage2);
                }
                ReportController.b(null, "dc01331", "", "", "0X80050E6", "0X80050E6", 0, 0, "0", "", "", "");
                return;
        }
    }

    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
        FormSwitchItem formSwitchItem;
        int i = 2;
        if (!compoundButton.isPressed()) {
            if (QLog.isColorLevel()) {
                QLog.d(f16876a, 2, "onCheckedChanged isCheck: " + z + ", NOT switched by user.");
                return;
            }
            return;
        }
        if (QLog.isColorLevel()) {
            QLog.d(f16876a, 2, "onCheckedChanged isCheck: " + z + ", switched by user.");
        }
        this.f16888a.setVisibility(this.f16889a.m9777a() ? 0 : 8);
        if (!this.f16891a) {
            if (compoundButton == this.f16889a.m9775a()) {
                formSwitchItem = this.f16889a;
            } else if (compoundButton == this.f16892b.m9775a()) {
                i = 3;
                formSwitchItem = this.f16892b;
            } else {
                return;
            }
            if (NetworkUtil.h(this)) {
                this.f16882a.a(i, new String[]{this.f16893b}, new boolean[]{z});
                return;
            }
            Message obtainMessage = this.f16877a.obtainMessage(e);
            obtainMessage.arg1 = 0;
            obtainMessage.arg2 = R.string.f63198name_res_0x7f0a12bb;
            this.f16877a.sendMessage(obtainMessage);
            formSwitchItem.setChecked(formSwitchItem.m9777a() ? false : true);
        }
    }
}