Search in sources :

Example 1 with MessageAdapter

use of eu.siacs.conversations.ui.adapter.MessageAdapter in project Conversations by siacs.

the class SearchActivity method onCreate.

@Override
public void onCreate(final Bundle bundle) {
    final Intent intent = getIntent();
    this.uuid = intent == null ? null : Strings.emptyToNull(intent.getStringExtra(EXTRA_CONVERSATION_UUID));
    final String searchTerm = bundle == null ? null : bundle.getString(EXTRA_SEARCH_TERM);
    if (searchTerm != null) {
        pendingSearchTerm.push(searchTerm);
    }
    super.onCreate(bundle);
    this.binding = DataBindingUtil.setContentView(this, R.layout.activity_search);
    setSupportActionBar(this.binding.toolbar);
    configureActionBar(getSupportActionBar());
    this.messageListAdapter = new MessageAdapter(this, this.messages);
    this.messageListAdapter.setOnContactPictureClicked(this);
    this.binding.searchResults.setAdapter(messageListAdapter);
    registerForContextMenu(this.binding.searchResults);
}
Also used : MessageAdapter(eu.siacs.conversations.ui.adapter.MessageAdapter) Intent(android.content.Intent)

Example 2 with MessageAdapter

use of eu.siacs.conversations.ui.adapter.MessageAdapter in project Conversations by siacs.

the class ConversationFragment method onCreateView.

@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    this.binding = DataBindingUtil.inflate(inflater, R.layout.fragment_conversation, container, false);
    // TODO why the fuck did we do this?
    binding.getRoot().setOnClickListener(null);
    binding.textinput.addTextChangedListener(new StylingHelper.MessageEditorStyler(binding.textinput));
    binding.textinput.setOnEditorActionListener(mEditorActionListener);
    binding.textinput.setRichContentListener(new String[] { "image/*" }, mEditorContentListener);
    binding.textSendButton.setOnClickListener(this.mSendButtonListener);
    binding.scrollToBottomButton.setOnClickListener(this.mScrollButtonListener);
    binding.messagesView.setOnScrollListener(mOnScrollListener);
    binding.messagesView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
    mediaPreviewAdapter = new MediaPreviewAdapter(this);
    binding.mediaPreview.setAdapter(mediaPreviewAdapter);
    messageListAdapter = new MessageAdapter((XmppActivity) getActivity(), this.messageList);
    messageListAdapter.setOnContactPictureClicked(this);
    messageListAdapter.setOnContactPictureLongClicked(this);
    binding.messagesView.setAdapter(messageListAdapter);
    registerForContextMenu(binding.messagesView);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        this.binding.textinput.setCustomInsertionActionModeCallback(new EditMessageActionModeCallback(this.binding.textinput));
    }
    return binding.getRoot();
}
Also used : EditMessageActionModeCallback(eu.siacs.conversations.ui.util.EditMessageActionModeCallback) MessageAdapter(eu.siacs.conversations.ui.adapter.MessageAdapter) MediaPreviewAdapter(eu.siacs.conversations.ui.adapter.MediaPreviewAdapter) StylingHelper(eu.siacs.conversations.utils.StylingHelper)

Aggregations

MessageAdapter (eu.siacs.conversations.ui.adapter.MessageAdapter)2 Intent (android.content.Intent)1 MediaPreviewAdapter (eu.siacs.conversations.ui.adapter.MediaPreviewAdapter)1 EditMessageActionModeCallback (eu.siacs.conversations.ui.util.EditMessageActionModeCallback)1 StylingHelper (eu.siacs.conversations.utils.StylingHelper)1