马上连更改登录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 rememberPasswordCB: CheckBox
private lateinit var userAgreementCB: CheckBox
private lateinit var userAgreementTv: TextView
private lateinit var loginUserName: String
private var username_encrypt = ""
private var password_encrypt = ""
@ -295,25 +294,23 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
}
val userAgreementIsChecked =
MMKV.defaultMMKV().decodeBool(BZYConstants.MMKV_KEY_USER_AGREEMENT_IS_CHECKED)
userAgreementTv = findViewById(R.id.tv_user_agreement)
userAgreementCB = findViewById(R.id.cb_user_agreement)
if (!userAgreementIsChecked) {
userAgreementTv.setTextColor(Color.parseColor("#828282"))
userAgreementCB.setTextColor(Color.parseColor("#828282"))
} else {
userAgreementTv.setTextColor(Color.parseColor("#4F4F4F"))
userAgreementCB.setTextColor(Color.parseColor("#4F4F4F"))
}
userAgreementCB.isChecked = userAgreementIsChecked
userAgreementCB.setOnCheckedChangeListener { _, isChecked ->
if (!isChecked) {
MMKV.defaultMMKV().encode(BZYConstants.MMKV_KEY_USER_AGREEMENT_IS_CHECKED, false)
userAgreementTv.setTextColor(Color.parseColor("#828282"))
userAgreementCB.setTextColor(Color.parseColor("#828282"))
} else {
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)
passwordHideCb.setOnCheckedChangeListener(IOnCheckedChangeListener())

View File

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

View File

@ -157,7 +157,7 @@
android:id="@+id/cb_remember_password"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_marginTop="60dp"
android:layout_marginTop="20dp"
android:button="@null"
android:checked="true"
android:gravity="center"
@ -169,35 +169,47 @@
app:layout_constraintStart_toStartOf="@+id/tv_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"
<CheckBox
android:id="@+id/cb_user_agreement"
android:layout_width="0dp"
android:layout_height="30dp"
android:button="@null"
android:checked="true"
android:layout_marginTop="11dp"
android:gravity="center_vertical"
android:orientation="horizontal"
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">
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">-->
<CheckBox
android:id="@+id/cb_user_agreement"
android:layout_width="20dp"
android:layout_height="20dp"
android:button="@null"
android:checked="true"
android:gravity="center"
app:drawableLeftCompat="@drawable/checked_selector" />
<!-- <CheckBox-->
<!-- android:id="@+id/cb_user_agreement"-->
<!-- android:layout_width="20dp"-->
<!-- android:layout_height="20dp"-->
<!-- android:button="@null"-->
<!-- android:checked="true"-->
<!-- android:gravity="center"-->
<!-- app:drawableLeftCompat="@drawable/checked_selector" />-->
<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-->
<!-- 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
@ -217,7 +229,7 @@
android:textColor="@color/black"
android:textSize="@dimen/layout_login_tv_login_textsize"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@+id/ll_user_agreement" />
app:layout_constraintTop_toBottomOf="@+id/cb_user_agreement" />
<TextView
android:id="@+id/tv_tip_default_psw"