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

Commit d6209d4e authored by Jeff DeCew's avatar Jeff DeCew Committed by Android (Google) Code Review
Browse files

Merge changes I3a6b02ec,I516c44d2,I5a18f3ac,I465f7be9,I933fcc27 into sc-dev

* changes:
  Show text and progress bar for CallStyle
  The title of a notification can take 2 lines when expanded.
  Remove the line1 container for the title
  Move text to new line in big base style
  Fix dark mode progress bar background color
parents 546d8ae8 b4750690
Loading
Loading
Loading
Loading
+24 −32
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ import android.util.proto.ProtoOutputStream;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.contentcapture.ContentCaptureContext;
import android.widget.ProgressBar;
import android.widget.RemoteViews;
@@ -4970,8 +4969,6 @@ public class Notification implements Parcelable
            contentView.setTextViewText(R.id.title, null);
            contentView.setViewVisibility(R.id.text, View.GONE);
            contentView.setTextViewText(R.id.text, null);
            contentView.setViewVisibility(R.id.text_line_1, View.GONE);
            contentView.setTextViewText(R.id.text_line_1, null);
        }

        /**
@@ -5015,14 +5012,10 @@ public class Notification implements Parcelable
                contentView.setViewVisibility(R.id.title, View.VISIBLE);
                contentView.setTextViewText(R.id.title, processTextSpans(p.title));
                setTextViewColorPrimary(contentView, R.id.title, p);
                contentView.setViewLayoutWidth(R.id.title, showProgress
                        ? ViewGroup.LayoutParams.WRAP_CONTENT
                        : ViewGroup.LayoutParams.MATCH_PARENT,
                        TypedValue.COMPLEX_UNIT_PX);
            }
            if (p.text != null && p.text.length() != 0) {
                int textId = showProgress ? com.android.internal.R.id.text_line_1
                        : com.android.internal.R.id.text;
            }
            if (p.text != null && p.text.length() != 0
                    && (!showProgress || p.mAllowTextWithProgress)) {
                int textId = com.android.internal.R.id.text;
                contentView.setTextViewText(textId, processTextSpans(p.text));
                setTextViewColorSecondary(contentView, textId, p);
                contentView.setViewVisibility(textId, View.VISIBLE);
@@ -5188,16 +5181,13 @@ public class Notification implements Parcelable
            final boolean ind = ex.getBoolean(EXTRA_PROGRESS_INDETERMINATE);
            if (!p.mHideProgress && (max != 0 || ind)) {
                contentView.setViewVisibility(com.android.internal.R.id.progress, View.VISIBLE);
                contentView.setProgressBar(
                        R.id.progress, max, progress, ind);
                contentView.setProgressBackgroundTintList(
                        R.id.progress, ColorStateList.valueOf(mContext.getColor(
                                R.color.notification_progress_background_color)));
                if (getRawColor(p) != COLOR_DEFAULT) {
                    int color = getAccentColor(p);
                    ColorStateList colorStateList = ColorStateList.valueOf(color);
                    contentView.setProgressTintList(R.id.progress, colorStateList);
                    contentView.setProgressIndeterminateTintList(R.id.progress, colorStateList);
                contentView.setProgressBar(R.id.progress, max, progress, ind);
                contentView.setProgressBackgroundTintList(R.id.progress,
                        mContext.getColorStateList(R.color.notification_progress_background_color));
                if (mTintWithThemeAccent || getRawColor(p) != COLOR_DEFAULT) {
                    ColorStateList progressTint = ColorStateList.valueOf(getAccentColor(p));
                    contentView.setProgressTintList(R.id.progress, progressTint);
                    contentView.setProgressIndeterminateTintList(R.id.progress, progressTint);
                }
                return true;
            } else {
@@ -5220,7 +5210,7 @@ public class Notification implements Parcelable
            } else {
                // views in states with a header (big states)
                result.mHeadingExtraMarginSet.applyToView(contentView, R.id.notification_header);
                result.mTitleMarginSet.applyToView(contentView, R.id.line1);
                result.mTitleMarginSet.applyToView(contentView, R.id.title);
            }
        }

@@ -5749,7 +5739,6 @@ public class Notification implements Parcelable
            }
            if (mStyle != null) {
                result = mStyle.makeBigContentView();
                hideLine1Text(result);
                if (fullyCustomViewRequiresDecoration(true /* fromStyle */)) {
                    result = minimallyDecoratedBigContentView(result);
                }
