Fields Summary |
---|
private static final int | TEXT_SIZESize of text to render on the icon. |
private int | mIdSubscription Identifier, this is a device unique number
and not an index into an array |
private String | mIccIdThe GID for a SIM that maybe associated with this subscription, empty if unknown |
private int | mSimSlotIndexThe index of the slot that currently contains the subscription
and not necessarily unique and maybe INVALID_SLOT_ID if unknown |
private CharSequence | mDisplayNameThe name displayed to the user that identifies this subscription |
private CharSequence | mCarrierNameThe string displayed to the user that identifies Subscription Provider Name |
private int | mNameSourceThe source of the name, NAME_SOURCE_UNDEFINED, NAME_SOURCE_DEFAULT_SOURCE,
NAME_SOURCE_SIM_SOURCE or NAME_SOURCE_USER_INPUT. |
private int | mIconTintThe color to be used for tinting the icon when displaying to the user |
private String | mNumberA number presented to the user identify this subscription |
private int | mDataRoamingData roaming state, DATA_RAOMING_ENABLE, DATA_RAOMING_DISABLE |
private android.graphics.Bitmap | mIconBitmapSIM Icon bitmap |
private int | mMccMobile Country Code |
private int | mMncMobile Network Code |
private String | mCountryIsoISO Country code for the subscription's provider |
public static final Parcelable.Creator | CREATOR |
Methods Summary |
---|
public android.graphics.Bitmap | createIconBitmap(android.content.Context context)Creates and returns an icon {@code Bitmap} to represent this {@code SubscriptionInfo} in a user
interface.
int width = mIconBitmap.getWidth();
int height = mIconBitmap.getHeight();
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
// Create a new bitmap of the same size because it will be modified.
Bitmap workingBitmap = Bitmap.createBitmap(metrics, width, height, mIconBitmap.getConfig());
Canvas canvas = new Canvas(workingBitmap);
Paint paint = new Paint();
// Tint the icon with the color.
paint.setColorFilter(new PorterDuffColorFilter(mIconTint, PorterDuff.Mode.SRC_ATOP));
canvas.drawBitmap(mIconBitmap, 0, 0, paint);
paint.setColorFilter(null);
// Write the sim slot index.
paint.setAntiAlias(true);
paint.setTypeface(Typeface.create("sans-serif", Typeface.NORMAL));
paint.setColor(Color.WHITE);
// Set text size scaled by density
paint.setTextSize(TEXT_SIZE * metrics.density);
// Convert sim slot index to localized string
final String index = String.format("%d", mSimSlotIndex + 1);
final Rect textBound = new Rect();
paint.getTextBounds(index, 0, 1, textBound);
final float xOffset = (width / 2.f) - textBound.centerX();
final float yOffset = (height / 2.f) - textBound.centerY();
canvas.drawText(index, xOffset, yOffset, paint);
return workingBitmap;
|
public int | describeContents()
return 0;
|
public java.lang.CharSequence | getCarrierName()
return this.mCarrierName;
|
public java.lang.String | getCountryIso()
return this.mCountryIso;
|
public int | getDataRoaming()
return this.mDataRoaming;
|
public java.lang.CharSequence | getDisplayName()
return this.mDisplayName;
|
public java.lang.String | getIccId()
return this.mIccId;
|
public int | getIconTint()A highlight color to use in displaying information about this {@code PhoneAccount}.
return mIconTint;
|
public int | getMcc()
return this.mMcc;
|
public int | getMnc()
return this.mMnc;
|
public int | getNameSource()
return this.mNameSource;
|
public java.lang.String | getNumber()
return mNumber;
|
public int | getSimSlotIndex()
return this.mSimSlotIndex;
|
public int | getSubscriptionId()
return this.mId;
|
public void | setCarrierName(java.lang.CharSequence name)Sets the name displayed to the user that identifies Subscription provider name
this.mCarrierName = name;
|
public void | setDisplayName(java.lang.CharSequence name)Sets the name displayed to the user that identifies this subscription
this.mDisplayName = name;
|
public void | setIconTint(int iconTint)Sets the color displayed to the user that identifies this subscription
this.mIconTint = iconTint;
|
public java.lang.String | toString()
return "{id=" + mId + ", iccId=" + mIccId + " simSlotIndex=" + mSimSlotIndex
+ " displayName=" + mDisplayName + " carrierName=" + mCarrierName
+ " nameSource=" + mNameSource + " iconTint=" + mIconTint
+ " dataRoaming=" + mDataRoaming + " iconBitmap=" + mIconBitmap + " mcc " + mMcc
+ " mnc " + mMnc + "}";
|
public void | writeToParcel(android.os.Parcel dest, int flags)
dest.writeInt(mId);
dest.writeString(mIccId);
dest.writeInt(mSimSlotIndex);
dest.writeCharSequence(mDisplayName);
dest.writeCharSequence(mCarrierName);
dest.writeInt(mNameSource);
dest.writeInt(mIconTint);
dest.writeString(mNumber);
dest.writeInt(mDataRoaming);
dest.writeInt(mMcc);
dest.writeInt(mMnc);
dest.writeString(mCountryIso);
mIconBitmap.writeToParcel(dest, flags);
|