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

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


package com.tencent.mobileqq.troopreward;

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.OrientationEventListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.tencent.biz.anonymous.AnonymousChatHelper;
import com.tencent.mobileqq.activity.QQBrowserActivity;
import com.tencent.mobileqq.app.BaseActivity;
import com.tencent.mobileqq.app.ThreadManager;
import com.tencent.mobileqq.app.TroopHandler;
import com.tencent.mobileqq.app.TroopObserver;
import com.tencent.mobileqq.jsp.EventApiPlugin;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.troop.utils.TroopRewardMgr;
import com.tencent.mobileqq.util.DisplayUtil;
import com.tencent.mobileqq.utils.DialogUtil;
import com.tencent.mobileqq.utils.NetworkUtil;
import com.tencent.mobileqq.utils.QQCustomDialog;
import com.tencent.mobileqq.widget.IndexView;
import com.tencent.mobileqq.widget.QQProgressDialog;
import com.tencent.mobileqq.widget.QQToast;
import com.tencent.open.business.viareport.ReportConfig;
import com.tencent.qphone.base.util.QLog;
import com.tencent.tim.R;
import com.tencent.widget.ActionSheet;
import com.tencent.widget.immersive.ImmersiveUtils;
import cooperation.qwallet.plugin.QWalletPayProgressDialog;
import java.lang.ref.WeakReference;
import org.json.JSONObject;
public class TroopRewardDetailActivity extends BaseActivity implements View.OnClickListener {
    protected static final long f94313a = 2000;
    public static final String f33212a = ".troop.troop_reward.detailActivity";
    protected static final int f94314b = 4;
    public int f33213a;
    public Context f33214a;
    protected View f33215a;
    protected FrameLayout f33216a;
    protected ImageView f33217a;
    protected RewardImageDetailView f33219a;
    protected OrientationDetector f33220a;
    public TroopRewardInfo f33221a;
    protected TroopRewardVideoPlayView f33222a;
    protected QQProgressDialog f33223a;
    public QWalletPayProgressDialog f33224a;
    protected View f33226b;
    protected FrameLayout f33227b;
    public boolean f33228b;
    protected boolean f33225a = true;
    protected TroopObserver f33218a = new vin(this);

    @Override
    public boolean doOnCreate(Bundle bundle) {
        if (Build.VERSION.SDK_INT >= 14) {
            getWindow().addFlags(8192);
        }
        this.mActNeedImmersive = false;
        super.doOnCreate(bundle);
        setContentView(R.layout.f57285name_res_0x7f0303ac);
        if (!m8950a()) {
            finish();
        } else {
            a();
            new IntentFilter().addAction(EventApiPlugin.f24508a);
            c("Exp_guestpay");
        }
        return true;
    }

    @Override
    public void doOnDestroy() {
        super.doOnDestroy();
        removeObserver(this.f33218a);
    }

    protected boolean m8950a() {
        this.f33221a = (TroopRewardInfo) getIntent().getSerializableExtra("rewardInfo");
        if (this.f33221a == null) {
            this.f33221a = new TroopRewardInfo();
        }
        this.f33221a.privilege = 100;
        this.f33221a.blurPicUrl = "";
        this.f33221a.clearPicUrl = "";
        if (TextUtils.isEmpty(this.f33221a.troopUin) || TextUtils.isEmpty(this.f33221a.ownerUin) || TextUtils.isEmpty(this.f33221a.rewardId)) {
            return false;
        }
        addObserver(this.f33218a);
        return true;
    }

    protected void a() {
        this.f33214a = this;
        this.f33216a = (FrameLayout) findViewById(R.id.f47788root);
        this.f33227b = (FrameLayout) findViewById(R.id.f47794name_res_0x7f0902ce);
        this.f33215a = findViewById(R.id.f48290rlCommenTitle);
        if (ImmersiveUtils.isSupporImmersive() == 1) {
            this.f33215a.setPadding(0, ImmersiveUtils.a((Context) this), 0, 0);
        }
        findViewById(R.id.f47677ivTitleBtnLeft).setOnClickListener(this);
        this.f33220a = new OrientationDetector(getApplicationContext());
        b();
    }

