From 0674537f39274ae11761095e2a254f16e8ee5f88 Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Sat, 3 Sep 2022 11:33:38 -0700 Subject: [PATCH] no duplicates --- .../page/s3manager/ObjectSelect.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java b/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java index 7b7f91f..5e840b7 100644 --- a/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java +++ b/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java @@ -26,13 +26,14 @@ import com.amazonaws.services.s3.model.S3ObjectSummary; import java.net.URL; import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; public class ObjectSelect extends AppCompatActivity { ArrayList Name; ArrayList Img; - ArrayList object; + //ArrayList object; RecyclerView recyclerView; String username, password, endpoint, bucket, prefix; int treelevel; @@ -72,16 +73,25 @@ public class ObjectSelect extends AppCompatActivity { ListObjectsV2Result result = s3client.listObjectsV2(bucket, "/"); //System.out.println(objects); //This convert bucket list to an array list - Name = new ArrayList(); Img = new ArrayList(); + LinkedHashSet object = new LinkedHashSet(); // Print bucket names //System.out.println("Buckets:"); - int i=0; + //int i=0; List objects = result.getObjectSummaries(); for (S3ObjectSummary os : objects) { filename = os.getKey().split("/"); - Name.add(filename[treelevel]); - if (os.getKey().endsWith(".opus") || os.getKey().endsWith(".ogg") + object.add(filename[treelevel]); + + //i++; + } + + Name = new ArrayList(object); + //Img.add(R.drawable.unknownfile); + int i = 0; + while(i