mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-26 08:37:29 +00:00
dm attachment filename issue
This commit is contained in:
parent
eb21854ee7
commit
ddb911624c
@ -98,19 +98,19 @@ public final class DownloadUtils {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private static void dmDownloadImpl(@NonNull final Context context,
|
// private static void dmDownloadImpl(@NonNull final Context context,
|
||||||
@Nullable final String username,
|
// @Nullable final String username,
|
||||||
final String modelId,
|
// final String modelId,
|
||||||
final String url) {
|
// final String url) {
|
||||||
final File dir = getDownloadDir(context, username);
|
// final File dir = getDownloadDir(context, username);
|
||||||
if (dir.exists() || dir.mkdirs()) {
|
// if (dir.exists() || dir.mkdirs()) {
|
||||||
download(context,
|
// download(context,
|
||||||
url,
|
// url,
|
||||||
getDownloadSaveFile(dir, modelId, url).getAbsolutePath());
|
// getDownloadSaveFile(dir, modelId, url).getAbsolutePath());
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
Toast.makeText(context, R.string.error_creating_folders, Toast.LENGTH_SHORT).show();
|
// Toast.makeText(context, R.string.error_creating_folders, Toast.LENGTH_SHORT).show();
|
||||||
}
|
// }
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private static File getDownloadSaveFile(final File finalDir,
|
private static File getDownloadSaveFile(final File finalDir,
|
||||||
@ -297,7 +297,14 @@ public final class DownloadUtils {
|
|||||||
case MEDIA_TYPE_IMAGE:
|
case MEDIA_TYPE_IMAGE:
|
||||||
case MEDIA_TYPE_VIDEO: {
|
case MEDIA_TYPE_VIDEO: {
|
||||||
final String url = getUrlOfType(media);
|
final String url = getUrlOfType(media);
|
||||||
final File file = getDownloadSaveFile(downloadDir, media.getCode(), url);
|
String fileName = media.getId();
|
||||||
|
if (mediaUser != null) {
|
||||||
|
fileName = mediaUser.getUsername() + "_" + fileName;
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(media.getCode())) {
|
||||||
|
fileName = media.getCode();
|
||||||
|
}
|
||||||
|
final File file = getDownloadSaveFile(downloadDir, fileName, url);
|
||||||
map.put(url, file.getAbsolutePath());
|
map.put(url, file.getAbsolutePath());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user