Search in sources :

Example 1 with OnConversationSelected

use of de.pixart.messenger.ui.interfaces.OnConversationSelected in project Pix-Art-Messenger by kriztan.

the class ConversationsOverviewFragment method onCreateView.

@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(Config.LOGTAG, "onCreateView");
    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.binding.list.setAdapter(this.conversationsAdapter);
    this.binding.list.setOnItemClickListener((parent, view, position, id) -> {
        Conversation conversation = this.conversations.get(position);
        if (activity instanceof OnConversationSelected) {
            ((OnConversationSelected) activity).onConversationSelected(conversation);
        } else {
            Log.w(ConversationsOverviewFragment.class.getCanonicalName(), "Activity does not implement OnConversationSelected");
        }
    });
    return binding.getRoot();
}
Also used : OnConversationSelected(de.pixart.messenger.ui.interfaces.OnConversationSelected) ConversationAdapter(de.pixart.messenger.ui.adapter.ConversationAdapter) Conversation(de.pixart.messenger.entities.Conversation)

Aggregations

Conversation (de.pixart.messenger.entities.Conversation)1 ConversationAdapter (de.pixart.messenger.ui.adapter.ConversationAdapter)1 OnConversationSelected (de.pixart.messenger.ui.interfaces.OnConversationSelected)1