diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-10-27 00:18:53 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-10-27 00:18:53 +0000 |
commit | 4f6214ee55f6d286db36d970e2c60c9402c34d60 (patch) | |
tree | 47eefa3a9b9b172df2db32e2f1b6246bad885a57 /java/com/android/incallui/incall | |
parent | 9b99b22391a92fe20a74076bf5e47d36eb9b4ab4 (diff) | |
parent | 8d662cae2c05b5e256e7bb826abf05fb9ace133d (diff) |
Merge "Set incall button color to match sim color."
Diffstat (limited to 'java/com/android/incallui/incall')
4 files changed, 24 insertions, 2 deletions
diff --git a/java/com/android/incallui/incall/impl/CheckableLabeledButton.java b/java/com/android/incallui/incall/impl/CheckableLabeledButton.java index a681adcb4..325c3a92a 100644 --- a/java/com/android/incallui/incall/impl/CheckableLabeledButton.java +++ b/java/com/android/incallui/incall/impl/CheckableLabeledButton.java @@ -18,11 +18,14 @@ package com.android.incallui.incall.impl; import android.animation.AnimatorInflater; import android.content.Context; +import android.content.res.ColorStateList; import android.content.res.TypedArray; +import android.graphics.Color; import android.graphics.PorterDuff.Mode; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; +import android.support.annotation.ColorInt; import android.support.annotation.DrawableRes; import android.support.annotation.StringRes; import android.text.TextUtils.TruncateAt; @@ -88,6 +91,7 @@ public class CheckableLabeledButton extends LinearLayout implements Checkable { iconView.setImageDrawable(icon); iconView.setImageTintMode(Mode.SRC_IN); iconView.setImageTintList(getResources().getColorStateList(R.color.incall_button_icon, null)); + iconView.setBackground(getResources().getDrawable(R.drawable.incall_button_background, null)); iconView.setDuplicateParentStateEnabled(true); iconView.setElevation(getResources().getDimension(R.dimen.incall_button_elevation)); @@ -124,6 +128,13 @@ public class CheckableLabeledButton extends LinearLayout implements Checkable { labelView.setAlpha(isEnabled() ? 1f : DISABLED_STATE_OPACITY); } + public void setCheckedColor(@ColorInt int color) { + iconView.setImageTintList( + new ColorStateList( + new int[][] {new int[] {android.R.attr.state_checked}, new int[] {}}, + new int[] {color, Color.WHITE})); + } + public void setIconDrawable(@DrawableRes int drawableRes) { iconView.setImageResource(drawableRes); } diff --git a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java index db0b5b9b8..a0eead128 100644 --- a/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java +++ b/java/com/android/incallui/incall/impl/InCallButtonGridFragment.java @@ -17,6 +17,7 @@ package com.android.incallui.incall.impl; import android.os.Bundle; +import android.support.annotation.ColorInt; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.ArraySet; @@ -127,6 +128,12 @@ public class InCallButtonGridFragment extends Fragment { return numVisibleButtons; } + public void updateButtonColor(@ColorInt int color) { + for (CheckableLabeledButton button : buttons) { + button.setCheckedColor(color); + } + } + /** Interface to let the listener know the status of the button grid. */ public interface OnButtonGridCreatedListener { void onButtonGridCreated(InCallButtonGridFragment inCallButtonGridFragment); diff --git a/java/com/android/incallui/incall/impl/InCallFragment.java b/java/com/android/incallui/incall/impl/InCallFragment.java index e96060c06..ddad61d27 100644 --- a/java/com/android/incallui/incall/impl/InCallFragment.java +++ b/java/com/android/incallui/incall/impl/InCallFragment.java @@ -23,6 +23,7 @@ import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.Handler; +import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; @@ -476,7 +477,9 @@ public class InCallFragment extends Fragment } @Override - public void updateInCallButtonUiColors() {} + public void updateInCallButtonUiColors(@ColorInt int color) { + inCallButtonGridFragment.updateButtonColor(color); + } @Override public Fragment getInCallButtonUiFragment() { diff --git a/java/com/android/incallui/incall/protocol/InCallButtonUi.java b/java/com/android/incallui/incall/protocol/InCallButtonUi.java index 96d741af3..28dd84c42 100644 --- a/java/com/android/incallui/incall/protocol/InCallButtonUi.java +++ b/java/com/android/incallui/incall/protocol/InCallButtonUi.java @@ -16,6 +16,7 @@ package com.android.incallui.incall.protocol; +import android.support.annotation.ColorInt; import android.support.v4.app.Fragment; import android.telecom.CallAudioState; @@ -42,7 +43,7 @@ public interface InCallButtonUi { */ void updateButtonStates(); - void updateInCallButtonUiColors(); + void updateInCallButtonUiColors(@ColorInt int color); Fragment getInCallButtonUiFragment(); |