use of im.actor.sdk.view.adapters.OnItemClickedListener in project actor-platform by actorapp.
the class GlobalSearchBaseFragment method showSearch.
private void showSearch() {
if (isSearchVisible) {
return;
}
isSearchVisible = true;
searchDisplay = messenger().buildSearchDisplayList();
searchDisplay.setBindHook(new BindedDisplayList.BindHook<SearchEntity>() {
@Override
public void onScrolledToEnd() {
scrolledToEnd = true;
checkGlobalSearch();
}
@Override
public void onItemTouched(SearchEntity item) {
}
});
searchAdapter = new SearchAdapter(getActivity(), searchDisplay, new OnItemClickedListener<SearchEntity>() {
@Override
public void onClicked(SearchEntity item) {
onPeerPicked(item.getPeer());
searchMenu.collapseActionView();
}
@Override
public boolean onLongClicked(SearchEntity item) {
return false;
}
});
HeaderViewRecyclerAdapter recyclerAdapter = new HeaderViewRecyclerAdapter(searchAdapter);
View header = new View(getActivity());
header.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, Screen.dp(0)));
header.setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor());
recyclerAdapter.addHeaderView(header);
searchList.setAdapter(recyclerAdapter);
RecyclerView.ItemAnimator animator = searchList.getItemAnimator();
if (animator instanceof SimpleItemAnimator) {
((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
}
searchDisplay.addListener(searchListener);
showView(searchHintView, false);
goneView(searchEmptyView, false);
showView(searchContainer, false);
Fragment parent = getParentFragment();
if (parent != null && parent instanceof GlobalSearchStateDelegate) {
((GlobalSearchStateDelegate) parent).onGlobalSearchStarted();
}
}
use of im.actor.sdk.view.adapters.OnItemClickedListener in project actor-platform by actorapp.
the class InviteFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View res = inflater.inflate(R.layout.fragment_list, container, false);
res.findViewById(R.id.listView).setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor());
emptyText = (TextView) res.findViewById(R.id.emptyView);
emptyText.setTextColor(ActorSDK.sharedActor().style.getTextSecondaryColor());
emptyText.setText(R.string.progress_common);
collection = (RecyclerListView) res.findViewById(R.id.listView);
AndroidPhoneBook phoneBookLoader = new AndroidPhoneBook();
phoneBookLoader.useDelay(false);
res.setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor());
phoneBookLoader.loadPhoneBook(contacts -> {
if (contacts.size() > 0) {
getActivity().runOnUiThread(() -> {
InviteFragment.this.contacts = contacts;
adapter = new InviteAdapter(getActivity(), contacts, new OnItemClickedListener<PhoneBookContact>() {
@Override
public void onClicked(PhoneBookContact item) {
onItemClicked(item);
}
@Override
public boolean onLongClicked(PhoneBookContact item) {
return false;
}
});
collection.setAdapter(adapter);
hideView(emptyText);
showView(collection);
showMenu();
});
}
});
return res;
}
Aggregations