This commit is contained in:
Page Asgardius 2022-12-22 06:41:24 -07:00
parent 6526002a9b
commit 0e069bef1e
6 changed files with 23 additions and 20 deletions

View file

@ -91,8 +91,7 @@
android:supportsPictureInPicture="true" android:supportsPictureInPicture="true"
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode|keyboardHidden" android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode|keyboardHidden"
android:exported="false" android:exported="false"
android:launchMode="singleTask" android:launchMode="singleTask" />
android:theme="@style/Theme.AsgardiusS3Manager.NoActionBar" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode|keyboardHidden" android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode|keyboardHidden"

View file

@ -24,7 +24,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class ObjectInfo extends AppCompatActivity { public class ObjectInfo extends AppCompatActivity {
String username, password, endpoint, bucket, object, location; String username, password, endpoint, bucket, object, location, title;
Region region; Region region;
S3ClientOptions s3ClientOptions; S3ClientOptions s3ClientOptions;
AWSCredentials myCredentials; AWSCredentials myCredentials;
@ -49,6 +49,7 @@ public class ObjectInfo extends AppCompatActivity {
filesizeinfo = (TextView) findViewById(R.id.size_info); filesizeinfo = (TextView) findViewById(R.id.size_info);
objectcount = (TextView) findViewById(R.id.object_count); objectcount = (TextView) findViewById(R.id.object_count);
endpoint = getIntent().getStringExtra("endpoint"); endpoint = getIntent().getStringExtra("endpoint");
title = getIntent().getStringExtra("title");
username = getIntent().getStringExtra("username"); username = getIntent().getStringExtra("username");
password = getIntent().getStringExtra("password"); password = getIntent().getStringExtra("password");
bucket = getIntent().getStringExtra("bucket"); bucket = getIntent().getStringExtra("bucket");
@ -57,7 +58,7 @@ public class ObjectInfo extends AppCompatActivity {
if (object == null) { if (object == null) {
getSupportActionBar().setTitle(bucket+"/"); getSupportActionBar().setTitle(bucket+"/");
} else { } else {
getSupportActionBar().setTitle(bucket+"/"+object); getSupportActionBar().setTitle(title);
} }
region = Region.getRegion(location); region = Region.getRegion(location);
s3ClientOptions = S3ClientOptions.builder().build(); s3ClientOptions = S3ClientOptions.builder().build();

View file

@ -350,7 +350,7 @@ public class ObjectSelect extends AppCompatActivity {
@Override @Override
public void run() { public void run() {
// Sending reference and data to Adapter // Sending reference and data to Adapter
videoPlayer(objectURL.toString(), Name.get(position).toString().endsWith(".m3u8")); videoPlayer(objectURL.toString(), Name.get(position).toString(), Name.get(position).toString().endsWith(".m3u8"));
} }
}); });
//System.out.println("tree "+treelevel); //System.out.println("tree "+treelevel);
@ -395,7 +395,7 @@ public class ObjectSelect extends AppCompatActivity {
//Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show(); //Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
upload(); upload();
} else if (menuItem.getTitle() == getResources().getString(R.string.object_info)) { } else if (menuItem.getTitle() == getResources().getString(R.string.object_info)) {
objectInfo(prefix + Name.get(position).toString()); objectInfo(prefix + Name.get(position).toString(), Name.get(position).toString());
} else if (menuItem.getTitle() == getResources().getString(R.string.file_del)) { } else if (menuItem.getTitle() == getResources().getString(R.string.file_del)) {
if (Name.size() == 1 && treelevel >= 1) { if (Name.size() == 1 && treelevel >= 1) {
Toast.makeText(ObjectSelect.this, getResources().getString(R.string.only_item_onlist), Toast.LENGTH_SHORT).show(); Toast.makeText(ObjectSelect.this, getResources().getString(R.string.only_item_onlist), Toast.LENGTH_SHORT).show();
@ -426,13 +426,9 @@ public class ObjectSelect extends AppCompatActivity {
//Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show(); //Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
upload(); upload();
} else if (menuItem.getTitle() == getResources().getString(R.string.create_link)) { } else if (menuItem.getTitle() == getResources().getString(R.string.create_link)) {
if (Img.get(position).equals(R.drawable.audiofile) || Img.get(position).equals(R.drawable.videofile)) { share(prefix + Name.get(position).toString(), Name.get(position).toString(), Img.get(position).equals(R.drawable.audiofile) || Img.get(position).equals(R.drawable.videofile));
share(prefix + Name.get(position).toString(), true);
} else {
share(prefix + Name.get(position).toString(), false);
}
} else if (menuItem.getTitle() == getResources().getString(R.string.object_info)) { } else if (menuItem.getTitle() == getResources().getString(R.string.object_info)) {
objectInfo(prefix + Name.get(position).toString()); objectInfo(prefix + Name.get(position).toString(), Name.get(position).toString());
} else if (menuItem.getTitle() == getResources().getString(R.string.file_del)) { } else if (menuItem.getTitle() == getResources().getString(R.string.file_del)) {
if (menuItem.getTitle() == getResources().getString(R.string.file_del)) { if (menuItem.getTitle() == getResources().getString(R.string.file_del)) {
if (Name.size() == 1 && treelevel >= 1) { if (Name.size() == 1 && treelevel >= 1) {
@ -452,10 +448,11 @@ public class ObjectSelect extends AppCompatActivity {
})); }));
} }
private void videoPlayer(String url, boolean hls) { private void videoPlayer(String url, String title, boolean hls) {
Intent intent = new Intent(this, VideoPlayer.class); Intent intent = new Intent(this, VideoPlayer.class);
intent.putExtra("video_url", url); intent.putExtra("video_url", url);
intent.putExtra("title", title);
intent.putExtra("videocache", videocache); intent.putExtra("videocache", videocache);
intent.putExtra("buffersize", buffersize); intent.putExtra("buffersize", buffersize);
intent.putExtra("hls", hls); intent.putExtra("hls", hls);
@ -506,7 +503,7 @@ public class ObjectSelect extends AppCompatActivity {
} }
private void share(String object, boolean mediafile) { private void share(String object, String title, boolean mediafile) {
Intent intent = new Intent(this, Share.class); Intent intent = new Intent(this, Share.class);
//treelevel ++; //treelevel ++;
@ -515,6 +512,7 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("password", password); intent.putExtra("password", password);
intent.putExtra("bucket", bucket); intent.putExtra("bucket", bucket);
intent.putExtra("object", object); intent.putExtra("object", object);
intent.putExtra("title", title);
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("mediafile", mediafile); intent.putExtra("mediafile", mediafile);
intent.putExtra("videotime", videotime); intent.putExtra("videotime", videotime);
@ -522,7 +520,7 @@ public class ObjectSelect extends AppCompatActivity {
} }
private void objectInfo(String object) { private void objectInfo(String object, String title) {
Intent intent = new Intent(this, ObjectInfo.class); Intent intent = new Intent(this, ObjectInfo.class);
//treelevel ++; //treelevel ++;
@ -531,6 +529,7 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("password", password); intent.putExtra("password", password);
intent.putExtra("bucket", bucket); intent.putExtra("bucket", bucket);
intent.putExtra("object", object); intent.putExtra("object", object);
intent.putExtra("title", title);
intent.putExtra("region", location); intent.putExtra("region", location);
startActivity(intent); startActivity(intent);

View file

@ -23,7 +23,7 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
public class Share extends AppCompatActivity { public class Share extends AppCompatActivity {
String username, password, endpoint, bucket, object, location; String username, password, endpoint, bucket, object, location, title;
boolean mediafile; boolean mediafile;
Region region; Region region;
S3ClientOptions s3ClientOptions; S3ClientOptions s3ClientOptions;
@ -87,6 +87,8 @@ public class Share extends AppCompatActivity {
object = getIntent().getStringExtra("object"); object = getIntent().getStringExtra("object");
mediafile = getIntent().getBooleanExtra("mediafile", false); mediafile = getIntent().getBooleanExtra("mediafile", false);
videotime = getIntent().getIntExtra("videotime", 1); videotime = getIntent().getIntExtra("videotime", 1);
title = getIntent().getStringExtra("title");
getSupportActionBar().setTitle(title);
region = Region.getRegion(location); region = Region.getRegion(location);
s3ClientOptions = S3ClientOptions.builder().build(); s3ClientOptions = S3ClientOptions.builder().build();
myCredentials = new BasicAWSCredentials(username, password); myCredentials = new BasicAWSCredentials(username, password);

View file

@ -72,7 +72,7 @@ public class VideoPlayer extends AppCompatActivity {
private int notificationId = 1234; private int notificationId = 1234;
boolean hls; boolean hls;
boolean success = false; boolean success = false;
String videoURL; String videoURL, title;
Rational ratio; Rational ratio;
@Override @Override
@ -100,9 +100,11 @@ public class VideoPlayer extends AppCompatActivity {
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "S3Manager:wake_lock"); mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "S3Manager:wake_lock");
//Get media url //Get media url
videoURL = getIntent().getStringExtra("video_url"); videoURL = getIntent().getStringExtra("video_url");
title = getIntent().getStringExtra("title");
videocache = getIntent().getIntExtra("videocache", 40); videocache = getIntent().getIntExtra("videocache", 40);
buffersize = getIntent().getIntExtra("buffersize", 2000); buffersize = getIntent().getIntExtra("buffersize", 2000);
hls = getIntent().getBooleanExtra("hls", false); hls = getIntent().getBooleanExtra("hls", false);
getSupportActionBar().setTitle(title);
loadControl = new DefaultLoadControl.Builder().setBufferDurationsMs(2000, buffersize, 1500, 2000).build(); loadControl = new DefaultLoadControl.Builder().setBufferDurationsMs(2000, buffersize, 1500, 2000).build();
@DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode = DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER; @DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode = DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER;
@ -247,8 +249,7 @@ public class VideoPlayer extends AppCompatActivity {
private void showSystemBars() { private void showSystemBars() {
View decorView = getWindow().getDecorView(); View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility( decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
} }
@ -321,9 +322,11 @@ public class VideoPlayer extends AppCompatActivity {
protected void onNewIntent(Intent intent) { protected void onNewIntent(Intent intent) {
videoURL = intent.getStringExtra("video_url"); videoURL = intent.getStringExtra("video_url");
title = intent.getStringExtra("title");
videocache = intent.getIntExtra("videocache", 40); videocache = intent.getIntExtra("videocache", 40);
buffersize = intent.getIntExtra("buffersize", 2000); buffersize = intent.getIntExtra("buffersize", 2000);
hls = intent.getBooleanExtra("hls", false); hls = intent.getBooleanExtra("hls", false);
getSupportActionBar().setTitle(title);
mediaSource = new ProgressiveMediaSource.Factory( mediaSource = new ProgressiveMediaSource.Factory(
new CacheDataSource.Factory() new CacheDataSource.Factory()
.setCache(simpleCache) .setCache(simpleCache)

View file

@ -4,7 +4,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/black" android:background="@color/black"
android:theme="@style/ThemeOverlay.AsgardiusS3Manager.FullscreenContainer"
tools:context=".VideoPlayer"> tools:context=".VideoPlayer">
<!-- The primary full-screen view. This can be replaced with whatever view <!-- The primary full-screen view. This can be replaced with whatever view