Merge "Add secondary text to mobile data tile." into pi-dev

This commit is contained in:
TreeHugger Robot
2018-03-08 21:51:40 +00:00
committed by Android (Google) Code Review
7 changed files with 75 additions and 46 deletions

View File

@@ -88,7 +88,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:text="@string/accessibility_data_connection_roaming"
android:text="@string/data_connection_roaming"
android:textAppearance="@style/TextAppearance.QS.DataUsage.Secondary"
android:visibility="gone" />

View File

@@ -76,7 +76,7 @@
android:paddingBottom="3dp"
android:scaleType="fitCenter"
android:src="@drawable/stat_sys_roaming"
android:contentDescription="@string/accessibility_data_connection_roaming"
android:contentDescription="@string/data_connection_roaming"
android:visibility="gone" />
</FrameLayout>
</LinearLayout>

View File

@@ -362,41 +362,41 @@
<!-- Content description of an item that is connecting for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_desc_connecting">Connecting.</string>
<!-- Content description of the data connection type GPRS for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_gprs">GPRS</string>
<!-- Content description of the data connection type GPRS. [CHAR LIMIT=NONE] -->
<string name="data_connection_gprs">GPRS</string>
<!-- Content description of the data connection type 1x for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_1x">1 X</string>
<!-- Content description of the data connection type 1x. [CHAR LIMIT=NONE] -->
<string name="data_connection_1x">1 X</string>
<!-- Content description of the data connection type HSPA and its variants for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_hspa">HSPA</string>
<!-- Content description of the data connection type HSPA and its variants. [CHAR LIMIT=NONE] -->
<string name="data_connection_hspa">HSPA</string>
<!-- Content description of the data connection type 3G for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_3g">3G</string>
<!-- Content description of the data connection type 3G. [CHAR LIMIT=NONE] -->
<string name="data_connection_3g">3G</string>
<!-- Content description of the data connection type 3.5G for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_3.5g">3.5G</string>
<!-- Content description of the data connection type 3.5G. [CHAR LIMIT=NONE] -->
<string name="data_connection_3_5g">3.5G</string>
<!-- Content description of the data connection type 4G for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_4g">4G</string>
<!-- Content description of the data connection type 4G . [CHAR LIMIT=NONE] -->
<string name="data_connection_4g">4G</string>
<!-- Content description of the data connection type 4G for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_4g_plus">4G+</string>
<!-- Content description of the data connection type 4G+. [CHAR LIMIT=NONE] -->
<string name="data_connection_4g_plus">4G+</string>
<!-- Content description of the data connection type LTE for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_lte">LTE</string>
<!-- Content description of the data connection type LTE. [CHAR LIMIT=NONE] -->
<string name="data_connection_lte">LTE</string>
<!-- Content description of the data connection type LTE+ for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_lte_plus">LTE+</string>
<!-- Content description of the data connection type LTE+. [CHAR LIMIT=NONE] -->
<string name="data_connection_lte_plus">LTE+</string>
<!-- Content description of the data connection type CDMA for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_cdma">CDMA</string>
<!-- Content description of the data connection type CDMA. [CHAR LIMIT=NONE] -->
<string name="data_connection_cdma">CDMA</string>
<!-- Content description of the roaming data connection type for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_roaming">Roaming</string>
<!-- Content description of the roaming data connection type. [CHAR LIMIT=NONE] -->
<string name="data_connection_roaming">Roaming</string>
<!-- Content description of the data connection type Edge for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_edge">Edge</string>
<!-- Content description of the data connection type Edge. [CHAR LIMIT=NONE] -->
<string name="data_connection_edge">EDGE</string>
<!-- Content description of the data connection type WiFi for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_data_connection_wifi">Wi-Fi</string>
@@ -411,7 +411,7 @@
<string name="accessibility_cell_data_on">Mobile Data On</string>
<!-- Content description of the cell data being disabled. [CHAR LIMIT=NONE] -->
<string name="accessibility_cell_data_off">Mobile Data Off</string>
<string name="cell_data_off">Mobile data off</string>
<!-- Content description of the bluetooth tethering icon for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_bluetooth_tether">Bluetooth tethering.</string>
@@ -425,8 +425,8 @@
<!-- Content description of the no sim icon for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_no_sims">No SIM card.</string>
<!-- Content description of the carrier network changing icon for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_carrier_network_change_mode">Carrier network changing.</string>
<!-- Content description of the carrier network changing icon. [CHAR LIMIT=NONE] -->
<string name="carrier_network_change_mode">Carrier network changing</string>
<!-- Content description of button to open battery details icon for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_battery_details">Open battery details</string>
@@ -1941,8 +1941,8 @@
<!-- accessibility label for button to select user [CHAR LIMIT=NONE] -->
<string name="accessibility_quick_settings_user">Signed in as <xliff:g name="user" example="John">%s</xliff:g></string>
<!-- accessibility label for no internet [CHAR LIMIT=NONE] -->
<string name="accessibility_quick_settings_no_internet">No internet.</string>
<!-- Content description for no internet connection [CHAR LIMIT=NONE] -->
<string name="data_connection_no_internet">No internet</string>
<!-- accessibility label for quick settings items that open a details page [CHAR LIMIT=NONE] -->
<string name="accessibility_quick_settings_open_details">Open details.</string>
@@ -2096,6 +2096,9 @@
<!-- Quick settings tile for toggling mobile data [CHAR LIMIT=20] -->
<string name="mobile_data">Mobile data</string>
<!-- Quick settings tile secondary label format combining roaming with the mobile data type. [CHAR LIMIT=NONE] -->
<string name="mobile_data_text_format"><xliff:g name="roaming_status" example="Roaming">%s</xliff:g> \u2014 <xliff:g name="mobile_data_type" example="LTE">%s</xliff:g></string>
<!-- Label for when wifi is off in QS detail panel [CHAR LIMIT=NONE] -->
<string name="wifi_is_off">Wi-Fi is off</string>

