use of com.foobnix.ui2.fast.FastScrollStateChangeListener in project LibreraReader by foobnix.
the class SearchFragment2 method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_search2, container, false);
NO_SERIES = " (" + getString(R.string.without_series) + ")";
handler = new Handler();
secondTopPanel = view.findViewById(R.id.secondTopPanel);
countBooks = (TextView) view.findViewById(R.id.countBooks);
onRefresh = view.findViewById(R.id.onRefresh);
onRefresh.setActivated(true);
cleanFilter = (ImageView) view.findViewById(R.id.cleanFilter);
sortBy = (TextView) view.findViewById(R.id.sortBy);
sortOrder = (ImageView) view.findViewById(R.id.sortOrder);
myAutoCompleteImage = (ImageView) view.findViewById(R.id.myAutoCompleteImage);
searchEditText = (AutoCompleteTextView) view.findViewById(R.id.filterLine);
recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
myAutoCompleteImage.setVisibility(View.GONE);
((FastScrollRecyclerView) recyclerView).setFastScrollStateChangeListener(new FastScrollStateChangeListener() {
@Override
public void onFastScrollStop() {
ImageLoader.getInstance().resume();
LOG.d("ImageLoader resume");
}
@Override
public void onFastScrollStart() {
LOG.d("ImageLoader pause");
ImageLoader.getInstance().pause();
}
});
searchEditText.addTextChangedListener(filterTextWatcher);
searchEditText.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
EditTextHelper.enableKeyboardSearch(searchEditText, new Runnable() {
@Override
public void run() {
Keyboards.close(searchEditText);
Keyboards.hideNavigation(getActivity());
}
});
searchAdapter = new FileMetaAdapter();
authorsAdapter = new AuthorsAdapter2();
onGridlList = (ImageView) view.findViewById(R.id.onGridList);
onGridlList.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
popupMenu(onGridlList);
}
});
onRefresh.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!onRefresh.isActivated()) {
Toast.makeText(getActivity(), R.string.extracting_information_from_books, Toast.LENGTH_LONG).show();
return;
}
PrefDialogs.chooseFolderDialog(getActivity(), new Runnable() {
@Override
public void run() {
AppState.get().searchPaths = AppState.get().searchPaths.replace("//", "/");
}
}, new Runnable() {
@Override
public void run() {
recyclerView.scrollToPosition(0);
seachAll();
}
});
}
});
cleanFilter.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
searchEditText.setText("");
recyclerView.scrollToPosition(0);
searchAndOrderAsync();
}
});
sortBy.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
sortByPopup(v);
}
});
sortOrder.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AppState.get().isSortAsc = !AppState.get().isSortAsc;
searchAndOrderAsync();
}
});
bindAdapter(searchAdapter);
searchAdapter.setOnAuthorClickListener(onAuthorClick);
searchAdapter.setOnSeriesClickListener(onSeriesClick);
authorsAdapter.setOnItemClickListener(onAuthorSeriesClick);
onGridList();
if (AppDB.get().getCount() == 0) {
seachAll();
} else {
checkForDeleteBooks();
searchAndOrderAsync();
}
initAutocomplition();
onTintChanged();
recyclerView.addOnScrollListener(new OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
}
});
myAutoCompleteImage.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showAutoCompleteDialog();
}
});
return view;
}
Aggregations