Merge "Polish background for controls panel." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
bb848b653a
22
packages/SystemUI/res/drawable/controls_panel_background.xml
Normal file
22
packages/SystemUI/res/drawable/controls_panel_background.xml
Normal 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>
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginLeft="@dimen/global_actions_side_margin"
|
android:layout_marginLeft="@dimen/global_actions_side_margin"
|
||||||
android:layout_marginRight="@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:padding="@dimen/global_actions_side_margin"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -50,7 +50,12 @@ object ControlsAnimations {
|
|||||||
* Setup an activity to handle enter/exit animations. [view] should be the root of the content.
|
* Setup an activity to handle enter/exit animations. [view] should be the root of the content.
|
||||||
* Fade and translate together.
|
* 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 {
|
return object : LifecycleObserver {
|
||||||
var showAnimation = intent.getBooleanExtra(ControlsUiController.EXTRA_ANIMATE, false)
|
var showAnimation = intent.getBooleanExtra(ControlsUiController.EXTRA_ANIMATE, false)
|
||||||
|
|
||||||
@@ -61,8 +66,12 @@ object ControlsAnimations {
|
|||||||
view.transitionAlpha = 0.0f
|
view.transitionAlpha = 0.0f
|
||||||
|
|
||||||
if (translationY == -1f) {
|
if (translationY == -1f) {
|
||||||
translationY = view.context.resources.getDimensionPixelSize(
|
if (animateY) {
|
||||||
R.dimen.global_actions_controls_y_translation).toFloat()
|
translationY = view.context.resources.getDimensionPixelSize(
|
||||||
|
R.dimen.global_actions_controls_y_translation).toFloat()
|
||||||
|
} else {
|
||||||
|
translationY = 0f
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ class ControlsActivity @Inject constructor(
|
|||||||
ControlsAnimations.observerForAnimations(
|
ControlsAnimations.observerForAnimations(
|
||||||
requireViewById<ViewGroup>(R.id.control_detail_root),
|
requireViewById<ViewGroup>(R.id.control_detail_root),
|
||||||
window,
|
window,
|
||||||
intent
|
intent,
|
||||||
|
!featureFlags.isEnabled(Flags.USE_APP_PANELS)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ import android.app.PendingIntent
|
|||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
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.systemui.util.boundsOnScreen
|
||||||
import com.android.wm.shell.TaskView
|
import com.android.wm.shell.TaskView
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
@@ -64,6 +68,16 @@ class PanelTaskViewController(
|
|||||||
options.taskAlwaysOnTop = true
|
options.taskAlwaysOnTop = true
|
||||||
|
|
||||||
taskView.post {
|
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(
|
taskView.startActivity(
|
||||||
pendingIntent,
|
pendingIntent,
|
||||||
fillInIntent,
|
fillInIntent,
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class PanelTaskViewControllerTest : SysuiTestCase() {
|
|||||||
uiExecutor.execute(it.arguments[0] as Runnable)
|
uiExecutor.execute(it.arguments[0] as Runnable)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
whenever(activityContext.resources).thenReturn(context.resources)
|
||||||
|
|
||||||
uiExecutor = FakeExecutor(FakeSystemClock())
|
uiExecutor = FakeExecutor(FakeSystemClock())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user