    public void b() {
        this.f33227b.removeAllViews();
        View findViewById = findViewById(R.id.f48300ivTitleBtnRightImage);
        findViewById.setVisibility(8);
        this.f33215a.setBackgroundDrawable(null);
        LayoutInflater from = LayoutInflater.from(this.f33214a);
        if (this.f33221a.privilege == 22) {
            this.f33226b = from.inflate(R.layout.f57289name_res_0x7f0303b0, (ViewGroup) this.f33227b, false);
            TextView textView = (TextView) this.f33226b.findViewById(R.id.f51774name_res_0x7f09125a);
            View findViewById2 = this.f33226b.findViewById(R.id.f51773name_res_0x7f091259);
            View findViewById3 = this.f33226b.findViewById(R.id.f51785name_res_0x7f091265);
            TextView textView2 = (TextView) this.f33226b.findViewById(R.id.f51784name_res_0x7f091264);
            TextView textView3 = (TextView) this.f33226b.findViewById(R.id.f51789name_res_0x7f091269);
            TextView textView4 = (TextView) this.f33226b.findViewById(R.id.f51786name_res_0x7f091266);
            a(this.f33221a.f94316msg, (TextView) this.f33226b.findViewById(R.id.f51771name_res_0x7f091257), false);
            if (this.f33221a.type == 2) {
                textView.setText(m8949a(this.f33221a.videoDuration));
                findViewById2.setVisibility(0);
            } else {
                findViewById2.setVisibility(8);
            }
            String string = getString(R.string.f61537name_res_0x7f0a0c3e);
            String str = string + getString(R.string.f61538name_res_0x7f0a0c3f);
            SpannableString spannableString = new SpannableString(str);
            spannableString.setSpan(new vim(this), string.length(), str.length(), 33);
            textView3.setText(spannableString);
            textView3.setHighlightColor(0);
            textView3.setMovementMethod(LinkMovementMethod.getInstance());
            String format = String.format("%.2f", Float.valueOf(this.f33221a.rewardFee / 100.0f));
            String string2 = getString(R.string.f61561name_res_0x7f0a0c56, new Object[]{format});
            SpannableString spannableString2 = new SpannableString(string2);
            spannableString2.setSpan(new AbsoluteSizeSpan(15, true), format.length(), string2.length(), 33);
            textView2.setText(spannableString2);
            if (this.f33221a.payMemberNum > 0) {
                textView4.setText(getString(R.string.f61560name_res_0x7f0a0c55, new Object[]{Integer.valueOf(this.f33221a.payMemberNum)}));
                textView4.setOnClickListener(this);
            } else {
                textView4.setText("");
                textView4.setOnClickListener(null);
            }
            this.f33217a = (ImageView) this.f33226b.findViewById(R.id.f51788name_res_0x7f091268);
            this.f33217a.setOnClickListener(this);
            findViewById3.setOnClickListener(this);
        } else if (this.f33221a.privilege == 0) {
            findViewById.setOnClickListener(this);
            findViewById.setVisibility(0);
            if (this.f33221a.type == 1) {
                this.f33226b = from.inflate(R.layout.f57288name_res_0x7f0303af, (ViewGroup) this.f33227b, false);
                ((TextView) this.f33226b.findViewById(R.id.f51782name_res_0x7f091262)).setText(getString(R.string.f61544name_res_0x7f0a0c45));
                if (this.f33220a != null) {
                    this.f33220a.enable();
                }
            } else if (this.f33221a.type == 2) {
                this.f33222a = new TroopRewardVideoPlayView(this.f33214a);
                this.f33222a.setOutTitleBar(this.f33215a);
                this.f33222a.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
                this.f33222a.setTroopRewardInfo(this.f33221a);
                this.f33226b = null;
                this.f33227b.addView(this.f33222a);
            }
        } else if (this.f33221a.privilege == 1 || this.f33221a.privilege == 5 || this.f33221a.privilege == 2) {
            this.f33226b = from.inflate(R.layout.f57286name_res_0x7f0303ad, (ViewGroup) this.f33227b, false);
            TextView textView5 = (TextView) this.f33226b.findViewById(R.id.f51774name_res_0x7f09125a);
            View findViewById4 = this.f33226b.findViewById(R.id.f51773name_res_0x7f091259);
            TextView textView6 = (TextView) this.f33226b.findViewById(R.id.f51775name_res_0x7f09125b);
            TextView textView7 = (TextView) this.f33226b.findViewById(R.id.f51777name_res_0x7f09125d);
            ((TextView) this.f33226b.findViewById(R.id.f51776name_res_0x7f09125c)).setOnClickListener(this);
            a(this.f33221a.f94316msg, (TextView) this.f33226b.findViewById(R.id.f51771name_res_0x7f091257), true);
            if (this.f33221a.payMemberNum > 0) {
                textView6.setText(getString(R.string.f61536name_res_0x7f0a0c3d, new Object[]{this.f33221a.payMemberNum + ""}));
                textView6.setVisibility(0);
            } else {
                textView6.setVisibility(8);
            }
            if (this.f33221a.type == 2) {
                textView5.setText(m8949a(this.f33221a.videoDuration));
                findViewById4.setVisibility(0);
            } else {
                findViewById4.setVisibility(8);
            }
            if (this.f33221a.privilege == 2) {
                textView7.setVisibility(0);
                if (!TextUtils.isEmpty(this.f33221a.punishWarningInfo)) {
                    textView7.setText(this.f33221a.punishWarningInfo);
                }
            } else {
                textView7.setVisibility(8);
            }
        } else if (this.f33221a.privilege == 40) {
            this.f33226b = from.inflate(R.layout.f57287name_res_0x7f0303ae, (ViewGroup) this.f33227b, false);
            ((TextView) this.f33226b.findViewById(R.id.f51779name_res_0x7f09125f)).setText(getString(R.string.f61540name_res_0x7f0a0c41));
            ((TextView) this.f33226b.findViewById(R.id.f51780name_res_0x7f091260)).setText(this.f33221a.punishWarningInfo);
            this.f33215a.setBackgroundColor(Color.parseColor("#f24971"));
        } else if (this.f33221a.privilege == 41) {
            this.f33226b = from.inflate(R.layout.f57290name_res_0x7f0303b1, (ViewGroup) this.f33227b, false);
            ((TextView) this.f33226b.findViewById(R.id.f51779name_res_0x7f09125f)).setText(getString(R.string.f61540name_res_0x7f0a0c41));
            ((TextView) this.f33226b.findViewById(R.id.f51790name_res_0x7f09126a)).setText(a(this.f33221a.punishLeftTime));
            ((TextView) this.f33226b.findViewById(R.id.f51780name_res_0x7f091260)).setText(this.f33221a.punishWarningInfo);
            this.f33215a.setBackgroundColor(Color.parseColor("#f24971"));
        }
        if (a(this.f33221a.type, this.f33221a.privilege)) {
            this.f33219a = new RewardImageDetailView(this.f33214a);
            this.f33219a.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
            this.f33219a.setOutAnimView(this.f33226b, this.f33215a);
            this.f33219a.a(getWindowManager().getDefaultDisplay().getRotation());
            this.f33219a.a(this.f33221a);
            if (this.f33220a != null) {
                this.f33220a.a(this.f33219a);
            }
            this.f33227b.addView(this.f33219a);
        }
        if (this.f33226b != null) {
            this.f33227b.addView(this.f33226b);
        }
    }

