Browse Source

removed "@" for consistency

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
fcdcef4ebb
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 6
      app/src/main/java/awais/instagrabber/utils/DownloadUtils.java

6
app/src/main/java/awais/instagrabber/utils/DownloadUtils.java

@ -142,7 +142,7 @@ public final class DownloadUtils {
final String sliderPostfix, final String sliderPostfix,
final String displayUrl, final String displayUrl,
final String username) { final String username) {
final String usernamePrepend = TextUtils.isEmpty(username) ? "" : "@" + username + "_";
final String usernamePrepend = TextUtils.isEmpty(username) ? "" : (username + "_");
final String fileName = usernamePrepend + postId + sliderPostfix + getFileExtensionFromUrl(displayUrl); final String fileName = usernamePrepend + postId + sliderPostfix + getFileExtensionFromUrl(displayUrl);
return new File(finalDir, fileName); return new File(finalDir, fileName);
} }
@ -278,7 +278,7 @@ public final class DownloadUtils {
final String baseFileName = storyModel.getStoryMediaId() + "_" final String baseFileName = storyModel.getStoryMediaId() + "_"
+ storyModel.getTimestamp() + DownloadUtils.getFileExtensionFromUrl(url); + storyModel.getTimestamp() + DownloadUtils.getFileExtensionFromUrl(url);
final String usernamePrepend = Utils.settingsHelper.getBoolean(Constants.DOWNLOAD_PREPEND_USER_NAME) final String usernamePrepend = Utils.settingsHelper.getBoolean(Constants.DOWNLOAD_PREPEND_USER_NAME)
&& storyModel.getUsername() != null ? "@" + storyModel.getUsername() + "_" : "";
&& storyModel.getUsername() != null ? storyModel.getUsername() + "_" : "";
final File saveFile = new File(downloadDir, final File saveFile = new File(downloadDir,
usernamePrepend + baseFileName); usernamePrepend + baseFileName);
download(context, url, saveFile.getAbsolutePath()); download(context, url, saveFile.getAbsolutePath());
@ -306,7 +306,7 @@ public final class DownloadUtils {
final Map<String, String> map = new HashMap<>(); final Map<String, String> map = new HashMap<>();
for (final Media media : feedModels) { for (final Media media : feedModels) {
final User mediaUser = media.getUser(); final User mediaUser = media.getUser();
final File downloadDir = getDownloadDir(context, mediaUser == null ? "" : "@" + mediaUser.getUsername());
final File downloadDir = getDownloadDir(context, mediaUser == null ? "" : mediaUser.getUsername());
if (downloadDir == null) return; if (downloadDir == null) return;
switch (media.getMediaType()) { switch (media.getMediaType()) {
case MEDIA_TYPE_IMAGE: case MEDIA_TYPE_IMAGE:

Loading…
Cancel
Save