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

Commit 1242ae92 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Remove the reply action entirely.

Bug: 163626038
Test: manual
Change-Id: I28992441300ffdecc58900730ff9d858d6c0a009
parent 18422628
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -92442,7 +92442,6 @@ Lcom/android/internal/R$id;->remote_input_send:I
Lcom/android/internal/R$id;->replaceText:I
Lcom/android/internal/R$id;->replace_app_icon:I
Lcom/android/internal/R$id;->replace_message:I
Lcom/android/internal/R$id;->reply_icon_action:I
Lcom/android/internal/R$id;->resolver_list:I
Lcom/android/internal/R$id;->rew:I
Lcom/android/internal/R$id;->rightSpacer:I
+6 −99
Original line number Diff line number Diff line
@@ -4884,7 +4884,7 @@ public class Notification implements Parcelable
            final Bundle ex = mN.extras;
            updateBackgroundColor(contentView, p);
            bindNotificationHeader(contentView, p);
            bindLargeIconAndReply(contentView, p, result);
            bindLargeIconAndApplyMargin(contentView, p, result);
            boolean showProgress = handleProgressBar(contentView, ex, p);
            if (p.title != null && p.title.length() > 0) {
                contentView.setViewVisibility(R.id.title, View.VISIBLE);
@@ -5101,16 +5101,14 @@ public class Notification implements Parcelable
            }
        }

        private void bindLargeIconAndReply(RemoteViews contentView,
        private void bindLargeIconAndApplyMargin(RemoteViews contentView,
                @NonNull StandardTemplateParams p,
                @Nullable TemplateBindResult result) {
            if (result == null) {
                result = new TemplateBindResult();
            }
            boolean largeIconShown = bindLargeIcon(contentView, p);
            boolean replyIconShown = bindReplyIcon(contentView, p);
            calculateLargeIconMarginEnd(largeIconShown, result);
            calculateReplyIconMarginEnd(replyIconShown, result);
            if (p.mHeaderless) {
                // views in the headerless (collapsed) state
                contentView.setViewLayoutMarginEnd(R.id.notification_standard_view_column,
@@ -5138,21 +5136,6 @@ public class Notification implements Parcelable
            result.setRightIconState(largeIconShown, extraMarginEnd, expanderSize);
        }

        private void calculateReplyIconMarginEnd(boolean replyIconShown,
                @NonNull TemplateBindResult result) {
            int marginEnd = 0;
            if (replyIconShown) {
                int iconSize = mContext.getResources().getDimensionPixelSize(
                        R.dimen.notification_reply_icon_size);
                int contentMargin = mContext.getResources().getDimensionPixelSize(
                        R.dimen.notification_content_margin_end);
                int replyInset = mContext.getResources().getDimensionPixelSize(
                        R.dimen.notification_reply_inset);
                marginEnd = iconSize + contentMargin - replyInset * 2;
            }
            result.setReplyIconState(replyIconShown, marginEnd);
        }

        /**
         * Bind the large icon.
         * @return if the largeIcon is visible
@@ -5173,48 +5156,6 @@ public class Notification implements Parcelable
            return showLargeIcon;
        }

        /**
         * Bind the reply icon.
         * @return if the reply icon is visible
         */
        private boolean bindReplyIcon(RemoteViews contentView, StandardTemplateParams p) {
            boolean actionVisible = !p.hideReplyIcon && !p.mHeaderless;
            Action action = null;
            if (actionVisible) {
                action = findReplyAction();
                actionVisible = action != null;
            }
            if (actionVisible) {
                contentView.setViewVisibility(R.id.reply_icon_action, View.VISIBLE);
                contentView.setDrawableTint(R.id.reply_icon_action,
                        false /* targetBackground */,
                        getNeutralColor(p),
                        PorterDuff.Mode.SRC_ATOP);
                contentView.setOnClickPendingIntent(R.id.reply_icon_action, action.actionIntent);
                contentView.setRemoteInputs(R.id.reply_icon_action, action.mRemoteInputs);
            } else {
                contentView.setRemoteInputs(R.id.reply_icon_action, null);
            }
            contentView.setViewVisibility(R.id.reply_icon_action,
                    actionVisible ? View.VISIBLE : View.GONE);
            return actionVisible;
        }

        private Action findReplyAction() {
            ArrayList<Action> actions = mActions;
            if (mOriginalActions != null) {
                actions = mOriginalActions;
            }
            int numActions = actions.size();
            for (int i = 0; i < numActions; i++) {
                Action action = actions.get(i);
                if (hasValidRemoteInput(action)) {
                    return action;
                }
            }
            return null;
        }

        private void bindNotificationHeader(RemoteViews contentView, StandardTemplateParams p) {
            bindSmallIcon(contentView, p);
            bindHeaderAppName(contentView, p);
@@ -7131,10 +7072,7 @@ public class Notification implements Parcelable
            StandardTemplateParams p = mBuilder.mParams.reset()
                    .viewType(StandardTemplateParams.VIEW_TYPE_BIG)
                    .fillTextsFrom(mBuilder).text(null);
            TemplateBindResult result = new TemplateBindResult();
            RemoteViews contentView = getStandardView(mBuilder.getBigTextLayoutResource(), p,
                    result);
            contentView.setInt(R.id.big_text, "setImageEndMargin", result.getTextMarginEnd());
            RemoteViews contentView = getStandardView(mBuilder.getBigTextLayoutResource(), p, null);

            CharSequence bigTextText = mBuilder.processLegacyText(mBigText);
            if (TextUtils.isEmpty(bigTextText)) {
@@ -7147,8 +7085,6 @@ public class Notification implements Parcelable
            mBuilder.setTextViewColorSecondary(contentView, R.id.big_text, p);
            contentView.setViewVisibility(R.id.big_text,
                    TextUtils.isEmpty(bigTextText) ? View.GONE : View.VISIBLE);
            contentView.setBoolean(R.id.big_text, "setHasImage",
                    result.isReplyIconVisible());

            return contentView;
        }
@@ -7738,7 +7674,6 @@ public class Notification implements Parcelable
                    .title(conversationTitle)
                    .text(null)
                    .hideLargeIcon(hideRightIcons || isOneToOne)
                    .hideReplyIcon(hideRightIcons)
                    .headerTextSecondary(conversationTitle);
            RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(
                    isConversationLayout
@@ -10998,8 +10933,6 @@ public class Notification implements Parcelable
        boolean mRightIconVisible;
        int mRightIconMarginEnd;
        int mExpanderSize;
        boolean mReplyIconVisible;
        int mReplyIconMarginEnd;

        /**
         * @return the margin end that needs to be added to the heading so that it won't overlap
@@ -11023,31 +10956,11 @@ public class Notification implements Parcelable

        /**
         * @return the margin end that needs to be added to the title text of the big state
         * so that it won't overlap with either the large icon or the reply action.
         * so that it won't overlap with the large icon, but assuming the text can run under
         * the expander when that icon is not visible.
         */
        public int getTitleMarginEnd() {
            return mRightIconVisible ? getHeadingFullMarginEnd() : mReplyIconMarginEnd;
        }

        /**
         * @return the margin end that needs to be added to the topmost content of the big state
         * so that it won't overlap with the reply action.
         */
        public int getTextMarginEnd() {
            return mReplyIconMarginEnd;
        }

        /**
         * Is the icon container visible on the right size because of the reply button or the
         * right icon.
         */
        public boolean isReplyIconVisible() {
            return mReplyIconVisible;
        }

        public void setReplyIconState(boolean visible, int marginEnd) {
            mReplyIconVisible = visible;
            mReplyIconMarginEnd = marginEnd;
            return mRightIconVisible ? getHeadingFullMarginEnd() : 0;
        }

        public void setRightIconState(boolean visible, int marginEnd, int expanderSize) {
@@ -11074,7 +10987,6 @@ public class Notification implements Parcelable
        CharSequence summaryText;
        int maxRemoteInputHistory = Style.MAX_REMOTE_INPUT_HISTORY_LINES;
        boolean hideLargeIcon;
        boolean hideReplyIcon;
        boolean allowColorization  = true;
        boolean forceDefaultColor = false;

@@ -11132,11 +11044,6 @@ public class Notification implements Parcelable
            return this;
        }

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

        final StandardTemplateParams disallowColorization() {
            this.allowColorization = false;
            return this;
+0 −32
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2017 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
  -->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
       android:inset="@dimen/notification_reply_inset">
    <vector android:width="24dp"
            android:height="24dp"
            android:viewportWidth="24"
            android:viewportHeight="24">

        <path
            android:fillColor="#000000"
            android:strokeWidth="1"
            android:pathData="M16,10 L6.83,10 L9,7.83 L10.41,6.42 L9,5 L3,11 L9,17 L10.41,15.59 L9,14.17 L6.83,12 L16,12 C17.65,12 19,13.35 19,15 L19,19 L21,19 L21,15 C21,12.24 18.76,10 16,10 Z" />
        <path
            android:fillColor="#000000"
            android:strokeWidth="1"
            android:pathData="M16,10 L6.83,10 L9,7.83 L10.41,6.42 L9,5 L3,11 L9,17 L10.41,15.59 L9,14.17 L6.83,12 L16,12 C17.65,12 19,13.35 19,15 L19,19 L21,19 L21,15 C21,12.24 18.76,10 16,10 Z" />
    </vector>
</inset>
+0 −1
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@
            </LinearLayout>

            <include layout="@layout/notification_template_right_icon" />
            <include layout="@layout/notification_template_reply_icon" />
        </FrameLayout>

        <ViewStub
+0 −2
Original line number Diff line number Diff line
@@ -31,8 +31,6 @@

    <include layout="@layout/notification_template_right_icon" />

    <include layout="@layout/notification_template_reply_icon" />

    <LinearLayout
        android:id="@+id/notification_action_list_margin_target"
        android:layout_width="match_parent"
Loading