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

Commit 10613a94 authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

Merge "Visuals for Inline Reply"

parents 99a1e50b fe84e1f4
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -3282,12 +3282,17 @@ public class Notification implements Parcelable
                    tombstone ? getActionTombstoneLayoutResource()
                              : getActionLayoutResource());
            final Icon ai = action.getIcon();
            button.setTextViewCompoundDrawablesRelative(R.id.action0, ai, null, null, null);
            button.setTextViewText(R.id.action0, processLegacyText(action.title));
            if (!tombstone) {
                button.setOnClickPendingIntent(R.id.action0, action.actionIntent);
            }
            button.setContentDescription(R.id.action0, action.title);
            if (action.mRemoteInputs != null) {
                button.setRemoteInputs(R.id.action0, action.mRemoteInputs);
            }
            if (mN.color != COLOR_DEFAULT) {
                button.setTextColor(R.id.action0, mN.color);
            }
            processLegacyAction(action, button);
            return button;
        }
+48 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.app.ActivityOptions;
import android.app.ActivityThread;
import android.app.Application;
import android.app.PendingIntent;
import android.app.RemoteInput;
import android.appwidget.AppWidgetHostView;
import android.content.Context;
import android.content.ContextWrapper;
@@ -152,6 +153,13 @@ public class RemoteViews implements Parcelable, Filter {
        }
    };

    /**
     * @hide
     */
    public void setRemoteInputs(int viewId, RemoteInput[] remoteInputs) {
        mActions.add(new SetRemoteInputsAction(viewId, remoteInputs));
    }

    /**
     * Handle with care!
     */
@@ -1698,6 +1706,43 @@ public class RemoteViews implements Parcelable, Filter {
        public final static int TAG = 17;
    }

    /**
     * Helper action to add a view tag with RemoteInputs.
     */
    private class SetRemoteInputsAction extends Action {

        public SetRemoteInputsAction(int viewId, RemoteInput[] remoteInputs) {
            this.viewId = viewId;
            this.remoteInputs = remoteInputs;
        }

        public SetRemoteInputsAction(Parcel parcel) {
            viewId = parcel.readInt();
            remoteInputs = parcel.readParcelableArray(RemoteInput.class.getClassLoader());
        }

        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(TAG);
            dest.writeInt(viewId);
            dest.writeParcelableArray(remoteInputs, flags);
        }

        @Override
        public void apply(View root, ViewGroup rootParent, OnClickHandler handler) {
            final TextView target = (TextView) root.findViewById(viewId);
            if (target == null) return;

            target.setTagInternal(R.id.remote_input_tag, remoteInputs);
        }

        public String getActionName() {
            return "SetRemoteInputsAction";
        }

        final Parcelable[] remoteInputs;
        public final static int TAG = 18;
    }

    /**
     * Simple class used to keep track of memory usage in a RemoteViews.
     *
@@ -1894,6 +1939,9 @@ public class RemoteViews implements Parcelable, Filter {
                        case TextViewDrawableColorFilterAction.TAG:
                            mActions.add(new TextViewDrawableColorFilterAction(parcel));
                            break;
                        case SetRemoteInputsAction.TAG:
                            mActions.add(new SetRemoteInputsAction(parcel));
                            break;
                        default:
                            throw new ActionException("Tag " + tag + " not found");
                    }
+3 −7
Original line number Diff line number Diff line
@@ -18,15 +18,11 @@
<Button xmlns:android="http://schemas.android.com/apk/res/android"
    style="@android:style/Widget.Material.Light.Button.Borderless.Small"
    android:id="@+id/action0"
    android:layout_width="0dp"
    android:layout_width="wrap_content"
    android:layout_height="48dp"
    android:layout_weight="1"
    android:layout_margin="0dp"
    android:gravity="start|center_vertical"
    android:drawablePadding="8dp"
    android:paddingStart="8dp"
    android:layout_gravity="center"
    android:layout_marginStart="8dp"
    android:textColor="@color/secondary_text_material_light"
    android:textSize="13sp"
    android:singleLine="true"
    android:ellipsize="end"
    android:background="@drawable/notification_material_action_background"
+17 −11
Original line number Diff line number Diff line
@@ -14,14 +14,20 @@
     limitations under the License.
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/actions_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/actions"
            android:layout_width="match_parent"
    android:layout_height="wrap_content"
            android:layout_height="56dp"
            android:paddingEnd="8dp"
            android:orientation="horizontal"
            android:visibility="gone"
    android:layout_marginBottom="8dp"
            android:background="#ffeeeeee"
            >
        <!-- actions will be added here -->
    </LinearLayout>
</FrameLayout>
+2 −0
Original line number Diff line number Diff line
@@ -122,4 +122,6 @@
  
  <!-- Accessibility action identifier for {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction#ACTION_CONTEXT_CLICK}. -->
  <item type="id" name="accessibilityActionContextClick" />

  <item type="id" name="remote_input_tag" />
</resources>
Loading