diff --git a/app/src/main/java/asgardius/page/s3manager/ObjectInfo.java b/app/src/main/java/asgardius/page/s3manager/ObjectInfo.java
index f91b74a..a084ce2 100644
--- a/app/src/main/java/asgardius/page/s3manager/ObjectInfo.java
+++ b/app/src/main/java/asgardius/page/s3manager/ObjectInfo.java
@@ -15,6 +15,10 @@ import com.amazonaws.regions.Region;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.S3ClientOptions;
+import com.amazonaws.services.s3.model.Bucket;
+
+import java.util.ArrayList;
+import java.util.List;
public class ObjectInfo extends AppCompatActivity {
String username, password, endpoint, bucket, object, location;
@@ -23,7 +27,8 @@ public class ObjectInfo extends AppCompatActivity {
AWSCredentials myCredentials;
AmazonS3 s3client;
ProgressBar simpleProgressBar;
- TextView filesize;
+ TextView filesize, filesizeinfo;
+ boolean isobject, isfolder;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -31,6 +36,7 @@ public class ObjectInfo extends AppCompatActivity {
setContentView(R.layout.activity_object_info);
simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
filesize = (TextView) findViewById(R.id.size);
+ filesizeinfo = (TextView) findViewById(R.id.size_info);
endpoint = getIntent().getStringExtra("endpoint");
username = getIntent().getStringExtra("username");
password = getIntent().getStringExtra("password");
@@ -50,6 +56,55 @@ public class ObjectInfo extends AppCompatActivity {
s3ClientOptions.setPathStyleAccess(true);
}
s3client.setS3ClientOptions(s3ClientOptions);
- simpleProgressBar.setVisibility(View.INVISIBLE);
+ Thread getInfo = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ //Your code goes here
+ if (object == null) {
+ isobject = false;
+ } else {
+ isobject = true;
+ if (object.endsWith("/")) {
+ isfolder = true;
+ } else {
+ isfolder = false;
+ }
+ }
+
+
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ if (isobject) {
+ if (isfolder) {
+ filesizeinfo.setText(getResources().getString(R.string.folder_size));
+ } else {
+ filesizeinfo.setText(getResources().getString(R.string.file_size));
+ }
+ } else {
+ filesizeinfo.setText(getResources().getString(R.string.bucket_size));
+ }
+ simpleProgressBar.setVisibility(View.INVISIBLE);
+ }
+ });
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
+ }
+ });
+ //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
+ finish();
+ }
+ }
+ });
+ getInfo.start();
}
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_object_info.xml b/app/src/main/res/layout/activity_object_info.xml
index a67b7c6..a58d65f 100644
--- a/app/src/main/res/layout/activity_object_info.xml
+++ b/app/src/main/res/layout/activity_object_info.xml
@@ -11,7 +11,6 @@
android:id="@+id/size_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/object_size"
android:textAlignment="center"
android:textSize="25sp" />
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index f8922f9..0ab688b 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -77,7 +77,9 @@
Hora de expiración
Crear enlace al archivo
La fecha de caducidad debe ser inferior a 7 días
- Tamaño del objeto
+ Tamaño del archivo
Propiedades
Abir en
+ Tamaño de la carpeta
+ Tamaño del bucket
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b74cd62..e1ff853 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -41,7 +41,9 @@
Download failed
Success
Properties
- Object Size
+ File Size
+ Folder Size
+ Bucket Size
Create new bucket
Bucket created successfully
Upload file in current folder