private void loadEvents() { EventFilterRequestParams params = new EventFilterRequestParams(); params.setOrganizationId(organization.getId()); setWorking(true); Workers.load( new EventRegisteredLoader(params), new EventRegisteredLoaderListener() { @Override public void onInternetException(Exception e) { UiTool.toast(R.string.error_no_internet, getApplicationContext()); setWorking(false); } @Override public void onServerSideException(ApiCall.ApiServerSideException e) { UiTool.toast(R.string.error_server, getApplicationContext()); setWorking(false); } @Override public void onResult(EventFilterResponseData result) { UserInEvent[] userInEvents = result.getUserInEvents(); if (userInEvents == null) userInEvents = new UserInEvent[0]; OrganizationInEvent[] orgInEvents = result.getOrganizationInEvents(); if (orgInEvents == null) orgInEvents = new OrganizationInEvent[0]; onEventsLoaded(userInEvents, orgInEvents); setWorking(false); } }, this, true); }
@Override protected void onCreate(Bundle state) { super.onCreate(state); setContentView(R.layout.activity_organization); organization = IntentHelper.getOrganization(getIntent()); user = IntentHelper.getUser(getIntent()); getSupportActionBar().setTitle(organization.getName()); initEvents(); initPreregisterButton(); loadEvents(); String description = organization.getDescription(); if (description != null) { description = description.trim(); } ((TextView) findViewById(R.id.organization_description)).setText(description); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_REGISTER) { EventFilterRequestParams params = new EventFilterRequestParams(); params.setOrganizationId(organization.getId()); EventRegisteredLoader loader = (EventRegisteredLoader) Workers.load( new EventRegisteredLoader(params), new EventRegisteredLoaderListener() { @Override public void onInternetException(Exception e) { UiTool.toast(R.string.error_no_internet, getApplicationContext()); } @Override public void onServerSideException(ApiCall.ApiServerSideException e) { UiTool.toast(R.string.error_server, getApplicationContext()); } @Override public void onResult(EventFilterResponseData result) { UserInEvent[] userInEvents = result.getUserInEvents(); if (userInEvents == null) userInEvents = new UserInEvent[0]; OrganizationInEvent[] orgInEvents = result.getOrganizationInEvents(); if (orgInEvents == null) orgInEvents = new OrganizationInEvent[0]; onEventsLoaded(userInEvents, orgInEvents); } }, this, true); } }