From 4bbf75d1844166b5dd5b05aac97a85c90d6dc992 Mon Sep 17 00:00:00 2001 From: Roozbeh Pournader Date: Mon, 10 Aug 2015 11:32:19 -0700 Subject: [PATCH] Inline TextUtils.join(Iterable). DataUsageSummary seems to be the only place the deprecated hidden method is used. This inlines the definition so the deprecated method could be removed. Change-Id: I63dc1de74e1df1119ba99f46bed5d016e07c87b5 --- src/com/android/settings/DataUsageSummary.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java index b3f79730e8d..35a85b56465 100644 --- a/src/com/android/settings/DataUsageSummary.java +++ b/src/com/android/settings/DataUsageSummary.java @@ -68,6 +68,8 @@ import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; +import android.icu.impl.ICUResourceBundle; +import android.icu.util.UResourceBundle; import android.net.ConnectivityManager; import android.net.INetworkPolicyManager; import android.net.INetworkStatsService; @@ -2576,7 +2578,18 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable limited.add(getText(R.string.data_usage_list_none)); } - return TextUtils.join(limited); + final ICUResourceBundle icuBundle = (ICUResourceBundle) UResourceBundle. + getBundleInstance(ICUResourceBundle.ICU_BASE_NAME); + final String listMiddlePattern = + icuBundle.getStringWithFallback("listPattern/standard/middle"); + // The returned pattern is something like "{0}, {1}", from which we want + // to extract the ", " part. + final int firstClosingBrace = listMiddlePattern.indexOf('}'); + final int lastOpeningBrace = listMiddlePattern.lastIndexOf('{'); + final CharSequence delimiter = listMiddlePattern.substring( + firstClosingBrace+1, lastOpeningBrace); + + return TextUtils.join(delimiter, limited); } /**