Search in sources :

Example 1 with SendBroadcastCommentManager

use of me.zhanghai.android.douya.broadcast.content.SendBroadcastCommentManager in project Douya by DreaminginCodeZH.

the class BroadcastFragment method updateSendCommentStatus.

private void updateSendCommentStatus() {
    boolean canSendComment = canSendComment();
    SendBroadcastCommentManager manager = SendBroadcastCommentManager.getInstance();
    boolean hasBroadcast = mResource.hasEffectiveBroadcast();
    boolean sendingComment = hasBroadcast && manager.isWriting(mResource.getEffectiveBroadcastId());
    boolean enabled = canSendComment && !sendingComment;
    mCommentEdit.setEnabled(enabled);
    mSendButton.setEnabled(enabled);
    mCommentEdit.setHint(!hasBroadcast || canSendComment ? R.string.broadcast_send_comment_hint : R.string.broadcast_send_comment_hint_disabled);
    if (sendingComment) {
        mCommentEdit.setText(manager.getComment(mResource.getEffectiveBroadcastId()));
    }
}
Also used : SendBroadcastCommentManager(me.zhanghai.android.douya.broadcast.content.SendBroadcastCommentManager)

Example 2 with SendBroadcastCommentManager

use of me.zhanghai.android.douya.broadcast.content.SendBroadcastCommentManager in project Douya by DreaminginCodeZH.

the class SendCommentFragment method updateSendCommentStatus.

private void updateSendCommentStatus() {
    if (mCommentSent) {
        return;
    }
    SendBroadcastCommentManager manager = SendBroadcastCommentManager.getInstance();
    boolean sendingComment = manager.isWriting(mBroadcastId);
    getActivity().setTitle(sendingComment ? R.string.broadcast_send_comment_title_sending : R.string.broadcast_send_comment_title);
    boolean enabled = !sendingComment;
    mTextEdit.setEnabled(enabled);
    if (mSendCommentMenuItem != null) {
        mSendCommentMenuItem.setEnabled(enabled);
    }
    if (sendingComment) {
        mTextEdit.setText(manager.getComment(mBroadcastId));
    }
}
Also used : SendBroadcastCommentManager(me.zhanghai.android.douya.broadcast.content.SendBroadcastCommentManager)

Aggregations

SendBroadcastCommentManager (me.zhanghai.android.douya.broadcast.content.SendBroadcastCommentManager)2