use of android.app.AlertDialog in project cw-omnibus by commonsguy.
the class ConstantsFragment method onClick.
public void onClick(DialogInterface di, int whichButton) {
ContentValues values = new ContentValues(2);
AlertDialog dlg = (AlertDialog) di;
EditText title = (EditText) dlg.findViewById(R.id.title);
EditText value = (EditText) dlg.findViewById(R.id.value);
values.put(DatabaseHelper.TITLE, title.getText().toString());
values.put(DatabaseHelper.VALUE, value.getText().toString());
task = new InsertTask().execute(values);
}
use of android.app.AlertDialog in project materialistic by hidroh.
the class DrawerActivityLoginTest method testNoExistingAccount.
@Test
public void testNoExistingAccount() {
assertThat(drawerAccount).hasText(R.string.login);
assertThat(drawerLogout).isNotVisible();
assertThat(drawerUser).isNotVisible();
Preferences.setUsername(activity, "username");
assertThat(drawerAccount).hasText("username");
assertThat(drawerLogout).isVisible();
assertThat(drawerUser).isVisible();
drawerLogout.performClick();
AlertDialog alertDialog = ShadowAlertDialog.getLatestAlertDialog();
assertNotNull(alertDialog);
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
assertThat(drawerAccount).hasText(R.string.login);
assertThat(drawerLogout).isNotVisible();
}
use of android.app.AlertDialog in project materialistic by hidroh.
the class DrawerActivityLoginTest method testRemoveAccount.
@Config(sdk = 21)
@Test
public void testRemoveAccount() {
ShadowAccountManager.get(activity).addAccountExplicitly(new Account("existing", BuildConfig.APPLICATION_ID), "password", null);
Preferences.setUsername(activity, "existing");
drawerAccount.performClick();
AlertDialog alertDialog = ShadowAlertDialog.getLatestAlertDialog();
assertNotNull(alertDialog);
assertThat(alertDialog.getListView().getAdapter()).hasCount(1);
alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL).performClick();
assertThat(alertDialog).isNotShowing();
assertThat(ShadowAccountManager.get(activity).getAccounts()).isEmpty();
}
use of android.app.AlertDialog in project materialistic by hidroh.
the class DrawerActivityLoginTest method testExistingAccount.
@Test
public void testExistingAccount() {
ShadowAccountManager.get(activity).addAccountExplicitly(new Account("existing", BuildConfig.APPLICATION_ID), "password", null);
drawerAccount.performClick();
AlertDialog alertDialog = ShadowAlertDialog.getLatestAlertDialog();
assertNotNull(alertDialog);
assertThat(alertDialog.getListView().getAdapter()).hasCount(1);
shadowOf(alertDialog).clickOnItem(0);
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
assertThat(alertDialog).isNotShowing();
assertThat(drawerAccount).hasText("existing");
assertThat(drawerLogout).isVisible();
drawerAccount.performClick();
alertDialog = ShadowAlertDialog.getLatestAlertDialog();
assertThat(alertDialog.getListView().getAdapter()).hasCount(1);
}
use of android.app.AlertDialog in project materialistic by hidroh.
the class DrawerActivityLoginTest method testAddAccount.
@Test
public void testAddAccount() {
ShadowAccountManager.get(activity).addAccountExplicitly(new Account("existing", BuildConfig.APPLICATION_ID), "password", null);
drawerAccount.performClick();
AlertDialog alertDialog = ShadowAlertDialog.getLatestAlertDialog();
assertNotNull(alertDialog);
assertThat(alertDialog.getListView().getAdapter()).hasCount(1);
alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).performClick();
assertThat(alertDialog).isNotShowing();
((ShadowSupportDrawerLayout) ShadowExtractor.extract(activity.findViewById(R.id.drawer_layout))).getDrawerListeners().get(0).onDrawerClosed(activity.findViewById(R.id.drawer));
assertThat(shadowOf(activity).getNextStartedActivity()).hasComponent(activity, LoginActivity.class);
}
Aggregations