Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3171ca2 authored by Sundeep Ghuman's avatar Sundeep Ghuman
Browse files

Standardize usages of "/" separator in SettingsLib

This separator should be translated the same as the
preference_summary_default_combination used in the Settings app. We
reintroduce this string here in order to avoid a dependency from
SettingsLib to Settings app.

Bug: b/62354743
Test: NA - Refactor
Change-Id: I2ce12848b944417b0df5e6f629aabd49712ff634
parent 1c005d1e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -110,6 +110,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 -->
+8 −14
Original line number Diff line number Diff line
@@ -677,13 +677,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(),
@@ -767,15 +760,16 @@ 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();
        }
    }

    /**
     * Returns the visibility status of the WifiConfiguration.