new release

This commit is contained in:
Page Asgardius 2022-09-18 12:57:56 -07:00
parent 954f4b6f51
commit 055cd40959
2 changed files with 46 additions and 16 deletions

View file

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

View file

@ -40,7 +40,7 @@ public class ObjectSelect extends AppCompatActivity {
ArrayList Img; ArrayList Img;
//ArrayList object; //ArrayList object;
RecyclerView recyclerView; RecyclerView recyclerView;
String username, password, endpoint, bucket, prefix, location, pdfendpoint; String username, password, endpoint, bucket, prefix, location, pdfendpoint, query;
int treelevel; int treelevel;
String[] filename; String[] filename;
Region region; Region region;
@ -229,21 +229,51 @@ public class ObjectSelect extends AppCompatActivity {
} }
} else if (Img.get(position).equals(R.drawable.pdffile)) { } else if (Img.get(position).equals(R.drawable.pdffile)) {
//load media file //load media file
Thread pdfread = new Thread(new Runnable() {
@Override
public void run() {
try { try {
//Your code goes here
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, prefix + Name.get(position).toString()); GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, prefix + Name.get(position).toString());
URL objectURL = s3client.generatePresignedUrl(request); URL objectURL = s3client.generatePresignedUrl(request);
//System.out.println(getResources().getString(R.string.pdf_reader)+ URLEncoder.encode(objectURL.toString(), "UTF-8" )); //System.out.println(getResources().getString(R.string.pdf_reader)+ URLEncoder.encode(objectURL.toString(), "UTF-8" ));
if (pdfendpoint == null) { if (pdfendpoint.endsWith("/")) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.pdf_reader_notready), Toast.LENGTH_SHORT).show(); query = pdfendpoint + "web/viewer.html?file=" + URLEncoder.encode(objectURL.toString(), "UTF-8" );
} else if (pdfendpoint.endsWith("/")) {
webBrowser(pdfendpoint + "web/viewer.html?file=" + URLEncoder.encode(objectURL.toString(), "UTF-8" ), Name.get(position).toString());
} else { } else {
webBrowser(pdfendpoint + "/web/viewer.html?file=" + URLEncoder.encode(objectURL.toString(), "UTF-8" ), Name.get(position).toString()); query = pdfendpoint + "/web/viewer.html?file=" + URLEncoder.encode(objectURL.toString(), "UTF-8" );
} }
runOnUiThread(new Runnable() {
@Override
public void run() {
// Sending reference and data to Adapter
webBrowser(query, Name.get(position).toString());
}
});
//System.out.println("tree "+treelevel);
//System.out.println("prefix "+prefix);
} catch (Exception e) { } 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();
} }
});
//Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
finish();
}
}
});
if (pdfendpoint == null) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.pdf_reader_notready), Toast.LENGTH_SHORT).show();
} else {
pdfread.start();
}
} else if (Img.get(position).equals(R.drawable.audiofile) || Img.get(position).equals(R.drawable.videofile)) { } else if (Img.get(position).equals(R.drawable.audiofile) || Img.get(position).equals(R.drawable.videofile)) {
//load media file //load media file
try { try {