style path detection

This commit is contained in:
Page Asgardius 2022-09-07 17:44:42 -07:00
parent 935a368348
commit 05f54a3d8a
6 changed files with 15 additions and 5 deletions

View file

@ -42,8 +42,6 @@ public class AccountAdd extends AppCompatActivity {
Button accounttest = (Button)findViewById(R.id.testaccount); Button accounttest = (Button)findViewById(R.id.testaccount);
edit = getIntent().getBooleanExtra("edit", false); edit = getIntent().getBooleanExtra("edit", false);
Region region = Region.getRegion(US_EAST_1); Region region = Region.getRegion(US_EAST_1);
S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build();
s3ClientOptions.setPathStyleAccess(true);
if (edit) { if (edit) {
register.setText(getResources().getString(R.string.accountsave_button)); register.setText(getResources().getString(R.string.accountsave_button));
id = getIntent().getStringExtra("alias"); id = getIntent().getStringExtra("alias");
@ -115,6 +113,10 @@ public class AccountAdd extends AppCompatActivity {
public void run() { public void run() {
try { try {
//Your code goes here //Your code goes here
S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build();
if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) {
s3ClientOptions.setPathStyleAccess(true);
}
myCredentials = new BasicAWSCredentials(username, password); myCredentials = new BasicAWSCredentials(username, password);
s3client = new AmazonS3Client(myCredentials, region); s3client = new AmazonS3Client(myCredentials, region);
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);

View file

@ -42,7 +42,9 @@ public class BucketSelect extends AppCompatActivity {
setContentView(R.layout.activity_bucket_select); setContentView(R.layout.activity_bucket_select);
Region region = Region.getRegion(US_EAST_1); Region region = Region.getRegion(US_EAST_1);
S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build(); S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build();
s3ClientOptions.setPathStyleAccess(true); if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) {
s3ClientOptions.setPathStyleAccess(true);
}
AWSCredentials myCredentials = new BasicAWSCredentials(username, password); AWSCredentials myCredentials = new BasicAWSCredentials(username, password);
AmazonS3 s3client = new AmazonS3Client(myCredentials, region); AmazonS3 s3client = new AmazonS3Client(myCredentials, region);
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);

View file

@ -27,7 +27,9 @@ public class FileShare extends AppCompatActivity {
prefix = getIntent().getStringExtra("prefix"); prefix = getIntent().getStringExtra("prefix");
Region region = Region.getRegion(US_EAST_1); Region region = Region.getRegion(US_EAST_1);
S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build(); S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build();
s3ClientOptions.setPathStyleAccess(true); if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) {
s3ClientOptions.setPathStyleAccess(true);
}
AWSCredentials myCredentials = new BasicAWSCredentials(username, password); AWSCredentials myCredentials = new BasicAWSCredentials(username, password);
AmazonS3 s3client = new AmazonS3Client(myCredentials, region); AmazonS3 s3client = new AmazonS3Client(myCredentials, region);
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);

View file

@ -56,7 +56,9 @@ public class ObjectSelect extends AppCompatActivity {
setContentView(R.layout.activity_object_select); setContentView(R.layout.activity_object_select);
Region region = Region.getRegion(US_EAST_1); Region region = Region.getRegion(US_EAST_1);
S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build(); S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build();
s3ClientOptions.setPathStyleAccess(true); if (!endpoint.contains(getResources().getString(R.string.aws_endpoint))) {
s3ClientOptions.setPathStyleAccess(true);
}
AWSCredentials myCredentials = new BasicAWSCredentials(username, password); AWSCredentials myCredentials = new BasicAWSCredentials(username, password);
AmazonS3 s3client = new AmazonS3Client(myCredentials, region); AmazonS3 s3client = new AmazonS3Client(myCredentials, region);
s3client.setEndpoint(endpoint); s3client.setEndpoint(endpoint);

View file

@ -14,6 +14,7 @@
android:focusable="false" android:focusable="false"
android:gravity="start|top" android:gravity="start|top"
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:text="Testting\nEditor"
tools:ignore="MissingConstraints" tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="79dp" tools:layout_editor_absoluteX="79dp"
tools:layout_editor_absoluteY="25dp"/> tools:layout_editor_absoluteY="25dp"/>

View file

@ -1,5 +1,6 @@
<resources> <resources>
<string name="app_name">S3 Manager</string> <string name="app_name">S3 Manager</string>
<string name="aws_endpoint">.amazonaws.com</string>
<string name="title_activity_video_player">VideoPlayer</string> <string name="title_activity_video_player">VideoPlayer</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="file_share">Share file</string> <string name="file_share">Share file</string>