use of net.iGap.adapter.AdapterListContact in project iGap-Android by KianIranian-STDG.
the class LocalContactFragment method onViewCreated.
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
toolbarLayout = rootView.findViewById(R.id.ll_localContact_toolbar);
loadingPb = rootView.findViewById(R.id.pb_localContact);
txtNoItem = rootView.findViewById(R.id.txt_no_item);
toolbarInit();
// calculate these for recycler pagination
recyclerRowsHeight = getResources().getDimensionPixelSize(R.dimen.dp60);
deviceScreenHeight = getDeviceScreenHeight();
recyclerView = rootView.findViewById(R.id.rv_localContact);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
adapterListContact = new AdapterListContact(phoneContactsList, getContext());
recyclerView.setAdapter(adapterListContact);
recyclerView.addOnScrollListener(new EndlessRecyclerViewScrollListener(linearLayoutManager) {
@Override
public void onLoadMore(int page, int totalItemsCount, RecyclerView view) {
if (!inSearchMode || mHelperToolbar.getEditTextSearch().getText().toString().trim().equals("")) {
if (Contacts.isEndLocal) {
return;
}
loadingPb.setVisibility(View.VISIBLE);
new Contacts.FetchContactForClient().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
});
mHelperToolbar.getEditTextSearch().setImeOptions(EditorInfo.IME_ACTION_SEARCH);
mHelperToolbar.getEditTextSearch().setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
cancelSearchTimer();
String text = mHelperToolbar.getEditTextSearch().getText().toString().trim();
if (text.equals(""))
return true;
new SearchAsync(text).execute();
return true;
}
return false;
}
});
}
Aggregations