am 12be45d7: am 9016ecab: am 0145e17d: Merge "Add getter methods in SubInfoRecord for UI. Adapt PhoneAccount." into lmp-sprout-dev

* commit '12be45d7c48bf3c0722a794bb44c37b7264e7244':
  Add getter methods in SubInfoRecord for UI. Adapt PhoneAccount.
This commit is contained in:
Nancy Chen
2014-10-23 22:02:54 +00:00
committed by Android Git Automerger
3 changed files with 56 additions and 0 deletions

View File

@@ -28822,6 +28822,9 @@ package android.telephony {
ctor public SubInfoRecord(); ctor public SubInfoRecord();
ctor public SubInfoRecord(long, java.lang.String, int, java.lang.String, int, int, java.lang.String, int, int, int[], int, int); ctor public SubInfoRecord(long, java.lang.String, int, java.lang.String, int, int, java.lang.String, int, int, int[], int, int);
method public int describeContents(); method public int describeContents();
method public int getColor();
method public android.graphics.drawable.BitmapDrawable getIconDrawable();
method public java.lang.String getLabel();
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR; field public static final android.os.Parcelable.Creator CREATOR;
field public int color; field public int color;

View File

@@ -105,11 +105,17 @@ public class PhoneAccount implements Parcelable {
*/ */
public static final String SCHEME_SIP = "sip"; 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 PhoneAccountHandle mAccountHandle;
private final Uri mAddress; private final Uri mAddress;
private final Uri mSubscriptionAddress; private final Uri mSubscriptionAddress;
private final int mCapabilities; private final int mCapabilities;
private final int mIconResId; private final int mIconResId;
private final int mColor;
private final CharSequence mLabel; private final CharSequence mLabel;
private final CharSequence mShortDescription; private final CharSequence mShortDescription;
private final List<String> mSupportedUriSchemes; private final List<String> mSupportedUriSchemes;
@@ -120,6 +126,7 @@ public class PhoneAccount implements Parcelable {
private Uri mSubscriptionAddress; private Uri mSubscriptionAddress;
private int mCapabilities; private int mCapabilities;
private int mIconResId; private int mIconResId;
private int mColor = NO_COLOR;
private CharSequence mLabel; private CharSequence mLabel;
private CharSequence mShortDescription; private CharSequence mShortDescription;
private List<String> mSupportedUriSchemes = new ArrayList<String>(); private List<String> mSupportedUriSchemes = new ArrayList<String>();
@@ -141,6 +148,7 @@ public class PhoneAccount implements Parcelable {
mSubscriptionAddress = phoneAccount.getSubscriptionAddress(); mSubscriptionAddress = phoneAccount.getSubscriptionAddress();
mCapabilities = phoneAccount.getCapabilities(); mCapabilities = phoneAccount.getCapabilities();
mIconResId = phoneAccount.getIconResId(); mIconResId = phoneAccount.getIconResId();
mColor = phoneAccount.getColor();
mLabel = phoneAccount.getLabel(); mLabel = phoneAccount.getLabel();
mShortDescription = phoneAccount.getShortDescription(); mShortDescription = phoneAccount.getShortDescription();
mSupportedUriSchemes.addAll(phoneAccount.getSupportedUriSchemes()); mSupportedUriSchemes.addAll(phoneAccount.getSupportedUriSchemes());
@@ -166,6 +174,11 @@ public class PhoneAccount implements Parcelable {
return this; return this;
} }
public Builder setColor(int value) {
this.mColor = value;
return this;
}
public Builder setShortDescription(CharSequence value) { public Builder setShortDescription(CharSequence value) {
this.mShortDescription = value; this.mShortDescription = value;
return this; return this;
@@ -219,6 +232,7 @@ public class PhoneAccount implements Parcelable {
mSubscriptionAddress, mSubscriptionAddress,
mCapabilities, mCapabilities,
mIconResId, mIconResId,
mColor,
mLabel, mLabel,
mShortDescription, mShortDescription,
mSupportedUriSchemes); mSupportedUriSchemes);
@@ -231,6 +245,7 @@ public class PhoneAccount implements Parcelable {
Uri subscriptionAddress, Uri subscriptionAddress,
int capabilities, int capabilities,
int iconResId, int iconResId,
int color,
CharSequence label, CharSequence label,
CharSequence shortDescription, CharSequence shortDescription,
List<String> supportedUriSchemes) { List<String> supportedUriSchemes) {
@@ -239,6 +254,7 @@ public class PhoneAccount implements Parcelable {
mSubscriptionAddress = subscriptionAddress; mSubscriptionAddress = subscriptionAddress;
mCapabilities = capabilities; mCapabilities = capabilities;
mIconResId = iconResId; mIconResId = iconResId;
mColor = color;
mLabel = label; mLabel = label;
mShortDescription = shortDescription; mShortDescription = shortDescription;
mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes); mSupportedUriSchemes = Collections.unmodifiableList(supportedUriSchemes);
@@ -370,6 +386,15 @@ public class PhoneAccount implements Parcelable {
return mIconResId; return mIconResId;
} }
/**
* 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. * An icon to represent this {@code PhoneAccount} in a user interface.
* *
@@ -418,6 +443,7 @@ public class PhoneAccount implements Parcelable {
out.writeParcelable(mSubscriptionAddress, 0); out.writeParcelable(mSubscriptionAddress, 0);
out.writeInt(mCapabilities); out.writeInt(mCapabilities);
out.writeInt(mIconResId); out.writeInt(mIconResId);
out.writeInt(mColor);
out.writeCharSequence(mLabel); out.writeCharSequence(mLabel);
out.writeCharSequence(mShortDescription); out.writeCharSequence(mShortDescription);
out.writeList(mSupportedUriSchemes); out.writeList(mSupportedUriSchemes);
@@ -444,6 +470,7 @@ public class PhoneAccount implements Parcelable {
mSubscriptionAddress = in.readParcelable(getClass().getClassLoader()); mSubscriptionAddress = in.readParcelable(getClass().getClassLoader());
mCapabilities = in.readInt(); mCapabilities = in.readInt();
mIconResId = in.readInt(); mIconResId = in.readInt();
mColor = in.readInt();
mLabel = in.readCharSequence(); mLabel = in.readCharSequence();
mShortDescription = in.readCharSequence(); mShortDescription = in.readCharSequence();

View File

@@ -16,6 +16,7 @@
package android.telephony; package android.telephony;
import android.graphics.drawable.BitmapDrawable;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@@ -107,6 +108,31 @@ public class SubInfoRecord implements Parcelable {
this.mnc = mnc; this.mnc = mnc;
} }
/**
* Returns the string displayed to the user that identifies this subscription
*/
public String getLabel() {
return this.displayName;
}
/**
* Return the icon used to identify this SIM.
* TODO: return the correct drawable.
*/
public BitmapDrawable getIconDrawable() {
return new BitmapDrawable();
}
/**
* Return the color to be used for when displaying to the user. This is the value of the color.
* ex: 0x00ff00
*/
public int getColor() {
// Note: This color is currently an index into a list of drawables, but this is soon to
// change.
return this.color;
}
public static final Parcelable.Creator<SubInfoRecord> CREATOR = new Parcelable.Creator<SubInfoRecord>() { public static final Parcelable.Creator<SubInfoRecord> CREATOR = new Parcelable.Creator<SubInfoRecord>() {
@Override @Override
public SubInfoRecord createFromParcel(Parcel source) { public SubInfoRecord createFromParcel(Parcel source) {