use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.
the class ButtonActionDialogFragmentTest method testOnCreateDialog_specialDisableDialog.
@Test
public void testOnCreateDialog_specialDisableDialog() {
ButtonActionDialogFragment fragment = ButtonActionDialogFragment.newInstance(SPECIAL_DISABLE_ID);
FragmentTestUtil.startFragment(fragment);
final AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog();
ShadowAlertDialog shadowDialog = shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo(mShadowContext.getString(R.string.app_disable_dlg_text));
assertThat(dialog.getButton(DialogInterface.BUTTON_POSITIVE).getText()).isEqualTo(mShadowContext.getString(R.string.app_disable_dlg_positive));
assertThat(dialog.getButton(DialogInterface.BUTTON_NEGATIVE).getText()).isEqualTo(mShadowContext.getString(R.string.dlg_cancel));
}
use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.
the class AnomalyDialogFragmentTest method testOnCreateDialog_wakelockAnomaly_fireForceStopDialog.
@Test
public void testOnCreateDialog_wakelockAnomaly_fireForceStopDialog() {
mAnomalyDialogFragment = AnomalyDialogFragment.newInstance(mWakeLockAnomaly, 0);
FragmentTestUtil.startFragment(mAnomalyDialogFragment);
final AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog();
ShadowAlertDialog shadowDialog = shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo(mContext.getString(R.string.dialog_stop_message, mWakeLockAnomaly.displayName));
assertThat(shadowDialog.getTitle()).isEqualTo(mContext.getString(R.string.dialog_stop_title));
assertThat(dialog.getButton(DialogInterface.BUTTON_POSITIVE).getText()).isEqualTo(mContext.getString(R.string.dialog_stop_ok));
assertThat(dialog.getButton(DialogInterface.BUTTON_NEGATIVE).getText()).isEqualTo(mContext.getString(R.string.dlg_cancel));
}
use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.
the class AnomalyDialogFragmentTest method testOnCreateDialog_wakeupAlarmAnomalyTargetingO_fireForceStopDialog.
@Test
public void testOnCreateDialog_wakeupAlarmAnomalyTargetingO_fireForceStopDialog() {
mAnomalyDialogFragment = AnomalyDialogFragment.newInstance(mWakeupAlarmAnomaly2, 0);
FragmentTestUtil.startFragment(mAnomalyDialogFragment);
final AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog();
ShadowAlertDialog shadowDialog = shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo(mContext.getString(R.string.dialog_stop_message_wakeup_alarm, mWakeLockAnomaly.displayName));
assertThat(shadowDialog.getTitle()).isEqualTo(mContext.getString(R.string.dialog_stop_title));
assertThat(dialog.getButton(DialogInterface.BUTTON_POSITIVE).getText()).isEqualTo(mContext.getString(R.string.dialog_stop_ok));
assertThat(dialog.getButton(DialogInterface.BUTTON_NEGATIVE).getText()).isEqualTo(mContext.getString(R.string.dlg_cancel));
}
use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.
the class AnomalyDialogFragmentTest method testOnCreateDialog_wakeupAlarmAnomalyPriorO_fireStopAndBackgroundCheckDialog.
@Test
public void testOnCreateDialog_wakeupAlarmAnomalyPriorO_fireStopAndBackgroundCheckDialog() {
mAnomalyDialogFragment = AnomalyDialogFragment.newInstance(mWakeupAlarmAnomaly, 0);
FragmentTestUtil.startFragment(mAnomalyDialogFragment);
final AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog();
ShadowAlertDialog shadowDialog = shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo(mContext.getString(R.string.dialog_background_check_message, mWakeLockAnomaly.displayName));
assertThat(shadowDialog.getTitle()).isEqualTo(mContext.getString(R.string.dialog_background_check_title));
assertThat(dialog.getButton(DialogInterface.BUTTON_POSITIVE).getText()).isEqualTo(mContext.getString(R.string.dialog_background_check_ok));
assertThat(dialog.getButton(DialogInterface.BUTTON_NEGATIVE).getText()).isEqualTo(mContext.getString(R.string.dlg_cancel));
}
use of android.app.AlertDialog in project android_packages_apps_crDroidSettings by crdroidandroid.
the class SlimRecentsBlacklist method onCreateDialog.
@Override
public Dialog onCreateDialog(int dialogId) {
switch(dialogId) {
case DIALOG_BLACKLIST_APPS:
{
Dialog dialog;
AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());
final ListView list = new ListView(getActivity());
list.setAdapter(mPackageAdapter);
alertDialog.setTitle(R.string.profile_choose_app);
alertDialog.setView(list);
dialog = alertDialog.create();
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// Add empty application definition, the user will be able to edit it later
PackageItem info = (PackageItem) parent.getItemAtPosition(position);
addCustomApplicationPref(info.packageName, mBlacklistPackages);
dialog.cancel();
}
});
return dialog;
}
}
return super.onCreateDialog(dialogId);
}
Aggregations