Merge "Update subtext for "Network & internet"" into sc-dev
This commit is contained in:
@@ -17,7 +17,6 @@
|
|||||||
package com.android.settings.network;
|
package com.android.settings.network;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.icu.text.ListFormatter;
|
|
||||||
import android.text.BidiFormatter;
|
import android.text.BidiFormatter;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
@@ -75,6 +74,20 @@ public class TopLevelNetworkEntryPreferenceController extends BasePreferenceCont
|
|||||||
&& !TextUtils.isEmpty(hotspotSummary)) {
|
&& !TextUtils.isEmpty(hotspotSummary)) {
|
||||||
summaries.add(hotspotSummary);
|
summaries.add(hotspotSummary);
|
||||||
}
|
}
|
||||||
return ListFormatter.getInstance().format(summaries);
|
return concatSummaries(summaries);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CharSequence concatSummaries(List<String> summaries) {
|
||||||
|
if (summaries.isEmpty()) {
|
||||||
|
return mContext.getText(R.string.summary_placeholder);
|
||||||
|
}
|
||||||
|
|
||||||
|
String summary = summaries.get(0);
|
||||||
|
final int summary_size = summaries.size();
|
||||||
|
for (int i = 1; i < summary_size; i++) {
|
||||||
|
summary = mContext.getString(R.string.join_two_unrelated_items, summary,
|
||||||
|
summaries.get(i));
|
||||||
|
}
|
||||||
|
return summary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,7 @@ public class TopLevelNetworkEntryPreferenceControllerTest {
|
|||||||
when(mTetherPreferenceController.isAvailable()).thenReturn(true);
|
when(mTetherPreferenceController.isAvailable()).thenReturn(true);
|
||||||
|
|
||||||
assertThat(mController.getSummary())
|
assertThat(mController.getSummary())
|
||||||
.isEqualTo("Wi\u2011Fi, mobile, data usage, and hotspot");
|
.isEqualTo("Wi\u2011Fi, mobile, data usage, hotspot");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -101,6 +101,6 @@ public class TopLevelNetworkEntryPreferenceControllerTest {
|
|||||||
when(mMobileNetworkPreferenceController.isAvailable()).thenReturn(false);
|
when(mMobileNetworkPreferenceController.isAvailable()).thenReturn(false);
|
||||||
when(mTetherPreferenceController.isAvailable()).thenReturn(false);
|
when(mTetherPreferenceController.isAvailable()).thenReturn(false);
|
||||||
|
|
||||||
assertThat(mController.getSummary()).isEqualTo("Wi\u2011Fi and data usage");
|
assertThat(mController.getSummary()).isEqualTo("Wi\u2011Fi, data usage");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user