bug fix
This commit is contained in:
parent
5cf91a5d7d
commit
dc360cccd7
3 changed files with 47 additions and 19 deletions
4
app/proguard-rules.pro
vendored
4
app/proguard-rules.pro
vendored
|
@ -14,8 +14,8 @@
|
|||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
-renamesourcefileattribute SourceFile
|
|
@ -277,21 +277,48 @@ public class ObjectSelect extends AppCompatActivity {
|
|||
pdfread.start();
|
||||
}
|
||||
} else if (Img.get(position).equals(R.drawable.audiofile) || Img.get(position).equals(R.drawable.videofile)) {
|
||||
//load media file
|
||||
try {
|
||||
Date expiration = new Date();
|
||||
Calendar mycal = Calendar.getInstance();
|
||||
mycal.setTime(expiration);
|
||||
//System.out.println("today is " + mycal.getTime());
|
||||
mycal.add(Calendar.HOUR, 6);
|
||||
//System.out.println("Expiration date: " + mycal.getTime());
|
||||
expiration = mycal.getTime();
|
||||
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, prefix + Name.get(position).toString()).withExpiration(expiration);;
|
||||
URL objectURL = s3client.generatePresignedUrl(request);
|
||||
videoPlayer(objectURL.toString());
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
Thread mediaread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
//load media file
|
||||
Date expiration = new Date();
|
||||
Calendar mycal = Calendar.getInstance();
|
||||
mycal.setTime(expiration);
|
||||
//System.out.println("today is " + mycal.getTime());
|
||||
mycal.add(Calendar.HOUR, 6);
|
||||
//System.out.println("Expiration date: " + mycal.getTime());
|
||||
expiration = mycal.getTime();
|
||||
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, prefix + Name.get(position).toString()).withExpiration(expiration);;
|
||||
URL objectURL = s3client.generatePresignedUrl(request);
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// Sending reference and data to Adapter
|
||||
videoPlayer(objectURL.toString());
|
||||
}
|
||||
});
|
||||
//System.out.println("tree "+treelevel);
|
||||
//System.out.println("prefix "+prefix);
|
||||
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
});
|
||||
mediaread.start();
|
||||
} else {
|
||||
Toast.makeText(ObjectSelect.this, getResources().getString(R.string.unsupported_file), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public class Share extends AppCompatActivity {
|
|||
Button share, external;
|
||||
GeneratePresignedUrlRequest request;
|
||||
Date expiration;
|
||||
URL objectURL;
|
||||
|
||||
public static String URLify(String str) {
|
||||
str = str.trim();
|
||||
|
@ -121,7 +122,7 @@ public class Share extends AppCompatActivity {
|
|||
expiration = mycal.getTime();
|
||||
//System.out.println(expiration);
|
||||
request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
|
||||
URL objectURL = s3client.generatePresignedUrl(request);
|
||||
objectURL = s3client.generatePresignedUrl(request);
|
||||
//System.out.println(URLify(objectURL.toString()));
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain");
|
||||
|
@ -150,7 +151,7 @@ public class Share extends AppCompatActivity {
|
|||
} else {
|
||||
request = new GeneratePresignedUrlRequest(bucket, object);
|
||||
}
|
||||
URL objectURL = s3client.generatePresignedUrl(request);
|
||||
objectURL = s3client.generatePresignedUrl(request);
|
||||
//System.out.println(URLify(objectURL.toString()));
|
||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||
shareIntent.setType("text/plain");
|
||||
|
|
Loading…
Reference in a new issue