use of eu.siacs.conversations.ui.interfaces.OnConversationSelected in project Conversations by siacs.
the class ConversationsOverviewFragment method onCreateView.
@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
this.mSwipeEscapeVelocity = getResources().getDimension(R.dimen.swipe_escape_velocity);
this.binding = DataBindingUtil.inflate(inflater, R.layout.fragment_conversations_overview, container, false);
this.binding.fab.setOnClickListener((view) -> StartConversationActivity.launch(getActivity()));
this.conversationsAdapter = new ConversationAdapter(this.activity, this.conversations);
this.conversationsAdapter.setConversationClickListener((view, conversation) -> {
if (activity instanceof OnConversationSelected) {
((OnConversationSelected) activity).onConversationSelected(conversation);
} else {
Log.w(ConversationsOverviewFragment.class.getCanonicalName(), "Activity does not implement OnConversationSelected");
}
});
this.binding.list.setAdapter(this.conversationsAdapter);
this.binding.list.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
this.touchHelper = new ItemTouchHelper(this.callback);
this.touchHelper.attachToRecyclerView(this.binding.list);
return binding.getRoot();
}
Aggregations