use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class UpdateEventFragment method setupPlacesAutocomplete.
private void setupPlacesAutocomplete() {
ApplicationInfo ai = null;
try {
ai = getContext().getPackageManager().getApplicationInfo(getContext().getPackageName(), PackageManager.GET_META_DATA);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
Bundle bundle = ai.metaData;
String placesApiKey = bundle.getString("com.google.android.geo.API_KEY");
Places.initialize(getActivity().getApplicationContext(), placesApiKey);
AutocompleteSupportFragment autocompleteFragment = (AutocompleteSupportFragment) getChildFragmentManager().findFragmentById(R.id.autocomplete_fragment);
autocompleteFragment.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME, Place.Field.LAT_LNG, Place.Field.ADDRESS));
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
Timber.d(place.getAddress());
Event event = binding.getEvent();
event.latitude = place.getLatLng().latitude;
event.longitude = place.getLatLng().longitude;
event.locationName = place.getAddress();
event.searchableLocationName = place.getName();
}
@Override
public void onError(Status status) {
ViewUtils.showSnackbar(binding.getRoot(), status.getStatusMessage());
}
});
}
use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class CreateTrackViewModel method createTrack.
public void createTrack() {
nullifyEmptyFields(track);
long eventId = ContextManager.getSelectedEvent().getId();
Event event = new Event();
event.setId(eventId);
track.setEvent(event);
compositeDisposable.add(trackRepository.createTrack(track).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> progress.setValue(false)).subscribe(createdTrack -> {
success.setValue("Track Created");
dismiss.call();
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class CreateSpeakersCallViewModel method updateSpeakersCall.
public void updateSpeakersCall(long eventId) {
if (!verify())
return;
Event event = new Event();
event.setId(eventId);
speakersCallLive.getValue().setEvent(event);
compositeDisposable.add(speakersCallRepository.updateSpeakersCall(speakersCallLive.getValue()).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> progress.setValue(false)).subscribe(var -> success.setValue("Speakers Call Updated Successfully"), throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class CreateSpeakersCallViewModel method createSpeakersCall.
public void createSpeakersCall(long eventId) {
if (!verify())
return;
Event event = new Event();
event.setId(eventId);
speakersCallLive.getValue().setEvent(event);
compositeDisposable.add(speakersCallRepository.createSpeakersCall(speakersCallLive.getValue()).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> progress.setValue(false)).subscribe(var -> success.setValue("Speakers Call Created Successfully"), throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
use of com.eventyay.organizer.data.event.Event in project open-event-orga-app by fossasia.
the class CreateSponsorViewModel method updateSponsor.
public void updateSponsor() {
nullifyEmptyFields(sponsor);
long eventId = ContextManager.getSelectedEvent().getId();
Event event = new Event();
event.setId(eventId);
sponsor.setEvent(event);
compositeDisposable.add(sponsorRepository.updateSponsor(sponsor).doOnSubscribe(disposable -> progress.setValue(true)).doFinally(() -> progress.setValue(false)).subscribe(updatedSponsor -> {
success.setValue("Sponsor Updated");
dismiss.call();
}, throwable -> error.setValue(ErrorUtils.getMessage(throwable).toString())));
}
Aggregations