Search in sources :

Example 1 with SendButtonAction

use of de.pixart.messenger.ui.util.SendButtonAction in project Pix-Art-Messenger by kriztan.

the class ConversationFragment method updateSendButton.

public void updateSendButton() {
    boolean useSendButtonToIndicateStatus = PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("send_button_status", getResources().getBoolean(R.bool.send_button_status));
    final Conversation c = this.conversation;
    final Presence.Status status;
    final String text = this.binding.textinput == null ? "" : this.binding.textinput.getText().toString();
    final SendButtonAction action = SendButtonTool.getAction(getActivity(), c, text);
    if (useSendButtonToIndicateStatus && c.getAccount().getStatus() == Account.State.ONLINE) {
        if (activity.xmppConnectionService != null && activity.xmppConnectionService.getMessageArchiveService().isCatchingUp(c)) {
            status = Presence.Status.OFFLINE;
        } else if (c.getMode() == Conversation.MODE_SINGLE) {
            status = c.getContact().getShownStatus();
        } else {
            status = c.getMucOptions().online() ? Presence.Status.ONLINE : Presence.Status.OFFLINE;
        }
    } else {
        status = Presence.Status.OFFLINE;
    }
    this.binding.textSendButton.setTag(action);
    this.binding.textSendButton.setImageResource(SendButtonTool.getSendButtonImageResource(getActivity(), action, status));
}
Also used : SendButtonAction(de.pixart.messenger.ui.util.SendButtonAction) Presence(de.pixart.messenger.entities.Presence) Conversation(de.pixart.messenger.entities.Conversation)

Aggregations

Conversation (de.pixart.messenger.entities.Conversation)1 Presence (de.pixart.messenger.entities.Presence)1 SendButtonAction (de.pixart.messenger.ui.util.SendButtonAction)1