导航菜单

页面标题

页面副标题

新暖心缘 v8.1.1 - ChooseGenderActivity.java 源代码

正在查看: 新暖心缘 v8.1.1 应用的 ChooseGenderActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.luanxingyuan.app.activity;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import butterknife.BindView;
import butterknife.OnClick;
import cn.jpush.android.api.JThirdPlatFormInterface;
import com.faceunity.wrappe.R;
import com.luanxingyuan.app.base.AppManager;
import com.luanxingyuan.app.base.BaseActivity;
import com.luanxingyuan.app.base.BaseResponse;
import com.luanxingyuan.app.bean.ChatUserInfo;
import com.luanxingyuan.app.util.ParamUtil;
import com.luanxingyuan.app.util.ToastUtil;
import java.util.HashMap;
import o6.n;
import x8.c0;

public class ChooseGenderActivity extends BaseActivity {
    private ChatUserInfo chatUserInfo;

    @BindView
    EditText codeEt;

    @BindView
    View codeLl;

    @BindView
    ImageView mBoyIv;

    @BindView
    ImageView mGirlIv;
    private final int BOY = 1;
    private final int GIRL = 0;
    private int mSelectGender = -1;

    class a extends r6.a<BaseResponse> {
        a() {
        }

        public void onResponse(BaseResponse baseResponse, int i8) {
            if (ChooseGenderActivity.this.isFinishing() || baseResponse == null || baseResponse.m_istatus != -1) {
                return;
            }
            ChooseGenderActivity.this.codeLl.setVisibility(0);
        }
    }

    class b extends r6.a<BaseResponse<ChatUserInfo>> {
        b() {
        }

        public void onBefore(c0 c0Var, int i8) {
            super.onBefore(c0Var, i8);
            ChooseGenderActivity.this.showLoadingDialog();
        }

        @Override
        public void onError(x8.e eVar, Exception exc, int i8) {
            if (ChooseGenderActivity.this.isFinishing()) {
                return;
            }
            super.onError(eVar, exc, i8);
            ChooseGenderActivity.this.dismissLoadingDialog();
            ToastUtil.showToast(ChooseGenderActivity.this.getApplicationContext(), 2131821363);
        }

        public void onResponse(BaseResponse<ChatUserInfo> baseResponse, int i8) {
            if (ChooseGenderActivity.this.isFinishing()) {
                return;
            }
            ChooseGenderActivity.this.dismissLoadingDialog();
            if (baseResponse != null) {
                if (baseResponse.m_istatus != 1) {
                    ToastUtil.showToast(baseResponse.m_strMessage);
                    return;
                }
                ToastUtil.showToast(ChooseGenderActivity.this.getApplicationContext(), 2131820749);
                if (AppManager.f().k() != null) {
                    AppManager.f().k().t_sex = ChooseGenderActivity.this.mSelectGender;
                }
                n.x(ChooseGenderActivity.this.getApplicationContext(), ChooseGenderActivity.this.mSelectGender);
                Intent intent = new Intent(ChooseGenderActivity.this.getApplicationContext(), (Class<?>) MainActivity.class);
                intent.putExtra("LOGIN_SUCCESS", true);
                ChooseGenderActivity.this.startActivity(intent);
                ChooseGenderActivity.this.finish();
            }
        }
    }

    private void chooseGender() {
        if (this.mSelectGender == -1) {
            ToastUtil.showToast("请选择性别");
            return;
        }
        HashMap hashMap = new HashMap();
        hashMap.put("userId", getUserId());
        hashMap.put("sex", String.valueOf(this.mSelectGender));
        if (!TextUtils.isEmpty(this.codeEt.getText().toString().trim())) {
            hashMap.put("id_card", this.codeEt.getText().toString().trim());
        }
        x7.a.h().c(m6.a.p1()).e("param", ParamUtil.getParam(hashMap)).f().c(new b());
    }

    private void getReferee() {
        HashMap hashMap = new HashMap();
        hashMap.put("userId", getUserId());
        x7.a.h().c(m6.a.X1()).e("param", ParamUtil.getParam(hashMap)).f().c(new a());
    }

    private void setGenderSelect(int i8) {
        if (i8 == 1) {
            if (this.mBoyIv.isSelected()) {
                return;
            }
            this.mSelectGender = 1;
            this.mBoyIv.setSelected(true);
            this.mBoyIv.setImageResource(2131230906);
            this.mGirlIv.setSelected(false);
            this.mGirlIv.setImageResource(2131231070);
            return;
        }
        if (i8 != 0 || this.mGirlIv.isSelected()) {
            return;
        }
        this.mSelectGender = 0;
        this.mGirlIv.setSelected(true);
        this.mGirlIv.setImageResource(2131231055);
        this.mBoyIv.setSelected(false);
        this.mBoyIv.setImageResource(2131230907);
    }

    public static void start(Context context, ChatUserInfo chatUserInfo) {
        Intent intent = new Intent(context, (Class<?>) ChooseGenderActivity.class);
        intent.putExtra(JThirdPlatFormInterface.KEY_DATA, chatUserInfo);
        context.startActivity(intent);
    }

    @Override
    protected View getContentView() {
        return inflate(2131492913);
    }

    @OnClick
    public void onClick(View view) {
        int id = view.getId();
        if (id == 2131296415) {
            setGenderSelect(1);
        } else if (id == 2131296726) {
            setGenderSelect(0);
        } else {
            if (id != 2131297170) {
                return;
            }
            chooseGender();
        }
    }

    @Override
    protected void onContentAdded() {
        this.chatUserInfo = (ChatUserInfo) getIntent().getSerializableExtra(JThirdPlatFormInterface.KEY_DATA);
        setTitle(2131820745);
        setRightText(R.string.confirm);
        setBackVisibility(8);
        this.codeLl.setVisibility(8);
        getReferee();
    }
}