Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c4397fe authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Add progressbar to UdfpsView

Note that the progress bar should live in UdfpsView instead of
UdfpsAnimationView (at least for now), since it needs to be shown
even while the finger is down.

Bug: 177965281
Test: atest com.android.systemui.biometrics

Change-Id: I297bcdee7cfd19bb91312c617774dd4725e610ee
parent 7f2c016b
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2021 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background">
        <shape
            android:innerRadiusRatio="2.2"
            android:shape="ring"
            android:thickness="@dimen/udfps_enroll_progress_thickness"
            android:useLevel="false"
            android:tint="?android:colorControlNormal">
            <solid android:color="@*android:color/white_disabled_material" />
        </shape>
    </item>
    <item android:id="@android:id/progress">
        <rotate
            android:fromDegrees="270"
            android:pivotX="50%"
            android:pivotY="50%"
            android:toDegrees="270">
            <shape
                android:innerRadiusRatio="2.2"
                android:shape="ring"
                android:thickness="@dimen/udfps_enroll_progress_thickness"
                android:tint="?android:attr/colorControlActivated">
                <solid android:color="@android:color/white" />
            </shape>
        </rotate>
    </item>
</layer-list>
 No newline at end of file
+14 −1
Original line number Diff line number Diff line
@@ -20,4 +20,17 @@
    android:id="@+id/udfps_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    systemui:sensorTouchAreaCoefficient="0.5"/>
    systemui:sensorTouchAreaCoefficient="0.5">

    <!-- Enrollment progress bar-->
    <com.android.systemui.biometrics.UdfpsProgressBar
        android:id="@+id/progress_bar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:max="100"
        android:padding="@dimen/udfps_enroll_progress_thickness"
        android:progress="0"
        android:layout_gravity="center"
        android:visibility="gone"/>

</com.android.systemui.biometrics.UdfpsView>
+3 −0
Original line number Diff line number Diff line
@@ -1117,6 +1117,9 @@
    <!-- Y translation for credential contents when animating in -->
    <dimen name="biometric_dialog_credential_translation_offset">60dp</dimen>

    <!-- UDFPS enrollment progress bar thickness -->
    <dimen name="udfps_enroll_progress_thickness">12dp</dimen>

    <!-- Wireless Charging Animation values -->
    <dimen name="wireless_charging_dots_radius_start">0dp</dimen>
    <dimen name="wireless_charging_dots_radius_end">4dp</dimen>
+8 −0
Original line number Diff line number Diff line
@@ -752,4 +752,12 @@
        <item name="android:textSize">14sp</item>
        <item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
    </style>

    <style name="UdfpsProgressBarStyle"
        parent="android:style/Widget.Material.ProgressBar.Horizontal">
        <item name="android:indeterminate">false</item>
        <item name="android:max">10000</item>
        <item name="android:mirrorForRtl">false</item>
        <item name="android:progressDrawable">@drawable/udfps_progress_bar</item>
    </style>
</resources>
+3 −10
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ public class UdfpsAnimationEnroll extends UdfpsAnimation {
    private static final String TAG = "UdfpsAnimationEnroll";

    private static final float SHADOW_RADIUS = 5.f;
    private static final float PROGRESS_BAR_RADIUS = 140.f;

    @Nullable private RectF mSensorRect;
    @NonNull private final Paint mSensorPaint;
@@ -81,12 +82,12 @@ public class UdfpsAnimationEnroll extends UdfpsAnimation {

    @Override
    public int getPaddingX() {
        return (int) Math.ceil(SHADOW_RADIUS);
        return (int) Math.ceil(PROGRESS_BAR_RADIUS);
    }

    @Override
    public int getPaddingY() {
        return (int) Math.ceil(SHADOW_RADIUS);
        return (int) Math.ceil(PROGRESS_BAR_RADIUS);
    }

    @Override
@@ -104,12 +105,4 @@ public class UdfpsAnimationEnroll extends UdfpsAnimation {
    public int getOpacity() {
        return 0;
    }

    public void onEnrollmentProgress(int remaining) {
        Log.d(TAG, "Remaining: " + remaining);
    }

    public void onEnrollmentHelp() {
        Log.d(TAG, "onEnrollmentHelp");
    }
}
Loading