Search in sources :

Example 71 with AlertDialog

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));
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) OnLockTypeSelectedListener(com.android.settings.password.ChooseLockTypeDialogFragment.OnLockTypeSelectedListener) Test(org.junit.Test)

Example 72 with AlertDialog

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);
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) Test(org.junit.Test)

Example 73 with AlertDialog

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);
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) Test(org.junit.Test)

Example 74 with AlertDialog

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();
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog)

Example 75 with AlertDialog

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();
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog)

Aggregations

AlertDialog (androidx.appcompat.app.AlertDialog)256 Test (org.junit.Test)89 View (android.view.View)48 DialogInterface (android.content.DialogInterface)40 Button (android.widget.Button)39 TextView (android.widget.TextView)39 Intent (android.content.Intent)30 ShadowAlertDialogCompat (com.android.settings.testutils.shadow.ShadowAlertDialogCompat)30 NonNull (androidx.annotation.NonNull)27 Context (android.content.Context)26 Bundle (android.os.Bundle)20 SuppressLint (android.annotation.SuppressLint)17 EditText (android.widget.EditText)17 ArrayList (java.util.ArrayList)17 MaterialAlertDialogBuilder (com.google.android.material.dialog.MaterialAlertDialogBuilder)14 List (java.util.List)12 Activity (android.app.Activity)11 Uri (android.net.Uri)11 LayoutInflater (android.view.LayoutInflater)11 ListView (android.widget.ListView)10