object info ready
This commit is contained in:
parent
b7beceb8b3
commit
0e49707444
6 changed files with 62 additions and 25 deletions
|
@ -20,6 +20,8 @@ Current feature list
|
||||||
* File download
|
* File download
|
||||||
* pdf file reader using user provided pdf.js server
|
* pdf file reader using user provided pdf.js server
|
||||||
* file sharing links
|
* file sharing links
|
||||||
|
* get object info
|
||||||
|
* get bucket info
|
||||||
|
|
||||||
Planned feature list
|
Planned feature list
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ android {
|
||||||
applicationId "asgardius.page.s3manager"
|
applicationId "asgardius.page.s3manager"
|
||||||
minSdk 24
|
minSdk 24
|
||||||
targetSdk 33
|
targetSdk 33
|
||||||
versionCode 14
|
versionCode 15
|
||||||
versionName "0.1.12"
|
versionName "0.1.13"
|
||||||
setProperty("archivesBaseName", "s3-manager-$versionName")
|
setProperty("archivesBaseName", "s3-manager-$versionName")
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class Share extends AppCompatActivity {
|
||||||
Calendar mycal;
|
Calendar mycal;
|
||||||
EditText datepick, monthpick, yearpick, hourpick, minutepick;
|
EditText datepick, monthpick, yearpick, hourpick, minutepick;
|
||||||
int date, month, year, hour, minute;
|
int date, month, year, hour, minute;
|
||||||
Button share;
|
Button share, external;
|
||||||
|
|
||||||
public static String URLify(String str) {
|
public static String URLify(String str) {
|
||||||
str = str.trim();
|
str = str.trim();
|
||||||
|
@ -73,6 +73,7 @@ public class Share extends AppCompatActivity {
|
||||||
hourpick = (EditText)findViewById(R.id.Hour);
|
hourpick = (EditText)findViewById(R.id.Hour);
|
||||||
minutepick = (EditText)findViewById(R.id.Minute);
|
minutepick = (EditText)findViewById(R.id.Minute);
|
||||||
share = (Button)findViewById(R.id.share);
|
share = (Button)findViewById(R.id.share);
|
||||||
|
external = (Button)findViewById(R.id.open_in);
|
||||||
endpoint = getIntent().getStringExtra("endpoint");
|
endpoint = getIntent().getStringExtra("endpoint");
|
||||||
username = getIntent().getStringExtra("username");
|
username = getIntent().getStringExtra("username");
|
||||||
password = getIntent().getStringExtra("password");
|
password = getIntent().getStringExtra("password");
|
||||||
|
@ -97,31 +98,55 @@ public class Share extends AppCompatActivity {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
//buttonaction
|
//buttonaction
|
||||||
try {
|
try {
|
||||||
date = Integer.parseInt(datepick.getText().toString());
|
if (datepick.getText().toString().equals("") || monthpick.getText().toString().equals("") ||
|
||||||
month = Integer.parseInt(monthpick.getText().toString());
|
yearpick.getText().toString().equals("") || hourpick.getText().toString().equals("") ||
|
||||||
year = Integer.parseInt(yearpick.getText().toString());
|
minutepick.getText().toString().equals("")) {
|
||||||
hour = Integer.parseInt(hourpick.getText().toString());
|
Toast.makeText(getApplicationContext(),getResources().getString(R.string.null_expiration_date), Toast.LENGTH_SHORT).show();
|
||||||
minute = Integer.parseInt(minutepick.getText().toString());
|
} else {
|
||||||
mycal.set(Calendar.YEAR, year);
|
date = Integer.parseInt(datepick.getText().toString());
|
||||||
mycal.set(Calendar.MONTH, month-1);
|
month = Integer.parseInt(monthpick.getText().toString());
|
||||||
mycal.set(Calendar.DATE, date);
|
year = Integer.parseInt(yearpick.getText().toString());
|
||||||
mycal.set(Calendar.HOUR, hour);
|
hour = Integer.parseInt(hourpick.getText().toString());
|
||||||
mycal.set(Calendar.MINUTE, minute);
|
minute = Integer.parseInt(minutepick.getText().toString());
|
||||||
mycal.set(Calendar.SECOND, 0);
|
mycal.set(Calendar.YEAR, year);
|
||||||
Date expiration = mycal.getTime();
|
mycal.set(Calendar.MONTH, month-1);
|
||||||
//System.out.println(expiration);
|
mycal.set(Calendar.DATE, date);
|
||||||
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
|
mycal.set(Calendar.HOUR, hour);
|
||||||
URL objectURL = s3client.generatePresignedUrl(request);
|
mycal.set(Calendar.MINUTE, minute);
|
||||||
//System.out.println(URLify(objectURL.toString()));
|
mycal.set(Calendar.SECOND, 0);
|
||||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
Date expiration = mycal.getTime();
|
||||||
shareIntent.setType("text/plain");
|
//System.out.println(expiration);
|
||||||
shareIntent.putExtra(Intent.EXTRA_TEXT, URLify(objectURL.toString()));
|
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
|
||||||
startActivity(Intent.createChooser(shareIntent, "choose one"));
|
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) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -115,6 +115,14 @@
|
||||||
android:text="@string/file_share"
|
android:text="@string/file_share"
|
||||||
tools:ignore="MissingConstraints" />
|
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>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -82,5 +82,6 @@
|
||||||
<string name="file_external">Abir en</string>
|
<string name="file_external">Abir en</string>
|
||||||
<string name="folder_size">Tamaño de la carpeta</string>
|
<string name="folder_size">Tamaño de la carpeta</string>
|
||||||
<string name="bucket_size">Tamaño del bucket</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>
|
</resources>
|
|
@ -18,6 +18,7 @@
|
||||||
<string name="share_year">YYYY</string>
|
<string name="share_year">YYYY</string>
|
||||||
<string name="create_link">Create file link</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="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="broken_database">Local database is corrupted. Please reinstall this app</string>
|
||||||
<string name="pending_feature">This feature is not implemented yet</string>
|
<string name="pending_feature">This feature is not implemented yet</string>
|
||||||
<string name="set_bucket_name">Set new bucket name</string>
|
<string name="set_bucket_name">Set new bucket name</string>
|
||||||
|
@ -44,7 +45,7 @@
|
||||||
<string name="file_size">File Size</string>
|
<string name="file_size">File Size</string>
|
||||||
<string name="folder_size">Folder Size</string>
|
<string name="folder_size">Folder Size</string>
|
||||||
<string name="bucket_size">Bucket 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">Create new bucket</string>
|
||||||
<string name="create_bucket_success">Bucket created successfully</string>
|
<string name="create_bucket_success">Bucket created successfully</string>
|
||||||
<string name="upload_file_here">Upload file in current folder</string>
|
<string name="upload_file_here">Upload file in current folder</string>
|
||||||
|
|
Loading…
Reference in a new issue