From 96cf38e427fdc59240c52c372f8db9ce54683661 Mon Sep 17 00:00:00 2001 From: JianYang Liu Date: Mon, 16 Mar 2020 14:54:33 -0700 Subject: Added boolean flag to allow showing notification on the bottom of the screen rather than on the top. Bug: 146901563 Test: Manual Change-Id: I493dd41190c487e00acd783fa02361afd3380188 --- .../res/drawable/headsup_scrim_bottom.xml | 24 +++++++++++ .../res/layout/headsup_container_bottom.xml | 50 ++++++++++++++++++++++ packages/CarSystemUI/res/values/config.xml | 7 +++ .../CarHeadsUpNotificationSystemContainer.java | 10 +++-- 4 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 packages/CarSystemUI/res/drawable/headsup_scrim_bottom.xml create mode 100644 packages/CarSystemUI/res/layout/headsup_container_bottom.xml diff --git a/packages/CarSystemUI/res/drawable/headsup_scrim_bottom.xml b/packages/CarSystemUI/res/drawable/headsup_scrim_bottom.xml new file mode 100644 index 000000000000..1724ef008269 --- /dev/null +++ b/packages/CarSystemUI/res/drawable/headsup_scrim_bottom.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/packages/CarSystemUI/res/layout/headsup_container_bottom.xml b/packages/CarSystemUI/res/layout/headsup_container_bottom.xml new file mode 100644 index 000000000000..caf1677234d0 --- /dev/null +++ b/packages/CarSystemUI/res/layout/headsup_container_bottom.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/CarSystemUI/res/values/config.xml b/packages/CarSystemUI/res/values/config.xml index aaa65de2fa1d..2077e7707f59 100644 --- a/packages/CarSystemUI/res/values/config.xml +++ b/packages/CarSystemUI/res/values/config.xml @@ -34,6 +34,13 @@ true + + false true false diff --git a/packages/CarSystemUI/src/com/android/systemui/car/notification/CarHeadsUpNotificationSystemContainer.java b/packages/CarSystemUI/src/com/android/systemui/car/notification/CarHeadsUpNotificationSystemContainer.java index 689d2d537bd6..53e5d9fe91ec 100644 --- a/packages/CarSystemUI/src/com/android/systemui/car/notification/CarHeadsUpNotificationSystemContainer.java +++ b/packages/CarSystemUI/src/com/android/systemui/car/notification/CarHeadsUpNotificationSystemContainer.java @@ -60,6 +60,8 @@ public class CarHeadsUpNotificationSystemContainer implements CarHeadsUpNotifica mCarDeviceProvisionedController = deviceProvisionedController; mCarStatusBarLazy = carStatusBarLazy; + boolean showOnBottom = resources.getBoolean(R.bool.config_showHeadsUpNotificationOnBottom); + WindowManager.LayoutParams lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT, @@ -68,11 +70,13 @@ public class CarHeadsUpNotificationSystemContainer implements CarHeadsUpNotifica | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, PixelFormat.TRANSLUCENT); - lp.gravity = Gravity.TOP; + lp.gravity = showOnBottom ? Gravity.BOTTOM : Gravity.TOP; lp.setTitle("HeadsUpNotification"); - mWindow = (ViewGroup) LayoutInflater.from(context) - .inflate(R.layout.headsup_container, null, false); + int layoutId = showOnBottom + ? R.layout.headsup_container_bottom + : R.layout.headsup_container; + mWindow = (ViewGroup) LayoutInflater.from(context).inflate(layoutId, null, false); windowManager.addView(mWindow, lp); mWindow.setVisibility(View.INVISIBLE); mHeadsUpContentFrame = mWindow.findViewById(R.id.headsup_content); -- cgit v1.2.3-59-g8ed1b