马上连更改登录UI

This commit is contained in:
level 2025-06-04 11:30:47 +08:00
parent 48e93f59b8
commit 37d9a6ddb7
3 changed files with 45 additions and 36 deletions

View File

@ -60,7 +60,6 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
private lateinit var rxDialogShapeLoading: RxDialogShapeLoading private lateinit var rxDialogShapeLoading: RxDialogShapeLoading
private lateinit var rememberPasswordCB: CheckBox private lateinit var rememberPasswordCB: CheckBox
private lateinit var userAgreementCB: CheckBox private lateinit var userAgreementCB: CheckBox
private lateinit var userAgreementTv: TextView
private lateinit var loginUserName: String private lateinit var loginUserName: String
private var username_encrypt = "" private var username_encrypt = ""
private var password_encrypt = "" private var password_encrypt = ""
@ -295,25 +294,23 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
} }
val userAgreementIsChecked = val userAgreementIsChecked =
MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_USER_AGREEMENT_IS_CHECKED) MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_USER_AGREEMENT_IS_CHECKED)
userAgreementTv = findViewById(R.id.tv_user_agreement)
userAgreementCB = findViewById(R.id.cb_user_agreement) userAgreementCB = findViewById(R.id.cb_user_agreement)
if (!userAgreementIsChecked) { if (!userAgreementIsChecked) {
userAgreementTv.setTextColor(Color.parseColor("#828282")) userAgreementCB.setTextColor(Color.parseColor("#828282"))
} else { } else {
userAgreementTv.setTextColor(Color.parseColor("#4F4F4F")) userAgreementCB.setTextColor(Color.parseColor("#4F4F4F"))
} }
userAgreementCB.isChecked = userAgreementIsChecked userAgreementCB.isChecked = userAgreementIsChecked
userAgreementCB.setOnCheckedChangeListener { _, isChecked -> userAgreementCB.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) { if (!isChecked) {
MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_USER_AGREEMENT_IS_CHECKED, false) MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_USER_AGREEMENT_IS_CHECKED, false)
userAgreementTv.setTextColor(Color.parseColor("#828282")) userAgreementCB.setTextColor(Color.parseColor("#828282"))
} else { } else {
MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_USER_AGREEMENT_IS_CHECKED, true) MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_USER_AGREEMENT_IS_CHECKED, true)
userAgreementTv.setTextColor(Color.parseColor("#4F4F4F")) userAgreementCB.setTextColor(Color.parseColor("#4F4F4F"))
} }
} }
initUserAgreementView(userAgreementTv) initUserAgreementView(userAgreementCB)
val passwordHideCb = findViewById<CheckBox>(R.id.cb_password_hide) val passwordHideCb = findViewById<CheckBox>(R.id.cb_password_hide)
passwordHideCb.setOnCheckedChangeListener(IOnCheckedChangeListener()) passwordHideCb.setOnCheckedChangeListener(IOnCheckedChangeListener())

View File

@ -379,7 +379,7 @@
android:layout_weight="1" android:layout_weight="1"
android:text="@string/edition" android:text="@string/edition"
android:textColor="#000" android:textColor="#000"
android:gravity="center" android:gravity="start"
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" /> android:textStyle="bold" />

View File

@ -157,7 +157,7 @@
android:id="@+id/cb_remember_password" android:id="@+id/cb_remember_password"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_marginTop="60dp" android:layout_marginTop="20dp"
android:button="@null" android:button="@null"
android:checked="true" android:checked="true"
android:gravity="center" android:gravity="center"
@ -169,35 +169,47 @@
app:layout_constraintStart_toStartOf="@+id/tv_password" app:layout_constraintStart_toStartOf="@+id/tv_password"
app:layout_constraintTop_toBottomOf="@+id/et_password" /> app:layout_constraintTop_toBottomOf="@+id/et_password" />
<LinearLayout
android:id="@+id/ll_user_agreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="11dp"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="@+id/cb_remember_password"
app:layout_constraintTop_toBottomOf="@+id/cb_remember_password">
<CheckBox <CheckBox
android:id="@+id/cb_user_agreement" android:id="@+id/cb_user_agreement"
android:layout_width="20dp" android:layout_width="0dp"
android:layout_height="20dp" android:layout_height="30dp"
android:button="@null" android:button="@null"
android:checked="true" android:checked="true"
android:gravity="center" android:layout_marginTop="11dp"
app:drawableLeftCompat="@drawable/checked_selector" /> android:drawablePadding="@dimen/dp_10"
app:drawableLeftCompat="@drawable/checked_selector"
app:layout_constraintStart_toStartOf="@+id/cb_remember_password"
app:layout_constraintTop_toBottomOf="@+id/cb_remember_password"
/>
<!-- <LinearLayout-->
<!-- android:id="@+id/ll_user_agreement"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="11dp"-->
<!-- android:gravity="center_vertical"-->
<!-- android:orientation="horizontal"-->
<!-- app:layout_constraintStart_toStartOf="@+id/cb_remember_password"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/cb_remember_password">-->
<TextView <!-- <CheckBox-->
android:id="@+id/tv_user_agreement" <!-- android:id="@+id/cb_user_agreement"-->
android:layout_width="wrap_content" <!-- android:layout_width="20dp"-->
android:layout_height="wrap_content" <!-- android:layout_height="20dp"-->
android:layout_marginStart="7dp" <!-- android:button="@null"-->
android:gravity="center_vertical" <!-- android:checked="true"-->
android:maxLines="2" <!-- android:gravity="center"-->
android:textColor="@color/white_70" <!-- app:drawableLeftCompat="@drawable/checked_selector" />-->
android:textSize="12sp" />
</LinearLayout> <!-- <TextView-->
<!-- android:id="@+id/tv_user_agreement"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="7dp"-->
<!-- android:gravity="center_vertical"-->
<!-- android:maxLines="2"-->
<!-- android:textColor="@color/white_70"-->
<!-- android:textSize="12sp" />-->
<!-- </LinearLayout>-->
<TextView <TextView
@ -217,7 +229,7 @@
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/layout_login_tv_login_textsize" android:textSize="@dimen/layout_login_tv_login_textsize"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@+id/ll_user_agreement" /> app:layout_constraintTop_toBottomOf="@+id/cb_user_agreement" />
<TextView <TextView
android:id="@+id/tv_tip_default_psw" android:id="@+id/tv_tip_default_psw"