object info ready

This commit is contained in:
Page Asgardius 2022-09-22 09:55:40 -07:00
parent b7beceb8b3
commit 0e49707444
6 changed files with 62 additions and 25 deletions

View file

@ -20,6 +20,8 @@ Current feature list
* File download
* pdf file reader using user provided pdf.js server
* file sharing links
* get object info
* get bucket info
Planned feature list

View file

@ -9,8 +9,8 @@ android {
applicationId "asgardius.page.s3manager"
minSdk 24
targetSdk 33
versionCode 14
versionName "0.1.12"
versionCode 15
versionName "0.1.13"
setProperty("archivesBaseName", "s3-manager-$versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -31,7 +31,7 @@ public class Share extends AppCompatActivity {
Calendar mycal;
EditText datepick, monthpick, yearpick, hourpick, minutepick;
int date, month, year, hour, minute;
Button share;
Button share, external;
public static String URLify(String str) {
str = str.trim();
@ -73,6 +73,7 @@ public class Share extends AppCompatActivity {
hourpick = (EditText)findViewById(R.id.Hour);
minutepick = (EditText)findViewById(R.id.Minute);
share = (Button)findViewById(R.id.share);
external = (Button)findViewById(R.id.open_in);
endpoint = getIntent().getStringExtra("endpoint");
username = getIntent().getStringExtra("username");
password = getIntent().getStringExtra("password");
@ -97,6 +98,11 @@ public class Share extends AppCompatActivity {
public void onClick(View view) {
//buttonaction
try {
if (datepick.getText().toString().equals("") || monthpick.getText().toString().equals("") ||
yearpick.getText().toString().equals("") || hourpick.getText().toString().equals("") ||
minutepick.getText().toString().equals("")) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.null_expiration_date), Toast.LENGTH_SHORT).show();
} else {
date = Integer.parseInt(datepick.getText().toString());
month = Integer.parseInt(monthpick.getText().toString());
year = Integer.parseInt(yearpick.getText().toString());
@ -117,6 +123,25 @@ public class Share extends AppCompatActivity {
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, URLify(objectURL.toString()));
startActivity(Intent.createChooser(shareIntent, "choose one"));
}
} catch (Exception e) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show();
}
}
});
external.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
//buttonaction
try {
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, object);
URL objectURL = s3client.generatePresignedUrl(request);
//System.out.println(URLify(objectURL.toString()));
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, URLify(objectURL.toString()));
startActivity(Intent.createChooser(shareIntent, "choose one"));
} catch (Exception e) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show();
}

View file

@ -115,6 +115,14 @@
android:text="@string/file_share"
tools:ignore="MissingConstraints" />
<Button
android:id="@+id/open_in"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/file_external"
tools:ignore="MissingConstraints" />
</LinearLayout>
</LinearLayout>

View file

@ -82,5 +82,6 @@
<string name="file_external">Abir en</string>
<string name="folder_size">Tamaño de la carpeta</string>
<string name="bucket_size">Tamaño del bucket</string>
<string name="file_count">archivos</string>
<string name="file_count">Archivos</string>
<string name="null_expiration_date">Debe establecer una fecha de expiración para compartir archivos</string>
</resources>

View file

@ -18,6 +18,7 @@
<string name="share_year">YYYY</string>
<string name="create_link">Create file link</string>
<string name="invalid_expiration_date">Expiration date must be at most 7 days</string>
<string name="null_expiration_date">You must set an expiration date to share files</string>
<string name="broken_database">Local database is corrupted. Please reinstall this app</string>
<string name="pending_feature">This feature is not implemented yet</string>
<string name="set_bucket_name">Set new bucket name</string>
@ -44,7 +45,7 @@
<string name="file_size">File Size</string>
<string name="folder_size">Folder Size</string>
<string name="bucket_size">Bucket Size</string>
<string name="file_count">files</string>
<string name="file_count">Files</string>
<string name="create_bucket">Create new bucket</string>
<string name="create_bucket_success">Bucket created successfully</string>
<string name="upload_file_here">Upload file in current folder</string>