@SuppressWarnings("UnusedDeclaration") public void onEventMainThread(ShowDisclaimerEvent event) { mBus.removeStickyEvent(ShowDisclaimerEvent.class); if (!Installation.wasDisclaimerShown(this)) { final MainActivity that = this; AlertDialog dialog = new AlertDialog.Builder(this) .setTitle(R.string.disclaimer_header) .setMessage(R.string.disclaimer) .setPositiveButton( R.string.accept, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { Installation.setDisclaimerShown(that); mBus.post(new DisclaimerAcceptedEvent()); } }) .setNegativeButton( R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { that.finish(); } }) .create(); dialog.show(); } else { mBus.post(new DisclaimerAcceptedEvent()); } }
@SuppressWarnings("UnusedDeclaration") public void onEvent(DisclaimerAcceptedEvent event) { if (!Installation.wasChooseAccountShown(this)) { final MainActivity that = this; new ChooseAccountFragment( new Runnable() { @Override public void run() { Installation.setChooseAccountShown(that); mBus.post(new AccountChoosnEvent()); } }) .show(getSupportFragmentManager(), "choose_account"); } else { mBus.post(new AccountChoosnEvent()); } }