Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 649059af authored by Jian-Yang Liu's avatar Jian-Yang Liu Committed by Automerger Merge Worker
Browse files

Merge "Added boolean flag to allow showing notification on the bottom of the...

Merge "Added boolean flag to allow showing notification on the bottom of the screen rather than on the top." into rvc-dev am: 962b460f

Change-Id: I80b20fc416c7af7096e907b2520fd8e4e34549bd
parents 1e90986e 962b460f
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 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"
    android:shape="rectangle">
    <gradient
        android:startColor="@android:color/black"
        android:endColor="@android:color/transparent"
        android:angle="90" />
</shape>
+50 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 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.
  -->

<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/notification_headsup"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/gradient_edge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_begin="@dimen/headsup_scrim_height"/>

    <View
        android:id="@+id/scrim"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:background="@drawable/headsup_scrim_bottom"
        app:layout_constraintBottom_toBottomOf="@+id/gradient_edge"
        app:layout_constraintTop_toTopOf="parent"/>

    <FrameLayout
        android:id="@+id/headsup_content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/headsup_notification_top_margin"
        app:layout_constraintEnd_toStartOf="parent"
        app:layout_constraintStart_toEndOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
    />

</androidx.constraintlayout.widget.ConstraintLayout>
 No newline at end of file
+7 −0
Original line number Diff line number Diff line
@@ -34,6 +34,13 @@

    <!-- Whether heads-up notifications should be shown when shade is open. -->
    <bool name="config_enableHeadsUpNotificationWhenNotificationShadeOpen">true</bool>
    <!-- Whether heads-up notifications should be shown on the bottom. If false, heads-up
         notifications will be shown pushed to the top of their parent container. If true, they will
         be shown pushed to the bottom of their parent container. If true, then should override
         config_headsUpNotificationAnimationHelper to use a different AnimationHelper, such as
         com.android.car.notification.headsup.animationhelper.
         CarHeadsUpNotificationBottomAnimationHelper. -->
    <bool name="config_showHeadsUpNotificationOnBottom">false</bool>

    <bool name="config_hideNavWhenKeyguardBouncerShown">true</bool>
    <bool name="config_enablePersistentDockedActivity">false</bool>
+7 −3
Original line number Diff line number Diff line
@@ -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);