Browse Source

Resolve PR comments

renovate/org.robolectric-robolectric-4.x
junhuicoding 4 years ago
parent
commit
f0167f2d93
  1. 2
      app/src/main/java/awais/instagrabber/fragments/settings/DownloadsPreferencesFragment.java
  2. 4
      app/src/main/java/awais/instagrabber/utils/DownloadUtils.java

2
app/src/main/java/awais/instagrabber/fragments/settings/DownloadsPreferencesFragment.java

@ -53,7 +53,7 @@ public class DownloadsPreferencesFragment extends BasePreferencesFragment {
private Preference getPrependUsernameToFilenamePreference(@NonNull final Context context) {
final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
preference.setKey(Constants.DOWNLOAD_PREPEND_USER_NAME);
preference.setTitle("Prepend Username to Filename");
preference.setTitle(R.string.download_prepend_username);
preference.setIconSpaceReserved(false);
return preference;
}

4
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) {
final String usernamePrepend = "".equals(username) ? "" : "@" + username + "_";
final String usernamePrepend = TextUtils.isEmpty(username) ? "" : "@" + username + "_";
final String fileName = usernamePrepend + postId + sliderPostfix + getFileExtensionFromUrl(displayUrl);
return new File(finalDir, fileName);
}
@ -228,7 +228,7 @@ public final class DownloadUtils {
final Media child = sliderItems.get(i);
if (child == null) continue;
final String url = ResponseBodyUtils.getImageUrl(child);
final File file = getDownloadChildSaveFile(downloadDir, media.getCode(), i + 1, url, username);
final File file = getDownloadChildSaveFile(downloadDir, media.getCode(), i + 1, url, usernamePrepend);
checkList.add(file.exists());
}
break;

Loading…
Cancel
Save