mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Convert few model classes to kotlin (#3270)
This commit is contained in:
parent
d0f97398a5
commit
b0be4970ef
86 changed files with 661 additions and 1300 deletions
|
|
@ -58,32 +58,29 @@ class PickedFiles implements Constants {
|
|||
}
|
||||
|
||||
static void copyFilesInSeparateThread(final Context context, final List<UploadableFile> filesToCopy) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<File> copiedFiles = new ArrayList<>();
|
||||
int i = 1;
|
||||
for (UploadableFile uploadableFile : filesToCopy) {
|
||||
File fileToCopy = uploadableFile.getFile();
|
||||
File dstDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), getFolderName(context));
|
||||
if (!dstDir.exists()) dstDir.mkdirs();
|
||||
new Thread(() -> {
|
||||
List<File> copiedFiles = new ArrayList<>();
|
||||
int i = 1;
|
||||
for (UploadableFile uploadableFile : filesToCopy) {
|
||||
File fileToCopy = uploadableFile.getFile();
|
||||
File dstDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), getFolderName(context));
|
||||
if (!dstDir.exists()) dstDir.mkdirs();
|
||||
|
||||
String[] filenameSplit = fileToCopy.getName().split("\\.");
|
||||
String extension = "." + filenameSplit[filenameSplit.length - 1];
|
||||
String filename = String.format("IMG_%s_%d.%s", new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()), i, extension);
|
||||
String[] filenameSplit = fileToCopy.getName().split("\\.");
|
||||
String extension = "." + filenameSplit[filenameSplit.length - 1];
|
||||
String filename = String.format("IMG_%s_%d.%s", new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()), i, extension);
|
||||
|
||||
File dstFile = new File(dstDir, filename);
|
||||
try {
|
||||
dstFile.createNewFile();
|
||||
copyFile(fileToCopy, dstFile);
|
||||
copiedFiles.add(dstFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
i++;
|
||||
File dstFile = new File(dstDir, filename);
|
||||
try {
|
||||
dstFile.createNewFile();
|
||||
copyFile(fileToCopy, dstFile);
|
||||
copiedFiles.add(dstFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
scanCopiedImages(context, copiedFiles);
|
||||
i++;
|
||||
}
|
||||
scanCopiedImages(context, copiedFiles);
|
||||
}).run();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue