public void setSearchQuery(String query) { if (mPendingJobId != NO_ID) { mJobManager.cancelJobInBackground(mPendingJobId, false); } mQuery = query; mPendingJobId = mJobManager.addJob(new FetchSearchPage(mQuery, 1)); mWatchMeAdapter.clear(); if (!isProgressVisible()) { showProgress(); } }
@Subscribe @SuppressWarnings("unused") public void onSearchResult(State.OnSearchResponseEvent event) { Mover.SearchPage response = (Mover.SearchPage) event.page; mPendingJobId = NO_ID; if (!response.hasResult()) { return; } mCurrentPageNumber = response.getPageNumber(); mSearchPagesCount = response.getPagesCount(); showContent(); mWatchMeAdapter.add( getString(R.string.section_paginated_page, mCurrentPageNumber), response.getVideos(), response.getVideos().size()); }