Improve Bluetooth pairing dialog & contact sharing toggle

Before change: https://screenshot.googleplex.com/Agr29KTvgptbsag
After change: https://screenshot.googleplex.com/ArjiavkFAFiuCTR

Bug: 274521434
Test: RunSettingsRoboTests
Change-Id: Ib896b70bc219de128b733b75249bf80e3389f221
This commit is contained in:
Haijie Hong
2023-08-08 13:15:38 +08:00
parent 317bfca133
commit 21b075770e
5 changed files with 48 additions and 21 deletions

View File

@@ -33,7 +33,6 @@ import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.CheckBox;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
@@ -276,7 +275,7 @@ public class BluetoothPairingDialogTest {
}
@Test
public void contactSharingCheckbox_conditionIsReady_showsUi() {
public void contactSharingToggle_conditionIsReady_showsUi() {
// set the dialog variant to confirmation/consent
when(controller.getDialogType()).thenReturn(BluetoothPairingController.CONFIRMATION_DIALOG);
// set a fake device name and pretend the profile has not been set up for it
@@ -286,14 +285,14 @@ public class BluetoothPairingDialogTest {
// build the fragment
BluetoothPairingDialogFragment frag = makeFragment();
// verify that the checkbox is visible and that the device name is correct
CheckBox sharingCheckbox =
frag.getmDialog().findViewById(R.id.phonebook_sharing_message_confirm_pin);
assertThat(sharingCheckbox.getVisibility()).isEqualTo(View.VISIBLE);
// verify that the toggle is visible
View sharingToggle =
frag.getmDialog().findViewById(R.id.phonebook_sharing);
assertThat(sharingToggle.getVisibility()).isEqualTo(View.VISIBLE);
}
@Test
public void contactSharingCheckbox_conditionIsNotReady_doesNotShowUi() {
public void contactSharingToggle_conditionIsNotReady_doesNotShowUi() {
// set the dialog variant to confirmation/consent
when(controller.getDialogType()).thenReturn(BluetoothPairingController.CONFIRMATION_DIALOG);
// set a fake device name and pretend the profile has been set up for it
@@ -303,10 +302,10 @@ public class BluetoothPairingDialogTest {
// build the fragment
BluetoothPairingDialogFragment frag = makeFragment();
// verify that the checkbox is gone
CheckBox sharingCheckbox =
frag.getmDialog().findViewById(R.id.phonebook_sharing_message_confirm_pin);
assertThat(sharingCheckbox.getVisibility()).isEqualTo(View.GONE);
// verify that the toggle is gone
View sharingToggle =
frag.getmDialog().findViewById(R.id.phonebook_sharing);
assertThat(sharingToggle.getVisibility()).isEqualTo(View.GONE);
}
@Test