MCPcopy Create free account
hub / github.com/Odoo-mobile/framework / accountSelectionDialog

Method accountSelectionDialog

src/com/odoo/MainActivity.java:336–385  ·  view source on GitHub ↗
(final List<OEUser> accounts)

Source from the content-addressed store, hash-verified

334 OEUser mAccount = null;
335
336 public Dialog accountSelectionDialog(final List<OEUser> accounts) {
337
338 AlertDialog.Builder builder = new AlertDialog.Builder(this);
339
340 builder.setTitle(R.string.title_select_account)
341 .setSingleChoiceItems(accountList(accounts), 1,
342 new DialogInterface.OnClickListener() {
343
344 @Override
345 public void onClick(DialogInterface dialog,
346 int which) {
347 mAccount = accounts.get(which);
348 }
349 })
350 .setNeutralButton(R.string.label_new, new OnClickListener() {
351
352 @Override
353 public void onClick(DialogInterface dialog, int which) {
354 getActionBar().setDisplayHomeAsUpEnabled(false);
355 getActionBar().setHomeButtonEnabled(false);
356 AccountFragment fragment = new AccountFragment();
357 startMainFragment(fragment, false);
358 }
359 })
360 // Set the action buttons
361 .setPositiveButton(R.string.label_login,
362 new DialogInterface.OnClickListener() {
363 @Override
364 public void onClick(DialogInterface dialog, int id) {
365 if (mAccount != null) {
366 OdooAccountManager.loginUser(mContext,
367 mAccount.getAndroidName());
368 } else {
369 Toast.makeText(mContext,
370 "Please select account",
371 Toast.LENGTH_LONG).show();
372 }
373 init();
374 }
375 })
376 .setNegativeButton(R.string.label_cancel,
377 new DialogInterface.OnClickListener() {
378 @Override
379 public void onClick(DialogInterface dialog, int id) {
380 finish();
381 }
382 });
383
384 return builder.create();
385 }
386
387 @Override
388 public void refreshDrawer(String tag_key) {

Callers 1

initMethod · 0.95

Calls 3

accountListMethod · 0.95
setTitleMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected