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

Commit ee448599 authored by Joshua Mokut's avatar Joshua Mokut
Browse files

Implemented hover support for Notifications

Added new hover state implementation for notifications with new UX Specs.

Test: manual testing - create a notification, hover over it, and ensure there is a hover effect - notification should become slightly darker but should not blend with background notification panel
Fixes: 283804865
Change-Id: I8f707227b3d3d72ae60ca8deff6bc9c8dcbfb6cb
parent a2ac214a
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2023 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.
  -->

<selector xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
    <item android:state_pressed="true" android:color="?androidprv:attr/materialColorOnSurface" android:alpha="0.15" />
    <item android:state_hovered="true" android:color="?androidprv:attr/materialColorOnSurface" android:alpha="0.11" />
    <item android:color="@color/transparent" />
</selector>
 No newline at end of file
+7 −2
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
  ~ limitations under the License
  -->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
        android:color="?android:attr/colorControlHighlight">
    <item>
@@ -23,4 +23,9 @@
            <solid android:color="?androidprv:attr/colorSurface" />
        </shape>
    </item>
</ripple>
 No newline at end of file
    <item>
        <shape>
            <solid android:color="@color/notification_overlay_color" />
        </shape>
    </item>
</layer-list>
 No newline at end of file
+4 −2
Original line number Diff line number Diff line
@@ -30,12 +30,14 @@
    <com.android.systemui.statusbar.notification.row.NotificationBackgroundView
        android:id="@+id/backgroundNormal"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
        android:layout_height="match_parent"
        android:duplicateParentState="true"/>

    <com.android.systemui.statusbar.notification.row.NotificationBackgroundView
        android:id="@+id/backgroundDimmed"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
        android:layout_height="match_parent"
        android:duplicateParentState="true"/>

    <com.android.systemui.statusbar.notification.row.NotificationContentView
        android:id="@+id/expanded"
+0 −10
Original line number Diff line number Diff line
@@ -188,12 +188,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        return super.onInterceptTouchEvent(ev);
    }

    /**
     * Called by the TouchHandler when this view is tapped. This will be called for actual taps
     * only, i.e. taps that have been filtered by the FalsingManager.
     */
    public void onTap() {}

    /** Sets the last action up time this view was touched. */
    public void setLastActionUpTime(long eventTime) {
        mLastActionUpTime = eventTime;
@@ -227,10 +221,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        mBackgroundNormal.setState(getDrawableState());
    }

    void setRippleAllowed(boolean allowed) {
        mBackgroundNormal.setPressedAllowed(allowed);
    }

    private void updateOutlineAlpha() {
        float alpha = NotificationStackScrollLayout.BACKGROUND_ALPHA_DIMMED;
        alpha = (alpha + (1.0f - alpha) * mNormalBackgroundVisibilityAmount);
+1 −5
Original line number Diff line number Diff line
@@ -80,11 +80,7 @@ public class ActivatableNotificationViewController

            if (ev.getAction() == MotionEvent.ACTION_UP) {
                // If this is a false tap, capture the even so it doesn't result in a click.
                boolean falseTap = mFalsingManager.isFalseTap(FalsingManager.LOW_PENALTY);
                if (!falseTap && v instanceof ActivatableNotificationView) {
                    ((ActivatableNotificationView) v).onTap();
                }
                return falseTap;
                return mFalsingManager.isFalseTap(FalsingManager.LOW_PENALTY);
            }
            return result;
        }
Loading