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 --- .../notification/CarHeadsUpNotificationSystemContainer.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'packages/CarSystemUI/src') 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