<string name="bluetooth_phonebook_request">"Phone book access request"</string>
<!-- Bluetooth phone book permission Alert Activity text [CHAR LIMIT=none] -->
- <string name="bluetooth_pb_acceptance_dialog_text">%1$s wants to access your contacts and call history. Give access to %2$s?</string>
+ <string name="bluetooth_pb_acceptance_dialog_text">
+ <xliff:g id="device_name">%1$s</xliff:g> wants to access your contacts and call history. Give access to <xliff:g id="device_name">%2$s</xliff:g>?
+ </string>
<!-- Bluetooth phone book permission Alert Activity checkbox text [CHAR LIMIT=none] -->
<string name="bluetooth_remember_choice">Don\u2019t ask again</string>
<string name="mobile_unknown_sim_operator" translatable="true">Unknown SIM operator</string>
<!-- There is no mobile provisiong website for the operator which is the firat parameter [CHAR_ LIMIT=50]-->
- <string name="mobile_no_provisioning_url" translatable="true">%1$s has no known provisioning website</string>
+ <string name="mobile_no_provisioning_url"><xliff:g id="operator">%1$s</xliff:g> has no known provisioning website</string>
<!-- Ask user to insert a SIM card [CHAR_ LIMIT=50]-->
<string name="mobile_insert_sim_card" translatable="true">Please insert SIM card and restart</string>
<string name="battery_saver_turn_on_automatically_never">Never</string>
<!-- [CHAR_LIMIT=40] Battery saver: Value for automatic entry option: pct% battery -->
- <string name="battery_saver_turn_on_automatically_pct">at %1$s battery</string>
+ <string name="battery_saver_turn_on_automatically_pct">at <xliff:g id="percent">%1$s</xliff:g>battery</string>
<!-- Process Stats strings -->
<skip />
package com.android.settings.bluetooth;
import android.app.AlertDialog;
+import android.content.Context;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
+
import com.android.settings.R;
import com.android.settings.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowApplication;
import org.robolectric.util.FragmentTestUtil;
import static com.google.common.truth.Truth.assertThat;
assertThat(message.getVisibility()).isEqualTo(View.GONE);
}
+ @Test
+ public void pairingStringIsFormattedCorrectly() {
+ final String device = "test_device";
+ final Context context = ShadowApplication.getInstance().getApplicationContext();
+ assertThat(context.getString(R.string.bluetooth_pb_acceptance_dialog_text, device, device))
+ .contains(device);
+ }
+
private BluetoothPairingDialogFragment makeFragment() {
BluetoothPairingDialogFragment frag = new BluetoothPairingDialogFragment();
frag.setPairingController(controller);
--- /dev/null
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.network;
+
+import android.content.Context;
+
+import com.android.settings.R;
+import com.android.settings.SettingsRobolectricTestRunner;
+import com.android.settings.TestConfig;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowApplication;
+
+import static com.google.common.truth.Truth.assertThat;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+public class MobilePlanPreferenceControllerTest {
+
+ @Test
+ public void testNoProvisionStringFormattedCorrectly() {
+ final String operator = "test_operator";
+ final Context context = ShadowApplication.getInstance().getApplicationContext();
+ assertThat(context.getString(R.string.mobile_no_provisioning_url, operator, operator))
+ .contains(operator);
+ }
+}