酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319

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


package com.kugou.android.userCenter;

import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Looper;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.kugou.android.app.NavigationUtils;
import com.kugou.android.app.flexowebview.KGFelxoWebFragment;
import com.kugou.android.app.flexowebview.KugouWebUtils;
import com.kugou.android.common.delegate.DelegateFragment;
import com.kugou.android.lite.R;
import com.kugou.android.netmusic.discovery.post.PostListPostedFragment;
import com.kugou.android.recentweek.RecentWeekRankListFragment;
import com.kugou.android.userCenter.invite.contact.InviteContactFragment;
import com.kugou.android.useraccount.UserAccountSettingActivity;
import com.kugou.common.permission.Action;
import com.kugou.common.permission.GrantAction;
import com.kugou.common.permission.KGCommonRational;
import com.kugou.common.permission.KGPermission;
import com.kugou.common.permission.Permission;
import com.kugou.common.userCenter.LogoutLayout;
import com.kugou.common.utils.as;
import com.kugou.common.utils.br;
import com.kugou.common.utils.bv;
import com.kugou.common.utils.cj;
import com.kugou.framework.musicfees.ui.walletrecharge.WalletInfoActivity;
import com.kugou.framework.service.util.BackgroundServiceUtil;
import com.kugou.svplayer.worklog.WorkLog;
import java.lang.ref.WeakReference;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public class UserInfoFragment extends DelegateFragment implements View.OnClickListener, com.kugou.ktv.android.common.user.a {
    private View A;
    private View B;
    private View C;
    private TextView D;
    private LinearLayout E;
    private com.kugou.android.setting.c.f G;
    private TextView H;

    private View f43910a;

    private TextView f43911b;

    private View f43912c;

    private View f43913d;

    private TextView f43914e;
    private View f;
    private View g;
    private TextView h;
    private View i;
    private TextView j;
    private a k;
    private b l;
    private com.kugou.common.userCenter.m m;
    private com.kugou.android.recentweek.util.c o;
    private com.kugou.android.recentweek.d p;
    private UserInfosMainFragment u;
    private View x;
    private LinearLayout z;
    private boolean n = false;
    private boolean q = false;
    private boolean r = false;
    private int s = 0;
    private int y = -1;
    private int F = -1;
    private com.kugou.android.userCenter.a t = null;
    private final BroadcastReceiver v = new BroadcastReceiver() {
        @Override
        @SuppressLint({"NewApi"})
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if ("com.kugou.android.action.refresh_request".equals(action)) {
                UserInfoFragment.this.k.removeMessages(2);
                UserInfoFragment.this.k.sendEmptyMessage(2);
                return;
            }
            if ("com.kugou.android.pay_finish".equals(action)) {
                UserInfoFragment.this.k.removeMessages(2);
                UserInfoFragment.this.k.sendEmptyMessage(2);
                return;
            }
            if ("com.kugou.android.user_logout".equals(action)) {
                UserInfoFragment.this.l.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        UserInfoFragment.this.finish();
                    }
                }, 500L);
                return;
            }
            if ("com.kugou.android.action.wallet_balance_change".equals(action)) {
                UserInfoFragment.this.l.obtainMessage(4).sendToTarget();
                return;
            }
            if ("com.kugou.android.action.vip_state_change".equals(action)) {
                UserInfoFragment.this.k.removeMessages(6);
                UserInfoFragment.this.k.sendEmptyMessage(6);
                return;
            }
            if ("com.kugou.android.action.ksmodule.status".equals(action)) {
                int intExtra = intent.getIntExtra("KS_STATUS", -1);
                if (intent.getIntExtra("KS_TYPE", -1) == 0) {
                    if (intExtra == 0) {
                        UserInfoFragment.this.F = 0;
                    } else if (intExtra == 1) {
                        UserInfoFragment.this.F = 2;
                    } else if (intExtra == 2) {
                        UserInfoFragment.this.F = 0;
                    } else if (intExtra == 3) {
                        UserInfoFragment.this.F = 0;
                    } else if (intExtra == 4) {
                        UserInfoFragment.this.F = 0;
                    }
                    UserInfoFragment.this.g();
                    return;
                }
                return;
            }
            if ("com.kugou.android.action.h5face.status".equals(action)) {
                UserInfoFragment.this.F = intent.getIntExtra("KS_STATUS", -1);
                UserInfoFragment.this.g();
            }
        }
    };
    private final int w = 6;

    private boolean a(int i) {
        return (i > 0 && i < 5) || i == 6;
    }

    private boolean b(int i) {
        return i == 6;
    }

    private boolean c(int i) {
        return i > 0 && i < 5;
    }

    private boolean d(int i) {
        return i > 2;
    }

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

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        d();
    }

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        return layoutInflater.inflate(R.layout.alc, viewGroup, false);
    }

    @Override
    public void onActivityCreated(Bundle bundle) {
        super.onActivityCreated(bundle);
        ((LogoutLayout) findViewById(R.id.i9)).setCurFragment(getParentFragment());
        this.g = findViewById(R.id.b2q);
        this.h = (TextView) findViewById(R.id.c9e);
        this.D = (TextView) findViewById(R.id.fgy);
        this.i = findViewById(R.id.awo);
        this.j = (TextView) findViewById(R.id.awp);
        this.f43910a = findViewById(R.id.awk);
        this.A = findViewById(R.id.fgx);
        this.f43912c = findViewById(R.id.awi);
        this.x = findViewById(R.id.fgz);
        this.f43913d = findViewById(R.id.awr);
        this.f = findViewById(R.id.awh);
        this.z = (LinearLayout) findViewById(R.id.fgt);
        this.E = (LinearLayout) findViewById(R.id.fgv);
        this.H = (TextView) findViewById(R.id.fgw);
        View findViewById = findViewById(R.id.fgu);
        if (com.kugou.common.config.c.a().d(com.kugou.android.app.a.a.CB) == 1) {
            this.E.setVisibility(0);
            findViewById.setVisibility(0);
        } else {
            this.E.setVisibility(8);
            findViewById.setVisibility(8);
        }
        this.B = findViewById(R.id.fh1);
        this.C = findViewById(R.id.fh0);
        this.f43914e = (TextView) findViewById(R.id.aws);
        this.f43911b = (TextView) findViewById(R.id.awl);
        this.i.setOnClickListener(this);
        this.f43910a.setOnClickListener(this);
        this.f43912c.setOnClickListener(this);
        this.f43913d.setOnClickListener(this);
        this.x.setOnClickListener(this);
        this.f.setOnClickListener(this);
        this.z.setOnClickListener(this);
        this.E.setOnClickListener(this);
        this.A.setOnClickListener(this);
        this.z.setVisibility(com.kugou.common.utils.l.c(false) ? 8 : 0);
        if (br.ap()) {
            this.g.setVisibility(8);
        } else {
            this.g.setVisibility(8);
        }
        this.y = getArguments().getInt("key_kugou_auth", -1);
        this.F = getArguments().getInt("key_kugou_face_auth", -1);
        g();
        if (n()) {
            this.x.setVisibility(0);
        }
        this.k = new a(getWorkLooper(), this);
        this.l = new b(Looper.getMainLooper(), this);
        findViewById(R.id.awq).setOnClickListener(this);
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("com.kugou.android.action.nieck_name_changed");
        intentFilter.addAction("com.kugou.android.action.refresh_request");
        intentFilter.addAction("com.kugou.android.pay_finish");
        intentFilter.addAction("com.kugou.android.action.h5face.status");
        intentFilter.addAction("com.kugou.android.user_logout");
        intentFilter.addAction("com.kugou.android.action.ACTION_USER_INFO_GET_SUCCESS");
        intentFilter.addAction("com.kugou.android.action.ACTION_USER_INFO_GET_FAILED");
        intentFilter.addAction("com.kugou.android.action.ksmodule.status");
        intentFilter.addAction("com.kugou.android.action.ACTION_USERINFO_MODIFY_SUCCESS");
        intentFilter.addAction("com.kugou.android.action.wallet_balance_change");
        intentFilter.addAction("com.kugou.android.action.vip_state_change");
        intentFilter.addAction("com.kugou.android.action.buy_vip_success");
        com.kugou.common.b.a.b(this.v, intentFilter);
        this.n = true;
        f();
        e();
        a();
        if (!com.kugou.common.environment.a.o()) {
            br.T(getActivity());
        }
        this.B.setVisibility(8);
        this.C.setVisibility(8);
        this.B.setOnClickListener(this);
        if (this.u.getIsOpenMusician()) {
            this.B.setVisibility(0);
            this.C.setVisibility(0);
        }
        if (com.kugou.common.environment.a.u() && com.kugou.common.environment.a.P()) {
            this.D.setText(R.string.a4h);
        } else {
            this.D.setText(R.string.a4j);
        }
    }

    public void g() {
        TextView textView = this.H;
        if (textView != null) {
            int i = this.F;
            if (i == 0) {
                textView.setText("未认证");
                return;
            }
            if (i == 1) {
                textView.setText("认证中");
                return;
            }
            if (i == 2) {
                textView.setText("已认证");
                return;
            }
            if (i == 3) {
                textView.setText("认证不通过");
            } else if (i == 4) {
                textView.setText("已通过");
            } else {
                textView.setText("");
            }
        }
    }

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

    @Override
    public void onFragmentFirstStart() {
        super.onFragmentFirstStart();
        this.q = true;
        if (this.r) {
            this.j.setText(com.kugou.android.recentweek.util.d.a(this.s));
        }
    }

    @Override
    public void setFragmentArguments(Bundle bundle) {
        com.kugou.common.userCenter.m mVar;
        if (bundle == null || (mVar = (com.kugou.common.userCenter.m) bundle.getSerializable("personalInfo")) == null || mVar.C() != 1) {
            return;
        }
        this.m = mVar;
        if (this.n) {
            e();
        }
    }

    private void a() {
        String v = com.kugou.framework.setting.a.d.a().v();
        if (!TextUtils.isEmpty(v)) {
            if (v.startsWith(com.kugou.common.environment.a.Y() + "") && v.substring(v.indexOf(WorkLog.SEPARATOR_KEY_VALUE) + 1, v.length()).equals("true")) {
                this.f43912c.setVisibility(0);
                findViewById(R.id.awn).setVisibility(0);
                return;
            }
        }
        this.k.sendEmptyMessage(1);
    }

    private com.kugou.android.recentweek.d b() {
        if (this.p == null) {
            this.p = new com.kugou.android.recentweek.d() {
                @Override
                public void a(com.kugou.android.recentweek.b.g gVar) {
                    UserInfoFragment.this.s = gVar.b();
                    UserInfoFragment.this.r = true;
                    if (UserInfoFragment.this.q) {
                        UserInfoFragment.this.j.setText(com.kugou.android.recentweek.util.d.a(gVar.b()));
                    }
                }
            };
        }
        return this.p;
    }

    private com.kugou.android.recentweek.util.c c() {
        if (this.o == null) {
            this.o = new com.kugou.android.recentweek.util.c(aN_(), b());
        }
        return this.o;
    }

    private void d() {
        if (com.kugou.android.recentweek.util.d.a(aN_(), false)) {
            c().a(com.kugou.common.environment.a.Y());
        }
    }

    private void e() {
        com.kugou.common.userCenter.m mVar = this.m;
        if (mVar != null) {
            int l = mVar.l();
            int m = this.m.m();
            int i = 1;
            if (!a(l) && !c(m)) {
                i = 0;
            } else if (a(l) && c(m)) {
                long a2 = com.kugou.common.useraccount.utils.d.a(com.kugou.common.business.unicom.b.f.a(new Date(System.currentTimeMillis()), "yyyy-MM-dd HH:mm:ss"), this.m.n());
                long a3 = com.kugou.common.useraccount.utils.d.a(com.kugou.common.business.unicom.b.f.a(new Date(System.currentTimeMillis()), "yyyy-MM-dd HH:mm:ss"), this.m.o());
                if (a3 > 0 && a3 < a2) {
                    a2 = a3;
                }
                if (com.kugou.common.useraccount.utils.d.a(com.kugou.common.business.unicom.b.f.a(new Date(System.currentTimeMillis()), "yyyy-MM-dd HH:mm:ss"), this.m.p()) < a2) {
                }
            } else if (c(m)) {
            }
            a(i, this.m.p(), this.m.n(), this.m.o());
        }
    }

    private void f() {
        this.k.sendEmptyMessage(0);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        com.kugou.common.b.a.b(this.v);
        com.kugou.android.setting.c.f fVar = this.G;
        if (fVar != null) {
            fVar.b();
        }
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.awh:
                if (!com.kugou.common.environment.a.o()) {
                    br.T(aN_());
                    return;
                }
                Intent intent = new Intent();
                intent.setClass(aN_(), UserAccountSettingActivity.class);
                startActivity(intent);
                return;
            case R.id.awi:
                Bundle bundle = new Bundle();
                bundle.putString(DelegateFragment.KEY_IDENTIFIER, getSourcePath());
                bundle.putString(DelegateFragment.KEY_RESUME_PAGE_CUSTOM_IDENTIFIER, "已购音乐");
                bundle.putBoolean(DelegateFragment.KEY_RESUME_PAGE_IDENTIFIER_APPEND_TITLE, false);
                bundle.putBoolean(DelegateFragment.KEY_USE_AUTO_IDENTIFIER_SOURCE, false);
                NavigationUtils.a((DelegateFragment) this, bundle);
                return;
            case R.id.awk:
                if (!com.kugou.common.network.a.g.a()) {
                    com.kugou.common.network.a.g.a(1009);
                    return;
                } else {
                    startActivity(new Intent(aN_(), (Class<?>) WalletInfoActivity.class));
                    return;
                }
            case R.id.awo:
                Bundle bundle2 = new Bundle();
                bundle2.putBoolean("isMySelf", true);
                bundle2.putLong("targetId", com.kugou.common.environment.a.Y());
                bundle2.putString("targetName", com.kugou.common.environment.a.D());
                com.kugou.common.base.g.b(RecentWeekRankListFragment.class, bundle2);
                BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(aN_(), com.kugou.framework.statistics.easytrace.a.FL));
                return;
            case R.id.awq:
                startFragment(PostListPostedFragment.class, null);
                return;
            case R.id.awr:
                NavigationUtils.startVipInfoFragmetn(aN_());
                return;
            case R.id.b2q:
                h();
                return;
            case R.id.fgt:
                this.G = new com.kugou.android.setting.c.f(getActivity());
                this.G.a();
                return;
            case R.id.fgv:
                if (!com.kugou.common.environment.a.o()) {
                    br.T(getActivity());
                    return;
                } else {
                    i();
                    return;
                }
            case R.id.fgx:
                if (!br.Q(getActivity())) {
                    bv.a(getActivity(), R.string.av3);
                    return;
                } else if (!com.kugou.common.environment.a.o()) {
                    br.T(getActivity());
                    return;
                } else {
                    a_("此钱包入口不可用");
                    return;
                }
            case R.id.fgz:
                if (br.aj(getActivity())) {
                    String string = aN_().getResources().getString(R.string.aie);
                    Bundle bundle3 = new Bundle();
                    bundle3.putString("web_url", p());
                    bundle3.putString("web_title", string);
                    startFragment(KGFelxoWebFragment.class, bundle3);
                    return;
                }
                return;
            case R.id.fh1:
                Bundle bundle4 = new Bundle();
                bundle4.putString("web_url", "http://www2.kugou.kugou.com/apps/yinyueren/html/index.html");
                bundle4.putBoolean("KG_FELXO_WEB_IS_AUTO_WEB_VIEW", true);
                startFragment(KGFelxoWebFragment.class, bundle4);
                return;
            default:
                return;
        }
    }

    private void i() {
        KGPermission.with(this).runtime().permission(Permission.CAMERA).rationale(new KGCommonRational.Builder(getActivity()).setTitleResId(R.string.axq).setContentResId(R.string.awc).setLocationResId(R.string.axi).build()).onDenied(new Action<List<String>>() {
            @Override
            public void onAction(List<String> list) {
                bv.d(UserInfoFragment.this.aN_(), "启动相机失败!请在“权限管理”中设置!");
            }
        }).onGranted(new GrantAction<List<String>>() {
            @Override
            public void onTokenAction(String str, List<String> list) {
                KugouWebUtils.startWebActivity(UserInfoFragment.this.getActivity(), "真人认证", com.kugou.common.config.c.a().b(com.kugou.android.app.a.a.Cr));
                com.kugou.common.statistics.e.a.a(com.kugou.framework.statistics.easytrace.c.eA);
            }
        }).start();
    }

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

    private void a(boolean z) {
        if (br.ap()) {
            return;
        }
        if (this.t == null) {
            this.t = new com.kugou.android.userCenter.a();
        }
        this.t.a(new com.kugou.framework.common.utils.m<Boolean, Void>() {
            @Override
            public void a(Boolean bool) {
                UserInfoFragment.this.h.setText((bool == null || !bool.booleanValue()) ? R.string.b7b : R.string.b7a);
            }
        }, z);
    }

    private void h() {
        Bundle bundle = new Bundle();
        bundle.putString("PAGE_SOURCE_KEY_ICF", "个人中心-设置/帐号设置");
        com.kugou.common.base.g.a((Class<? extends Fragment>) InviteContactFragment.class, bundle);
        BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(com.kugou.framework.statistics.easytrace.a.Xe));
    }

    public void a(UserInfosMainFragment userInfosMainFragment) {
        this.u = userInfosMainFragment;
    }

    private void a(int i, String str, String str2, String str3) {
        if (i == 0) {
            this.f43914e.setText("开通豪华VIP,立赠音乐包");
            return;
        }
        if (i == 1 || i == 2) {
            String a2 = a(str);
            if (TextUtils.isEmpty(a2)) {
                return;
            }
            this.f43914e.setText("音乐包 " + a2 + "到期");
            return;
        }
        if (i == 3) {
            String a3 = a(str2);
            if (TextUtils.isEmpty(a3)) {
                return;
            }
            this.f43914e.setText("VIP " + a3 + "到期");
            return;
        }
        if (i != 4) {
            return;
        }
        String a4 = a(str3);
        if (TextUtils.isEmpty(a4)) {
            return;
        }
        this.f43914e.setText("豪华VIP " + a4 + "到期");
    }

    private String a(String str) {
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        try {
            return new SimpleDateFormat("yyyy-MM-dd").format(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(str));
        } catch (Exception e2) {
            as.e(e2);
            return "";
        }
    }

    private void j() {
        int c2;
        com.kugou.common.i.b.a.a e2 = new com.kugou.framework.musicfees.k().e(1, 1);
        if (e2 == null || e2.d() == null || (c2 = e2.d().c()) <= 0) {
            return;
        }
        com.kugou.framework.setting.a.d.a().c(com.kugou.common.environment.a.Y() + WorkLog.SEPARATOR_KEY_VALUE + true);
        this.l.obtainMessage(3, c2, 0).sendToTarget();
    }

    private void k() {
        int i = 1;
        if (!com.kugou.common.environment.a.E() && !com.kugou.common.environment.a.P()) {
            i = 0;
        } else if (com.kugou.common.environment.a.E() && com.kugou.common.environment.a.P()) {
            long a2 = com.kugou.common.useraccount.utils.d.a(com.kugou.common.business.unicom.b.f.a(new Date(System.currentTimeMillis()), "yyyy-MM-dd HH:mm:ss"), com.kugou.common.environment.a.O());
            long a3 = com.kugou.common.useraccount.utils.d.a(com.kugou.common.business.unicom.b.f.a(new Date(System.currentTimeMillis()), "yyyy-MM-dd HH:mm:ss"), com.kugou.common.environment.a.M());
            if (a3 > 0 && a3 < a2) {
                a2 = a3;
            }
            if (com.kugou.common.useraccount.utils.d.a(com.kugou.common.business.unicom.b.f.a(new Date(System.currentTimeMillis()), "yyyy-MM-dd HH:mm:ss"), com.kugou.common.environment.a.T()) < a2) {
            }
        } else if (com.kugou.common.environment.a.P()) {
        }
        this.l.obtainMessage(5, i, 0).sendToTarget();
    }

    private void l() {
        new com.kugou.framework.musicfees.k().a(aN_());
        this.l.obtainMessage(4).sendToTarget();
    }

    public void a(Message message) {
        int i = message.what;
        if (i == 0) {
            l();
            return;
        }
        if (i == 1) {
            j();
        } else if (i == 2) {
            l();
        } else {
            if (i != 6) {
                return;
            }
            k();
        }
    }

    public void b(Message message) {
        if (isAlive()) {
            int i = message.what;
            if (i == 3) {
                if (message.arg1 > 0) {
                    this.f43912c.setVisibility(0);
                    findViewById(R.id.awn).setVisibility(0);
                    return;
                } else {
                    this.f43912c.setVisibility(8);
                    findViewById(R.id.awn).setVisibility(8);
                    return;
                }
            }
            if (i != 4) {
                if (i != 5) {
                    return;
                }
                a(message.arg1, com.kugou.common.environment.a.T(), com.kugou.common.environment.a.N(), com.kugou.common.environment.a.M());
                return;
            }
            String U = com.kugou.common.environment.a.U();
            if (!com.kugou.framework.musicfees.l.d() && Double.valueOf(U).doubleValue() == 0.0d) {
                this.f43910a.setVisibility(8);
                findViewById(R.id.awm).setVisibility(8);
            } else {
                findViewById(R.id.awm).setVisibility(8);
                this.f43910a.setVisibility(0);
            }
            if (cj.d(aN_())) {
                this.f43911b.setText(U);
            } else {
                this.f43911b.setText("");
            }
        }
    }

    public static class a extends com.kugou.framework.common.utils.stacktrace.e {

        private WeakReference<UserInfoFragment> f43921a;

        public a(Looper looper, UserInfoFragment userInfoFragment) {
            super(looper);
            this.f43921a = null;
            this.f43921a = new WeakReference<>(userInfoFragment);
        }

        @Override
        public void handleMessage(Message message) {
            WeakReference<UserInfoFragment> weakReference = this.f43921a;
            if (weakReference == null || weakReference.get() == null) {
                return;
            }
            this.f43921a.get().a(message);
        }
    }

    private boolean m() {
        int i = this.y;
        return i == 1 || i == 3;
    }

    private boolean n() {
        return m() && o() && !TextUtils.isEmpty(p());
    }

    private boolean o() {
        return com.kugou.common.config.c.a().c(com.kugou.android.app.a.a.qT);
    }

    private String p() {
        return com.kugou.common.config.c.a().b(com.kugou.android.app.a.a.qS);
    }

    public static class b extends com.kugou.framework.common.utils.stacktrace.e {

        private WeakReference<UserInfoFragment> f43922a;

        public b(Looper looper, UserInfoFragment userInfoFragment) {
            super(looper);
            this.f43922a = null;
            this.f43922a = new WeakReference<>(userInfoFragment);
        }

        @Override
        public void handleMessage(Message message) {
            WeakReference<UserInfoFragment> weakReference = this.f43922a;
            if (weakReference == null || weakReference.get() == null) {
                return;
            }
            this.f43922a.get().b(message);
        }
    }
}