diff options
| author | Nancy Chen <nancychen@google.com> | 2014-10-22 17:45:26 -0700 |
|---|---|---|
| committer | Nancy Chen <nancychen@google.com> | 2014-10-22 21:44:45 -0700 |
| commit | 3ace54b895c97f0e98e989667238be9c96c3b40c (patch) | |
| tree | 19529b4a01728ba5e775624a8d373abae0af962b /telecomm | |
| parent | df0ace26279f16beacdf9206cb2a8ecc126aecb7 (diff) | |
| download | frameworks_base-3ace54b895c97f0e98e989667238be9c96c3b40c.zip frameworks_base-3ace54b895c97f0e98e989667238be9c96c3b40c.tar.gz frameworks_base-3ace54b895c97f0e98e989667238be9c96c3b40c.tar.bz2 | |
Add getter methods in SubInfoRecord for UI. Adapt PhoneAccount.
Settings and Dialer need label, icon, and color for UI display of
subscriptions/SIMs. Add getters for these methods in SubInfoRecord. Sets
up for the following changes:
+ getIcon will return a drawable instead of a resource ID
+ getColor will return a color value instead of an index
PhoneAccount will also be adding these changes which will be adopted
from SubInfoRecord. Adds changes that were reverted from ag/563976.
Bug: 17971273
Change-Id: Ie2beedf8475c6deb48a6ab83bc9656c1142cc004
Diffstat (limited to 'telecomm')
| -rw-r--r-- | telecomm/java/android/telecom/PhoneAccount.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java index 1d6d8bc..67b6328 100644 --- a/telecomm/java/android/telecom/PhoneAccount.java +++ b/telecomm/java/android/telecom/PhoneAccount.java @@ -108,11 +108,17 @@ public class PhoneAccount implements Parcelable { */ public static final String SCHEME_SIP = "sip"; + /** + * Indicating no color is set. + */ + public static final int NO_COLOR = -1; + private final PhoneAccountHandle mAccountHandle; private final Uri mAddress; private final Uri mSubscriptionAddress; private final int mCapabilities; private final int mIconResId; + private final int mColor; private final CharSequence mLabel; private final CharSequence mShortDescription; private final List<String> mSupportedUriSchemes; @@ -123,6 +129,7 @@ public class PhoneAccount implements Parcelable { private Uri mSubscriptionAddress; private int mCapabilities; private int mIconResId; + private int mColor = NO_COLOR; private CharSequence mLabel; private CharSequence mShortDescription; private List<String> mSupportedUriSchemes = new ArrayList<String>(); @@ -144,6 +151,7 @@ public class PhoneAccount implements Parcelable { mSubscriptionAddress = phoneAccount.getSubscriptionAddress(); mCapabilities = phoneAccount.getCapabilities(); mIconResId = phoneAccount.getIconResId(); + mColor = phoneAccount.getColor(); mLabel = phoneAccount.getLabel(); mShortDescription = phoneAccount.getShortDescription(); mSupportedUriSchemes.addAll(phoneAccount.getSupportedUriSchemes()); @@ -169,6 +177,11 @@ public class PhoneAccount implements Parcelable { return this; } + public Builder setColor(int value) { + this.mColor = value; + return this; + } + public Builder setShortDescription(CharSequence value) { this.mShortDescription = value; return this; @@ -222,6 +235,7 @@ public class PhoneAccount implements Parcelable { mSubscriptionAddress, mCapabilities, mIconResId, + mColor, mLabel, mShortDescription, mSupportedUriSchemes); @@ -234,6 +248,7 @@ public class PhoneAccount implements Parcelable { Uri subscriptionAddress, int capabilities, int iconResId, + int color, CharSequence label, CharSequence shortDescription, List<String> supportedUriSchemes) { @@ -242,6 +257,7 @@ public class PhoneAccount implements Parcelable { mSubscriptionAddress = subscriptionAddress; mCapabilities = capabilities; mIconResId = iconResId; + mColor = color; mLabel = label; mShortDescription = shortDescription; mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes); @@ -371,6 +387,15 @@ public class PhoneAccount implements Parcelable { } /** + * A highlight color to use in displaying information about this {@code PhoneAccount}. + * + * @return A hexadecimal color value. + */ + public int getColor() { + return mColor; + } + + /** * An icon to represent this {@code PhoneAccount} in a user interface. * * @return An icon for this {@code PhoneAccount}. @@ -413,6 +438,7 @@ public class PhoneAccount implements Parcelable { out.writeParcelable(mSubscriptionAddress, 0); out.writeInt(mCapabilities); out.writeInt(mIconResId); + out.writeInt(mColor); out.writeCharSequence(mLabel); out.writeCharSequence(mShortDescription); out.writeList(mSupportedUriSchemes); @@ -439,6 +465,7 @@ public class PhoneAccount implements Parcelable { mSubscriptionAddress = in.readParcelable(getClass().getClassLoader()); mCapabilities = in.readInt(); mIconResId = in.readInt(); + mColor = in.readInt(); mLabel = in.readCharSequence(); mShortDescription = in.readCharSequence(); |
