Search in sources :

Example 1 with ExploreResponse

use of app.insti.api.response.ExploreResponse in project IITB-App by wncc.

the class ExploreFragment method doSearch.

public void doSearch(final String query) {
    if (getActivity() == null || getView() == null)
        return;
    // Set the lastest query
    currentQuery = query;
    // Make request
    RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
    retrofitInterface.search(sessionId, query).enqueue(new EmptyCallback<ExploreResponse>() {

        @Override
        public void onResponse(Call<ExploreResponse> call, Response<ExploreResponse> response) {
            // Check if we already have a new query pending
            if (!currentQuery.equals(query)) {
                return;
            }
            // Get data
            bodies = response.body().getBodies();
            events = response.body().getEvents();
            users = response.body().getUsers();
            updateAdapter(bodies, events, users);
        }
    });
}
Also used : ExploreResponse(app.insti.api.response.ExploreResponse) RetrofitInterface(app.insti.api.RetrofitInterface)

Aggregations

RetrofitInterface (app.insti.api.RetrofitInterface)1 ExploreResponse (app.insti.api.response.ExploreResponse)1