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

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


package com.kugou.android.userCenter;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
import android.os.Message;
import android.provider.MediaStore;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Space;
import android.widget.TextView;
import com.kugou.android.app.KGApplication;
import com.kugou.android.app.NavigationUtils;
import com.kugou.android.app.msgchat.picture.FullScreenActivity;
import com.kugou.android.common.delegate.DelegateFragment;
import com.kugou.android.common.imagecrop.CropImage;
import com.kugou.android.common.utils.KGSystemUtil;
import com.kugou.android.common.widget.KGCircularImageViewWithLabel;
import com.kugou.android.denpant.model.AvatorPendantModel;
import com.kugou.android.denpant.widget.AvatorPendantLayout;
import com.kugou.android.lite.R;
import com.kugou.android.userCenter.event.UpdateUserStarVipEvent;
import com.kugou.android.userCenter.event.i;
import com.kugou.android.useraccount.ModifyUserInfoActivity;
import com.kugou.common.app.KGCommonApplication;
import com.kugou.common.base.AbsFrameworkFragment;
import com.kugou.common.base.VIPMusicImageView;
import com.kugou.common.userCenter.UserInfoConstant;
import com.kugou.common.userCenter.protocol.j;
import com.kugou.common.userCenter.protocol.o;
import com.kugou.common.useraccount.entity.z;
import com.kugou.common.useraccount.protocol.GetYoungVipInfoProtocol;
import com.kugou.common.useraccount.protocol.ac;
import com.kugou.common.utils.ag;
import com.kugou.common.utils.al;
import com.kugou.common.utils.ap;
import com.kugou.common.utils.as;
import com.kugou.common.utils.au;
import com.kugou.common.utils.be;
import com.kugou.common.utils.br;
import com.kugou.common.utils.bt;
import com.kugou.common.utils.bv;
import com.kugou.common.utils.cj;
import com.kugou.common.utils.y;
import com.kugou.common.widget.overscroll.OverScrollDecoratorHelper;
import com.kugou.common.widget.overscroll.VerticalOverScrollBounceEffectDecorator;
import com.kugou.fanxing.delegate.FanxingModule;
import com.kugou.fanxing.delegate.FxResource;
import com.kugou.fanxing.delegate.IFanxingTargetWrapperManager;
import com.kugou.fanxing.delegate.SimpleErrorAction1;
import com.kugou.framework.service.util.BackgroundServiceUtil;
import com.kugou.framework.statistics.kpi.bc;
import com.qq.e.comm.constants.ErrorCode;
import de.greenrobot.event.EventBus;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class UserInfosMainFragment extends DelegateFragment implements View.OnClickListener {
    private int F;
    private View G;
    private ImageView H;
    private boolean J;
    private Bitmap L;
    private n M;
    private com.kugou.common.userCenter.m Q;
    private ImageView R;
    private ImageView S;
    private TextView X;
    private com.kugou.common.dialog8.c.a Z;
    private UserInfoFragment ac;
    private AvatorPendantLayout ae;
    private AvatorPendantModel.DenpantData af;

    private KGCircularImageViewWithLabel f43925c;

    private TextView f43926d;

    private View f43927e;
    private VIPMusicImageView f;
    private VIPMusicImageView g;
    private TextView h;
    private TextView i;
    private View j;
    private Space k;
    private View l;
    private LinearLayout m;
    private Button n;
    private TextView o;
    private TextView p;
    private TextView q;
    private TextView r;
    private a s;
    private b t;
    private static final List<rx.l> u = Collections.EMPTY_LIST;

    public static String f43923a = "current_fragment_type";
    public static String W = "from_type";
    public static String aa = "is_open_musician";
    private com.kugou.android.denpant.d.a ad = new com.kugou.android.denpant.d.a();
    private boolean ab = false;

    ArrayList<Integer> f43924b = new ArrayList<>();
    private final int v = 0;
    private final int w = 1;
    private final int x = 2;
    private final int y = 3;
    private AbsFrameworkFragment[] z = new AbsFrameworkFragment[4];
    private final String[] A = {"user_info_fragment_tag_ting", "user_info_fragment_tag_kan", "user_info_fragment_tag_chang", "user_info_fragment_tag_wan"};
    private int B = -1;
    private int Y = 0;
    private int C = 0;
    private int D = 0;
    private int E = 0;
    private boolean I = false;
    private boolean K = false;
    private boolean N = true;
    private boolean O = false;
    private final BroadcastReceiver P = new BroadcastReceiver() {
        @Override
        @SuppressLint({"NewApi"})
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (as.f54365e) {
                as.f("vz-UserInfosMainFragment", action);
            }
            if ("com.kugou.android.update_user_image_action".equals(action)) {
                if (as.f54365e) {
                    as.d("musicfees", "LOGOUT_UPDATE_USER_IMAGE_ACTION");
                }
                if (ag.v(com.kugou.common.q.b.a().x())) {
                    UserInfosMainFragment.this.b();
                    return;
                }
                return;
            }
            if ("com.kugou.android.user_logout".equals(action)) {
                UserInfosMainFragment.this.finish();
                return;
            }
            if ("com.kugou.android.action.ACTION_USERINFO_MODIFY_SUCCESS".equals(intent.getAction())) {
                return;
            }
            if ("com.kugou.android.action.vip_state_change".equals(action) || "com.kugou.android.action.music_package_state_change".equals(action)) {
                UserInfosMainFragment.this.s.sendEmptyMessage(8);
                return;
            }
            if ("com.kugou.android.user_login_success".equals(action)) {
                if (UserInfosMainFragment.this.J) {
                    return;
                }
                UserInfosMainFragment.this.c();
            } else if ("com.kugou.android.action.net_mode_changed".equals(action) && UserInfosMainFragment.this.f43927e.getVisibility() == 0) {
                UserInfosMainFragment.this.s.removeMessages(19);
                UserInfosMainFragment.this.s.sendEmptyMessage(19);
            }
        }
    };
    private final int T = 9;
    private final int U = 10;
    private final int V = 11;

    private void a(AvatorPendantModel.DenpantData denpantData) {
    }

    private boolean p() {
        return true;
    }

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

    @Override
    public boolean statusBarLightMode() {
        return true;
    }

    public boolean getIsOpenMusician() {
        return this.ab;
    }

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

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

    @Override
    public void onViewCreated(View view, Bundle bundle) {
        Bundle arguments;
        super.onViewCreated(view, bundle);
        if (bundle != null) {
            this.B = bundle.getInt("user_info_fragment_current_tab_index", -1);
            int i = this.B;
            if (i == 0 || i == 3) {
                this.z[this.B] = (AbsFrameworkFragment) getChildFragmentManager().findFragmentByTag(this.A[this.B]);
                if (as.f54365e) {
                    as.d("vz-UserInfosMainFragment", "onViewCreated mFragments[" + this.B + "] " + this.z[this.B]);
                }
            } else {
                this.B = -1;
            }
        }
        if (getArguments() != null) {
            this.Y = getArguments().getInt(W, 0);
            this.ab = getArguments().getBoolean(aa, false);
            this.af = (AvatorPendantModel.DenpantData) getArguments().getParcelable("user_avator_denpant_model");
        }
        if (as.f54365e) {
            as.d("vz-UserInfosMainFragment", "onViewCreated1 mCurrentTabIndex " + this.B);
        }
        if (this.B < 0 && (arguments = getArguments()) != null) {
            int i2 = arguments.getInt(f43923a, 0);
            if (as.f54365e) {
                as.d("vz-UserInfosMainFragment", "onViewCreated2 sourceType " + i2);
            }
            if (!b(i2)) {
                this.B = 0;
            }
        }
        this.t = new b(Looper.getMainLooper(), this);
        this.s = new a(getWorkLooper(), this);
        d();
        f();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("com.kugou.android.update_user_image_action");
        intentFilter.addAction("com.kugou.android.user_logout");
        intentFilter.addAction("com.kugou.android.action.ACTION_USERINFO_MODIFY_SUCCESS");
        intentFilter.addAction("com.kugou.android.action.vip_state_change");
        intentFilter.addAction("com.kugou.android.action.music_package_state_change");
        intentFilter.addAction("com.kugou.android.user_login_success");
        intentFilter.addAction("com.kugou.android.action.net_mode_changed");
        com.kugou.common.b.a.b(this.P, intentFilter);
        if (this.B < 0) {
            this.B = 0;
        }
        if (as.f54365e) {
            as.d("vz-UserInfosMainFragment", "onViewCreated2 mCurrentTabIndex " + this.B);
        }
        if (com.kugou.common.environment.a.u()) {
            this.J = true;
            this.G.setVisibility(8);
            c(this.B);
            this.j.setVisibility(0);
            Bitmap b2 = com.kugou.common.skinpro.d.b.a().b(com.kugou.common.skinpro.shadowframe.b.MENU);
            if (b2 != null) {
                b2 = a(b2);
            }
            if (b2 != null) {
                this.t.obtainMessage(3, 0, 0, b2).sendToTarget();
                if (Build.VERSION.SDK_INT >= 16) {
                    this.S.setBackground(al.a(b2));
                } else {
                    this.S.setBackgroundDrawable(al.a(b2));
                }
                this.I = true;
            }
            com.kugou.common.userCenter.m a2 = o.a();
            if (a(a2)) {
                Message message = new Message();
                message.what = 4;
                message.obj = a2;
                this.t.sendMessage(message);
                this.j.setVisibility(8);
            }
        } else {
            g();
        }
        if (!p()) {
            a(this.af);
        }
        BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(getApplicationContext(), com.kugou.framework.statistics.easytrace.a.oh));
    }

    @Override
    public void onActivityCreated(Bundle bundle) {
        super.onActivityCreated(bundle);
        EventBus.getDefault().register(aN_().getClassLoader(), UserInfosMainFragment.class.getName(), this);
    }

    @Override
    public void onSaveInstanceState(Bundle bundle) {
        bundle.putInt("user_info_fragment_current_tab_index", this.B);
        super.onSaveInstanceState(bundle);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        com.kugou.common.b.a.b(this.P);
        this.t.removeCallbacksAndMessages(null);
        this.s.removeCallbacksAndMessages(null);
        EventBus.getDefault().unregister(this);
        a();
        com.kugou.common.dialog8.c.a aVar = this.Z;
        if (aVar != null && aVar.isShowing()) {
            this.Z.dismiss();
        }
        this.ad.e();
    }

    private void a() {
        for (rx.l lVar : u) {
            if (lVar != null) {
                lVar.unsubscribe();
            }
        }
    }

    public void b() {
        try {
            String w = com.kugou.common.q.b.a().w();
            String g = this.Q != null ? this.Q.g() : "";
            if (!TextUtils.isEmpty(g) && !g.equals(w)) {
                b(com.kugou.common.q.b.a().e(w));
            } else {
                a(w);
            }
        } catch (OutOfMemoryError e2) {
            e2.printStackTrace();
        }
    }

    private void a(String str) {
        String e2 = com.kugou.common.q.b.a().e(str);
        if (!TextUtils.isEmpty(e2) && ag.v(e2)) {
            if (f(str)) {
                this.f43925c.setImageResource(R.drawable.bwe);
                return;
            }
            if (e(str)) {
                this.f43925c.setImageResource(R.drawable.brh);
                this.X.setVisibility(0);
                return;
            } else {
                this.X.setVisibility(8);
                this.f43925c.setImageBitmap(decodeUserRoundBitmap(al.a(e2)));
                return;
            }
        }
        b((String) null);
    }

    public Bitmap decodeUserRoundBitmap(Bitmap bitmap) {
        int dimensionPixelSize = getResources().getDimensionPixelSize(R.dimen.wh);
        int dimensionPixelSize2 = getResources().getDimensionPixelSize(R.dimen.wh);
        Bitmap zoomBitmap = zoomBitmap(bitmap, dimensionPixelSize, dimensionPixelSize);
        if (zoomBitmap == null) {
            return null;
        }
        Bitmap roundedBitmapWithBorder = getRoundedBitmapWithBorder(zoomBitmap, 5.0f, 0, 0);
        Bitmap a2 = ap.a(roundedBitmapWithBorder, 0, 0, dimensionPixelSize, dimensionPixelSize2);
        zoomBitmap.recycle();
        roundedBitmapWithBorder.recycle();
        return a2;
    }

    public Bitmap zoomBitmap(Bitmap bitmap, int i, int i2) {
        if (bitmap == null) {
            return null;
        }
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        Matrix matrix = new Matrix();
        matrix.postScale(i / width, i2 / height);
        return ap.a(bitmap, 0, 0, width, height, matrix, true);
    }

    public Bitmap getRoundedBitmapWithBorder(Bitmap bitmap, float f, int i, int i2) {
        Bitmap roundedBitmap = getRoundedBitmap(bitmap, f);
        if (roundedBitmap == null) {
            return null;
        }
        int i3 = i * 2;
        Bitmap a2 = ap.a(roundedBitmap.getWidth() + i3, roundedBitmap.getHeight() + i3, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(a2);
        Paint paint = new Paint();
        RectF rectF = new RectF(new Rect(0, 0, roundedBitmap.getWidth() + i3, roundedBitmap.getHeight() + i3));
        paint.setAntiAlias(true);
        paint.setColor(i2);
        canvas.drawOval(rectF, paint);
        Paint paint2 = new Paint();
        Rect rect = new Rect(0, 0, roundedBitmap.getWidth(), roundedBitmap.getHeight());
        Rect rect2 = new Rect(i, i, roundedBitmap.getWidth() + i, roundedBitmap.getHeight() + i);
        paint2.setAntiAlias(true);
        canvas.drawARGB(0, 0, 0, 0);
        canvas.drawBitmap(roundedBitmap, rect, rect2, paint2);
        return a2;
    }

    public Bitmap getRoundedBitmap(Bitmap bitmap, float f) {
        if (bitmap == null) {
            return null;
        }
        Bitmap a2 = ap.a(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(a2);
        Paint paint = new Paint();
        Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
        RectF rectF = new RectF(rect);
        paint.setAntiAlias(true);
        canvas.drawARGB(0, 0, 0, 0);
        paint.setColor(-12434878);
        canvas.drawOval(rectF, paint);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
        canvas.drawBitmap(bitmap, rect, rect, paint);
        return a2;
    }

    private boolean s() {
        return this.Y == 0;
    }

    private boolean e(String str) {
        return s() && com.kugou.android.userCenter.c.b.b(str);
    }

    private boolean f(String str) {
        return s() && TextUtils.isEmpty(str);
    }

    private void b(String str) {
        if (f(this.Q.g())) {
            this.X.setVisibility(8);
            this.f43925c.setImageResource(R.drawable.bwe);
            return;
        }
        if (e(this.Q.g())) {
            if (as.f54365e) {
                as.f("zzm-log", "check is un valid --userinfoMain");
            }
            this.f43925c.setImageResource(R.drawable.brh);
            this.X.setVisibility(0);
            return;
        }
        this.X.setVisibility(8);
        if (!TextUtils.isEmpty(str) && ag.v(str)) {
            this.f43925c.setImageBitmap(decodeUserRoundBitmap(al.a(str)));
        } else {
            this.f43925c.setImageBitmap(decodeUserRoundBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.axi)));
        }
        com.bumptech.glide.g.a(this).a(this.Q.g()).j().a((com.bumptech.glide.b<String>) new com.bumptech.glide.request.b.g<Bitmap>() {
            @Override
            public void a(Object obj, com.bumptech.glide.request.a.c cVar) {
                a((Bitmap) obj, (com.bumptech.glide.request.a.c<? super Bitmap>) cVar);
            }

            public void a(Bitmap bitmap, com.bumptech.glide.request.a.c<? super Bitmap> cVar) {
                if (bitmap == null || bitmap.isRecycled()) {
                    return;
                }
                try {
                    UserInfosMainFragment.this.L = bitmap;
                    UserInfosMainFragment.this.f43925c.setImageBitmap(UserInfosMainFragment.this.L);
                    UserInfosMainFragment.this.s.sendEmptyMessage(14);
                } catch (OutOfMemoryError unused) {
                }
            }
        });
    }

    public int getMusicTypeForSP() {
        if (com.kugou.framework.musicfees.l.b()) {
            return com.kugou.common.q.b.a().p();
        }
        return 0;
    }

    public void c() {
        getTitleDelegate().d(true);
        c(this.B);
        this.j.setVisibility(0);
        this.G.setVisibility(8);
        this.s.removeMessages(3);
        this.s.sendEmptyMessage(3);
        this.s.removeMessages(8);
        this.s.sendEmptyMessage(8);
    }

    public void onEventMainThread(com.kugou.android.userCenter.event.e eVar) {
        this.s.removeMessages(8);
        this.s.sendEmptyMessage(8);
    }

    public void onEventMainThread(com.kugou.android.userCenter.event.i iVar) {
        if (iVar.f44189a == 1) {
            a(iVar);
        }
    }

    public void onEventMainThread(com.kugou.android.denpant.c.c cVar) {
        AvatorPendantModel a2;
        if (p() || (a2 = cVar.a()) == null || a2.getUser_id() != com.kugou.common.environment.a.Y()) {
            return;
        }
        this.af = a2.getData();
        a(this.af);
    }

    private void a(com.kugou.android.userCenter.event.i iVar) {
        i.a aVar = iVar.f44190b;
        int i = this.B;
        if (i > -1) {
            AbsFrameworkFragment[] absFrameworkFragmentArr = this.z;
            if (absFrameworkFragmentArr[i] != null) {
                absFrameworkFragmentArr[i].onActivityResult(aVar.f44191a, aVar.f44192b, aVar.f44193c);
            }
        }
        if (aVar.f44192b == -1 && aVar.f44191a == 13) {
            String action = aVar.f44193c.getAction();
            Bitmap bitmap = null;
            if (!TextUtils.isEmpty(action) && "inline-data".equals(action)) {
                String stringExtra = aVar.f44193c.getStringExtra("data");
                if (!TextUtils.isEmpty(stringExtra)) {
                    bitmap = ap.a(stringExtra);
                }
            } else {
                try {
                    bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), Uri.parse(action));
                } catch (FileNotFoundException e2) {
                    if (as.f54365e) {
                        as.a(e2.getMessage());
                    }
                } catch (IOException e3) {
                    if (as.f54365e) {
                        as.a(e3.getMessage());
                    }
                }
            }
            if (bitmap != null) {
                this.t.removeMessages(9);
                Message obtain = Message.obtain();
                obtain.what = 9;
                obtain.obj = bitmap;
                this.t.sendMessage(obtain);
            }
        }
    }

    private void d() {
        int i;
        enablePlayModeDelegate();
        enableTitleDelegate(null);
        initDelegates();
        getTitleDelegate().f(false);
        getTitleDelegate().a(R.drawable.a4v);
        getTitleDelegate().a(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                NavigationUtils.startAddFriendFragment(UserInfosMainFragment.this);
                BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(UserInfosMainFragment.this.getApplicationContext(), com.kugou.framework.statistics.easytrace.a.Sn));
            }
        });
        getTitleDelegate().d(com.kugou.common.environment.a.u() && ((i = this.B) == 0 || i == 3));
        getTitleDelegate().g(false);
        getTitleDelegate().a("帐号设置");
        getTitleDelegate().y();
        getTitleDelegate().l(1);
        com.kugou.android.common.delegate.s titleDelegate = getTitleDelegate();
        int i2 = this.B;
        titleDelegate.o(i2 == 0 || i2 == 3);
    }

    private void e() {
        getMainFragmentContainer();
    }

    public void handleLogout() {
        BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(getApplicationContext(), com.kugou.framework.statistics.easytrace.a.oi));
        o.b();
        this.K = true;
        e();
    }

    @Override
    public void onSkinAllChanged() {
        super.onSkinAllChanged();
        getTitleDelegate().a(R.drawable.a4v);
        if (this.R != null) {
            this.s.removeMessages(3);
            this.s.sendEmptyMessage(3);
        }
        UserInfoFragment userInfoFragment = this.ac;
        if (userInfoFragment != null) {
            userInfoFragment.onSkinAllChanged();
        }
    }

    private void f() {
        this.R = (ImageView) findViewById(R.id.cdk);
        this.S = (ImageView) findViewById(R.id.cdl);
        this.F = br.a((Context) aN_(), 20.0f);
        this.G = findViewById(R.id.bc2);
        this.H = (ImageView) findViewById(R.id.bc4);
        findViewById(R.id.bc3).setOnClickListener(this);
        this.j = findViewById(R.id.b35);
        this.k = (Space) findViewById(R.id.avj);
        this.l = $(R.id.cd3);
        ((VerticalOverScrollBounceEffectDecorator) OverScrollDecoratorHelper.setUpStaticOverScroll(this.l, 0)).setIsAllowPullUp(false);
        br.a(this.k, aN_());
        this.m = (LinearLayout) findViewById(R.id.bpt);
        this.n = (Button) findViewById(R.id.it);
        this.n.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (!br.Q(UserInfosMainFragment.this.getApplicationContext())) {
                    UserInfosMainFragment.this.showToast(R.string.av3);
                    return;
                }
                if (com.kugou.common.environment.a.o()) {
                    UserInfosMainFragment.this.m.setVisibility(8);
                    UserInfosMainFragment.this.j.setVisibility(0);
                    UserInfosMainFragment.this.s.removeMessages(8);
                    UserInfosMainFragment.this.s.sendEmptyMessage(8);
                    return;
                }
                br.T(UserInfosMainFragment.this.getActivity());
            }
        });
        this.ae = (AvatorPendantLayout) findViewById(R.id.fgs);
        this.ad.a((com.kugou.android.denpant.d.b) this.ae);
        this.f43925c = (KGCircularImageViewWithLabel) findViewById(R.id.ccm);
        this.X = (TextView) findViewById(R.id.fg7);
        this.f43926d = (TextView) findViewById(R.id.cci);
        this.f43927e = findViewById(R.id.ccj);
        this.f43927e.setOnClickListener(this);
        this.f = (VIPMusicImageView) findViewById(R.id.cdb);
        this.g = (VIPMusicImageView) findViewById(R.id.cd6);
        this.h = (TextView) findViewById(R.id.cdr);
        this.i = (TextView) findViewById(R.id.a6);
        this.p = (TextView) findViewById(R.id.ccv);
        this.q = (TextView) findViewById(R.id.cct);
        this.r = (TextView) findViewById(R.id.ccr);
        findViewById(R.id.ccx).setOnClickListener(this);
        $K(this, this.r, this.q, this.f43925c);
        this.o = (TextView) findViewById(R.id.w3);
        this.o.setVisibility(8);
    }

    private void g() {
        try {
            this.H.setImageResource(R.drawable.b9v);
        } catch (OutOfMemoryError e2) {
            as.e(e2);
        }
        this.G.setVisibility(0);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.w3:
            case R.id.cdh:
                if (!com.kugou.common.environment.a.o()) {
                    br.T(aN_());
                    return;
                }
                Intent intent = new Intent();
                intent.setClass(aN_(), ModifyUserInfoActivity.class);
                startActivity(intent);
                BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(aN_(), com.kugou.framework.statistics.easytrace.a.ol));
                return;
            case R.id.bc3:
                NavigationUtils.startLoginFragment(this);
                return;
            case R.id.ccj:
                com.kugou.android.msgcenter.a.a(getActivity(), "http://m.kugou.com/vip/youth/growthSystem/android/static/index.html", R.string.aid);
                com.kugou.common.statistics.song.a.a aVar = new com.kugou.common.statistics.song.a.a(getApplicationContext(), com.kugou.framework.statistics.easytrace.a.TL);
                aVar.setFo("侧边栏/个人信息页").setSvar1("个人信息页/等级logo");
                BackgroundServiceUtil.trace(aVar);
                return;
            case R.id.ccm:
                String w = com.kugou.common.q.b.a().w();
                String e2 = com.kugou.common.q.b.a().e(w);
                if (e(w)) {
                    onEditUserHeadImageClick();
                    return;
                }
                if (p()) {
                    Intent intent2 = new Intent(aN_(), (Class<?>) FullScreenActivity.class);
                    intent2.putExtra("path", e2);
                    intent2.putExtra("url", w);
                    if (TextUtils.isEmpty(w)) {
                        intent2.putExtra("res_id", R.drawable.bwe);
                    }
                    intent2.putExtra("type_change", true);
                    startActivity(intent2);
                    return;
                }
                com.kugou.android.denpant.b.a(aN_(), this.af);
                return;
            case R.id.ccr:
                BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(getApplicationContext(), com.kugou.framework.statistics.easytrace.a.oo));
                com.kugou.android.friend.d.a().a(2);
                return;
            case R.id.cct:
                BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(getApplicationContext(), com.kugou.framework.statistics.easytrace.a.on));
                com.kugou.android.friend.d.a().a(1);
                return;
            case R.id.ccx:
                BackgroundServiceUtil.trace(new com.kugou.framework.statistics.easytrace.task.d(getApplicationContext(), com.kugou.framework.statistics.easytrace.a.om));
                com.kugou.android.friend.d.a().a(0);
                this.s.obtainMessage(13, this.Q).sendToTarget();
                return;
            default:
                return;
        }
    }

    public com.kugou.common.userCenter.m getPersonalInfo() {
        return this.Q;
    }

    public void h() {
        com.kugou.common.userCenter.m a2;
        if (cj.d(aN_())) {
            a2 = new com.kugou.common.userCenter.protocol.t().b(1, 0);
            if (a2 != null && a2.C() == 1) {
                if (this.K) {
                    if (as.f54365e) {
                        as.b("vz-UserInfosMainFragment", "savePersonalInfo but has login out");
                        return;
                    }
                    return;
                } else {
                    o.a(a2);
                    if (this.K) {
                        if (as.f54365e) {
                            as.b("vz-UserInfosMainFragment", "savePersonalInfo but has login out2");
                        }
                        o.b();
                    }
                }
            } else {
                a2 = o.a();
            }
        } else {
            a2 = o.a();
        }
        if (!a(a2)) {
            a2 = null;
        }
        waitForFragmentFirstStart();
        if (a2 != null && a2.C() == 1) {
            Message message = new Message();
            message.what = 4;
            message.obj = a2;
            this.t.sendMessage(message);
            i();
            this.s.removeMessages(19);
            this.s.sendEmptyMessage(19);
            return;
        }
        this.t.sendEmptyMessage(5);
    }

    private void i() {
        if (cj.d(aN_())) {
            j.d a2 = new com.kugou.common.userCenter.protocol.j().a(String.valueOf(com.kugou.common.environment.a.Y()));
            if (a2.a()) {
                int e2 = a2.e(com.kugou.common.environment.a.Y());
                com.kugou.common.q.b.a().t(e2);
                com.kugou.common.q.b.a().q(a2.i(com.kugou.common.environment.a.Y()));
                boolean z = e2 == 1;
                int f = a2.f(com.kugou.common.environment.a.Y());
                com.kugou.common.q.b.a().y(f);
                boolean z2 = f == 1;
                if (z || z2) {
                    EventBus.getDefault().post(new UpdateUserStarVipEvent());
                    this.t.sendEmptyMessage(16);
                }
            }
        }
    }

    private boolean a(com.kugou.common.userCenter.m mVar) {
        return mVar != null && mVar.C() == 1 && mVar.c() == com.kugou.common.environment.a.Y();
    }

    public void j() {
        this.j.setVisibility(8);
        this.m.setVisibility(0);
    }

    public void b(com.kugou.common.userCenter.m mVar) {
        this.j.setVisibility(8);
        this.m.setVisibility(8);
        this.Q = mVar;
        c(this.Q);
    }

    private void c(com.kugou.common.userCenter.m mVar) {
        if (mVar == null || mVar.C() != 1) {
            return;
        }
        this.h.setText(mVar.f());
        this.i.setText("酷狗ID:  " + mVar.c());
        this.p.setText(mVar.q() == -1 ? bc.g : a(mVar.q()));
        this.q.setText(a(mVar.r(), UserInfoConstant.LoginSourceType.FOLLOW));
        this.r.setText(a(mVar.s(), "粉丝"));
        for (AbsFrameworkFragment absFrameworkFragment : this.z) {
            a(absFrameworkFragment);
        }
        b();
        showUserStarVipStatus();
        k();
    }

    public void showUserStarVipStatus() {
        boolean z = com.kugou.common.q.b.a().am() == 1;
        boolean z2 = com.kugou.common.q.b.a().aD() == 1;
        if (z || z2) {
            com.kugou.common.msgcenter.f.a.a((Context) aN_(), this.h, true, z2);
            this.f.setVisibility(8);
            this.g.setVisibility(8);
        } else {
            com.kugou.common.msgcenter.f.a.a((Context) aN_(), this.h, false);
            int intValue = Integer.valueOf(com.kugou.common.q.b.a().o()).intValue();
            int musicTypeForSP = getMusicTypeForSP();
            int ai = com.kugou.common.q.b.a().ai();
            String a2 = com.kugou.common.q.b.a().a("young_user_data_json", "");
            new com.kugou.android.app.common.comment.c.b().a(!TextUtils.isEmpty(a2) ? GetYoungVipInfoProtocol.f53477a.a(a2).W() : null, intValue, musicTypeForSP, this.f, this.g, ai, true);
        }
    }

    public void k() {
        o.c a2 = o.c.a(com.kugou.common.q.c.b().p(com.kugou.common.environment.a.Y()));
        int i = a2 != null ? a2.f52409c : 0;
        if (i > 99) {
            i = 99;
        }
        if (i < 0) {
            i = 0;
        }
        this.f43926d.setText(getString(R.string.aaf, Integer.valueOf(i)));
        n nVar = this.M;
        if ((nVar == null || !nVar.isShowing()) && com.kugou.common.environment.a.u()) {
            if (com.kugou.common.environment.a.o() && !this.O) {
                this.s.obtainMessage(17, Integer.valueOf(i)).sendToTarget();
            } else {
                this.O = true;
            }
        }
        this.f43927e.setVisibility(0);
    }

    public void l() {
        o.c a2 = new com.kugou.common.userCenter.protocol.o().a(com.kugou.common.environment.a.Y());
        if (a2.f52407a == 1) {
            com.kugou.common.q.c.b().c(com.kugou.common.environment.a.Y(), a2.toString());
        }
        this.t.sendEmptyMessage(16);
        EventBus.getDefault().post(new UpdateUserStarVipEvent());
    }

    public void a(int i, int i2, long j) {
        n nVar;
        if (com.kugou.common.environment.a.u() && isAlive() && i == i2) {
            this.M = new n(this, i2, j);
            this.M.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialogInterface) {
                    UserInfosMainFragment.this.M = null;
                }
            });
            if (!this.N || (nVar = this.M) == null || nVar.isShowing()) {
                return;
            }
            this.M.show();
            BackgroundServiceUtil.trace(new com.kugou.common.statistics.song.a.a(getApplicationContext(), com.kugou.framework.statistics.easytrace.a.TM).setFo("侧边栏/个人信息页/升级弹窗").setSvar1("成长体系/升级提醒弹窗").setFs("成功"));
        }
    }

    private SpannableStringBuilder a(int i, String str) {
        String a2 = i == -1 ? bc.g : a(i);
        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
        spannableStringBuilder.append((CharSequence) a2).append((CharSequence) "\n");
        int length = spannableStringBuilder.length();
        spannableStringBuilder.append((CharSequence) str);
        spannableStringBuilder.setSpan(new ForegroundColorSpan(-1711276033), length, spannableStringBuilder.length(), 33);
        return spannableStringBuilder;
    }

    private String a(int i) {
        return com.kugou.android.mv.e.c.e(i);
    }

    private boolean b(int i) {
        if (i == 1) {
            this.B = 0;
            return true;
        }
        if (i != 4) {
            return false;
        }
        this.B = 3;
        return true;
    }

    private AbsFrameworkFragment m() {
        this.ac = new UserInfoFragment();
        this.ac.a(this);
        return this.ac;
    }

    private AbsFrameworkFragment n() {
        final AbsFrameworkFragment[] absFrameworkFragmentArr = new AbsFrameworkFragment[1];
        FanxingModule.getInstanceSynchronous().c(new rx.b.e<IFanxingTargetWrapperManager, rx.e<?>>() {
            @Override
            public rx.e<?> call(IFanxingTargetWrapperManager iFanxingTargetWrapperManager) {
                return iFanxingTargetWrapperManager.getFanxingTargetWrapper().loadResource(FxResource.USERINFO_FRAGMENT_INSTANCE, null, null);
            }
        }).a((rx.b.b<? super R>) new rx.b.b<Object>() {
            @Override
            public void call(Object obj) {
                absFrameworkFragmentArr[0] = (AbsFrameworkFragment) obj;
            }
        }, new SimpleErrorAction1());
        return absFrameworkFragmentArr[0];
    }

    private AbsFrameworkFragment o() {
        com.kugou.ktv.b.i c2 = com.kugou.ktv.b.k.c("UserInfosMainFragment.java#onCreateChangUserInfoFragment");
        if (c2 != null) {
            return c2.getMyHomeFragment();
        }
        return null;
    }

    public void a(String str, boolean z) {
        if (as.f54365e) {
            as.f("vz-UserInfosMainFragment", "onDexLoadOver onDexLoadOver " + str + " successed " + z);
        }
        if (net.wequick.small.g.ANDROIDFANXING.a().equals(str)) {
            this.C = z ? 2 : 3;
            if (1 == this.B) {
                int i = this.C;
                if (i == 2) {
                    c(1);
                    return;
                } else {
                    if (i == 3) {
                        q();
                        com.kugou.common.utils.e.c.a(getApplicationContext(), "看模块加载失败", 0).show();
                        return;
                    }
                    return;
                }
            }
            return;
        }
        if (net.wequick.small.g.ANDROIDKTV.a().equals(str)) {
            this.D = z ? 2 : 3;
            if (2 == this.B) {
                int i2 = this.D;
                if (i2 == 2) {
                    c(2);
                } else if (i2 == 3) {
                    q();
                    com.kugou.common.utils.e.c.a(getApplicationContext(), "唱模块加载失败", 0).show();
                }
            }
        }
    }

    private void q() {
        FragmentManager childFragmentManager = getChildFragmentManager();
        FragmentTransaction beginTransaction = childFragmentManager.beginTransaction();
        int i = 0;
        while (true) {
            AbsFrameworkFragment[] absFrameworkFragmentArr = this.z;
            if (i < absFrameworkFragmentArr.length) {
                if (absFrameworkFragmentArr[i] != null) {
                    beginTransaction.hide(absFrameworkFragmentArr[i]);
                }
                i++;
            } else {
                try {
                    break;
                } catch (RuntimeException e2) {
                    as.e(e2);
                } catch (Exception e3) {
                    as.e(e3);
                } catch (StackOverflowError e4) {
                    e4.printStackTrace();
                }
            }
        }
        beginTransaction.commitAllowingStateLoss();
        childFragmentManager.executePendingTransactions();
        br.c((Activity) getActivity());
    }

    private void c(int i) {
        AbsFrameworkFragment[] absFrameworkFragmentArr;
        if (i < 0 || i >= this.z.length) {
            if (as.f54365e) {
                as.d("vz-UserInfosMainFragment", "switchFragment failed index " + i);
                return;
            }
            return;
        }
        if (as.f54365e) {
            as.f("vz-UserInfosMainFragment", "switchFragment index " + i);
        }
        this.B = i;
        AbsFrameworkFragment absFrameworkFragment = this.z[i];
        FragmentManager childFragmentManager = getChildFragmentManager();
        FragmentTransaction beginTransaction = childFragmentManager.beginTransaction();
        int i2 = 0;
        if (absFrameworkFragment == null) {
            if (i == 0) {
                absFrameworkFragment = m();
            } else if (i == 1) {
                absFrameworkFragment = n();
            } else if (i == 2) {
                absFrameworkFragment = o();
            }
            if (absFrameworkFragment != null) {
                this.z[i] = absFrameworkFragment;
                Bundle bundle = new Bundle();
                bundle.putBoolean("FROM_TING_FRAGMENT", Boolean.TRUE.booleanValue());
                if (i == 0) {
                    bundle.putInt("key_kugou_auth", getArguments().getInt("key_kugou_auth"));
                    bundle.putString(DelegateFragment.KEY_IDENTIFIER, getSourcePath());
                    bundle.putInt("key_kugou_face_auth", getArguments().getInt("key_kugou_face_auth"));
                    bundle.putBoolean(DelegateFragment.KEY_RESUME_PAGE_IDENTIFIER_APPEND_TITLE, false);
                    bundle.putBoolean(DelegateFragment.KEY_USE_AUTO_IDENTIFIER_SOURCE, false);
                }
                absFrameworkFragment.setArguments(bundle);
                a(absFrameworkFragment);
                if (isInvokeFragmentFirstStartBySelf()) {
                    this.z[i].setInvokeFragmentFirstStartBySelf();
                }
                if (isFragmentFirstStartInvoked()) {
                    this.z[i].setFragmentFirstStartInvoked();
                }
                beginTransaction.add(R.id.tu, this.z[i], this.A[i]);
            }
        }
        if (this.z[i] != null) {
            while (true) {
                absFrameworkFragmentArr = this.z;
                if (i2 >= absFrameworkFragmentArr.length) {
                    break;
                }
                if (i2 != i && absFrameworkFragmentArr[i2] != null) {
                    beginTransaction.hide(absFrameworkFragmentArr[i2]);
                }
                i2++;
            }
            beginTransaction.show(absFrameworkFragmentArr[i]);
            if (as.f54365e) {
                as.f("vz-UserInfosMainFragment", "show index " + i);
            }
        } else if (as.f54365e) {
            as.d("vz-UserInfosMainFragment", "switchFragment failed mFragments[index" + i + "] = null");
        }
        try {
            beginTransaction.commitAllowingStateLoss();
            childFragmentManager.executePendingTransactions();
        } catch (RuntimeException e2) {
            as.e(e2);
        } catch (Exception e3) {
            as.e(e3);
        } catch (StackOverflowError e4) {
            e4.printStackTrace();
        }
        br.c((Activity) getActivity());
    }

    private void a(AbsFrameworkFragment absFrameworkFragment) {
        if (absFrameworkFragment == 0 || this.Q == null) {
            return;
        }
        try {
            Bundle bundle = new Bundle();
            bundle.putSerializable("personalInfo", this.Q);
            if (absFrameworkFragment instanceof com.kugou.ktv.android.common.user.a) {
                ((com.kugou.ktv.android.common.user.a) absFrameworkFragment).setFragmentArguments(bundle);
            }
        } catch (Exception e2) {
            as.e(e2);
        }
    }

    @Override
    public void onFragmentFirstStart() {
        super.onFragmentFirstStart();
        if (com.kugou.common.environment.a.u()) {
            this.s.removeMessages(8);
            this.s.sendEmptyMessage(8);
            this.s.removeMessages(3);
            this.s.sendEmptyMessage(3);
        }
        for (AbsFrameworkFragment absFrameworkFragment : this.z) {
            if (absFrameworkFragment != null) {
                if (as.f54365e) {
                    as.f("vz-UserInfosMainFragment", "onFragmentFirstStart fg " + absFrameworkFragment);
                }
                absFrameworkFragment.onFragmentFirstStart();
            }
        }
    }

    @Override
    public void onFragmentPause() {
        super.onFragmentPause();
        for (AbsFrameworkFragment absFrameworkFragment : this.z) {
            if (absFrameworkFragment != null) {
                if (as.f54365e) {
                    as.f("vz-UserInfosMainFragment", "onFragmentPause fg " + absFrameworkFragment);
                }
                absFrameworkFragment.onFragmentPause();
            }
        }
        this.ad.d();
    }

    @Override
    public void onFragmentRestart() {
        super.onFragmentRestart();
        for (AbsFrameworkFragment absFrameworkFragment : this.z) {
            if (absFrameworkFragment != null) {
                if (as.f54365e) {
                    as.f("vz-UserInfosMainFragment", "onFragmentRestart fg " + absFrameworkFragment);
                }
                absFrameworkFragment.onFragmentRestart();
            }
        }
    }

    @Override
    public void onFragmentResume() {
        super.onFragmentResume();
        for (AbsFrameworkFragment absFrameworkFragment : this.z) {
            if (absFrameworkFragment != null) {
                if (as.f54365e) {
                    as.f("vz-UserInfosMainFragment", "onFragmentResume fg " + absFrameworkFragment);
                }
                absFrameworkFragment.onFragmentResume();
            }
        }
        this.ad.b(true);
    }

    @Override
    public void onFragmentStop() {
        super.onFragmentStop();
        for (AbsFrameworkFragment absFrameworkFragment : this.z) {
            if (absFrameworkFragment != null) {
                if (as.f54365e) {
                    as.f("vz-UserInfosMainFragment", "onFragmentStop fg " + absFrameworkFragment);
                }
                absFrameworkFragment.onFragmentStop();
            }
        }
    }

    @Override
    public void onPersistentFragmentRestart() {
        super.onPersistentFragmentRestart();
        for (AbsFrameworkFragment absFrameworkFragment : this.z) {
            if (absFrameworkFragment != null) {
                if (as.f54365e) {
                    as.f("vz-UserInfosMainFragment", "onPersistentFragmentRestart fg " + absFrameworkFragment);
                }
                absFrameworkFragment.onPersistentFragmentRestart();
            }
        }
    }

    @Override
    public void onScreenStateChanged(int i) {
        super.onScreenStateChanged(i);
    }

    public void onEventMainThread(com.kugou.common.useraccount.entity.o oVar) {
        com.kugou.common.userCenter.m mVar;
        if (oVar != null) {
            int i = oVar.f53640a;
            if (i == 1) {
                if (oVar.f53641b == 100 || (mVar = this.Q) == null) {
                    return;
                }
                mVar.b(com.kugou.common.q.b.a().w());
                b();
                return;
            }
            if (i == 2) {
                this.h.setText(oVar.f53642c);
                this.Q.a(oVar.f53642c);
                this.s.obtainMessage(13, this.Q).sendToTarget();
            } else if (i == 4 && this.f43927e.getVisibility() == 0 && com.kugou.common.environment.a.o()) {
                this.s.removeMessages(19);
                this.s.sendEmptyMessage(19);
            }
        }
    }

    public void onEventMainThread(com.kugou.common.useraccount.entity.n nVar) {
        if (nVar != null) {
            n nVar2 = this.M;
            if (nVar2 != null && nVar2.isShowing()) {
                this.M.dismiss();
            }
            if ("self_user_center".equals(nVar.a())) {
                KGSystemUtil.showLoginTipsDialog(aN_());
            }
        }
    }

    public void onEventMainThread(com.kugou.common.userCenter.b bVar) {
        com.kugou.common.userCenter.m mVar;
        if (bVar == null || bVar.b() == -1 || (mVar = this.Q) == null || mVar.C() != 1 || this.Q.r() < 0) {
            return;
        }
        int b2 = bVar.b();
        if (b2 == 1) {
            com.kugou.common.userCenter.m mVar2 = this.Q;
            mVar2.i(mVar2.r() - 1);
        } else if (b2 == 2) {
            com.kugou.common.userCenter.m mVar3 = this.Q;
            mVar3.j(mVar3.s() - 1);
        } else if (b2 == 3) {
            com.kugou.common.userCenter.m mVar4 = this.Q;
            mVar4.h(mVar4.q() - 1);
            com.kugou.common.userCenter.m mVar5 = this.Q;
            mVar5.i(mVar5.r() - 1);
            com.kugou.common.userCenter.m mVar6 = this.Q;
            mVar6.j(mVar6.s() - 1);
        }
        com.kugou.common.userCenter.m mVar7 = this.Q;
        mVar7.i(mVar7.r() >= 0 ? this.Q.r() : 0);
        com.kugou.common.userCenter.m mVar8 = this.Q;
        mVar8.h(mVar8.q() >= 0 ? this.Q.q() : 0);
        com.kugou.common.userCenter.m mVar9 = this.Q;
        mVar9.j(mVar9.s() >= 0 ? this.Q.s() : 0);
        this.p.setText(a(this.Q.q()));
        this.q.setText(a(this.Q.r(), UserInfoConstant.LoginSourceType.FOLLOW));
        this.r.setText(a(this.Q.s(), "粉丝"));
        this.s.obtainMessage(13, this.Q).sendToTarget();
    }

    public void onEventMainThread(com.kugou.common.userCenter.t tVar) {
        com.kugou.common.userCenter.m mVar;
        if (tVar == null || (mVar = this.Q) == null || mVar.C() != 1 || this.Q.r() < 0) {
            return;
        }
        int c2 = tVar.c();
        if (c2 == 0) {
            com.kugou.common.userCenter.m mVar2 = this.Q;
            mVar2.i(mVar2.r() - 1);
        } else if (c2 == 1) {
            com.kugou.common.userCenter.m mVar3 = this.Q;
            mVar3.i(mVar3.r() + 1);
        } else if (c2 == 2) {
            com.kugou.common.userCenter.m mVar4 = this.Q;
            mVar4.i(mVar4.r() - 1);
            com.kugou.common.userCenter.m mVar5 = this.Q;
            mVar5.h(mVar5.q() - 1);
        } else if (c2 == 3) {
            this.Q.a(1);
            com.kugou.common.userCenter.m mVar6 = this.Q;
            mVar6.h(mVar6.q() + 1);
            com.kugou.common.userCenter.m mVar7 = this.Q;
            mVar7.i(mVar7.r() + 1);
        }
        com.kugou.common.userCenter.m mVar8 = this.Q;
        mVar8.i(mVar8.r() >= 0 ? this.Q.r() : 0);
        com.kugou.common.userCenter.m mVar9 = this.Q;
        mVar9.h(mVar9.q() >= 0 ? this.Q.q() : 0);
        this.p.setText(a(this.Q.q()));
        this.q.setText(a(this.Q.r(), UserInfoConstant.LoginSourceType.FOLLOW));
        this.r.setText(a(this.Q.s(), "粉丝"));
        this.s.obtainMessage(13, this.Q).sendToTarget();
    }

    public void a(Bitmap bitmap, boolean z) {
        if (bitmap == null || bitmap.isRecycled() || this.R == null) {
            return;
        }
        if (Build.VERSION.SDK_INT >= 16) {
            this.R.setBackground(al.a(bitmap));
        } else {
            this.R.setBackgroundDrawable(al.a(bitmap));
        }
        if (z) {
            AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
            alphaAnimation.setDuration(1000L);
            alphaAnimation.setFillAfter(true);
            alphaAnimation.setAnimationListener(new Animation.AnimationListener() {
                @Override
                public void onAnimationRepeat(Animation animation) {
                }

                @Override
                public void onAnimationStart(Animation animation) {
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    UserInfosMainFragment.this.S.setVisibility(8);
                }
            });
            this.R.startAnimation(alphaAnimation);
        }
    }

    public void r() {
        try {
            Bitmap b2 = b(com.kugou.common.skinpro.d.b.a().b(com.kugou.common.skinpro.shadowframe.b.MENU));
            if (b2 == null || b2.isRecycled()) {
                return;
            }
            waitForFragmentFirstStart();
            this.t.obtainMessage(3, this.I ? 1 : 0, 0, b2).sendToTarget();
            this.I = false;
        } catch (Exception e2) {
            as.e(e2);
        } catch (OutOfMemoryError e3) {
            e3.printStackTrace();
        }
    }

    private Bitmap a(Bitmap bitmap) {
        if (this.F <= 0) {
            this.F = br.a(KGCommonApplication.getContext(), 60.0f);
        }
        return al.a(ap.a(bitmap, this.F), this.F);
    }

    private Bitmap b(Bitmap bitmap) {
        return com.kugou.common.base.b.a(KGCommonApplication.getContext(), a(bitmap), 100);
    }

    public void workHandleMessage(Message message) {
        switch (message.what) {
            case 12:
                au.a().a(new Runnable() {
                    @Override
                    public void run() {
                        z a2 = new ac().a();
                        if (a2.f53678a) {
                            UserInfosMainFragment.this.t.sendEmptyMessage(10);
                            com.kugou.common.b.a.a(new Intent("com.kugou.android.action.user_avatar_update"));
                        } else if (!TextUtils.isEmpty(a2.f53679b)) {
                            UserInfosMainFragment.this.t.sendEmptyMessage(11);
                            UserInfosMainFragment.this.a_(a2.f53679b);
                        } else {
                            UserInfosMainFragment.this.t.sendEmptyMessage(11);
                            UserInfosMainFragment.this.showToast(R.string.bj6);
                        }
                    }
                });
                return;
            case 13:
                if (message.obj != null) {
                    if (this.K) {
                        if (as.f54365e) {
                            as.b("vz-UserInfosMainFragment", "savePersonalInfo but has login out2");
                            return;
                        }
                        return;
                    } else {
                        o.a((com.kugou.common.userCenter.m) message.obj);
                        if (this.K) {
                            if (as.f54365e) {
                                as.b("vz-UserInfosMainFragment", "savePersonalInfo but has login out2");
                            }
                            o.b();
                            return;
                        }
                        return;
                    }
                }
                return;
            case 14:
                if (this.L != null) {
                    String g = this.Q.g();
                    com.kugou.common.q.b.a().d(g);
                    if (!ag.v(bt.f54448b)) {
                        ag.b(bt.f54448b);
                    }
                    be.a(aN_(), this.L, com.kugou.common.q.b.a().e(g));
                    EventBus.getDefault().post(new com.kugou.common.useraccount.entity.o(1, 100));
                    return;
                }
                return;
            default:
                return;
        }
    }

    public void uiHandleMessage(Message message) {
        switch (message.what) {
            case 9:
                Bitmap bitmap = (Bitmap) message.obj;
                ag.e(bt.f54450d);
                al.a(bitmap, bt.f54450d, Bitmap.CompressFormat.JPEG);
                if (!br.Q(getActivity())) {
                    bv.a(getActivity(), R.string.av3);
                    return;
                }
                if (!com.kugou.common.environment.a.o()) {
                    br.T(getActivity());
                    return;
                }
                D_();
                this.s.removeMessages(12);
                this.s.sendEmptyMessage(12);
                bitmap.recycle();
                return;
            case 10:
                if (as.f54365e) {
                    as.d("musicfees", "MSG_UPLOAD_IMAGE_SUCCESS");
                }
                com.kugou.common.userCenter.m mVar = this.Q;
                if (mVar != null) {
                    mVar.b(com.kugou.common.q.b.a().w());
                }
                EventBus.getDefault().post(new com.kugou.common.useraccount.entity.o(1));
                b();
                ao_();
                showToast(R.string.bj7);
                return;
            case 11:
                ao_();
                return;
            default:
                return;
        }
    }

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

        private WeakReference<UserInfosMainFragment> f43940a;

        public a(Looper looper, UserInfosMainFragment userInfosMainFragment) {
            super(looper);
            this.f43940a = null;
            this.f43940a = new WeakReference<>(userInfosMainFragment);
        }

        @Override
        public void handleMessage(Message message) {
            UserInfosMainFragment userInfosMainFragment = this.f43940a.get();
            if (userInfosMainFragment == null) {
                return;
            }
            int i = message.what;
            if (i == 3) {
                this.f43940a.get().r();
                return;
            }
            if (i == 17) {
                o.c b2 = o.c.b("uupgrade");
                if (b2 == null || b2.f52407a != 1) {
                    return;
                }
                Message obtainMessage = userInfosMainFragment.t.obtainMessage(18);
                obtainMessage.obj = Long.valueOf(b2.i);
                obtainMessage.arg1 = ((Integer) message.obj).intValue();
                obtainMessage.arg2 = b2.f52409c;
                obtainMessage.sendToTarget();
                return;
            }
            if (i == 19) {
                userInfosMainFragment.l();
                return;
            }
            if (i == 7) {
                com.kugou.android.useraccount.h.a(KGApplication.getContext());
                return;
            }
            if (i == 8) {
                this.f43940a.get().h();
                if (as.f54365e) {
                    as.d("vz-test", "BackGroundHandler end");
                    return;
                }
                return;
            }
            this.f43940a.get().workHandleMessage(message);
        }
    }

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

        private WeakReference<UserInfosMainFragment> f43941a;

        public b(Looper looper, UserInfosMainFragment userInfosMainFragment) {
            super(looper);
            this.f43941a = null;
            this.f43941a = new WeakReference<>(userInfosMainFragment);
        }

        @Override
        public void handleMessage(Message message) {
            WeakReference<UserInfosMainFragment> weakReference = this.f43941a;
            if (weakReference == null || weakReference.get() == null) {
                return;
            }
            int i = message.what;
            if (i == 1) {
                this.f43941a.get().a((String) message.obj, true);
                return;
            }
            if (i == 2) {
                this.f43941a.get().a((String) message.obj, false);
                return;
            }
            if (i == 3) {
                this.f43941a.get().a((Bitmap) message.obj, message.arg1 == 1);
                return;
            }
            if (i == 4) {
                this.f43941a.get().b((com.kugou.common.userCenter.m) message.obj);
                return;
            }
            if (i == 5) {
                this.f43941a.get().j();
                return;
            }
            if (i == 16) {
                this.f43941a.get().showUserStarVipStatus();
                this.f43941a.get().k();
            } else if (i == 18) {
                this.f43941a.get().a(message.arg1, message.arg2, ((Long) message.obj).longValue());
            } else {
                this.f43941a.get().uiHandleMessage(message);
            }
        }
    }

    @Override
    public int getTab() {
        return this.B;
    }

    @Override
    public void setTab(int i) {
        c(i);
    }

    @Override
    public void onPause() {
        super.onPause();
        this.N = false;
        this.ad.c();
    }

    @Override
    public void onResume() {
        super.onResume();
        n nVar = this.M;
        if (nVar != null && !nVar.isShowing() && com.kugou.common.environment.a.u()) {
            this.M.show();
        }
        this.ad.a(true);
    }

    public void onEditUserHeadImageClick() {
        com.kugou.common.dialog8.c.a aVar = this.Z;
        if (aVar != null && aVar.isShowing()) {
            this.Z.dismiss();
        }
        this.Z = new com.kugou.common.dialog8.c.a(getActivity(), new CharSequence[]{"拍照", "相册"}, new CharSequence[]{"0", "1"}, -1);
        this.Z.a("修改头像");
        this.Z.a(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                if (i == 0) {
                    y.a(UserInfosMainFragment.this.getActivity(), new y.a() {
                        @Override
                        public void b() {
                        }

                        @Override
                        public void a() {
                            UserInfosMainFragment.this.t();
                        }
                    });
                } else if (i == 1) {
                    bt.a(UserInfosMainFragment.this);
                }
                UserInfosMainFragment.this.Z.dismiss();
            }
        });
        this.Z.show();
    }

    public void t() {
        if (cj.j(getActivity())) {
            try {
                bt.b(this);
                return;
            } catch (ActivityNotFoundException e2) {
                if (as.f54365e) {
                    as.a((Throwable) e2);
                }
                bv.b(getActivity(), false, "相机启动失败,稍后重试,或检测SD卡是否可用");
                return;
            }
        }
        bv.b(getActivity(), false, getString(R.string.a27));
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        int i3 = this.B;
        if (i3 > -1) {
            AbsFrameworkFragment[] absFrameworkFragmentArr = this.z;
            if (absFrameworkFragmentArr[i3] != null) {
                absFrameworkFragmentArr[i3].onActivityResult(i, i2, intent);
            }
        }
        a(new com.kugou.android.userCenter.event.i(1, new i.a(i, i2, intent)));
        if (intent == null) {
            if (i == 12 && ag.v(bt.f54449c)) {
                a(Uri.fromFile(new com.kugou.common.utils.s(bt.f54449c)));
                bt.f54447a = false;
                return;
            }
            return;
        }
        if (i2 == -1) {
            switch (i) {
                case 11:
                    a(intent.getData());
                    return;
                case 12:
                    if (bt.f54447a && ag.v(bt.f54449c)) {
                        a(Uri.fromFile(new com.kugou.common.utils.s(bt.f54449c)));
                        bt.f54447a = false;
                        return;
                    }
                    return;
                case 13:
                default:
                    return;
            }
        }
    }

    private void a(Uri uri) {
        Intent b2 = bt.b(getActivity(), (Class<? extends Activity>) CropImage.class);
        b2.putExtra("moduleId", 1);
        b2.putExtra("outputX", ErrorCode.OtherError.CONTENT_FORCE_EXPOSURE);
        b2.putExtra("outputY", ErrorCode.OtherError.CONTENT_FORCE_EXPOSURE);
        b2.setData(uri);
        startActivityForResult(b2, 13);
    }
}