add bucket list activity

This commit is contained in:
Page Asgardius 2022-08-29 11:45:03 -07:00
parent 612f6ed83f
commit 7497dc562f
7 changed files with 89 additions and 0 deletions

View file

@ -3,6 +3,7 @@
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="app/src/main/res/layout/activity_bucket_select.xml" value="0.1" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.1" />
<entry key="app/src/main/res/layout/activity_video_player.xml" value="0.1" />
</map>

View file

@ -15,6 +15,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.AsgardiusS3Manager"
tools:targetApi="31">
<activity
android:name=".BucketSelect"
android:exported="false" />
<activity
android:name=".VideoPlayer"
android:configChanges="orientation|keyboardHidden|screenSize"

View file

@ -0,0 +1,50 @@
package asgardius.page.s3manager;
import static com.amazonaws.regions.Regions.US_EAST_1;
import androidx.appcompat.app.AppCompatActivity;
import android.os.AsyncTask;
import android.os.Bundle;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.regions.Region;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.S3ClientOptions;
public class BucketSelect extends AppCompatActivity {
AmazonS3 s3client;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bucket_select);
Region region = Region.getRegion(US_EAST_1);
S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build();
s3ClientOptions.setPathStyleAccess(true);
AWSCredentials myCredentials = new BasicAWSCredentials(getResources().getString(R.string.access_key), getResources().getString(R.string.secret_key));
s3client = new AmazonS3Client(myCredentials, region);
s3client.setEndpoint(getResources().getString(R.string.endpoint_url));
s3client.setS3ClientOptions(s3ClientOptions);
listbucket list = new listbucket();
list.execute("test");
}
private class listbucket extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String[] params) {
// do above Server call here
System.out.println(s3client.listBuckets());
return "some message";
}
@Override
protected void onPostExecute(String message) {
//process message
}
}
}

View file

@ -39,6 +39,17 @@ public class MainActivity extends AppCompatActivity {
//videoplayer("https://video.asgardius.company/download/videos/41780585-a935-4d53-84c8-45ce97141231-480.mp4");
}
});
//This is to launch file explorer test
Button explorertest = (Button)findViewById(R.id.ltest);
explorertest.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
//buttonaction
explorer();
//videoplayer("https://video.asgardius.company/download/videos/41780585-a935-4d53-84c8-45ce97141231-480.mp4");
}
});
}
private void s3test() {
@ -64,5 +75,11 @@ public class MainActivity extends AppCompatActivity {
startActivity(intent);
}
private void explorer() {
Intent intent = new Intent(this, BucketSelect.class);
startActivity(intent);
}
}

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".BucketSelect">
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -31,6 +31,14 @@
android:text="@string/video_test_button"
tools:ignore="MissingConstraints" />
<Button
android:id="@+id/ltest"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/explorer_test_button"
tools:ignore="MissingConstraints" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -7,6 +7,7 @@
<string name="secret_key">password</string>
<string name="bucketname">bucket</string>
<string name="objectname">object</string>
<string name="explorer_test_button">File Explorer Test</string>
<string name="video_test_button">Video Test</string>
<string name="media_load_fail">Cannot load media file</string>
<string name="dummy_button">Dummy Button</string>