new release

This commit is contained in:
Page Asgardius 2022-12-29 10:54:21 -07:00
parent 44c28dc748
commit d49fb984e0
4 changed files with 28 additions and 13 deletions

View file

@ -9,8 +9,8 @@ android {
applicationId "asgardius.page.s3manager" applicationId "asgardius.page.s3manager"
minSdk 23 minSdk 23
targetSdk 33 targetSdk 33
versionCode 50 versionCode 51
versionName "0.4.4" versionName "0.5.0"
setProperty("archivesBaseName", "s3-manager-$versionName") setProperty("archivesBaseName", "s3-manager-$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -33,19 +33,19 @@ android {
dependencies { dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.4.0' implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
def exoplayer_version = "2.18.1" def exoplayer_version = "2.18.2"
implementation "com.google.android.exoplayer:exoplayer:$exoplayer_version" implementation "com.google.android.exoplayer:exoplayer:$exoplayer_version"
implementation "com.google.android.exoplayer:extension-mediasession:$exoplayer_version" implementation "com.google.android.exoplayer:extension-mediasession:$exoplayer_version"
implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.recyclerview:recyclerview:1.2.1'
// BEGIN AWS DEPENDENCIES // BEGIN AWS DEPENDENCIES
def aws_version = "2.58.0" def aws_version = "2.60.0"
implementation "com.amazonaws:aws-android-sdk-s3:$aws_version" implementation "com.amazonaws:aws-android-sdk-s3:$aws_version"
implementation ("com.amazonaws:aws-android-sdk-mobile-client:$aws_version") { transitive = true } implementation ("com.amazonaws:aws-android-sdk-mobile-client:$aws_version") { transitive = true }
// END AWS DEPENDENCIES // END AWS DEPENDENCIES
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
} }

View file

@ -9,8 +9,8 @@
<H3>Created by Page Asgardius</H3> <H3>Created by Page Asgardius</H3>
<H3>Libraries used in this app</H3> <H3>Libraries used in this app</H3>
<ul> <ul>
<li>Amazon Web Services SDK 2.58.0</li> <li>Amazon Web Services SDK 2.60.0</li>
<li>ExoPlayer 2.18.1</li> <li>ExoPlayer 2.18.2</li>
<li>Adwaita Icon Theme for GNOME 43</li> <li>Adwaita Icon Theme for GNOME 43</li>
<li>pdf.js</li> <li>pdf.js</li>
</ul> </ul>

View file

@ -41,6 +41,7 @@ public class Downloader extends AppCompatActivity {
String username, password, endpoint, bucket, filename, prefix, location; String username, password, endpoint, bucket, filename, prefix, location;
Uri fileuri, filepath; Uri fileuri, filepath;
Region region; Region region;
String[] folder;
S3ClientOptions s3ClientOptions; S3ClientOptions s3ClientOptions;
AWSCredentials myCredentials; AWSCredentials myCredentials;
AmazonS3 s3client; AmazonS3 s3client;
@ -128,7 +129,6 @@ public class Downloader extends AppCompatActivity {
//s3client.createBucket(bucket, location); //s3client.createBucket(bucket, location);
//System.out.println(fkey); //System.out.println(fkey);
if (isfolder) { if (isfolder) {
document = DocumentFile.fromTreeUri(getApplicationContext(), fileuri);
if (prefix == null) { if (prefix == null) {
orequest = new ListObjectsRequest().withBucketName(bucket).withMaxKeys(1000); orequest = new ListObjectsRequest().withBucketName(bucket).withMaxKeys(1000);
} else { } else {
@ -161,8 +161,22 @@ public class Downloader extends AppCompatActivity {
} }
for (String os : objectlist) { for (String os : objectlist) {
document = DocumentFile.fromTreeUri(getApplicationContext(), fileuri);
object = s3client.getObject(bucket, os); object = s3client.getObject(bucket, os);
filepath = document.createFile(null, os.replace(prefix, "")).getUri(); if (os.replace(prefix, "").contains("/")) {
folder = os.replace(prefix, "").split("/");
for (int i = 0; i < folder.length-1; i++) {
DocumentFile subfolder = document.findFile(folder[i].replace("/", ""));
if (subfolder != null) {
document = subfolder;
} else {
document = document.createDirectory(folder[i].replace("/", ""));
}
}
filepath = document.createFile(null, folder[folder.length-1]).getUri();
} else {
filepath = document.createFile(null, os.replace(prefix, "")).getUri();
}
writeContentToFile(filepath, object); writeContentToFile(filepath, object);
} }
} else { } else {

View file

@ -0,0 +1 @@
* Folder download function added