Search in sources :

Example 1 with ConversationAdapter

use of de.pixart.messenger.ui.adapter.ConversationAdapter 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)

Example 2 with ConversationAdapter

use of de.pixart.messenger.ui.adapter.ConversationAdapter in project Pix-Art-Messenger by kriztan.

the class ShareWithActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    boolean useBundledEmoji = getPreferences().getBoolean(USE_BUNDLED_EMOJIS, getResources().getBoolean(R.bool.use_bundled_emoji));
    new EmojiService(this).init(useBundledEmoji);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        getSupportActionBar().setHomeButtonEnabled(false);
    }
    setContentView(R.layout.activity_share_with);
    setTitle(getString(R.string.title_activity_sharewith));
    mListView = findViewById(R.id.choose_conversation_list);
    mAdapter = new ConversationAdapter(this, this.mConversations);
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener((arg0, arg1, position, arg3) -> share(mConversations.get(position)));
    if (savedInstanceState != null) {
        SharingIsRunning = savedInstanceState.getBoolean(STATE_SHARING_IS_RUNNING, false);
    }
    if (!SharingIsRunning) {
        Log.d(Config.LOGTAG, "ShareWithActivity onCreate: state restored");
        this.share = new Share();
    } else {
        Log.d(Config.LOGTAG, "ShareWithActivity onCreate: shring running, finish()");
        this.finish();
    }
}
Also used : EmojiService(de.pixart.messenger.services.EmojiService) ConversationAdapter(de.pixart.messenger.ui.adapter.ConversationAdapter)

Aggregations

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