Merge "Polish background for controls panel." into tm-qpr-dev am: bb848b653a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20668386

Change-Id: Idc6cd48ebaeae2aa0cb318cf27ff2eb680078992
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Fabian Kozynski
2022-12-14 14:28:03 +00:00
committed by Automerger Merge Worker
6 changed files with 52 additions and 5 deletions

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 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.
~
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#1F1F1F" />
<corners android:radius="@dimen/notification_corner_radius" />
</shape>

View File

@@ -90,7 +90,7 @@
android:layout_weight="1"
android:layout_marginLeft="@dimen/global_actions_side_margin"
android:layout_marginRight="@dimen/global_actions_side_margin"
android:background="#ff0000"
android:background="@drawable/controls_panel_background"
android:padding="@dimen/global_actions_side_margin"
android:visibility="gone"
/>

View File

@@ -50,7 +50,12 @@ object ControlsAnimations {
* Setup an activity to handle enter/exit animations. [view] should be the root of the content.
* Fade and translate together.
*/
fun observerForAnimations(view: ViewGroup, window: Window, intent: Intent): LifecycleObserver {
fun observerForAnimations(
view: ViewGroup,
window: Window,
intent: Intent,
animateY: Boolean = true
): LifecycleObserver {
return object : LifecycleObserver {
var showAnimation = intent.getBooleanExtra(ControlsUiController.EXTRA_ANIMATE, false)
@@ -61,8 +66,12 @@ object ControlsAnimations {
view.transitionAlpha = 0.0f
if (translationY == -1f) {
translationY = view.context.resources.getDimensionPixelSize(
R.dimen.global_actions_controls_y_translation).toFloat()
if (animateY) {
translationY = view.context.resources.getDimensionPixelSize(
R.dimen.global_actions_controls_y_translation).toFloat()
} else {
translationY = 0f
}
}
}

View File

@@ -70,7 +70,8 @@ class ControlsActivity @Inject constructor(
ControlsAnimations.observerForAnimations(
requireViewById<ViewGroup>(R.id.control_detail_root),
window,
intent
intent,
!featureFlags.isEnabled(Flags.USE_APP_PANELS)
)
)

View File

@@ -24,6 +24,10 @@ import android.app.PendingIntent
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.ShapeDrawable
import android.graphics.drawable.shapes.RoundRectShape
import com.android.systemui.R
import com.android.systemui.util.boundsOnScreen
import com.android.wm.shell.TaskView
import java.util.concurrent.Executor
@@ -64,6 +68,16 @@ class PanelTaskViewController(
options.taskAlwaysOnTop = true
taskView.post {
val roundedCorner =
activityContext.resources.getDimensionPixelSize(
R.dimen.notification_corner_radius
)
val radii = FloatArray(8) { roundedCorner.toFloat() }
taskView.background =
ShapeDrawable(RoundRectShape(radii, null, null)).apply {
setTint(Color.TRANSPARENT)
}
taskView.clipToOutline = true
taskView.startActivity(
pendingIntent,
fillInIntent,

View File

@@ -75,6 +75,7 @@ class PanelTaskViewControllerTest : SysuiTestCase() {
uiExecutor.execute(it.arguments[0] as Runnable)
true
}
whenever(activityContext.resources).thenReturn(context.resources)
uiExecutor = FakeExecutor(FakeSystemClock())