Merge "Fix overlap in auth_credential_password_view" into udc-dev

This commit is contained in:
Wenhui Yang
2023-04-26 20:16:55 +00:00
committed by Android (Google) Code Review
2 changed files with 48 additions and 32 deletions

View File

@@ -23,40 +23,47 @@
android:orientation="vertical"
android:theme="?app:attr/lockPinPasswordStyle">
<RelativeLayout
<ScrollView
android:id="@+id/auth_credential_header"
style="?headerStyle"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content">
<ImageView
android:id="@+id/icon"
style="?headerIconStyle"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@null"/>
<TextView
android:id="@+id/title"
style="?titleTextAppearance"
android:layout_below="@id/icon"
<RelativeLayout
style="?headerStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content">
<TextView
android:id="@+id/subtitle"
style="?subTitleTextAppearance"
android:layout_below="@id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/icon"
style="?headerIconStyle"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@null" />
<TextView
android:id="@+id/description"
style="?descriptionTextAppearance"
android:layout_below="@id/subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>
<TextView
android:id="@+id/title"
style="?titleTextAppearance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/icon" />
<TextView
android:id="@+id/subtitle"
style="?subTitleTextAppearance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title" />
<TextView
android:id="@+id/description"
style="?descriptionTextAppearance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/subtitle" />
</RelativeLayout>
</ScrollView>
<LinearLayout
android:id="@+id/auth_credential_input"

View File

@@ -65,7 +65,7 @@ class CredentialPasswordView(context: Context, attrs: AttributeSet?) :
super.onLayout(changed, left, top, right, bottom)
val inputLeftBound: Int
val inputTopBound: Int
var inputTopBound: Int
var headerRightBound = right
var headerTopBounds = top
val subTitleBottom: Int = if (subtitleView.isGone) titleView.bottom else subtitleView.bottom
@@ -75,14 +75,23 @@ class CredentialPasswordView(context: Context, attrs: AttributeSet?) :
inputLeftBound = (right - left) / 2
headerRightBound = inputLeftBound
headerTopBounds -= iconView.bottom.coerceAtMost(bottomInset)
if (descriptionView.bottom > bottomInset) {
credentialHeader.layout(left, headerTopBounds, headerRightBound, bottom)
}
} else {
inputTopBound = descBottom + (bottom - descBottom - credentialInput.height) / 2
inputLeftBound = (right - left - credentialInput.width) / 2
if (bottom - inputTopBound < credentialInput.height) {
inputTopBound = bottom - credentialInput.height
}
if (descriptionView.bottom > inputTopBound) {
credentialHeader.layout(left, headerTopBounds, headerRightBound, inputTopBound)
}
}
if (descriptionView.bottom > bottomInset) {
credentialHeader.layout(left, headerTopBounds, headerRightBound, bottom)
}
credentialInput.layout(inputLeftBound, inputTopBound, right, bottom)
}