mac
2023-09-23 b8209d15d915f72d9abe3a68b76e1f4cfd21eac3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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);
            }
        });
 
    }
}