use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ChooseLockTypeDialogFragmentTest method testThat_OnClickListener_IsNotCalledWhenCancelled.
@Test
public void testThat_OnClickListener_IsNotCalledWhenCancelled() {
mFragment.mDelegate = mock(OnLockTypeSelectedListener.class);
AlertDialog lockDialog = startLockFragment();
lockDialog.dismiss();
verify(mFragment.mDelegate, never()).onLockTypeSelected(any(ScreenLockType.class));
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class PreferredSimDialogFragmentTest method onClick_yesClicked_callsOnSubscriptionSelected.
@Test
public void onClick_yesClicked_callsOnSubscriptionSelected() {
mIntent.putExtra(PREFERRED_SIM, 0);
final AlertDialog alertDialog = startDialog();
final SimDialogActivity activity = (SimDialogActivity) spy(mFragment.getActivity());
doReturn(activity).when(mFragment).getActivity();
doNothing().when(activity).onSubscriptionSelected(anyInt(), anyInt());
mFragment.onClick(alertDialog, DialogInterface.BUTTON_POSITIVE);
verify(activity).onSubscriptionSelected(PREFERRED_PICK, SIM1_ID);
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimListDialogFragmentTest method onCreateDialog_twoSubscriptionsAskEveryTime_threeSubsForDisplay.
@Test
public void onCreateDialog_twoSubscriptionsAskEveryTime_threeSubsForDisplay() {
final int dialogType = SMS_PICK;
setDialogType(dialogType);
mFragment = spy(SimListDialogFragment.newInstance(dialogType, R.string.select_sim_for_sms, true));
doReturn(Arrays.asList(mSim1, mSim2)).when(mFragment).getCurrentSubscriptions();
// Avoid problems robolectric has with our real adapter.
doNothing().when(mFragment).setAdapter(any());
final AlertDialog alertDialog = startDialog();
assertThat(mFragment.mSubscriptions).hasSize(3);
assertThat(mFragment.mSubscriptions.get(0)).isNull();
final SimDialogActivity activity = (SimDialogActivity) spy(mFragment.getActivity());
doReturn(activity).when(mFragment).getActivity();
doNothing().when(activity).onSubscriptionSelected(anyInt(), anyInt());
mFragment.onClick(alertDialog, 0);
verify(activity).onSubscriptionSelected(dialogType, SubscriptionManager.INVALID_SUBSCRIPTION_ID);
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TextToSpeechSettings method displayNetworkAlert.
private void displayNetworkAlert() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(android.R.string.dialog_alert_title).setMessage(getActivity().getString(R.string.tts_engine_network_required)).setCancelable(false).setPositiveButton(android.R.string.ok, null);
AlertDialog dialog = builder.create();
dialog.show();
}
use of androidx.appcompat.app.AlertDialog in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TtsEnginePreference method displayDataAlert.
private void displayDataAlert(DialogInterface.OnClickListener positiveOnClickListener, DialogInterface.OnClickListener negativeOnClickListener) {
Log.i(TAG, "Displaying data alert for :" + mEngineInfo.name);
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle(android.R.string.dialog_alert_title).setMessage(getContext().getString(R.string.tts_engine_security_warning, mEngineInfo.label)).setCancelable(true).setPositiveButton(android.R.string.ok, positiveOnClickListener).setNegativeButton(android.R.string.cancel, negativeOnClickListener);
AlertDialog dialog = builder.create();
dialog.show();
}
Aggregations