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

Commit c27437b7 authored by Selim Cinek's avatar Selim Cinek
Browse files

Implemented visual speed-bump for notifications.

The separation between the important and the less important
notifications has now a visual representation.

Bug: 14607473
Change-Id: I8baa0a08924ec041be2884a2834139477313ab40
parent 4455f54b
Loading
Loading
Loading
Loading
+65 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2014 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
  -->

<!-- Extends FrameLayout -->
<com.android.systemui.statusbar.SpeedBumpView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusable="true"
    android:clickable="true"
    android:visibility="gone"
    >
    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="@dimen/speed_bump_height_collapsed"
            android:layout_gravity="top"
            android:orientation="horizontal">
        <View
            android:id="@+id/speedbump_line_left"
            android:layout_width="0dp"
            android:layout_height="1dp"
            android:layout_weight="1"
            android:background="#6fdddddd"
            android:layout_gravity="center_vertical"/>
        <com.android.systemui.statusbar.SpeedBumpDotsLayout
                android:id="@+id/speed_bump_dots_layout"
                android:layout_width="34dp"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="8dp"
                android:layout_height="match_parent"
                android:layout_weight="0"/>
        <View
            android:id="@+id/speedbump_line_right"
            android:layout_width="0dp"
            android:layout_height="1dp"
            android:layout_weight="1"
            android:background="#6fdddddd"
            android:layout_gravity="center_vertical"/>
    </LinearLayout>
    <TextView
            android:id="@+id/speed_bump_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="top|center_horizontal"
            android:fontFamily="sans-serif-condensed"
            android:textSize="15sp"
            android:singleLine="true"
            android:textColor="#eeeeee"
            android:visibility="invisible"
            android:text="@string/speed_bump_explanation"
            android:paddingTop="4dp" />
</com.android.systemui.statusbar.SpeedBumpView>
+12 −0
Original line number Diff line number Diff line
@@ -58,6 +58,18 @@
    <!-- Tint color for the content on the notification overflow card. -->
    <color name="keyguard_overflow_content_color">#ff666666</color>

    <!-- The color of the red speed bump dot -->
    <color name="speed_bump_dot_red">#ffd50000</color>

    <!-- The color of the blue speed bump dot -->
    <color name="speed_bump_dot_blue">#ff2962ff</color>

    <!-- The color of the yellow speed bump dot -->
    <color name="speed_bump_dot_yellow">#ffffd600</color>

    <!-- The color of the green speed bump dot -->
    <color name="speed_bump_dot_green">#ff00c853</color>

    <!-- The default recents task bar background color. -->
    <color name="recents_task_bar_default_background_color">#e6444444</color>
    <!-- The default recents task bar text color. -->
+9 −0
Original line number Diff line number Diff line
@@ -260,6 +260,15 @@
    <!-- The padding between the individual notification cards. -->
    <dimen name="notification_padding">4dp</dimen>

    <!-- The height of the collapsed speed bump view. -->
    <dimen name="speed_bump_height_collapsed">24dp</dimen>

    <!-- The padding inset the explanation text needs compared to the collapsed height -->
    <dimen name="speed_bump_text_padding_inset">10dp</dimen>

    <!-- The height of the speed bump dots. -->
    <dimen name="speed_bump_dots_height">5dp</dimen>

    <!-- The total height of the stack in its collapsed size (i.e. when quick settings is open) -->
    <dimen name="collapsed_stack_height">94dp</dimen>

+3 −0
Original line number Diff line number Diff line
@@ -553,6 +553,9 @@
        <item quantity="other">%d more</item>
    </plurals>

    <!-- An explanation for the visual speed bump in the notifications, which will appear when you click on it. [CHAR LIMIT=50] -->
    <string name="speed_bump_explanation">Less urgent notifications below</string>

    <!-- Shows to explain the double tap interaction with notifications: After tapping a notification on Keyguard, this will explain users to tap again to launch a notification. [CHAR LIMIT=60] -->
    <string name="notification_tap_again">Tap again to open</string>

+19 −1
Original line number Diff line number Diff line
@@ -877,6 +877,7 @@ public abstract class BaseStatusBar extends SystemUI implements
        entry.row = row;
        entry.row.setHeightRange(mRowMinHeight, mRowMaxHeight);
        entry.row.setOnActivatedListener(this);
        entry.row.setIsBelowSpeedBump(isBelowSpeedBump(entry.notification));
        entry.expanded = contentViewLocal;
        entry.expandedPublic = publicViewLocal;
        entry.setBigContentView(bigContentViewLocal);
@@ -1039,8 +1040,8 @@ public abstract class BaseStatusBar extends SystemUI implements
        if (DEBUG) {
            Log.d(TAG, "addNotificationViews: added at " + pos);
        }
        updateRowStates();
        updateNotificationIcons();
        updateRowStates();
    }

    private void addNotificationViews(IBinder key, StatusBarNotification notification) {
@@ -1060,6 +1061,7 @@ public abstract class BaseStatusBar extends SystemUI implements
        mKeyguardIconOverflowContainer.getIconsView().removeAllViews();
        int n = mNotificationData.size();
        int visibleNotifications = 0;
        int speedBumpIndex = -1;
        boolean onKeyguard = mState == StatusBarState.KEYGUARD;
        for (int i = n-1; i >= 0; i--) {
            NotificationData.Entry entry = mNotificationData.get(i);
@@ -1087,6 +1089,10 @@ public abstract class BaseStatusBar extends SystemUI implements
                entry.row.setVisibility(View.VISIBLE);
                visibleNotifications++;
            }
            if (entry.row.getVisibility() != View.GONE && speedBumpIndex == -1
                    && entry.row.isBelowSpeedBump() ) {
                speedBumpIndex = n - 1 - i;
            }
        }

        if (onKeyguard && mKeyguardIconOverflowContainer.getIconsView().getChildCount() > 0) {
@@ -1094,6 +1100,8 @@ public abstract class BaseStatusBar extends SystemUI implements
        } else {
            mKeyguardIconOverflowContainer.setVisibility(View.GONE);
        }

        mStackScroller.updateSpeedBumpIndex(speedBumpIndex);
    }

    private boolean shouldShowOnKeyguard(StatusBarNotification sbn) {
@@ -1309,9 +1317,19 @@ public abstract class BaseStatusBar extends SystemUI implements
        } else {
            entry.row.setOnClickListener(null);
        }
        boolean wasBelow = entry.row.isBelowSpeedBump();
        boolean nowBelow = isBelowSpeedBump(notification);
        if (wasBelow != nowBelow) {
            entry.row.setIsBelowSpeedBump(nowBelow);
        }
        entry.row.notifyContentUpdated();
    }

    private boolean isBelowSpeedBump(StatusBarNotification notification) {
        return notification.getNotification().priority ==
                Notification.PRIORITY_MIN;
    }

    protected void notifyHeadsUpScreenOn(boolean screenOn) {
        if (!screenOn && mInterruptingNotificationEntry != null) {
            mHandler.sendEmptyMessage(MSG_ESCALATE_HEADS_UP);
Loading