Disable input bar for RSS feeds

This commit is contained in:
Niels Andriesse 2019-08-28 15:17:13 +10:00
parent fb8104cd18
commit 386b219076

View File

@ -2131,6 +2131,14 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
}
private void updateInputPanel() {
Recipient recipient = DatabaseFactory.getThreadDatabase(this).getRecipientForThreadId(threadId);
boolean isGroup = recipient.isGroupRecipient();
if (isGroup) {
boolean isRSSFeed = recipient.getName().equals("Loki News") || recipient.getName().equals("Loki Messenger Updates"); // TODO: This is just a temporary hack and should be removed ASAP
inputPanel.setEnabled(!isRSSFeed);
String hint = isRSSFeed ? "Input disabled" : "New Message";
inputPanel.setHint(hint);
} else {
boolean hasPendingFriendRequest = DatabaseFactory.getLokiThreadDatabase(this).hasPendingFriendRequest(threadId);
inputPanel.setEnabled(!hasPendingFriendRequest);
int hintID = hasPendingFriendRequest ? R.string.activity_conversation_pending_friend_request_hint : R.string.activity_conversation_default_hint;
@ -2141,6 +2149,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
inputMethodManager.showSoftInput(inputPanel.composeText, 0);
}
}
}
private void sendMessage() {
if (inputPanel.isRecordingInLockedMode()) {
@ -2189,8 +2198,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
Toast.LENGTH_LONG).show();
Log.w(TAG, ex);
} catch (InvalidMessageException ex) {
Toast.makeText(ConversationActivity.this, R.string.ConversationActivity_message_is_empty_exclamation,
Toast.LENGTH_SHORT).show();
// Toast.makeText(ConversationActivity.this, R.string.ConversationActivity_message_is_empty_exclamation,
// Toast.LENGTH_SHORT).show();
Log.w(TAG, ex);
}
}