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:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode|keyboardHidden"
android:exported="false"
android:launchMode="singleTask"
android:theme="@style/Theme.AsgardiusS3Manager.NoActionBar" />
android:launchMode="singleTask" />
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode|keyboardHidden"

View file

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

View file

@ -350,7 +350,7 @@ public class ObjectSelect extends AppCompatActivity {
@Override
public void run() {
// 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);
@ -395,7 +395,7 @@ public class ObjectSelect extends AppCompatActivity {
//Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
upload();
} 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)) {
if (Name.size() == 1 && treelevel >= 1) {
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();
upload();
} 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(), true);
} else {
share(prefix + Name.get(position).toString(), false);
}
share(prefix + Name.get(position).toString(), Name.get(position).toString(), Img.get(position).equals(R.drawable.audiofile) || Img.get(position).equals(R.drawable.videofile));
} 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)) {
if (menuItem.getTitle() == getResources().getString(R.string.file_del)) {
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.putExtra("video_url", url);
intent.putExtra("title", title);
intent.putExtra("videocache", videocache);
intent.putExtra("buffersize", buffersize);
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);
//treelevel ++;
@ -515,6 +512,7 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("password", password);
intent.putExtra("bucket", bucket);
intent.putExtra("object", object);
intent.putExtra("title", title);
intent.putExtra("region", location);
intent.putExtra("mediafile", mediafile);
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);
//treelevel ++;
@ -531,6 +529,7 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("password", password);
intent.putExtra("bucket", bucket);
intent.putExtra("object", object);
intent.putExtra("title", title);
intent.putExtra("region", location);
startActivity(intent);

View file

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

View file

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

View file

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