Search in sources :

Example 1 with CheckInSearchAdapter

use of cz.destil.glasquare.adapter.CheckInSearchAdapter in project glasquare by davidvavra.

the class CheckInSearchActivity method loadData.

@Override
protected void loadData() {
    showProgress(R.string.loading);
    LocationUtils.getRecentLocation(new LocationUtils.LocationListener() {

        @Override
        public void onLocationAcquired(Location location) {
            String ll = LocationUtils.getLatLon(location);
            Api.get().create(SearchVenues.class).searchForCheckIn(ll, new Callback<SearchVenues.SearchResponse>() {

                @Override
                public void success(SearchVenues.SearchResponse venuesResponse, Response response) {
                    showContent(new CheckInSearchAdapter(venuesResponse.getVenues()), new CardSelectedListener() {

                        @Override
                        public void onCardSelected(Object item) {
                            SearchVenues.Venue venue = (SearchVenues.Venue) item;
                            CheckInActivity.call(CheckInSearchActivity.this, venue.id, venue.name);
                        }
                    });
                }

                @Override
                public void failure(RetrofitError retrofitError) {
                    showError(R.string.error_please_try_again);
                }
            });
        }

        @Override
        public void onLocationFailed() {
            showError(R.string.no_location);
        }
    });
}
Also used : LocationUtils(cz.destil.glasquare.util.LocationUtils) SearchVenues(cz.destil.glasquare.api.SearchVenues) Response(retrofit.client.Response) CheckInSearchAdapter(cz.destil.glasquare.adapter.CheckInSearchAdapter) Callback(retrofit.Callback) Location(android.location.Location) RetrofitError(retrofit.RetrofitError)

Aggregations

Location (android.location.Location)1 CheckInSearchAdapter (cz.destil.glasquare.adapter.CheckInSearchAdapter)1 SearchVenues (cz.destil.glasquare.api.SearchVenues)1 LocationUtils (cz.destil.glasquare.util.LocationUtils)1 Callback (retrofit.Callback)1 RetrofitError (retrofit.RetrofitError)1 Response (retrofit.client.Response)1