View File

@@ -26,6 +26,7 @@ import android.content.res.Resources;
import android.os.SystemProperties;
import android.provider.Settings;
import android.service.quicksettings.Tile;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -166,6 +167,9 @@ public class CellularTile extends QSTileImpl<SignalState> {
final String signalContentDesc = cb.enabled && (cb.mobileSignalIconId > 0)
? cb.signalContentDescription
: r.getString(R.string.accessibility_no_signal);
boolean mobileDataEnabled = mDataController.isMobileDataSupported()
&& mDataController.isMobileDataEnabled();
state.value = mobileDataEnabled;
if (cb.noSim) {
state.contentDescription = state.label;
} else {
@@ -182,13 +186,33 @@ public class CellularTile extends QSTileImpl<SignalState> {
state.icon = new SignalIcon(cb.mobileSignalIconId);
}
if (cb.airplaneModeEnabled | cb.noSim) {
if (cb.noSim) {
state.state = Tile.STATE_UNAVAILABLE;
} else {
state.secondaryLabel = r.getString(R.string.keyguard_missing_sim_message_short);
} else if (cb.airplaneModeEnabled) {
state.state = Tile.STATE_UNAVAILABLE;
state.secondaryLabel = r.getString(R.string.status_bar_airplane);
} else if (mobileDataEnabled) {
state.state = Tile.STATE_ACTIVE;
state.secondaryLabel = getMobileDataDescription(cb);
} else {
state.state = Tile.STATE_INACTIVE;
state.secondaryLabel = r.getString(R.string.cell_data_off);
}
}
private CharSequence getMobileDataDescription(CallbackInfo cb) {
if (cb.roaming && !TextUtils.isEmpty(cb.dataContentDescription)) {
String roaming = mContext.getString(R.string.data_connection_roaming);
String dataDescription = cb.dataContentDescription;
return mContext.getString(R.string.mobile_data_text_format, roaming, dataDescription);
}
if (cb.roaming) {
return mContext.getString(R.string.data_connection_roaming);
}
return cb.dataContentDescription;
}
@Override
public int getMetricsCategory() {
return MetricsEvent.QS_CELLULAR;

View File

@@ -278,6 +278,9 @@ public class MobileSignalController extends SignalController<
String contentDescription = getStringIfExists(getContentDescription());
String dataContentDescription = getStringIfExists(icons.mDataContentDescription);
if (mCurrentState.inetCondition == 0) {
dataContentDescription = mContext.getString(R.string.data_connection_no_internet);
}
final boolean dataDisabled = mCurrentState.iconGroup == TelephonyIcons.DATA_DISABLED
&& mCurrentState.userSetup;

View File

@@ -53,7 +53,7 @@ class TelephonyIcons {
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_carrier_network_change_mode,
R.string.carrier_network_change_mode,
0,
false,
0
@@ -68,7 +68,7 @@ class TelephonyIcons {
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_3g,
R.string.data_connection_3g,
TelephonyIcons.ICON_3G,
true,
TelephonyIcons.QS_DATA_3G
@@ -107,7 +107,7 @@ class TelephonyIcons {
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_edge,
R.string.data_connection_edge,
TelephonyIcons.ICON_E,
false,
TelephonyIcons.QS_DATA_E
@@ -122,7 +122,7 @@ class TelephonyIcons {
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_cdma,
R.string.data_connection_cdma,
TelephonyIcons.ICON_1X,
true,
TelephonyIcons.QS_DATA_1X
@@ -137,7 +137,7 @@ class TelephonyIcons {
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_gprs,
R.string.data_connection_gprs,
TelephonyIcons.ICON_G,
false,
TelephonyIcons.QS_DATA_G
@@ -152,7 +152,7 @@ class TelephonyIcons {
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_3_5g,
R.string.data_connection_3_5g,
TelephonyIcons.ICON_H,
false,
TelephonyIcons.QS_DATA_H
@@ -167,7 +167,7 @@ class TelephonyIcons {
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_4g,
R.string.data_connection_4g,
TelephonyIcons.ICON_4G,
true,
TelephonyIcons.QS_DATA_4G
@@ -182,7 +182,7 @@ class TelephonyIcons {
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_4g_plus,
R.string.data_connection_4g_plus,
TelephonyIcons.ICON_4G_PLUS,
true,
TelephonyIcons.QS_DATA_4G_PLUS
@@ -197,7 +197,7 @@ class TelephonyIcons {
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_lte,
R.string.data_connection_lte,
TelephonyIcons.ICON_LTE,
true,
TelephonyIcons.QS_DATA_LTE
@@ -212,7 +212,7 @@ class TelephonyIcons {
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_data_connection_lte_plus,
R.string.data_connection_lte_plus,
TelephonyIcons.ICON_LTE_PLUS,
true,
TelephonyIcons.QS_DATA_LTE_PLUS
@@ -227,7 +227,7 @@ class TelephonyIcons {
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.accessibility_cell_data_off,
R.string.cell_data_off,
0,
false,
0

View File

@@ -84,8 +84,7 @@ public class WifiSignalController extends
boolean ssidPresent = wifiVisible && mCurrentState.ssid != null;
String contentDescription = getStringIfExists(getContentDescription());
if (mCurrentState.inetCondition == 0) {
contentDescription +=
("," + mContext.getString(R.string.accessibility_quick_settings_no_internet));
contentDescription += ("," + mContext.getString(R.string.data_connection_no_internet));
}
IconState statusIcon = new IconState(wifiVisible, getCurrentIconId(), contentDescription);