    public void a(String str, TextView textView, boolean z) {
        int i;
        String str2;
        ImageView imageView = (ImageView) this.f33226b.findViewById(R.id.f51772name_res_0x7f091258);
        RelativeLayout relativeLayout = (RelativeLayout) this.f33226b.findViewById(R.id.f51770name_res_0x7f091256);
        if (str != null) {
            String trim = str.trim();
            if (trim.length() <= 5) {
                textView.setTextSize(1, 30.0f);
                i = 18;
            } else {
                textView.setTextSize(1, 24.0f);
                i = 12;
            }
            if (trim.length() >= 9) {
                String str3 = trim.substring(0, 8) + "\n" + trim.substring(8);
                int i2 = (i * 2) + (i / 2);
                if (z) {
                    ViewGroup.LayoutParams layoutParams = relativeLayout.getLayoutParams();
                    layoutParams.height += DisplayUtil.a(this.f33214a, i2);
                    relativeLayout.setLayoutParams(layoutParams);
                }
                i = i2 + i + 1;
                str2 = str3;
            } else {
                str2 = trim;
            }
            if (z) {
                imageView.setPadding(imageView.getPaddingLeft(), imageView.getPaddingTop(), imageView.getPaddingRight(), DisplayUtil.a(this.f33214a, i));
            }
            textView.setText(str2);
            return;
        }
        textView.setText("");
    }