@@ -5758,6 +5747,7 @@ public class Notification implements Parcelable
                if (bigContentViewRequired()) {
                    StandardTemplateParams p = mParams.reset()
                            .viewType(StandardTemplateParams.VIEW_TYPE_BIG)
                            .allowTextWithProgress(true)
                            .fillTextsFrom(this);
                    result = applyStandardTemplateWithActions(getBigBaseLayoutResource(), p,
                            null /* result */);
@@ -5832,12 +5822,6 @@ public class Notification implements Parcelable
            return createContentView();
        }

        private void hideLine1Text(RemoteViews result) {
            if (result != null) {
                result.setViewVisibility(R.id.text_line_1, View.GONE);
            }
        }

        /**
         * Adapt the Notification header if this view is used as an expanded view.
         *
@@ -7031,9 +7015,9 @@ public class Notification implements Parcelable
                    result);

            if (mBigContentTitle != null && mBigContentTitle.equals("")) {
                contentView.setViewVisibility(R.id.line1, View.GONE);
                contentView.setViewVisibility(R.id.title, View.GONE);
            } else {
                contentView.setViewVisibility(R.id.line1, View.VISIBLE);
                contentView.setViewVisibility(R.id.title, View.VISIBLE);
            }

            return contentView;
@@ -9100,7 +9084,7 @@ public class Notification implements Parcelable

        private void handleImage(RemoteViews contentView) {
            if (mBuilder.mN.hasLargeIcon()) {
                contentView.setViewLayoutMarginDimen(R.id.line1, RemoteViews.MARGIN_END, 0);
                contentView.setViewLayoutMarginDimen(R.id.title, RemoteViews.MARGIN_END, 0);
                contentView.setViewLayoutMarginDimen(R.id.text, RemoteViews.MARGIN_END, 0);
            }
        }
@@ -9409,6 +9393,7 @@ public class Notification implements Parcelable
            StandardTemplateParams p = mBuilder.mParams.reset()
                    .viewType(StandardTemplateParams.VIEW_TYPE_BIG)
                    .allowActionIcons(true)
                    .allowTextWithProgress(true)
                    .hideLargeIcon(true)
                    .text(text)
                    .summaryText(mBuilder.processLegacyText(mVerificationText));
@@ -12073,6 +12058,7 @@ public class Notification implements Parcelable
        boolean mHideSnoozeButton;
        boolean mPromotePicture;
        boolean mAllowActionIcons;
        boolean mAllowTextWithProgress;
        CharSequence title;
        CharSequence text;
        CharSequence headerTextSecondary;
@@ -12091,6 +12077,7 @@ public class Notification implements Parcelable
            mHideSnoozeButton = false;
            mPromotePicture = false;
            mAllowActionIcons = false;
            mAllowTextWithProgress = false;
            title = null;
            text = null;
            summaryText = null;
@@ -12135,6 +12122,11 @@ public class Notification implements Parcelable
            return this;
        }

        final StandardTemplateParams allowTextWithProgress(boolean allowTextWithProgress) {
            this.mAllowTextWithProgress = allowTextWithProgress;
            return this;
        }

        final StandardTemplateParams hideSnoozeButton(boolean hideSnoozeButton) {
            this.mHideSnoozeButton = hideSnoozeButton;
            return this;
+7 −24
Original line number Diff line number Diff line
@@ -59,32 +59,15 @@
            <!--<include layout="@layout/notification_template_part_line1"/>-->
            <!--<include layout="@layout/notification_template_text"/>-->

            <LinearLayout
                android:id="@+id/line1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                >
            <TextView android:id="@+id/title"
                android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:ellipsize="marquee"
                    android:fadingEdge="horizontal"
                    android:textAlignment="viewStart"
                    />
                <TextView android:id="@+id/text_line_1"
                    style="@style/Widget.DeviceDefault.Notification.Text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                    android:gravity="end|bottom"
                    android:layout_marginStart="16dp"
                android:singleLine="true"
                android:ellipsize="marquee"
                android:fadingEdge="horizontal"
                android:textAlignment="viewStart"
                />
            </LinearLayout>

            <com.android.internal.widget.ImageFloatingTextView
                style="@style/Widget.DeviceDefault.Notification.Text"
+7 −24
Original line number Diff line number Diff line
@@ -63,32 +63,15 @@
                <!--<include layout="@layout/notification_template_part_line1"/>-->
                <!--<include layout="@layout/notification_template_text"/>-->

                <LinearLayout
                    android:id="@+id/line1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    >
                <TextView android:id="@+id/title"
                    android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Title"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:singleLine="true"
                        android:ellipsize="marquee"
                        android:fadingEdge="horizontal"
                        android:textAlignment="viewStart"
                        />
                    <TextView android:id="@+id/text_line_1"
                        style="@style/Widget.DeviceDefault.Notification.Text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                        android:gravity="end|bottom"
                        android:layout_marginStart="16dp"
                    android:singleLine="true"
                    android:ellipsize="marquee"
                    android:fadingEdge="horizontal"
                    android:textAlignment="viewStart"
                    />
                </LinearLayout>

                <com.android.internal.widget.ImageFloatingTextView
                    style="@style/Widget.DeviceDefault.Notification.Text"
+8 −24
Original line number Diff line number Diff line
@@ -15,29 +15,13 @@
  ~ limitations under the License
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/line1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    >
    <TextView android:id="@+id/title"
<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/title"
    android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.BigTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal"
        android:textAlignment="viewStart"
        />
    <TextView android:id="@+id/text_line_1"
        style="@style/Widget.DeviceDefault.Notification.Text"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
        android:gravity="end|bottom"
        android:layout_marginStart="16dp"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal"
    android:maxLines="2"
    android:ellipsize="end"
    android:textAlignment="viewStart"
    />
</LinearLayout>
+1 −1
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@

    <color name="notification_action_button_text_color">@color/notification_default_color</color>

    <color name="notification_progress_background_color">@color/secondary_text_material_light</color>
    <color name="notification_progress_background_color">@color/notification_secondary_text_color_current</color>

    <color name="notification_action_list">#ffeeeeee</color>

Loading