This commit is contained in:
Grishka 2022-11-14 22:59:34 +04:00
parent 2c11b879ae
commit 539ac26e0d
1 changed files with 14 additions and 1 deletions

View File

@ -35,6 +35,8 @@ import java.util.stream.Collectors;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import me.grishka.appkit.Nav; import me.grishka.appkit.Nav;
import me.grishka.appkit.api.Callback;
import me.grishka.appkit.api.ErrorResponse;
import me.grishka.appkit.api.SimpleCallback; import me.grishka.appkit.api.SimpleCallback;
import me.grishka.appkit.utils.MergeRecyclerAdapter; import me.grishka.appkit.utils.MergeRecyclerAdapter;
import me.grishka.appkit.utils.V; import me.grishka.appkit.utils.V;
@ -128,7 +130,7 @@ public class SearchFragment extends BaseStatusListFragment<SearchResult>{
}else{ }else{
progressVisibilityListener.onProgressVisibilityChanged(true); progressVisibilityListener.onProgressVisibilityChanged(true);
currentRequest=new GetSearchResults(currentQuery, null, true) currentRequest=new GetSearchResults(currentQuery, null, true)
.setCallback(new SimpleCallback<>(this){ .setCallback(new Callback<>(){
@Override @Override
public void onSuccess(SearchResults result){ public void onSuccess(SearchResults result){
ArrayList<SearchResult> results=new ArrayList<>(); ArrayList<SearchResult> results=new ArrayList<>();
@ -148,6 +150,17 @@ public class SearchFragment extends BaseStatusListFragment<SearchResult>{
unfilteredResults=results; unfilteredResults=results;
onDataLoaded(filterSearchResults(results), false); onDataLoaded(filterSearchResults(results), false);
} }
@Override
public void onError(ErrorResponse error){
currentRequest=null;
Activity a=getActivity();
if(a==null)
return;
error.showToast(a);
if(progressVisibilityListener!=null)
progressVisibilityListener.onProgressVisibilityChanged(false);
}
}) })
.exec(accountID); .exec(accountID);
} }