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

Commit c3ebc332 authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Add initial corner radius to pin button." into tm-qpr-dev am:...

Merge "Merge "Add initial corner radius to pin button." into tm-qpr-dev am: dbed209f am: be53ffc4"
parents a2d0a9ab e18f7fef
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ class NumPadAnimator {
    private float mStartRadius;
    private float mEndRadius;
    private int mHeight;
    private boolean mInitialized;

    private static final int EXPAND_ANIMATION_MS = 100;
    private static final int EXPAND_COLOR_ANIMATION_MS = 50;
@@ -97,6 +98,11 @@ class NumPadAnimator {
        mEndRadius = height / 4f;
        mExpandAnimator.setFloatValues(mStartRadius, mEndRadius);
        mContractAnimator.setFloatValues(mEndRadius, mStartRadius);
        // Set initial corner radius.
        if (!mInitialized) {
            mBackground.setCornerRadius(mStartRadius);
            mInitialized = true;
        }
    }

    /**
+56 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.
 */
package com.android.keyguard

import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.Mockito.anyFloat
import org.mockito.Mockito.never
import org.mockito.Mockito.reset
import org.mockito.Mockito.verify
import org.mockito.MockitoAnnotations

@SmallTest
@RunWith(AndroidTestingRunner::class)
@TestableLooper.RunWithLooper
class NumPadAnimatorTest : SysuiTestCase() {
    @Mock lateinit var background: GradientDrawable
    @Mock lateinit var buttonImage: Drawable
    private lateinit var underTest: NumPadAnimator

    @Before
    fun setup() {
        MockitoAnnotations.initMocks(this)
        underTest = NumPadAnimator(context, background, 0, buttonImage)
    }

    @Test
    fun testOnLayout() {
        underTest.onLayout(100)
        verify(background).cornerRadius = 50f
        reset(background)
        underTest.onLayout(100)
        verify(background, never()).cornerRadius = anyFloat()
    }
}