[Audiosharing] Update cancel btn label.
When broadcast is off, the negative btn of share audio dialog should be "Switch to xxx" Test: atest Flag: com.android.settingslib.flags.enable_le_audio_sharing Bug: 305620450 Change-Id: I8006e2901b8f859d1ee86cbf12d81401e004aa0f
This commit is contained in:
@@ -158,7 +158,11 @@ public class AudioSharingJoinDialogFragment extends InstrumentedDialogFragment {
|
||||
dismiss();
|
||||
})
|
||||
.setCustomNegativeButton(
|
||||
R.string.audio_sharing_no_thanks_button_label,
|
||||
getMetricsCategory() == SettingsEnums.DIALOG_START_AUDIO_SHARING
|
||||
? getString(
|
||||
R.string.audio_sharing_switch_active_button_label,
|
||||
newDeviceName)
|
||||
: getString(R.string.audio_sharing_no_thanks_button_label),
|
||||
v -> {
|
||||
if (sListener != null) {
|
||||
sListener.onCancelClick();
|
||||
|
@@ -31,6 +31,7 @@ import android.content.Context;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -180,6 +181,7 @@ public class AudioSharingJoinDialogFragmentTest {
|
||||
@Test
|
||||
public void onCreateDialog_flagOn_dialogShowTextForSingleDevice() {
|
||||
mSetFlagsRule.enableFlags(Flags.FLAG_ENABLE_LE_AUDIO_SHARING);
|
||||
when(mBroadcast.isEnabled(null)).thenReturn(true);
|
||||
AudioSharingJoinDialogFragment.show(
|
||||
mParent,
|
||||
new ArrayList<>(),
|
||||
@@ -192,6 +194,10 @@ public class AudioSharingJoinDialogFragmentTest {
|
||||
assertThat(dialog.isShowing()).isTrue();
|
||||
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
|
||||
assertThat(shadowDialog.getMessage().toString()).isEqualTo(TEST_DEVICE_NAME2);
|
||||
Button btnView = dialog.findViewById(R.id.negative_btn);
|
||||
assertThat(btnView).isNotNull();
|
||||
assertThat(btnView.getText().toString())
|
||||
.isEqualTo(mParent.getString(R.string.audio_sharing_no_thanks_button_label));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -212,6 +218,13 @@ public class AudioSharingJoinDialogFragmentTest {
|
||||
R.string.audio_sharing_share_dialog_subtitle,
|
||||
TEST_DEVICE_NAME1,
|
||||
TEST_DEVICE_NAME2));
|
||||
Button btnView = dialog.findViewById(R.id.negative_btn);
|
||||
assertThat(btnView).isNotNull();
|
||||
assertThat(btnView.getText().toString())
|
||||
.isEqualTo(
|
||||
mParent.getString(
|
||||
R.string.audio_sharing_switch_active_button_label,
|
||||
TEST_DEVICE_NAME2));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user