package com.hdl.photovoltaic.ui.account; import android.os.Bundle; import android.view.View; import androidx.constraintlayout.widget.ConstraintSet; import com.hdl.photovoltaic.R; import com.hdl.photovoltaic.base.CustomBaseActivity; import com.hdl.photovoltaic.databinding.ActivityRegisterAccountBinding; import com.hdl.photovoltaic.utils.KeyboardStateObserverUtils; /** * 注册账号界面 */ public class RegisterAccountActivity extends CustomBaseActivity { private ActivityRegisterAccountBinding viewBinding; @Override public Object getContentView() { viewBinding = ActivityRegisterAccountBinding.inflate(getLayoutInflater()); return viewBinding.getRoot(); } @Override public void onBindView(Bundle savedInstanceState) { //初始化 initView(); //初始化界面监听器 initEvent(); KeyboardStateObserverUtils.getKeyboardStateObserver(_mActivity).setKeyboardVisibilityListener(new KeyboardStateObserverUtils.OnKeyboardVisibilityListener() { @Override public void onKeyboardShow(int h) { ConstraintSet cs = new ConstraintSet(); cs.clone(viewBinding.parentCl); cs.connect(viewBinding.registerConfirmPswEt.getId(), ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM, px2dip(h)) ;// //应用约束 cs.applyTo(viewBinding.parentCl); } @Override public void onKeyboardHide(int h) { ConstraintSet cs = new ConstraintSet(); cs.clone(viewBinding.parentCl); cs.connect(viewBinding.registerConfirmPswEt.getId(), ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM, px2dip(h));// //应用约束 cs.applyTo(viewBinding.parentCl); } }); } private void initView() { viewBinding.registerPhoneTitleIc.accountTitleTv.setText(R.string.home_login_手机号); viewBinding.registerPhoneTitleIc.accountTitleTv.setTextSize(20); viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_90000000)); viewBinding.registerPhoneTitleIc.lineV.setVisibility(View.VISIBLE); viewBinding.registerMailTitleIc.accountTitleTv.setText(R.string.home_login_邮箱); viewBinding.registerMailTitleIc.accountTitleTv.setTextSize(16); viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_40000000)); viewBinding.registerMailTitleIc.lineV.setVisibility(View.GONE); } private void initEvent() { viewBinding.registerBackTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); viewBinding.registerPhoneTitleIc.underlineCl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { viewBinding.registerPhoneTitleIc.accountTitleTv.setText(R.string.home_login_手机号); viewBinding.registerPhoneTitleIc.accountTitleTv.setTextSize(20); viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_90000000)); viewBinding.registerPhoneTitleIc.lineV.setVisibility(View.VISIBLE); viewBinding.registerMailTitleIc.accountTitleTv.setText(R.string.home_login_邮箱); viewBinding.registerMailTitleIc.accountTitleTv.setTextSize(16); viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_40000000)); viewBinding.registerMailTitleIc.lineV.setVisibility(View.GONE); } }); viewBinding.registerMailTitleIc.underlineCl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { viewBinding.registerPhoneTitleIc.accountTitleTv.setText(R.string.home_login_手机号); viewBinding.registerPhoneTitleIc.accountTitleTv.setTextSize(16); viewBinding.registerPhoneTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_40000000)); viewBinding.registerPhoneTitleIc.lineV.setVisibility(View.GONE); viewBinding.registerMailTitleIc.accountTitleTv.setText(R.string.home_login_邮箱); viewBinding.registerMailTitleIc.accountTitleTv.setTextSize(20); viewBinding.registerMailTitleIc.accountTitleTv.setTextColor(getResources().getColor(R.color.text_90000000)); viewBinding.registerMailTitleIc.lineV.setVisibility(View.VISIBLE); } }); } }