Merge "Standardize usages of "/" separator in SettingsLib"

This commit is contained in:
TreeHugger Robot
2017-07-19 20:39:10 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 14 deletions

View File

@@ -113,6 +113,9 @@
<!-- Speed label for very fast network speed -->
<string name="speed_label_very_fast">Very Fast</string>
<!-- Summary text separator for preferences including a short description (eg. "Fast / Connected"). -->
<string name="preference_summary_default_combination"><xliff:g id="state" example="ON">%1$s</xliff:g> / <xliff:g id="description" example="High accuracy mode">%2$s</xliff:g></string>
<!-- Bluetooth settings. Message when a device is disconnected -->
<string name="bluetooth_disconnected">Disconnected</string>
<!-- Bluetooth settings. Message when disconnecting from a device -->

View File

@@ -673,13 +673,6 @@ public class AccessPoint implements Comparable<AccessPoint> {
// Update to new summary
StringBuilder summary = new StringBuilder();
// TODO(b/62354743): Standardize and international delimiter usage
final String concatenator = " / ";
if (mSpeed != Speed.NONE) {
summary.append(getSpeedLabel() + concatenator);
}
if (isActive() && config != null && config.isPasspoint()) {
// This is the active connection on passpoint
summary.append(getSummary(mContext, getDetailedState(),
@@ -773,14 +766,15 @@ public class AccessPoint implements Comparable<AccessPoint> {
}
}
// Strip trailing delimiter if applicable
int concatLength = concatenator.length();
if (summary.length() >= concatLength && summary.substring(
summary.length() - concatLength, summary.length()).equals(concatenator)) {
summary.delete(summary.length() - concatLength, summary.length());
// If Speed label is present, use the preference combination to prepend it to the summary.
if (mSpeed != Speed.NONE) {
return mContext.getResources().getString(
R.string.preference_summary_default_combination,
getSpeedLabel(),
summary.toString());
} else {
return summary.toString();
}
return summary.toString();
}
/**