Polish background for controls panel.

Now the background is a #1f1f1f 1dp border around the panel.

Fixes: 261201851
Test: manual
Change-Id: Ica0c410602860c69583d50c670883919e2f4292d
This commit is contained in:
Fabian Kozynski
2022-12-07 15:28:21 -05:00
parent 0bfdbbf4c2
commit 4454139264
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

@@ -66,7 +66,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())