diff options
author | Stuart Scott <stuartscott@google.com> | 2014-12-02 21:04:53 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-12-02 21:04:54 +0000 |
commit | 4e779ecd56faad5901854e030f593c5d4ad3dee8 (patch) | |
tree | 5056efa38895ffbd8331de8288a690c5129cdf8d /telephony/java | |
parent | 75f304f922dcb27e57dcbea17a36d426f6b223a7 (diff) | |
parent | 7151cde3ca742d24ea97f163526519b83431c87e (diff) | |
download | frameworks_base-4e779ecd56faad5901854e030f593c5d4ad3dee8.zip frameworks_base-4e779ecd56faad5901854e030f593c5d4ad3dee8.tar.gz frameworks_base-4e779ecd56faad5901854e030f593c5d4ad3dee8.tar.bz2 |
Merge "Subscription Info density-dependent text size and localized SIM slot index" into lmp-mr1-dev
Diffstat (limited to 'telephony/java')
-rw-r--r-- | telephony/java/android/telephony/SubscriptionInfo.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java index c8b782f..e57f9e3 100644 --- a/telephony/java/android/telephony/SubscriptionInfo.java +++ b/telephony/java/android/telephony/SubscriptionInfo.java @@ -27,6 +27,7 @@ import android.graphics.Rect; import android.graphics.Typeface; import android.os.Parcel; import android.os.Parcelable; +import android.util.DisplayMetrics; /** * A Parcelable class for Subscription Information. @@ -36,7 +37,7 @@ public class SubscriptionInfo implements Parcelable { /** * Size of text to render on the icon. */ - private static final int TEXT_SIZE = 22; + private static final int TEXT_SIZE = 16; /** * Subscription Identifier, this is a device unique number @@ -197,10 +198,10 @@ public class SubscriptionInfo implements Parcelable { public Bitmap createIconBitmap(Context context) { 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(context.getResources().getDisplayMetrics(), - width, height, mIconBitmap.getConfig()); + Bitmap workingBitmap = Bitmap.createBitmap(metrics, width, height, mIconBitmap.getConfig()); Canvas canvas = new Canvas(workingBitmap); Paint paint = new Paint(); @@ -214,8 +215,10 @@ public class SubscriptionInfo implements Parcelable { paint.setAntiAlias(true); paint.setTypeface(Typeface.create("sans-serif", Typeface.NORMAL)); paint.setColor(Color.WHITE); - paint.setTextSize(TEXT_SIZE); - final String index = Integer.toString(mSimSlotIndex + 1); + // 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(); |