From a6289f4c1fbf21b719bfc41a99e00b2eecbd1458 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Fri, 26 Feb 2021 20:11:32 +0800 Subject: Minor bugs fixed. --- .../activities/CustomizePostFilterActivity.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java index 7b1d6ade..7e89c508 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java @@ -444,11 +444,11 @@ public class CustomizePostFilterActivity extends BaseActivity { } else if (requestCode == ADD_USERS_REQUEST_CODE) { ArrayList usernames = data.getStringArrayListExtra(SearchActivity.RETURN_EXTRA_SELECTED_USERNAMES); String currentUsers = excludesUsersTextInputEditText.getText().toString().trim(); - if (usernames != null && !currentUsers.isEmpty() && currentUsers.charAt(currentUsers.length() - 1) != ',') { - String newString = currentUsers + ","; - excludesUsersTextInputEditText.setText(newString); - } - if (usernames != null) { + if (usernames != null && !usernames.isEmpty()) { + if (!currentUsers.isEmpty() && currentUsers.charAt(currentUsers.length() - 1) != ',') { + String newString = currentUsers + ","; + excludesUsersTextInputEditText.setText(newString); + } StringBuilder stringBuilder = new StringBuilder(); for (String s : usernames) { stringBuilder.append(s).append(","); @@ -462,11 +462,11 @@ public class CustomizePostFilterActivity extends BaseActivity { private void updateExcludeSubredditNames(ArrayList subredditNames) { String currentSubreddits = excludesSubredditsTextInputEditText.getText().toString().trim(); - if (subredditNames != null && !currentSubreddits.isEmpty() && currentSubreddits.charAt(currentSubreddits.length() - 1) != ',') { - String newString = currentSubreddits + ","; - excludesSubredditsTextInputEditText.setText(newString); - } - if (subredditNames != null) { + if (subredditNames != null && !subredditNames.isEmpty()) { + if (!currentSubreddits.isEmpty() && currentSubreddits.charAt(currentSubreddits.length() - 1) != ',') { + String newString = currentSubreddits + ","; + excludesSubredditsTextInputEditText.setText(newString); + } StringBuilder stringBuilder = new StringBuilder(); for (String s : subredditNames) { stringBuilder.append(s).append(","); -- cgit v1.2.3