Merge "Make foreground color selection in SmartReplyView and RemoteInputView match Notification." into sc-qpr1-dev
This commit is contained in:
@@ -6247,8 +6247,9 @@ public class Notification implements Parcelable
|
|||||||
*
|
*
|
||||||
* @param color the color to check
|
* @param color the color to check
|
||||||
* @return true if the color has higher contrast with white than black
|
* @return true if the color has higher contrast with white than black
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
private static boolean isColorDark(int color) {
|
public static boolean isColorDark(int color) {
|
||||||
// as per ContrastColorUtil.shouldUseDark, this uses the color contrast midpoint.
|
// as per ContrastColorUtil.shouldUseDark, this uses the color contrast midpoint.
|
||||||
return ContrastColorUtil.calculateLuminance(color) <= 0.17912878474;
|
return ContrastColorUtil.calculateLuminance(color) <= 0.17912878474;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ import com.android.internal.logging.MetricsLogger;
|
|||||||
import com.android.internal.logging.UiEvent;
|
import com.android.internal.logging.UiEvent;
|
||||||
import com.android.internal.logging.UiEventLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
import com.android.internal.logging.nano.MetricsProto;
|
import com.android.internal.logging.nano.MetricsProto;
|
||||||
import com.android.internal.util.ContrastColorUtil;
|
|
||||||
import com.android.systemui.Dependency;
|
import com.android.systemui.Dependency;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.statusbar.NotificationRemoteInputManager;
|
import com.android.systemui.statusbar.NotificationRemoteInputManager;
|
||||||
@@ -204,7 +203,7 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
|
|||||||
final int stroke = colorized ? mContext.getResources().getDimensionPixelSize(
|
final int stroke = colorized ? mContext.getResources().getDimensionPixelSize(
|
||||||
R.dimen.remote_input_view_text_stroke) : 0;
|
R.dimen.remote_input_view_text_stroke) : 0;
|
||||||
if (colorized) {
|
if (colorized) {
|
||||||
final boolean dark = !ContrastColorUtil.isColorLight(backgroundColor);
|
final boolean dark = Notification.Builder.isColorDark(backgroundColor);
|
||||||
final int foregroundColor = dark ? Color.WHITE : Color.BLACK;
|
final int foregroundColor = dark ? Color.WHITE : Color.BLACK;
|
||||||
final int inverseColor = dark ? Color.BLACK : Color.WHITE;
|
final int inverseColor = dark ? Color.BLACK : Color.WHITE;
|
||||||
editBgColor = backgroundColor;
|
editBgColor = backgroundColor;
|
||||||
|
|||||||
@@ -628,7 +628,7 @@ public class SmartReplyView extends ViewGroup {
|
|||||||
mCurrentBackgroundColor = backgroundColor;
|
mCurrentBackgroundColor = backgroundColor;
|
||||||
mCurrentColorized = colorized;
|
mCurrentColorized = colorized;
|
||||||
|
|
||||||
final boolean dark = !ContrastColorUtil.isColorLight(backgroundColor);
|
final boolean dark = Notification.Builder.isColorDark(backgroundColor);
|
||||||
|
|
||||||
mCurrentTextColor = ContrastColorUtil.ensureTextContrast(
|
mCurrentTextColor = ContrastColorUtil.ensureTextContrast(
|
||||||
dark ? mDefaultTextColorDarkBg : mDefaultTextColor,
|
dark ? mDefaultTextColorDarkBg : mDefaultTextColor,
|
||||||
|
|||||||
Reference in New Issue
Block a user