diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index e7dd5ff89517a..620ab508045cb 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -3330,7 +3330,6 @@ public class Notification implements Parcelable
if (mN.color != COLOR_DEFAULT) {
button.setTextColor(R.id.action0, mN.color);
}
- processLegacyAction(action, button);
return button;
}
@@ -3342,14 +3341,6 @@ public class Notification implements Parcelable
return getColorUtil() != null;
}
- private void processLegacyAction(Action action, RemoteViews button) {
- if (!isLegacy() || getColorUtil().isGrayscaleIcon(mContext, action.getIcon())) {
- button.setTextViewCompoundDrawablesRelativeColorFilter(R.id.action0, 0,
- mContext.getColor(R.color.notification_action_color_filter),
- PorterDuff.Mode.MULTIPLY);
- }
- }
-
private CharSequence processLegacyText(CharSequence charSequence) {
if (isLegacy()) {
return getColorUtil().invertCharSequenceColors(charSequence);
diff --git a/core/res/res/layout/notification_material_action.xml b/core/res/res/layout/notification_material_action.xml
index 62602d8016b3c..398f52df32ad1 100644
--- a/core/res/res/layout/notification_material_action.xml
+++ b/core/res/res/layout/notification_material_action.xml
@@ -22,7 +22,7 @@
android:layout_height="48dp"
android:layout_gravity="center"
android:layout_marginStart="4dp"
- android:textColor="@color/secondary_text_material_light"
+ android:textColor="@color/notification_default_color"
android:singleLine="true"
android:ellipsize="end"
android:background="@drawable/notification_material_action_background"
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index af8ff2e4d8b94..7711825ecad50 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -130,8 +130,8 @@
#29000000
#29ffffff
- #ff616161
- @color/secondary_text_material_light
+ #757575
+ @color/notification_default_color
@color/secondary_text_material_light
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 530b08de80095..dd81f89f10c53 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1874,7 +1874,6 @@
-
diff --git a/packages/SystemUI/res/color/remote_input_send.xml b/packages/SystemUI/res/color/remote_input_send.xml
new file mode 100644
index 0000000000000..fe2ffaa838eb6
--- /dev/null
+++ b/packages/SystemUI/res/color/remote_input_send.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/SystemUI/res/color/remote_input_text.xml b/packages/SystemUI/res/color/remote_input_text.xml
new file mode 100644
index 0000000000000..11ce0b7effa95
--- /dev/null
+++ b/packages/SystemUI/res/color/remote_input_text.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/remote_input.xml b/packages/SystemUI/res/layout/remote_input.xml
index 74092c16fbe22..83cfc764066c0 100644
--- a/packages/SystemUI/res/layout/remote_input.xml
+++ b/packages/SystemUI/res/layout/remote_input.xml
@@ -36,7 +36,8 @@
android:paddingEnd="12dp"
android:gravity="start|center_vertical"
android:textAppearance="?android:attr/textAppearance"
- android:textColor="#deffffff"
+ android:textColor="@color/remote_input_text"
+ android:textColorHint="@color/remote_input_hint"
android:textSize="16sp"
android:background="@null"
android:singleLine="true"
@@ -58,8 +59,8 @@
android:paddingBottom="12dp"
android:id="@+id/remote_input_send"
android:src="@drawable/ic_send"
- android:tint="@android:color/white"
- android:tintMode="src_atop"
+ android:tint="@color/remote_input_send"
+ android:tintMode="src_in"
android:background="@drawable/ripple_drawable" />
#ff000000
#ffffff
+
+ @*android:color/notification_default_color
+ #4dffffff
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index a78158503a956..cc6a29ae0f60e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -1602,7 +1602,7 @@ public abstract class BaseStatusBar extends SystemUI implements
private void applyRemoteInput(final Entry entry) {
if (!ENABLE_REMOTE_INPUT) return;
- RemoteInput remoteInput = null;
+ boolean hasRemoteInput = false;
Notification.Action[] actions = entry.notification.getNotification().actions;
if (actions != null) {
@@ -1610,7 +1610,7 @@ public abstract class BaseStatusBar extends SystemUI implements
if (a.getRemoteInputs() != null) {
for (RemoteInput ri : a.getRemoteInputs()) {
if (ri.getAllowFreeFormInput()) {
- remoteInput = ri;
+ hasRemoteInput = true;
break;
}
}
@@ -1618,34 +1618,50 @@ public abstract class BaseStatusBar extends SystemUI implements
}
}
- // See if we have somewhere to put that remote input
- if (remoteInput != null) {
- View bigContentView = entry.getExpandedContentView();
- if (bigContentView != null) {
- inflateRemoteInput(bigContentView, entry);
- }
- View headsUpContentView = entry.getHeadsUpContentView();
- if (headsUpContentView != null) {
- inflateRemoteInput(headsUpContentView, entry);
- }
+ View bigContentView = entry.getExpandedContentView();
+ if (bigContentView != null) {
+ applyRemoteInput(bigContentView, entry, hasRemoteInput);
+ }
+ View headsUpContentView = entry.getHeadsUpContentView();
+ if (headsUpContentView != null) {
+ applyRemoteInput(headsUpContentView, entry, hasRemoteInput);
}
}
- private RemoteInputView inflateRemoteInput(View view, Entry entry) {
+ private RemoteInputView applyRemoteInput(View view, Entry entry, boolean hasRemoteInput) {
View actionContainerCandidate = view.findViewById(
com.android.internal.R.id.actions_container);
if (actionContainerCandidate instanceof FrameLayout) {
- ViewGroup actionContainer = (FrameLayout) actionContainerCandidate;
- RemoteInputView riv = inflateRemoteInputView(actionContainer, entry);
- if (riv != null) {
- riv.setVisibility(View.INVISIBLE);
- actionContainer.addView(riv, new FrameLayout.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT)
- );
- riv.setBackgroundColor(entry.notification.getNotification().color);
- return riv;
+ RemoteInputView existing = (RemoteInputView)
+ view.findViewWithTag(RemoteInputView.VIEW_TAG);
+
+ if (hasRemoteInput) {
+ if (existing != null) {
+ existing.onNotificationUpdate();
+ return existing;
+ }
+
+ ViewGroup actionContainer = (FrameLayout) actionContainerCandidate;
+ RemoteInputView riv = inflateRemoteInputView(actionContainer, entry);
+ if (riv != null) {
+ riv.setVisibility(View.INVISIBLE);
+ actionContainer.addView(riv, new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT)
+ );
+ int color = entry.notification.getNotification().color;
+ if (color == Notification.COLOR_DEFAULT) {
+ color = mContext.getColor(R.color.default_remote_input_background);
+ }
+ riv.setBackgroundColor(color);
+ return riv;
+ }
+ } else {
+ if (existing != null) {
+ existing.onNotificationUpdate();
+ return null;
+ }
}
}
return null;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
index 22c0cb9f270bf..65053f3c933fe 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
@@ -28,6 +28,8 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.text.Editable;
+import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Log;
import android.view.KeyEvent;
@@ -49,7 +51,7 @@ import java.util.ArrayList;
/**
* Host for the remote input.
*/
-public class RemoteInputView extends LinearLayout implements View.OnClickListener {
+public class RemoteInputView extends LinearLayout implements View.OnClickListener, TextWatcher {
private static final String TAG = "RemoteInput";
@@ -101,6 +103,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
}
});
mEditText.setOnClickListener(this);
+ mEditText.addTextChangedListener(this);
mEditText.setInnerFocusable(false);
mEditText.mDefocusListener = this;
}
@@ -115,6 +118,8 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
mEditText.setEnabled(false);
mSendButton.setVisibility(INVISIBLE);
mProgressBar.setVisibility(VISIBLE);
+ mController.removeRemoteInput(mEntry);
+ mEditText.mShowImeOnInputConnection = false;
try {
mPendingIntent.send(mContext, 0, fillInIntent);
@@ -175,6 +180,40 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
mEditText.setText(mEntry.remoteInputText);
mEditText.setSelection(mEditText.getText().length());
mEditText.requestFocus();
+ updateSendButton();
+ }
+
+ public void onNotificationUpdate() {
+ boolean sending = mProgressBar.getVisibility() == VISIBLE;
+
+ if (sending) {
+ // Update came in after we sent the reply, time to reset.
+ reset();
+ }
+ }
+
+ private void reset() {
+ mEditText.getText().clear();
+ mEditText.setEnabled(true);
+ mSendButton.setVisibility(VISIBLE);
+ mProgressBar.setVisibility(INVISIBLE);
+ updateSendButton();
+ onDefocus();
+ }
+
+ private void updateSendButton() {
+ mSendButton.setEnabled(mEditText.getText().length() != 0);
+ }
+
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {}
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ updateSendButton();
}
/**