Merge "Update fingerprint icon layout size" into tm-d1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
032ed256e6
@@ -36,12 +36,20 @@ open class AuthBiometricFingerprintIconController(
|
|||||||
iconView: ImageView
|
iconView: ImageView
|
||||||
) : AuthIconController(context, iconView) {
|
) : AuthIconController(context, iconView) {
|
||||||
|
|
||||||
|
var iconLayoutParamsSize = 0
|
||||||
|
set(value) {
|
||||||
|
if (field == value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
iconView.layoutParams.width = value
|
||||||
|
iconView.layoutParams.height = value
|
||||||
|
field = value
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val size = context.resources.getDimensionPixelSize(
|
iconLayoutParamsSize = context.resources.getDimensionPixelSize(
|
||||||
R.dimen.biometric_dialog_fingerprint_icon_size
|
R.dimen.biometric_dialog_fingerprint_icon_size
|
||||||
)
|
)
|
||||||
iconView.layoutParams.width = size
|
|
||||||
iconView.layoutParams.height = size
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateIcon(@BiometricState lastState: Int, @BiometricState newState: Int) {
|
override fun updateIcon(@BiometricState lastState: Int, @BiometricState newState: Int) {
|
||||||
|
|||||||
@@ -88,6 +88,13 @@ open class AuthBiometricFingerprintView(
|
|||||||
override fun createIconController(): AuthIconController =
|
override fun createIconController(): AuthIconController =
|
||||||
AuthBiometricFingerprintIconController(mContext, mIconView)
|
AuthBiometricFingerprintIconController(mContext, mIconView)
|
||||||
|
|
||||||
|
fun updateOverrideIconLayoutParamsSize() {
|
||||||
|
udfpsAdapter?.let {
|
||||||
|
(mIconController as? AuthBiometricFingerprintIconController)?.iconLayoutParamsSize =
|
||||||
|
it.getSensorDiameter(scaleFactorProvider?.provide() ?: 1.0f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onAttachedToWindow() {
|
override fun onAttachedToWindow() {
|
||||||
super.onAttachedToWindow()
|
super.onAttachedToWindow()
|
||||||
showTouchSensorString()
|
showTouchSensorString()
|
||||||
|
|||||||
@@ -320,6 +320,7 @@ public class AuthContainerView extends LinearLayout
|
|||||||
R.layout.auth_biometric_fingerprint_and_face_view, null, false);
|
R.layout.auth_biometric_fingerprint_and_face_view, null, false);
|
||||||
fingerprintAndFaceView.setSensorProperties(fpProperties);
|
fingerprintAndFaceView.setSensorProperties(fpProperties);
|
||||||
fingerprintAndFaceView.setScaleFactorProvider(config.mScaleProvider);
|
fingerprintAndFaceView.setScaleFactorProvider(config.mScaleProvider);
|
||||||
|
fingerprintAndFaceView.updateOverrideIconLayoutParamsSize();
|
||||||
mBiometricView = fingerprintAndFaceView;
|
mBiometricView = fingerprintAndFaceView;
|
||||||
} else if (fpProperties != null) {
|
} else if (fpProperties != null) {
|
||||||
final AuthBiometricFingerprintView fpView =
|
final AuthBiometricFingerprintView fpView =
|
||||||
@@ -327,6 +328,7 @@ public class AuthContainerView extends LinearLayout
|
|||||||
R.layout.auth_biometric_fingerprint_view, null, false);
|
R.layout.auth_biometric_fingerprint_view, null, false);
|
||||||
fpView.setSensorProperties(fpProperties);
|
fpView.setSensorProperties(fpProperties);
|
||||||
fpView.setScaleFactorProvider(config.mScaleProvider);
|
fpView.setScaleFactorProvider(config.mScaleProvider);
|
||||||
|
fpView.updateOverrideIconLayoutParamsSize();
|
||||||
mBiometricView = fpView;
|
mBiometricView = fpView;
|
||||||
} else if (faceProperties != null) {
|
} else if (faceProperties != null) {
|
||||||
mBiometricView = (AuthBiometricFaceView) layoutInflater.inflate(
|
mBiometricView = (AuthBiometricFaceView) layoutInflater.inflate(
|
||||||
|
|||||||
@@ -90,6 +90,13 @@ public class UdfpsDialogMeasureAdapter {
|
|||||||
return mBottomSpacerHeight;
|
return mBottomSpacerHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return sensor diameter size as scaleFactor
|
||||||
|
*/
|
||||||
|
public int getSensorDiameter(float scaleFactor) {
|
||||||
|
return (int) (scaleFactor * mSensorProps.getLocation().sensorRadius * 2);
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private AuthDialog.LayoutParams onMeasureInternalPortrait(int width, int height,
|
private AuthDialog.LayoutParams onMeasureInternalPortrait(int width, int height,
|
||||||
float scaleFactor) {
|
float scaleFactor) {
|
||||||
@@ -108,8 +115,7 @@ public class UdfpsDialogMeasureAdapter {
|
|||||||
// Go through each of the children and do the custom measurement.
|
// Go through each of the children and do the custom measurement.
|
||||||
int totalHeight = 0;
|
int totalHeight = 0;
|
||||||
final int numChildren = mView.getChildCount();
|
final int numChildren = mView.getChildCount();
|
||||||
final int sensorDiameter =
|
final int sensorDiameter = getSensorDiameter(scaleFactor);
|
||||||
(int) (scaleFactor * mSensorProps.getLocation().sensorRadius * 2);
|
|
||||||
for (int i = 0; i < numChildren; i++) {
|
for (int i = 0; i < numChildren; i++) {
|
||||||
final View child = mView.getChildAt(i);
|
final View child = mView.getChildAt(i);
|
||||||
if (child.getId() == R.id.biometric_icon_frame) {
|
if (child.getId() == R.id.biometric_icon_frame) {
|
||||||
@@ -203,8 +209,7 @@ public class UdfpsDialogMeasureAdapter {
|
|||||||
final int horizontalSpacerWidth = calculateHorizontalSpacerWidthForLandscape(
|
final int horizontalSpacerWidth = calculateHorizontalSpacerWidthForLandscape(
|
||||||
mSensorProps, displayWidth, dialogMargin, horizontalInset, scaleFactor);
|
mSensorProps, displayWidth, dialogMargin, horizontalInset, scaleFactor);
|
||||||
|
|
||||||
final int sensorDiameter =
|
final int sensorDiameter = getSensorDiameter(scaleFactor);
|
||||||
(int) (scaleFactor * mSensorProps.getLocation().sensorRadius * 2);
|
|
||||||
final int remeasuredWidth = sensorDiameter + 2 * horizontalSpacerWidth;
|
final int remeasuredWidth = sensorDiameter + 2 * horizontalSpacerWidth;
|
||||||
|
|
||||||
int remeasuredHeight = 0;
|
int remeasuredHeight = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user