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

Commit 91a84852 authored by Selim Cinek's avatar Selim Cinek Committed by android-build-merger
Browse files

Merge "Added support for media notifications without expanded state" into nyc-dev am: 635f7192

am: afaaf427

* commit 'afaaf427':
  Added support for media notifications without expanded state
parents 95dc01e2 afaaf427
Loading
Loading
Loading
Loading
+24 −8
Original line number Diff line number Diff line
@@ -3358,13 +3358,9 @@ public class Notification implements Parcelable
                return mN.bigContentView;
            } else if (mStyle != null) {
                result = mStyle.makeBigContentView();
            } else if (mActions.size() == 0) {
                return null;
            }
            if (result == null) {
                result = applyStandardTemplateWithActions(getBigBaseLayoutResource());
            } else {
                hideLine1Text(result);
            } else if (mActions.size() != 0) {
                result = applyStandardTemplateWithActions(getBigBaseLayoutResource());
            }
            adaptNotificationHeaderForBigContentView(result);
            return result;
@@ -3384,12 +3380,16 @@ public class Notification implements Parcelable
        }

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

        private void adaptNotificationHeaderForBigContentView(RemoteViews result) {
            if (result != null) {
                result.setBoolean(R.id.notification_header, "setExpanded", true);
            }
        }

        /**
         * Construct a RemoteViews for the final heads-up notification layout.
@@ -4326,6 +4326,15 @@ public class Notification implements Parcelable
            return makeMediaBigContentView();
        }

        /**
         * @hide
         */
        @Override
        public RemoteViews makeHeadsUpContentView() {
            RemoteViews expanded = makeMediaBigContentView();
            return expanded != null ? expanded : makeMediaContentView();
        }

        /** @hide */
        @Override
        public void addExtras(Bundle extras) {
@@ -4407,6 +4416,13 @@ public class Notification implements Parcelable

        private RemoteViews makeMediaBigContentView() {
            final int actionCount = Math.min(mBuilder.mActions.size(), MAX_MEDIA_BUTTONS);
            // Dont add an expanded view if there is no more content to be revealed
            int actionsInCompact = mActionsToShowInCompact == null
                    ? 0
                    : Math.min(mActionsToShowInCompact.length, MAX_MEDIA_BUTTONS_IN_COMPACT);
            if (mBuilder.mN.mLargeIcon == null && actionCount <= actionsInCompact) {
                return null;
            }
            RemoteViews big = mBuilder.applyStandardTemplate(
                    R.layout.notification_template_material_big_media,
                    false);