1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-26 08:37:29 +00:00

Resolve PR comments

This commit is contained in:
junhuicoding 2021-04-03 01:24:13 +08:00
parent 2d2ad6130b
commit f0167f2d93
2 changed files with 3 additions and 3 deletions

View File

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

View File

@ -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 = "".equals(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);
} }
@ -228,7 +228,7 @@ public final class DownloadUtils {
final Media child = sliderItems.get(i); final Media child = sliderItems.get(i);
if (child == null) continue; if (child == null) continue;
final String url = ResponseBodyUtils.getImageUrl(child); 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()); checkList.add(file.exists());
} }
break; break;