    public CharSequence a(int i) {
        try {
            String valueOf = String.valueOf(i / ReportConfig.f96238b);
            String valueOf2 = String.valueOf((i % ReportConfig.f96238b) / 60);
            String str = (valueOf.equals("0") && valueOf2.equals("0")) ? "1" : valueOf2;
            int parseColor = Color.parseColor("#f84a50");
            SpannableString spannableString = new SpannableString(getString(R.string.f61542name_res_0x7f0a0c43, new Object[]{valueOf, str}));
            spannableString.setSpan(new ForegroundColorSpan(parseColor), 0, valueOf.length(), 33);
            spannableString.setSpan(new ForegroundColorSpan(parseColor), valueOf.length() + 2, str.length() + valueOf.length() + 2, 33);
            return spannableString;
        } catch (Exception e) {
            if (QLog.isColorLevel()) {
                QLog.w(f33212a, 2, "getPunishTips exp", e);
            }
            return "";
        }
    }

    public String m8949a(int i) {
        int i2 = i / 60;
        int i3 = i % 60;
        return (i2 < 10 ? "0" + i2 : Integer.valueOf(i2)) + ":" + (i3 < 10 ? "0" + i3 : Integer.valueOf(i3));
    }

    public boolean a(int i, int i2) {
        if (i2 == 100) {
            return true;
        }
        if (i == 1) {
            return (i2 == 40 || i2 == 41) ? false : true;
        } else if (i == 2) {
            return (i2 == 40 || i2 == 41 || i2 == 0) ? false : true;
        } else {
            return true;
        }
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.f51785name_res_0x7f091265) {
            c("Clk_paybut");
            if (!NetworkUtil.e(getApplicationContext())) {
                a(getString(R.string.f64129name_res_0x7f0a1660));
            } else if (!this.f33225a) {
                a(getString(R.string.f61552name_res_0x7f0a0c4d));
            } else if (AnonymousChatHelper.a().m897a(this.f33221a.troopUin)) {
                QQCustomDialog message = DialogUtil.m9154a(this.f33214a, 230).setTitle(getString(R.string.f64209name_res_0x7f0a16b0)).setMessage(getString(R.string.f61551name_res_0x7f0a0c4c));
                message.setNegativeButton(getString(R.string.f63203cancel), new vio(this, message));
                message.setNegativeButtonContentDescription(getString(R.string.f58616name_res_0x7f0a00d2));
                message.setPositiveButton(getString(R.string.f61534name_res_0x7f0a0c3b), new vip(this));
                message.setPositiveButtonContentDescription(getString(R.string.f58615name_res_0x7f0a00d1));
                message.show();
            } else {
                d();
            }
        } else if (id == R.id.f51776name_res_0x7f09125c) {
            if (!NetworkUtil.e(getApplicationContext())) {
                a(getString(R.string.f64129name_res_0x7f0a1660));
                return;
            }
            TroopRewardMgr.a(this.app, this, this.f33221a.troopUin);
            finish();
        } else if (id == R.id.f47677ivTitleBtnLeft) {
            finish();
        } else if (id == R.id.f48300ivTitleBtnRightImage) {
            ActionSheet a2 = ActionSheet.a(this.f33214a);
            a2.c(getString(R.string.f61554name_res_0x7f0a0c4f));
            a2.c(getString(R.string.f61553name_res_0x7f0a0c4e));
            a2.d(R.string.f63203cancel);
            a2.a(new viq(this, a2));
            a2.show();
            c("Clk_filter");
        } else if (id == R.id.f51788name_res_0x7f091268) {
            if (this.f33217a != null) {
                this.f33225a = !this.f33225a;
                if (this.f33225a) {
                    this.f33217a.setImageResource(R.drawable.f43802name_res_0x7f020aaa);
                } else {
                    this.f33217a.setImageResource(R.drawable.f43803name_res_0x7f020aab);
                }
            }
            c("Clk_checkbut");
        } else if (id == R.id.f51786name_res_0x7f091266) {
            c();
            c("Clk_paypeople");
        }
    }

    public void c() {
        String str = "http://qun.qq.com/qunpay/reward/history.html?_wv=1039&_bid=2313&gc=" + this.f33221a.troopUin + "&id=" + this.f33221a.rewardId;
        Intent intent = new Intent(this.f33214a, QQBrowserActivity.class);
        intent.putExtra("url", str);
        this.f33214a.startActivity(intent);
        if (QLog.isColorLevel()) {
            QLog.d(".troop.troop_reward", 2, "openPayRecord:" + str);
        }
    }

    public void f() {
        StringBuilder sb = new StringBuilder();
        sb.append("system=android");
        sb.append(IndexView.f95329b);
        sb.append("version=" + Build.VERSION.RELEASE);
        sb.append(IndexView.f95329b);
        sb.append("uintype=1");
        sb.append(IndexView.f95329b);
        sb.append("eviluin=" + this.f33221a.ownerUin);
        sb.append(IndexView.f95329b);
        sb.append("appname=KQQ");
        sb.append(IndexView.f95329b);
        sb.append("appid=2400002");
        sb.append(IndexView.f95329b);
        sb.append("subapp=troopreward");
        sb.append(IndexView.f95329b);
        sb.append("scene=1108");
        sb.append(IndexView.f95329b);
        sb.append("srv_para=groupid:" + this.f33221a.troopUin + "|img:" + this.f33221a.clearPicUrl);
        if (this.f33221a.type == 2) {
            sb.append("|vid:" + this.f33221a.vid);
        }
        sb.append("|rewardid:" + this.f33221a.rewardId);
        ThreadManager.a(new vir(this, sb.toString()), 5, null, false);
    }

    public void d() {
        this.f33224a = new QWalletPayProgressDialog(this);
        this.f33224a.show();
        ((TroopRewardMgr) this.app.getManager(151)).a(this.f33221a.troopUin, this.f33221a.rewardId, new vis(this));
    }

    @Override
    public void doOnActivityResult(int i, int i2, Intent intent) {
        JSONObject jSONObject;
        JSONObject jSONObject2;
        if (i == 9 && i2 == -1 && intent != null) {
            String stringExtra = intent.getStringExtra("result");
            if (stringExtra != null && stringExtra.length() > 0) {
                try {
                    jSONObject = new JSONObject(stringExtra);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (jSONObject != null) {
                    jSONObject.optString("retmsg");
                    i2 = jSONObject.optInt("resultCode", -1);
                    String optString = jSONObject.optString("data");
                    if (optString != null && optString.length() > 0) {
                        try {
                            jSONObject2 = new JSONObject(optString);
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                        this.f33224a.dismiss();
                        if (i2 != 0 && jSONObject2 != null) {
                            ((TroopRewardMgr) this.app.getManager(151)).m8837a(stringExtra, this.app.getCurrentAccountUin());
                            c("Suc_pay");
                            this.f33228b = true;
                            this.f33213a = 0;
                            TroopHandler troopHandler = (TroopHandler) this.app.getBusinessHandler(20);
                            b(getString(R.string.f61558name_res_0x7f0a0c53));
                            ReportController.b(this.app, "dc01332", "BizTechReport", "", "Grp_troop_reward", "reward_succ", 0, 0, "", "", "", "");
                        } else {
                            a(getString(R.string.f61557name_res_0x7f0a0c52));
                        }
                    }
                }
                jSONObject2 = null;
                this.f33224a.dismiss();
                if (i2 != 0) {
                }
                a(getString(R.string.f61557name_res_0x7f0a0c52));
            }
            jSONObject = null;
            if (jSONObject != null) {
            }
            jSONObject2 = null;
            this.f33224a.dismiss();
            if (i2 != 0) {
            }
            a(getString(R.string.f61557name_res_0x7f0a0c52));
        }
        super.doOnActivityResult(i, i2, intent);
    }

    public void a(String str) {
        if (isResume()) {
            QQToast.a(this.f33214a, str, 1).b(getTitleBarHeight());
        }
    }

    protected void b(String str) {
        if (this.f33223a == null) {
            this.f33223a = new QQProgressDialog(this);
        }
        this.f33223a.a(str);
        this.f33223a.a(getTitleBarHeight());
        this.f33223a.show();
    }

    public void e() {
        if (this.f33223a != null && this.f33223a.isShowing()) {
            this.f33223a.dismiss();
        }
    }

    @Override
    public void doOnResume() {
        super.doOnResume();
        if (this.f33222a != null) {
            this.f33222a.d();
        }
        if (this.f33220a != null && this.f33221a.privilege == 0 && this.f33221a.type == 1) {
            this.f33220a.enable();
        }
    }

    @Override
    public void doOnPause() {
        super.doOnPause();
        if (this.f33222a != null) {
            this.f33222a.c();
        }
        if (this.f33220a != null) {
            this.f33220a.disable();
        }
    }

    public class OrientationDetector extends OrientationEventListener {
        WeakReference f94315a;

        public OrientationDetector(Context context) {
            super(context);
            this.f94315a = null;
        }

        public void a(RewardImageDetailView rewardImageDetailView) {
            this.f94315a = new WeakReference(rewardImageDetailView);
        }

        @Override
        public void onOrientationChanged(int i) {
            RewardImageDetailView rewardImageDetailView;
            if (this.f94315a != null && (rewardImageDetailView = (RewardImageDetailView) this.f94315a.get()) != null) {
                rewardImageDetailView.a(i);
            }
        }
    }

    @Override
    public boolean isSupportScreenShot() {
        return false;
    }

    public void c(String str) {
        if (this.f33221a != null) {
            String str2 = "";
            if (str.equals("Suc_pay")) {
                str2 = this.f33221a.rewardFee + "";
            }
            String str3 = "0";
            if (this.f33221a.type == 2) {
                str3 = "1";
            }
            ReportController.b(this.app, "dc01332", ReportController.t, "", "Guestpaypic", str, 0, 0, this.f33221a.troopUin, str2, str3, "");
            if (QLog.isColorLevel()) {
                QLog.d(f33212a, 2, "reportClickEvent: opName=" + str);
            }
        }
    }
}