From 1a57969abe6854434c45f6581e40aec969625bd1 Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Sun, 16 Aug 2020 06:04:50 +0900 Subject: [PATCH] simplify logic --- .../instagrabber/activities/DirectMessageThread.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/activities/DirectMessageThread.java b/app/src/main/java/awais/instagrabber/activities/DirectMessageThread.java index 9e0c0ff8..50c65708 100644 --- a/app/src/main/java/awais/instagrabber/activities/DirectMessageThread.java +++ b/app/src/main/java/awais/instagrabber/activities/DirectMessageThread.java @@ -86,9 +86,11 @@ public final class DirectMessageThread extends BaseLanguageActivity { } }; private final View.OnClickListener newCommentListener = v -> { - if (Utils.isEmpty(dmsBinding.commentText.getText().toString()) && v == dmsBinding.commentSend) - Toast.makeText(getApplicationContext(), R.string.comment_send_empty_comment, Toast.LENGTH_SHORT).show(); - else if (v == dmsBinding.commentSend) { + if (v == dmsBinding.commentSend) { + if (Utils.isEmpty(dmsBinding.commentText.getText().toString())) { + Toast.makeText(getApplicationContext(), R.string.comment_send_empty_comment, Toast.LENGTH_SHORT).show(); + return; + } final CommentAction action = new CommentAction(dmsBinding.commentText.getText().toString(), threadid); action.setOnTaskCompleteListener(result -> { if (!result) {