diff options
| -rw-r--r-- | packages/SystemUI/res/values/dimens.xml | 3 | ||||
| -rw-r--r-- | packages/SystemUI/res/values/styles.xml | 6 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java | 21 |
3 files changed, 29 insertions, 1 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 536bc4edf341..367e89594856 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1049,4 +1049,7 @@ <dimen name="bubble_pointer_margin">8dp</dimen> <!-- Height of the permission prompt shown with bubbles --> <dimen name="bubble_permission_height">120dp</dimen> + + <!-- Size of the RAT type for CellularTile --> + <dimen name="celltile_rat_type_size">10sp</dimen> </resources> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 96cdbd38ed0b..cfc6d029fce0 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -216,6 +216,12 @@ <item name="android:fontFamily">@*android:string/config_bodyFontFamily</item> </style> + <!-- This is hard coded to be sans-serif-condensed to match the icons --> + <style name="TextAppearance.RATBadge" parent="@style/TextAppearance.QS.TileLabel.Secondary"> + <item name="android:fontFamily">sans-serif-condensed</item> + <item name="android:textSize">@dimen/celltile_rat_type_size</item> + </style> + <style name="TextAppearance.QS.CarrierInfo"> <item name="android:fontFamily">@*android:string/config_headlineFontFamily</item> <item name="android:textSize">@dimen/qs_carrier_info_text_size</item> diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java index e1becdbb42a6..c587a39f49e3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java @@ -25,7 +25,11 @@ import android.content.Intent; import android.content.res.Resources; import android.provider.Settings; import android.service.quicksettings.Tile; +import android.text.SpannableString; +import android.text.SpannableStringBuilder; +import android.text.Spanned; import android.text.TextUtils; +import android.text.style.TextAppearanceSpan; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -188,7 +192,8 @@ public class CellularTile extends QSTileImpl<SignalState> { state.secondaryLabel = r.getString(R.string.status_bar_airplane); } else if (mobileDataEnabled) { state.state = Tile.STATE_ACTIVE; - state.secondaryLabel = getMobileDataSubscriptionName(cb); + state.secondaryLabel = appendMobileDataType(getMobileDataSubscriptionName(cb), + cb.dataContentDescription); } else { state.state = Tile.STATE_INACTIVE; state.secondaryLabel = r.getString(R.string.cell_data_off); @@ -207,6 +212,18 @@ public class CellularTile extends QSTileImpl<SignalState> { state.contentDescription = state.label + ", " + contentDescriptionSuffix; } + private CharSequence appendMobileDataType(CharSequence current, CharSequence dataType) { + if (TextUtils.isEmpty(dataType)) { + return current; + } + SpannableString type = new SpannableString(dataType); + SpannableStringBuilder builder = new SpannableStringBuilder(current); + builder.append(" "); + builder.append(type, new TextAppearanceSpan(mContext, R.style.TextAppearance_RATBadge), + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + return builder; + } + private CharSequence getMobileDataSubscriptionName(CallbackInfo cb) { if (cb.roaming && !TextUtils.isEmpty(cb.dataSubscriptionName)) { String roaming = mContext.getString(R.string.data_connection_roaming); @@ -232,6 +249,7 @@ public class CellularTile extends QSTileImpl<SignalState> { private static final class CallbackInfo { boolean airplaneModeEnabled; CharSequence dataSubscriptionName; + CharSequence dataContentDescription; boolean activityIn; boolean activityOut; boolean noSim; @@ -250,6 +268,7 @@ public class CellularTile extends QSTileImpl<SignalState> { return; } mInfo.dataSubscriptionName = mController.getMobileDataNetworkName(); + mInfo.dataContentDescription = (description != null) ? typeContentDescription : null; mInfo.activityIn = activityIn; mInfo.activityOut = activityOut; mInfo.roaming = roaming; |