From f1df75860b5f66fbe2fa9430d4ecd11b940fb77b Mon Sep 17 00:00:00 2001 From: junhuicoding Date: Thu, 1 Apr 2021 00:48:58 +0800 Subject: [PATCH] Fix Codacy Issues --- .../main/java/awais/instagrabber/utils/DownloadUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/utils/DownloadUtils.java b/app/src/main/java/awais/instagrabber/utils/DownloadUtils.java index fe92a0ce..d06ef850 100644 --- a/app/src/main/java/awais/instagrabber/utils/DownloadUtils.java +++ b/app/src/main/java/awais/instagrabber/utils/DownloadUtils.java @@ -142,7 +142,7 @@ public final class DownloadUtils { final String sliderPostfix, final String displayUrl, final String username) { - String usernamePrepend = (username.equals("")) ? "" : "@" + username + "_"; + final String usernamePrepend = "".equals(username) ? "" : "@" + username + "_"; final String fileName = usernamePrepend + postId + sliderPostfix + getFileExtensionFromUrl(displayUrl); return new File(finalDir, fileName); } @@ -212,8 +212,8 @@ public final class DownloadUtils { username = user.getUsername(); } final File downloadDir = getDownloadDir(null, "@" + username, true); - String usernamePrepend = (Utils.settingsHelper.getBoolean(Constants.DOWNLOAD_PREPEND_USER_NAME) - && user != null) ? username : ""; + final String usernamePrepend = Utils.settingsHelper.getBoolean(Constants.DOWNLOAD_PREPEND_USER_NAME) + && user != null ? username : ""; switch (media.getMediaType()) { case MEDIA_TYPE_IMAGE: case MEDIA_TYPE_VIDEO: { @@ -339,7 +339,7 @@ public final class DownloadUtils { } final Media child = sliderItems.get(i); final String url = getUrlOfType(child); - String usernamePrepend = (Utils.settingsHelper.getBoolean(Constants.DOWNLOAD_PREPEND_USER_NAME) && mediaUser != null) ? mediaUser.getUsername() : ""; + final String usernamePrepend = Utils.settingsHelper.getBoolean(Constants.DOWNLOAD_PREPEND_USER_NAME) && mediaUser != null ? mediaUser.getUsername() : ""; final File file = getDownloadChildSaveFile(downloadDir, media.getCode(), i + 1, url, usernamePrepend); map.put(url, file.getAbsolutePath()); }