This commit is contained in:
tom79 2019-08-07 19:05:06 +02:00
parent 4b314edbcd
commit e4ef497985
1 changed files with 11 additions and 6 deletions

View File

@ -83,10 +83,9 @@ public class DisplaySearchTagsFragment extends Fragment implements OnRetrieveSea
Bundle bundle = this.getArguments(); Bundle bundle = this.getArguments();
if (bundle != null) { if (bundle != null) {
search = bundle.getString("search"); search = bundle.getString("search");
if (search != null) if (search == null) {
new RetrieveSearchAsyncTask(context, search.trim(), DisplaySearchTagsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else
Toasty.error(context, getString(R.string.toast_error_search), Toast.LENGTH_LONG).show(); Toasty.error(context, getString(R.string.toast_error_search), Toast.LENGTH_LONG).show();
}
} else { } else {
Toasty.error(context, getString(R.string.toast_error_search), Toast.LENGTH_LONG).show(); Toasty.error(context, getString(R.string.toast_error_search), Toast.LENGTH_LONG).show();
} }
@ -123,7 +122,9 @@ public class DisplaySearchTagsFragment extends Fragment implements OnRetrieveSea
tags = new ArrayList<>(); tags = new ArrayList<>();
max_id = "0"; max_id = "0";
searchTagsAdapter.notifyItemRangeRemoved(0, size); searchTagsAdapter.notifyItemRangeRemoved(0, size);
new RetrieveSearchAsyncTask(context, search, API.searchType.TAGS, null,DisplaySearchTagsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); if( search != null) {
new RetrieveSearchAsyncTask(context, search, API.searchType.TAGS, null,DisplaySearchTagsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
} }
}); });
lv_search_tags.addOnScrollListener(new RecyclerView.OnScrollListener() { lv_search_tags.addOnScrollListener(new RecyclerView.OnScrollListener() {
@ -136,7 +137,9 @@ public class DisplaySearchTagsFragment extends Fragment implements OnRetrieveSea
if(firstVisibleItem + visibleItemCount == totalItemCount && context != null) { if(firstVisibleItem + visibleItemCount == totalItemCount && context != null) {
if(!flag_loading ) { if(!flag_loading ) {
flag_loading = true; flag_loading = true;
new RetrieveSearchAsyncTask(context, search, API.searchType.TAGS, max_id, DisplaySearchTagsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); if( search != null) {
new RetrieveSearchAsyncTask(context, search, API.searchType.TAGS, max_id, DisplaySearchTagsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
loading_next_tags.setVisibility(View.VISIBLE); loading_next_tags.setVisibility(View.VISIBLE);
} }
} else { } else {
@ -145,7 +148,9 @@ public class DisplaySearchTagsFragment extends Fragment implements OnRetrieveSea
} }
} }
}); });
new RetrieveSearchAsyncTask(context, search, API.searchType.TAGS, null,DisplaySearchTagsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); if( search != null) {
new RetrieveSearchAsyncTask(context, search, API.searchType.TAGS, null, DisplaySearchTagsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
return rootView; return rootView;
} }