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

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

Adapted the style of notification groups

The title is now not using the spanned styling anymore
and the overflow is divided differently. Also fixed the
layout for RTL languagues and BIDI.

Change-Id: I5963e1990fe0efefd0355fcaae249546cbb75181
parent 2b39c4cc
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -1044,9 +1044,6 @@
    <!-- VolumeUI restoration notification: text -->
    <!-- VolumeUI restoration notification: text -->
    <string name="volumeui_notification_text">Touch to restore the original.</string>
    <string name="volumeui_notification_text">Touch to restore the original.</string>


    <!-- Describes the way 2 names are concatenated. An example would be ", " to produce "Peter Muller, Paul Curry". Please also include a space here if it's appropriate in the language and if it's a RTL language include it on the left. The translation should start and end with " to keep the white space if desired [CHAR LIMIT=5] -->
    <string name="group_summary_concadenation">", "</string>

    <!-- Toast shown when user unlocks screen and managed profile activity is in the foreground -->
    <!-- Toast shown when user unlocks screen and managed profile activity is in the foreground -->
    <string name="managed_profile_foreground_toast">You\'re using your work profile</string>
    <string name="managed_profile_foreground_toast">You\'re using your work profile</string>


+4 −0
Original line number Original line Diff line number Diff line
@@ -241,6 +241,10 @@
        parent="@*android:style/TextAppearance.Material.Notification.Info">
        parent="@*android:style/TextAppearance.Material.Notification.Info">
    </style>
    </style>


    <style name="TextAppearance.Material.Notification.HybridNotificationDivider"
        parent="@*android:style/TextAppearance.Material.Notification">
    </style>

    <style name="SearchPanelCircle">
    <style name="SearchPanelCircle">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:layout_height">match_parent</item>
+5 −4
Original line number Original line Diff line number Diff line
@@ -107,12 +107,13 @@ public class HybridNotificationView extends AlphaOptimizedLinearLayout


    public void bind(CharSequence title, CharSequence text) {
    public void bind(CharSequence title, CharSequence text) {
        mTitleView.setText(title);
        mTitleView.setText(title);
        if (TextUtils.isEmpty(title)) {
        mTitleView.setVisibility(TextUtils.isEmpty(title) ? GONE : VISIBLE);
            mTitleView.setVisibility(GONE);
        }
        mTextView.setText(text);
        if (TextUtils.isEmpty(text)) {
        if (TextUtils.isEmpty(text)) {
            mTextView.setVisibility(GONE);
            mTextView.setVisibility(GONE);
            mTextView.setText(null);
        } else {
            mTextView.setVisibility(VISIBLE);
            mTextView.setText(text.toString());
        }
        }
        requestLayout();
        requestLayout();
    }
    }
+18 −10
Original line number Original line Diff line number Diff line
@@ -18,8 +18,13 @@ package com.android.systemui.statusbar.notification;


import android.app.Notification;
import android.app.Notification;
import android.content.Context;
import android.content.Context;
import android.text.BidiFormatter;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.TextUtils;
import android.text.style.TextAppearanceSpan;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup;


import com.android.systemui.R;
import com.android.systemui.R;
@@ -34,12 +39,12 @@ public class HybridNotificationViewManager {


    private final Context mContext;
    private final Context mContext;
    private ViewGroup mParent;
    private ViewGroup mParent;
    private String mConcadenationString;
    private String mDivider;


    public HybridNotificationViewManager(Context ctx, ViewGroup parent) {
    public HybridNotificationViewManager(Context ctx, ViewGroup parent) {
        mContext = ctx;
        mContext = ctx;
        mParent = parent;
        mParent = parent;
        mConcadenationString = mContext.getString(R.string.group_summary_concadenation);
        mDivider = " • ";
    }
    }


    private HybridNotificationView inflateHybridView() {
    private HybridNotificationView inflateHybridView() {
@@ -83,7 +88,7 @@ public class HybridNotificationViewManager {
        if (reusableView == null) {
        if (reusableView == null) {
            reusableView = inflateHybridView();
            reusableView = inflateHybridView();
        }
        }
        CharSequence summary = null;
        SpannableStringBuilder summary = new SpannableStringBuilder();
        int childCount = group.size();
        int childCount = group.size();
        for (int i = startIndex; i < childCount; i++) {
        for (int i = startIndex; i < childCount; i++) {
            ExpandableNotificationRow child = group.get(i);
            ExpandableNotificationRow child = group.get(i);
@@ -92,15 +97,18 @@ public class HybridNotificationViewManager {
            if (titleText == null) {
            if (titleText == null) {
                continue;
                continue;
            }
            }
            if (TextUtils.isEmpty(summary)) {
            if (!TextUtils.isEmpty(summary)) {
                summary = titleText;
                summary.append(mDivider,
            } else if (reusableView.isLayoutRtl()) {
                        new TextAppearanceSpan(mContext, R.style.
                summary = titleText + mConcadenationString + summary;
                                TextAppearance_Material_Notification_HybridNotificationDivider),
            } else {
                        Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                summary = summary + mConcadenationString + titleText;
            }
            }
            summary.append(BidiFormatter.getInstance().unicodeWrap(titleText));
        }
        }
        reusableView.bind(summary);
        // We want to force the same orientation as the layout RTL mode
        BidiFormatter formater = BidiFormatter.getInstance(
                reusableView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);
        reusableView.bind(formater.unicodeWrap(summary));
        return reusableView;
        return reusableView;
    }
    }
}
}
+12 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.stack;
package com.android.systemui.statusbar.stack;


import android.content.Context;
import android.content.Context;
import android.content.res.Configuration;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View;
@@ -58,6 +59,7 @@ public class NotificationChildrenContainer extends ViewGroup {
    private HybridNotificationView mGroupOverflowContainer;
    private HybridNotificationView mGroupOverflowContainer;
    private ViewState mGroupOverFlowState;
    private ViewState mGroupOverFlowState;
    private int mRealHeight;
    private int mRealHeight;
    private int mLayoutDirection = LAYOUT_DIRECTION_UNDEFINED;


    public NotificationChildrenContainer(Context context) {
    public NotificationChildrenContainer(Context context) {
        this(context, null);
        this(context, null);
@@ -209,6 +211,16 @@ public class NotificationChildrenContainer extends ViewGroup {
        }
        }
    }
    }


    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        int layoutDirection = getLayoutDirection();
        if (layoutDirection != mLayoutDirection) {
            updateGroupOverflow();
            mLayoutDirection = layoutDirection;
        }
    }

    private View inflateDivider() {
    private View inflateDivider() {
        return LayoutInflater.from(mContext).inflate(
        return LayoutInflater.from(mContext).inflate(
                R.layout.notification_children_divider, this, false);
                R.layout.notification_children_divider, this, false);