diff --git a/app/src/main/assets/about.htm b/app/src/main/assets/about.htm
deleted file mode 100644
index a02a065..0000000
--- a/app/src/main/assets/about.htm
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
- About
-
-
-
-About Asgardius S3 Manager
-File Explorer to manage servers compatible with S3 Object Storage Protocol
-Created by Page Asgardius
-Libraries used in this app
-
- - Amazon Web Services SDK 2.66.0
- - ExoPlayer 2.18.6
- - ZoomLayout 1.9.0
- - Adwaita Icon Theme for GNOME 43
- - pdf.js
-
-This software released under GNU General Public License 3
-You can find source code at https://patrice.asgardius.company/gitea/asgardius/s3manager
-
- You need to setup a pdf.js server to use pdf viewer. You can use https://office.asgardius.company/pdfjs or setup your own.
-
-You can find technical support on official forum https://forum.asgardius.company/t/s3-manager
-
-
diff --git a/app/src/main/java/asgardius/page/s3manager/AccountAdd.java b/app/src/main/java/asgardius/page/s3manager/AccountAdd.java
deleted file mode 100644
index 3350038..0000000
--- a/app/src/main/java/asgardius/page/s3manager/AccountAdd.java
+++ /dev/null
@@ -1,197 +0,0 @@
-package asgardius.page.s3manager;
-
-import android.content.Intent;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.Toast;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-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;
-import com.amazonaws.services.s3.model.Bucket;
-import com.google.android.material.switchmaterial.SwitchMaterial;
-
-import java.util.List;
-
-public class AccountAdd extends AppCompatActivity {
- EditText aapick, aupick, appick, aepick, arpick, pdfpick;
- SwitchMaterial pathstyle;
- String alias, username, password, endpoint, id, location, pdfendpoint, style;
- AWSCredentials myCredentials;
- AmazonS3 s3client;
- Region region;
- boolean edit;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_account_add);
- aapick = (EditText)findViewById(R.id.alias);
- pdfpick = (EditText)findViewById(R.id.pdfendpoint);
- aepick = (EditText)findViewById(R.id.endpoint);
- arpick = (EditText)findViewById(R.id.region);
- aupick = (EditText)findViewById(R.id.username);
- appick = (EditText)findViewById(R.id.password);
- pathstyle = (SwitchMaterial) findViewById(R.id.pathstyle);
- Button register = (Button)findViewById(R.id.addaccount);
- Button accounttest = (Button)findViewById(R.id.testaccount);
- edit = getIntent().getBooleanExtra("edit", false);
- if (edit) {
- getSupportActionBar().setTitle(getResources().getString(R.string.accountedit_button));
- register.setText(getResources().getString(R.string.accountsave_button));
- id = getIntent().getStringExtra("alias");
- endpoint = getIntent().getStringExtra("endpoint");
- username = getIntent().getStringExtra("username");
- password = getIntent().getStringExtra("password");
- location = getIntent().getStringExtra("region");
- pdfendpoint = getIntent().getStringExtra("pdfendpoint");
- if (getIntent().getBooleanExtra("style", false)) {
- pathstyle.setChecked(true);
- } else {
- pathstyle.setChecked(false);
- }
- aapick.setText(id);
- aepick.setText(endpoint);
- //aapick.setEnabled(false);
- aupick.setText(username);
- appick.setText(password);
- arpick.setText(location);
- pdfpick.setText(pdfendpoint);
- } else{
- getSupportActionBar().setTitle(getResources().getString(R.string.accountadd_button));
- }
-
-
-
- register.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- alias = aapick.getText().toString();
- pdfendpoint = pdfpick.getText().toString();
- endpoint = aepick.getText().toString();
- location = arpick.getText().toString();
- username = aupick.getText().toString();
- password = appick.getText().toString();
- if (pathstyle.isChecked()) {
- style = "1";
- } else {
- style = "0";
- }
- MyDbHelper dbHelper = new MyDbHelper(AccountAdd.this);
- SQLiteDatabase db = dbHelper.getWritableDatabase();
- if (alias.equals("") || endpoint.equals("") || username.equals("") || password.equals("")) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_null), Toast.LENGTH_SHORT).show();
- } else if (endpoint.startsWith("http://") || pdfendpoint.startsWith("http://")) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.nosslwarning), Toast.LENGTH_SHORT).show();
- } else if (!endpoint.startsWith("https://")) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_url), Toast.LENGTH_SHORT).show();
- } else if (db != null) {
- // Database Queries
- try {
- if (location.equals("")) {
- location = "us-east-1";
- }
- if(endpoint.endsWith("/")) {
- endpoint = endpoint.substring(0, endpoint.length()-1);
- }
- if (edit) {
- db.execSQL("UPDATE account SET id=\""+alias+"\", endpoint=\""+endpoint+"\", username=\""+username+"\", password=\""+password+"\", region=\""+location+"\", pdfendpoint=\""+pdfendpoint+"\", style=\""+style+"\" WHERE id=\""+id+"\"");
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountsave_success), Toast.LENGTH_SHORT).show();
- } else {
- db.execSQL("INSERT INTO account VALUES (\""+alias+"\", \""+endpoint+"\", \""+username+"\", \""+password+"\", \""+location+"\", \""+pdfendpoint+"\", \""+style+"\")");
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_success), Toast.LENGTH_SHORT).show();
- }
- mainmenu();
- } catch (Exception e) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_fail), Toast.LENGTH_SHORT).show();
- }
- }
- }
-
- });
-
- accounttest.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- alias = aapick.getText().toString();
- endpoint = aepick.getText().toString();
- username = aupick.getText().toString();
- password = appick.getText().toString();
- location = arpick.getText().toString();
- if (alias.equals("") || endpoint.equals("") || username.equals("") || password.equals("")) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_null), Toast.LENGTH_SHORT).show();
- } else if (endpoint.startsWith("http://")) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.nosslwarning), Toast.LENGTH_SHORT).show();
- } else if (!endpoint.startsWith("https://")) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_url), Toast.LENGTH_SHORT).show();
- } else {
- Thread servertest = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- if (endpoint.contains(getResources().getString(R.string.aws_endpoint)) || location.equals("")) {
- region = Region.getRegion("us-east-1");
- } else {
- region = Region.getRegion(location);
- }
- if(endpoint.endsWith("/")) {
- endpoint = endpoint.substring(0, endpoint.length()-1);
- }
- S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build();
- s3ClientOptions.setPathStyleAccess(pathstyle.isChecked());
- myCredentials = new BasicAWSCredentials(username, password);
- s3client = new AmazonS3Client(myCredentials, region);
- s3client.setEndpoint(endpoint);
- s3client.setS3ClientOptions(s3ClientOptions);
- List buckets = s3client.listBuckets();
- //System.out.println(Name);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- // Sending reference and data to Adapter
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.accounttest_success), Toast.LENGTH_SHORT).show();
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- });
- }
- }
- });
- servertest.start();
- }
- }
- });
- }
-
- private void mainmenu() {
-
- Intent intent = new Intent(this, MainActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- intent.putExtra("EXIT", true);
- startActivity(intent);
-
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/Adapter.java b/app/src/main/java/asgardius/page/s3manager/Adapter.java
deleted file mode 100644
index 4631f78..0000000
--- a/app/src/main/java/asgardius/page/s3manager/Adapter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package asgardius.page.s3manager;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-import java.util.ArrayList;
-
-public class Adapter extends RecyclerView.Adapter{
- ArrayList Img, Name;
- Context context;
-
- // Constructor for initialization
- public Adapter(Context context, ArrayList Img, ArrayList Name) {
- this.context = context;
- this.Img = Img;
- this.Name = Name;
- }
- @NonNull
- @Override
- public Adapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_list_item, parent, false);
-
- // Passing view to ViewHolder
- Adapter.ViewHolder viewHolder = new Adapter.ViewHolder(view);
- return viewHolder;
- }
- @Override
- public void onBindViewHolder(@NonNull Adapter.ViewHolder holder, @SuppressLint("RecyclerView") int position) {
- int res = (int) Img.get(position);
- holder.images.setImageResource(res);
- holder.text.setText((CharSequence) Name.get(position));
- }
- @Override
- public int getItemCount() {
- return Img.size();
- }
- public class ViewHolder extends RecyclerView.ViewHolder {
- ImageView images;
- TextView text;
-
- public ViewHolder(View view) {
- super(view);
- images = itemView.findViewById(R.id.image);
- text = itemView.findViewById(R.id.imageinfo);
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/BucketPolicy.java b/app/src/main/java/asgardius/page/s3manager/BucketPolicy.java
deleted file mode 100644
index 033f708..0000000
--- a/app/src/main/java/asgardius/page/s3manager/BucketPolicy.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package asgardius.page.s3manager;
-
-import android.os.Bundle;
-import android.view.View;
-import android.widget.Button;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-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 BucketPolicy extends AppCompatActivity {
- String username, password, endpoint, bucket, location;
- Region region;
- S3ClientOptions s3ClientOptions;
- AWSCredentials myCredentials;
- AmazonS3 s3client;
- boolean style, publicbucket;
- ProgressBar simpleProgressBar;
- TextView permission;
- Button setpublic, setprivate;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_bucket_policy);
- simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
- permission = (TextView) findViewById(R.id.permission);
- endpoint = getIntent().getStringExtra("endpoint");
- username = getIntent().getStringExtra("username");
- password = getIntent().getStringExtra("password");
- bucket = getIntent().getStringExtra("bucket");
- style = getIntent().getBooleanExtra("style", false);
- location = getIntent().getStringExtra("region");
- getSupportActionBar().setTitle(bucket+"/");
- region = Region.getRegion(location);
- s3ClientOptions = S3ClientOptions.builder().build();
- myCredentials = new BasicAWSCredentials(username, password);
- try {
- s3client = new AmazonS3Client(myCredentials, region);
- } catch (Exception e) {
- Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_SHORT).show();
- }
- s3client.setEndpoint(endpoint);
- s3ClientOptions.setPathStyleAccess(style);
- s3client.setS3ClientOptions(s3ClientOptions);
- setprivate = (Button)findViewById(R.id.set_private);
- setpublic = (Button)findViewById(R.id.set_public);
- Thread getPolicy = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- String policy = s3client.getBucketPolicy(bucket).getPolicyText();
- publicbucket = policy.contains("arn:aws:s3:::"+bucket+"/*") && policy.contains("s3:GetObject");
- //System.out.println(policy);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- //Your code goes here
- if(publicbucket){
- permission.setText(getResources().getString(R.string.public_bucket));
- } else {
- permission.setText(getResources().getString(R.string.custom_policy));
- setpublic.setVisibility(View.VISIBLE);
- }
- setprivate.setVisibility(View.VISIBLE);
- simpleProgressBar.setVisibility(View.INVISIBLE);
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- if(e.toString().contains("NoSuchBucketPolicy")) {
- permission.setText(getResources().getString(R.string.private_bucket));
- setpublic.setVisibility(View.VISIBLE);
- simpleProgressBar.setVisibility(View.INVISIBLE);
- }
- else {
- Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- }
- }
- });
- getPolicy.start();
- setpublic.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- simpleProgressBar.setVisibility(View.VISIBLE);
- setPublic();
- }
- });
- setprivate.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- simpleProgressBar.setVisibility(View.VISIBLE);
- setPrivate();
- }
- });
- }
- private void setPublic() {
- Thread setPublic = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- String policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetBucketLocation\",\"s3:ListBucket\"],\"Resource\":[\"arn:aws:s3:::"
- +bucket+"\"]},{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetObject\"],\"Resource\":[\"arn:aws:s3:::"+bucket+"/*\"]}]}";
- s3client.setBucketPolicy(bucket, policy);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_ok), Toast.LENGTH_SHORT).show();
- finish();
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.INVISIBLE);
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_error), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- }
- }
- });
- setPublic.start();
- }
-
- private void setPrivate() {
- Thread setPrivate = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- s3client.deleteBucketPolicy(bucket);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_ok), Toast.LENGTH_SHORT).show();
- finish();
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.INVISIBLE);
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_error), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- }
- }
- });
- setPrivate.start();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/BucketSelect.java b/app/src/main/java/asgardius/page/s3manager/BucketSelect.java
deleted file mode 100644
index 2da8bbc..0000000
--- a/app/src/main/java/asgardius/page/s3manager/BucketSelect.java
+++ /dev/null
@@ -1,424 +0,0 @@
-package asgardius.page.s3manager;
-
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import android.app.Activity;
-import android.content.ClipData;
-import android.content.ClipboardManager;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.Build;
-import android.os.Bundle;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.PopupMenu;
-import android.widget.ProgressBar;
-import android.widget.Toast;
-
-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;
-import com.amazonaws.services.s3.model.Bucket;
-import com.amazonaws.services.s3.model.DeleteObjectsRequest;
-import com.amazonaws.services.s3.model.ListObjectsRequest;
-import com.amazonaws.services.s3.model.ObjectListing;
-import com.amazonaws.services.s3.model.S3ObjectSummary;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class BucketSelect extends AppCompatActivity {
-
- ArrayList Name;
- ArrayList Img;
- RecyclerView recyclerView;
- String username, password, endpoint, prefix, location, pdfendpoint;
- boolean style, isplaylist;
- Region region;
- S3ClientOptions s3ClientOptions;
- AWSCredentials myCredentials;
- AmazonS3 s3client;
- ProgressBar simpleProgressBar;
- int videocache, videotime, buffersize, treelevel, playlisttime;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- endpoint = getIntent().getStringExtra("endpoint");
- username = getIntent().getStringExtra("username");
- password = getIntent().getStringExtra("password");
- location = getIntent().getStringExtra("region");
- pdfendpoint = getIntent().getStringExtra("pdfendpoint");
- style = getIntent().getBooleanExtra("style", false);
- videocache = getIntent().getIntExtra("videocache", 40);
- videotime = getIntent().getIntExtra("videotime", 1);
- playlisttime = getIntent().getIntExtra("playlisttime", 1);
- buffersize = getIntent().getIntExtra("buffersize", 2000);
- isplaylist = getIntent().getBooleanExtra("isplaylist", false);
- prefix = "";
- setContentView(R.layout.activity_bucket_select);
- if (endpoint.contains(getResources().getString(R.string.aws_endpoint))) {
- region = Region.getRegion("us-east-1");
- } else {
- region = Region.getRegion(location);
- }
- s3ClientOptions = S3ClientOptions.builder().build();
- s3ClientOptions.setPathStyleAccess(style);
- myCredentials = new BasicAWSCredentials(username, password);
- s3client = new AmazonS3Client(myCredentials, region);
- s3client.setEndpoint(endpoint);
- s3client.setS3ClientOptions(s3ClientOptions);
-
- recyclerView = findViewById(R.id.blist);
- simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
-
- // layout for vertical orientation
- LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
- recyclerView.setLayoutManager(linearLayoutManager);
- Thread listbucket = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- List buckets = s3client.listBuckets();
- //This convert bucket list to an array list
- Name = new ArrayList();
- Img = new ArrayList();
- // Print bucket names
- //System.out.println("Buckets:");
- for (Bucket bucket : buckets) {
- //i++;
- //System.out.println(bucket.getName());
- Name.add(bucket.getName());
- //Img.add(R.drawable.ic_launcher_foreground);
- Img.add(R.drawable.bucket);
- }
- if (Name.size() == 0) {
- Name.add(getResources().getString(R.string.create_bucket));
- //Img.add(R.drawable.ic_launcher_foreground);
- Img.add(R.drawable.create_new);
- }
- //System.out.println(Name);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- // Sending reference and data to Adapter
- Adapter adapter = new Adapter(BucketSelect.this, Img, Name);
- simpleProgressBar.setVisibility(View.INVISIBLE);
-
- // Setting Adapter to RecyclerView
- recyclerView.setAdapter(adapter);
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
-
- listbucket.start();
-
- recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getApplicationContext(), recyclerView, new RecyclerTouchListener.ClickListener() {
- @Override
- public void onClick(View view, int position) {
- //System.out.println("Click on "+Name.get(position).toString());
- if (Img.get(position).equals(R.drawable.bucket)) {
- //go to bucket content
- explorer(Name.get(position).toString());
- } else {
- newBucket();
- }
- }
-
- @Override
- public void onLongClick(View view, int position) {
- //System.out.println("Long click on "+Name.get(position).toString());
- if (Img.get(position).equals(R.drawable.bucket)) {
- PopupMenu popupMenu = new PopupMenu(recyclerView.getContext(), view);
-
- // Inflating popup menu from popup_menu.xml file
- popupMenu.getMenuInflater().inflate(R.menu.bucket_menu, popupMenu.getMenu());
- popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem menuItem) {
- // Toast message on menu item clicked
- //Toast.makeText(MainActivity.this, "You Clicked " + menuItem.getTitle(), Toast.LENGTH_SHORT).show();
- if (menuItem.getTitle() == getResources().getString(R.string.upload_file_tobucket)) {
- //Toast.makeText(BucketSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
- upload(Name.get(position).toString(), false);
-
- } else if (menuItem.getTitle() == getResources().getString(R.string.upload_folder_tobucket)) {
- //Toast.makeText(BucketSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
- upload(Name.get(position).toString(), true);
-
- } else if (menuItem.getTitle() == getResources().getString(R.string.create_link)) {
- share(Name.get(position).toString());
- } else if (menuItem.getTitle() == getResources().getString(R.string.download_bucket)) {
- //Toast.makeText(BucketSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
- download(Name.get(position).toString());
-
- } else if (menuItem.getTitle() == getResources().getString(R.string.create_bucket)) {
- //upload();
- newBucket();
- //System.out.println(file);
- //Toast.makeText(BucketSelect.this, intent.getData().toString(), Toast.LENGTH_SHORT).show();
-
- } else if (menuItem.getTitle() == getResources().getString(R.string.object_info)) {
- objectInfo(Name.get(position).toString());
- } else if (menuItem.getTitle() == getResources().getString(R.string.copy_name)) {
- copyName(Name.get(position).toString());
- } else if (menuItem.getTitle() == getResources().getString(R.string.cors_config)) {
- corsConfig(Name.get(position).toString());
- } else if (menuItem.getTitle() == getResources().getString(R.string.bucket_policy)) {
- policyConfig(Name.get(position).toString());
- } else if (menuItem.getTitle() == getResources().getString(R.string.file_del)) {
- //Toast.makeText(BucketSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
- delete(prefix + Name.get(position).toString());
- }
- return true;
- }
- });
- // Showing the popup menu
- popupMenu.show();
- }
- }
- }));
- }
-
- private void explorer(String bucket) {
-
- Intent intent = new Intent(this, ObjectSelect.class);
- treelevel = 0;
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("bucket", bucket);
- intent.putExtra("prefix", prefix);
- intent.putExtra("treelevel", treelevel);
- intent.putExtra("region", location);
- intent.putExtra("pdfendpoint", pdfendpoint);
- intent.putExtra("style", style);
- intent.putExtra("videocache", videocache);
- intent.putExtra("videotime", videotime);
- intent.putExtra("buffersize", buffersize);
- intent.putExtra("playlisttime", playlisttime);
- intent.putExtra("isplaylist", isplaylist);
- startActivity(intent);
-
- }
-
- private void share(String bucket) {
-
- Intent intent = new Intent(this, Share.class);
- //treelevel ++;
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("bucket", bucket);
- intent.putExtra("title", bucket);
- intent.putExtra("region", location);
- intent.putExtra("videotime", videotime);
- intent.putExtra("playlisttime", playlisttime);
- intent.putExtra("style", style);
- startActivity(intent);
-
- }
-
- private void delete(String bucket) {
- AlertDialog.Builder builder = new AlertDialog.Builder(BucketSelect.this);
- builder.setCancelable(true);
- builder.setTitle(bucket);
- builder.setMessage(getResources().getString(R.string.bucket_del_confirm));
- builder.setPositiveButton(android.R.string.ok,
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- //Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
- Thread deleteBucket = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- ListObjectsRequest orequest = new ListObjectsRequest().withBucketName(bucket).withMaxKeys(1000);
- //List objects = (List) s3client.listObjects(bucket, "/");
- ObjectListing result = s3client.listObjects(orequest);
- ArrayList objectl = new ArrayList();
- List objects = result.getObjectSummaries();
- for (S3ObjectSummary os : objects) {
- objectl.add(os.getKey());
- }
- if (objectl.size() >= 1) {
- DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucket).withKeys(objectl.toArray(new String[0]));
- s3client.deleteObjects(deleteObjectsRequest);
- }
- while (result.isTruncated()) {
- objectl = new ArrayList();
- result = s3client.listNextBatchOfObjects (result);
- objects = result.getObjectSummaries();
- for (S3ObjectSummary os : objects) {
- objectl.add(os.getKey());
- //i++;
- }
- DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucket).withKeys(objectl.toArray(new String[0]));
- s3client.deleteObjects(deleteObjectsRequest);
-
- }
- //System.out.println("bucket items: " + objectl.size());
- s3client.deleteBucket(bucket);
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- // Sending reference and data to Adapter
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.bucket_del_success), Toast.LENGTH_SHORT).show();
- recreate();
-
- }
- });
- //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(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
- simpleProgressBar.setVisibility(View.VISIBLE);
- deleteBucket.start();
- }
- });
- builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- }
- });
- AlertDialog dialog = builder.create();
- dialog.show();
- }
-
- private void upload(String bucket, boolean isfolder) {
- Intent intent = new Intent(this, Uploader.class);
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("bucket", bucket);
- intent.putExtra("prefix", prefix);
- intent.putExtra("region", location);
- intent.putExtra("style", style);
- intent.putExtra("isfolder", isfolder);
- startActivity(intent);
- }
-
- private void objectInfo(String bucket) {
-
- Intent intent = new Intent(this, ObjectInfo.class);
- //treelevel ++;
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("bucket", bucket);
- intent.putExtra("region", location);
- intent.putExtra("style", style);
- startActivity(intent);
-
- }
-
- private void newBucket() {
- Intent intent = new Intent(this, CreateBucket.class);
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("region", location);
- intent.putExtra("style", style);
- //startActivity(intent);
- ((Activity) this).startActivityForResult(intent, 25);
- }
-
- private void download(String bucket) {
-
- Intent intent = new Intent(this, Downloader.class);
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("prefix", prefix);
- intent.putExtra("region", location);
- intent.putExtra("style", style);
- intent.putExtra("bucket", bucket);
- intent.putExtra("isfolder", true);
- startActivity(intent);
- }
-
- private void corsConfig(String bucket) {
- Intent intent = new Intent(this, CorsConfig.class);
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("bucket", bucket);
- intent.putExtra("region", location);
- intent.putExtra("style", style);
- intent.putExtra("pdfendpoint", pdfendpoint);
- startActivity(intent);
- }
-
- private void policyConfig(String bucket) {
- Intent intent = new Intent(this, BucketPolicy.class);
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("bucket", bucket);
- intent.putExtra("region", location);
- intent.putExtra("style", style);
- intent.putExtra("pdfendpoint", pdfendpoint);
- startActivity(intent);
- }
-
- public void copyName (String name) {
- ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
- ClipData clip = ClipData.newPlainText("name", name);
- clipboard.setPrimaryClip(clip);
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.copy_ok), Toast.LENGTH_SHORT).show();
- }
- }
-
- public void onActivityResult(int requestCode, int resultCode, final Intent resultData) {
- // The ACTION_OPEN_DOCUMENT intent was sent with the request code OPEN_DIRECTORY_REQUEST_CODE.
- // If the request code seen here doesn't match, it's the response to some other intent,
- // and the below code shouldn't run at all.
- super.onActivityResult(requestCode, resultCode, resultData);
- if(requestCode == 25 && resultCode == 25) {
- recreate();
- }
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/CorsConfig.java b/app/src/main/java/asgardius/page/s3manager/CorsConfig.java
deleted file mode 100644
index cba45f3..0000000
--- a/app/src/main/java/asgardius/page/s3manager/CorsConfig.java
+++ /dev/null
@@ -1,278 +0,0 @@
-package asgardius.page.s3manager;
-
-import android.os.Bundle;
-import android.view.View;
-import android.widget.Button;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-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;
-import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration;
-import com.amazonaws.services.s3.model.CORSRule;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-
-public class CorsConfig extends AppCompatActivity {
- String username, password, endpoint, bucket, location;
- URI pdfendpoint;
- Region region;
- S3ClientOptions s3ClientOptions;
- AWSCredentials myCredentials;
- AmazonS3 s3client;
- ProgressBar simpleProgressBar;
- BucketCrossOriginConfiguration bucketcors;
- boolean style;
- boolean allorigins, pdfcompatible, found = false;
- TextView origins;
- Button allowall, allowpdf, deletecors;
- BucketCrossOriginConfiguration corsconfig;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_cors_config);
- simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
- endpoint = getIntent().getStringExtra("endpoint");
- username = getIntent().getStringExtra("username");
- password = getIntent().getStringExtra("password");
- bucket = getIntent().getStringExtra("bucket");
- style = getIntent().getBooleanExtra("style", false);
- location = getIntent().getStringExtra("region");
- allowall = (Button)findViewById(R.id.allow_all);
- allowpdf = (Button)findViewById(R.id.allow_pdf);
- deletecors = (Button)findViewById(R.id.delete_cors);
- try {
- pdfendpoint = new URI(getIntent().getStringExtra("pdfendpoint"));
- } catch (URISyntaxException e) {
- e.printStackTrace();
- }
- getSupportActionBar().setTitle(bucket+"/");
- region = Region.getRegion(location);
- s3ClientOptions = S3ClientOptions.builder().build();
- myCredentials = new BasicAWSCredentials(username, password);
- origins = (TextView) findViewById(R.id.origins);
- try {
- s3client = new AmazonS3Client(myCredentials, region);
- } catch (Exception e) {
- Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- s3client.setEndpoint(endpoint);
- s3ClientOptions.setPathStyleAccess(style);
- s3client.setS3ClientOptions(s3ClientOptions);
- Thread getCors = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- bucketcors = s3client.getBucketCrossOriginConfiguration(bucket);
- if (bucketcors != null) {
- List corsRules = bucketcors.getRules();
- if (!corsRules.isEmpty()) {
- found = true;
- for (CORSRule rule: corsRules) {
- //System.out.println("allowOrigins: "+rule.getAllowedOrigins());
- //System.out.println("AllowedMethod: "+rule.getAllowedMethods());
- if (rule.getAllowedOrigins().toString().equals("[*]")) {
- allorigins = true;
- } else if (rule.getAllowedOrigins().toString().contains("https://"+pdfendpoint.getHost())) {
- pdfcompatible = true;
- }
- }
- }
- }
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.INVISIBLE);
- if (allorigins) {
- origins.setText(getResources().getString(R.string.cors_all));
- deletecors.setVisibility(View.VISIBLE);
- } else if (pdfcompatible) {
- origins.setText(getResources().getString(R.string.cors_pdf));
- deletecors.setVisibility(View.VISIBLE);
- allowall.setVisibility(View.VISIBLE);
- } else if (found) {
- origins.setText(getResources().getString(R.string.cors_npdf));
- deletecors.setVisibility(View.VISIBLE);
- allowpdf.setVisibility(View.VISIBLE);
- allowall.setVisibility(View.VISIBLE);
- } else {
- origins.setText(getResources().getString(R.string.cors_none));
- allowall.setVisibility(View.VISIBLE);
- allowpdf.setVisibility(View.VISIBLE);
- }
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
- getCors.start();
- allowall.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- simpleProgressBar.setVisibility(View.VISIBLE);
- setAllowall();
- }
- });
- allowpdf.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- simpleProgressBar.setVisibility(View.VISIBLE);
- setAllowpdf();
- }
- });
- deletecors.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- simpleProgressBar.setVisibility(View.VISIBLE);
- setDeletecors();
- }
- });
- }
-
- private void setAllowall() {
- Thread addAll = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- List allowMethods = new ArrayList<>();
- allowMethods.add(CORSRule.AllowedMethods.GET);
- List allowOrigins = new ArrayList<>();
- allowOrigins.add("*");
- CORSRule corsRules = new CORSRule().withAllowedMethods(allowMethods).withAllowedOrigins(allowOrigins);
- corsconfig = new BucketCrossOriginConfiguration().withRules(corsRules);
- s3client.setBucketCrossOriginConfiguration(bucket, corsconfig);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_ok), Toast.LENGTH_SHORT).show();
- finish();
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.INVISIBLE);
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_error), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- }
- }
- });
- addAll.start();
- }
-
- private void setAllowpdf() {
- Thread addPdf = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- List allowMethods = new ArrayList<>();
- allowMethods.add(CORSRule.AllowedMethods.GET);
- List allowOrigins = new ArrayList<>();
- allowOrigins.add("https://"+pdfendpoint.getHost());
- CORSRule corsRules = new CORSRule().withAllowedMethods(allowMethods).withAllowedOrigins(allowOrigins);
- corsconfig = new BucketCrossOriginConfiguration().withRules(corsRules);
- s3client.setBucketCrossOriginConfiguration(bucket, corsconfig);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_ok), Toast.LENGTH_SHORT).show();
- finish();
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.INVISIBLE);
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_error), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- }
- }
- });
- addPdf.start();
- }
-
- private void setDeletecors() {
- Thread delCors = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- s3client.deleteBucketCrossOriginConfiguration(bucket);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_ok), Toast.LENGTH_SHORT).show();
- finish();
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.INVISIBLE);
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_error), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- }
- }
- });
- delCors.start();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/CreateBucket.java b/app/src/main/java/asgardius/page/s3manager/CreateBucket.java
deleted file mode 100644
index d8c7831..0000000
--- a/app/src/main/java/asgardius/page/s3manager/CreateBucket.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package asgardius.page.s3manager;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ProgressBar;
-import android.widget.Toast;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-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 CreateBucket extends AppCompatActivity {
- String username, password, endpoint, bucket, location;
- boolean style;
- EditText bname;
- Region region;
- S3ClientOptions s3ClientOptions;
- AWSCredentials myCredentials;
- AmazonS3 s3client;
- ProgressBar simpleProgressBar;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_create_bucket);
- endpoint = getIntent().getStringExtra("endpoint");
- username = getIntent().getStringExtra("username");
- password = getIntent().getStringExtra("password");
- location = getIntent().getStringExtra("region");
- style = getIntent().getBooleanExtra("style", false);
- region = Region.getRegion("us-east-1");
- s3ClientOptions = S3ClientOptions.builder().build();
- s3ClientOptions.setPathStyleAccess(style);
- myCredentials = new BasicAWSCredentials(username, password);
- s3client = new AmazonS3Client(myCredentials, region);
- s3client.setEndpoint(endpoint);
- s3client.setS3ClientOptions(s3ClientOptions);
- bname = (EditText)findViewById(R.id.bname);
- Button cbucket = (Button)findViewById(R.id.cbucket);
- simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
- cbucket.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- bucket = bname.getText().toString();
- if (bucket.equals("")) {
- Toast.makeText(CreateBucket.this, getResources().getString(R.string.bucket_name_empty), Toast.LENGTH_SHORT).show();
- } else {
- //Toast.makeText(CreateBucket.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
- Thread newBucket = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- s3client.createBucket(bucket, location);
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- // Sending reference and data to Adapter
- setResult(25);
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.create_bucket_success), Toast.LENGTH_SHORT).show();
- finish();
- //mainmenu();
-
- }
- });
- //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(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
- simpleProgressBar.setVisibility(View.VISIBLE);
- newBucket.start();
- }
- }
-
- });
-
- }
-
- /*private void mainmenu() {
-
- Intent intent = new Intent(this, MainActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- intent.putExtra("EXIT", true);
- startActivity(intent);
-
- }*/
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/Downloader.java b/app/src/main/java/asgardius/page/s3manager/Downloader.java
deleted file mode 100644
index ea6aa21..0000000
--- a/app/src/main/java/asgardius/page/s3manager/Downloader.java
+++ /dev/null
@@ -1,358 +0,0 @@
-package asgardius.page.s3manager;
-
-import static android.content.ContentValues.TAG;
-
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.documentfile.provider.DocumentFile;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.database.Cursor;
-import android.net.Uri;
-import android.net.wifi.WifiManager;
-import android.os.Bundle;
-import android.os.PowerManager;
-import android.provider.MediaStore;
-import android.util.Log;
-import android.view.View;
-import android.widget.Button;
-import android.widget.ProgressBar;
-import android.widget.Toast;
-
-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;
-import com.amazonaws.services.s3.model.ListObjectsRequest;
-import com.amazonaws.services.s3.model.ObjectListing;
-import com.amazonaws.services.s3.model.S3Object;
-import com.amazonaws.services.s3.model.S3ObjectSummary;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-public class Downloader extends AppCompatActivity {
- String username, password, endpoint, bucket, filename, prefix, location;
- Uri fileuri, filepath;
- Region region;
- String[] folder;
- S3ClientOptions s3ClientOptions;
- AWSCredentials myCredentials;
- AmazonS3 s3client;
- ProgressBar simpleProgressBar;
- ListObjectsRequest orequest;
- Intent intent;
- Button fileDownload;
- Thread downloadFile, downloadProgress;
- S3Object object;
- DocumentFile document;
- boolean started = false;
- boolean cancel = false;
- boolean style, isfolder;
- long filesize = 0;
- long objectsize;
- long transfered = 0;
- private WifiManager.WifiLock mWifiLock;
- private PowerManager.WakeLock mWakeLock;
- private PowerManager powerManager;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_downloader);
- // create Wifi and wake locks
- mWifiLock = ((WifiManager) this.getApplicationContext().getSystemService(Context.WIFI_SERVICE)).createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "Transistor:wifi_lock");
- powerManager = (PowerManager) getSystemService(POWER_SERVICE);
- mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Transistor:wake_lock");
- filename = getIntent().getStringExtra("filename");
- endpoint = getIntent().getStringExtra("endpoint");
- username = getIntent().getStringExtra("username");
- password = getIntent().getStringExtra("password");
- bucket = getIntent().getStringExtra("bucket");
- location = getIntent().getStringExtra("region");
- style = getIntent().getBooleanExtra("style", false);
- isfolder = getIntent().getBooleanExtra("isfolder", false);
- prefix = getIntent().getStringExtra("prefix");
- if(isfolder) {
- getSupportActionBar().setTitle(getResources().getString(R.string.download_files));
- } else {
- getSupportActionBar().setTitle(getResources().getString(R.string.download_file));
- }
- simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
- fileDownload = (Button)findViewById(R.id.filedownload);
- region = Region.getRegion(location);
- s3ClientOptions = S3ClientOptions.builder().build();
- s3ClientOptions.setPathStyleAccess(style);
- myCredentials = new BasicAWSCredentials(username, password);
- s3client = new AmazonS3Client(myCredentials, region);
- s3client.setEndpoint(endpoint);
- s3client.setS3ClientOptions(s3ClientOptions);
- performFileSearch("Select download location");
- fileDownload.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- if (started) {
- cancel = true;
- downloadFile.interrupt();
- //simpleProgressBar.setVisibility(View.INVISIBLE);
- } else {
- downloadFile();
- }
- }
-
- });
- }
-
- private void downloadFile () {
- started = true;
- simpleProgressBar.setVisibility(View.VISIBLE);
- //fileDownload.setEnabled(false);
- fileDownload.setText(getResources().getString(R.string.cancel_download));
- //Acquiring WakeLock and WifiLock if not held
- if (!mWifiLock.isHeld()) {
- mWifiLock.acquire();
- //System.out.println("WifiLock acquired");
- }
- if (!mWakeLock.isHeld()) {
- mWakeLock.acquire();
- //System.out.println("WakeLock acquired");
- }
- downloadFile = new Thread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.VISIBLE);
- try {
- //Your code goes here
- //s3client.createBucket(bucket, location);
- //System.out.println(fkey);
- if (isfolder) {
- if (prefix == null) {
- orequest = new ListObjectsRequest().withBucketName(bucket).withMaxKeys(1000);
- } else {
- orequest = new ListObjectsRequest().withBucketName(bucket).withPrefix(prefix).withMaxKeys(1000);
- }
- ArrayList objectlist = new ArrayList();
- ObjectListing result = s3client.listObjects(orequest);
- List objects = result.getObjectSummaries();
- for (S3ObjectSummary os : objects) {
- objectlist.add(os.getKey());
- objectsize = os.getSize();
- if (objectsize%1024 == 0) {
- filesize = filesize+(objectsize/1024);
- } else {
- filesize = filesize+(objectsize/1024)+1;
- }
- }
- while (result.isTruncated()) {
- result = s3client.listNextBatchOfObjects (result);
- objects = result.getObjectSummaries();
- for (S3ObjectSummary os : objects) {
- objectlist.add(os.getKey());
- objectsize = os.getSize();
- if (objectsize%1024 == 0) {
- filesize = filesize+(objectsize/1024);
- } else {
- filesize = filesize+(objectsize/1024)+1;
- }
- }
-
- }
- for (String os : objectlist) {
- document = DocumentFile.fromTreeUri(getApplicationContext(), fileuri);
- object = s3client.getObject(bucket, os);
- if (os.replace(prefix, "").contains("/")) {
- folder = os.replace(prefix, "").split("/");
- for (int i = 0; i < folder.length-1; i++) {
- DocumentFile subfolder = document.findFile(folder[i].replace("/", ""));
- if (subfolder != null) {
- document = subfolder;
- } else {
- document = document.createDirectory(folder[i].replace("/", ""));
- }
- }
- filepath = document.createFile(null, folder[folder.length-1]).getUri();
- } else {
- filepath = document.createFile(null, os.replace(prefix, "")).getUri();
- }
- writeContentToFile(filepath, object);
- }
- } else {
- object = s3client.getObject(bucket, prefix+filename);
- filesize = (object.getObjectMetadata().getContentLength())/1024;
- writeContentToFile(fileuri, object);
- }
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- //simpleProgressBar.setProgress(100);
- //Releasing WifiLock and WakeLock if held
- if (mWifiLock.isHeld()) {
- mWifiLock.release();
- //System.out.println("WifiLock released");
- }
- if (mWakeLock.isHeld()) {
- mWakeLock.release();
- //System.out.println("WakeLock released");
- }
- simpleProgressBar.setProgress(100);
- if (isfolder) {
- fileDownload.setText(getResources().getString(R.string.batch_download_success));
- } else {
- fileDownload.setText(getResources().getString(R.string.download_success));
- }
- fileDownload.setEnabled(false);
- //simpleProgressBar.setVisibility(View.INVISIBLE);
- }
- });
- //System.out.println("tree "+treelevel);
- //System.out.println("prefix "+prefix);
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- //Releasing WifiLock and WakeLock if held
- if (mWifiLock.isHeld()) {
- mWifiLock.release();
- //System.out.println("WifiLock released");
- }
- if (mWakeLock.isHeld()) {
- mWakeLock.release();
- //System.out.println("WakeLock released");
- }
- if (cancel) {
- fileDownload.setText(getResources().getString(R.string.download_canceled));
- } else {
- fileDownload.setText(getResources().getString(R.string.download_failed));
- }
- fileDownload.setEnabled(false);
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- //finish();
- }
- }
- });
- downloadProgress = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- while (fileDownload.isEnabled()) {
- try {
- if (filesize != 0) {
- simpleProgressBar.setProgress((int)((transfered*100)/filesize));
- }
- Thread.sleep(500);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- //finish();
- }
- }
- });
- downloadFile.start();
- downloadProgress.start();
- }
-
- private void performFileSearch(String messageTitle) {
- //uri = Uri.parse("content://com.android.externalstorage.documents/document/home");
- intent = new Intent();
- if (isfolder) {
- intent.setAction(Intent.ACTION_OPEN_DOCUMENT_TREE);
- } else {
- intent.setAction(Intent.ACTION_CREATE_DOCUMENT);
- //intent.addCategory(Intent.CATEGORY_OPENABLE);
- //intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
- //intent.putExtra("android.provider.extra.INITIAL_URI", uri);
- intent.putExtra(Intent.EXTRA_TITLE, filename);
- intent.setType("*/*");
- }
- ((Activity) this).startActivityForResult(intent, 50);
- }
-
- @Override
-
- public void onDestroy() {
- if (!mWifiLock.isHeld()) {
- mWifiLock.acquire();
- //System.out.println("WifiLock acquired");
- }
- if (!mWakeLock.isHeld()) {
- mWakeLock.acquire();
- //System.out.println("WakeLock acquired");
- }
- super.onDestroy();
- }
-
- public void onActivityResult(int requestCode, int resultCode, final Intent resultData) {
- // The ACTION_OPEN_DOCUMENT intent was sent with the request code OPEN_DIRECTORY_REQUEST_CODE.
- // If the request code seen here doesn't match, it's the response to some other intent,
- // and the below code shouldn't run at all.
- super.onActivityResult(requestCode, resultCode, resultData);
- if (requestCode == 50) {
- if (resultCode == Activity.RESULT_OK) {
- // The document selected by the user won't be returned in the intent.
- // Instead, a URI to that document will be contained in the return intent
- // provided to this method as a parameter. Pull that uri using "resultData.getData()"
- if (resultData != null && resultData.getData() != null) {
- fileuri = resultData.getData();
- System.out.println(fileuri.toString());
- downloadFile();
- //System.out.println("File selected successfully");
- //System.out.println("content://com.android.externalstorage.documents"+file.getPath());
- } else {
- Toast.makeText(Downloader.this, getResources().getString(R.string.file_path_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- } else {
- //System.out.println("User cancelled file browsing {}");
- finish();
- }
- }
- }
-
- private void writeContentToFile(Uri uri, S3Object object) throws IOException {
- try (
- final InputStream in = object.getObjectContent();
- final OutputStream out = getContentResolver().openOutputStream(uri);
- ) {
- byte[] buffer = new byte[1024];
- for (int len; (len = in.read(buffer)) != -1; ) {
- out.write(buffer, 0, len);
- transfered ++;
- }
- }
- }
-
- private String getDisplayName(Uri uri) {
- final String[] projection = { MediaStore.Images.Media.DISPLAY_NAME };
- try (
- Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
- ){
- int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME);
- if (cursor.moveToFirst()) {
- return cursor.getString(columnIndex);
- }
- }
- // If the display name is not found for any reason, use the Uri path as a fallback.
- Log.w(TAG, "Couldnt determine DISPLAY_NAME for Uri. Falling back to Uri path: " + uri.getPath());
- return uri.getPath();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/ImageViewer.java b/app/src/main/java/asgardius/page/s3manager/ImageViewer.java
deleted file mode 100644
index b9dc22f..0000000
--- a/app/src/main/java/asgardius/page/s3manager/ImageViewer.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package asgardius.page.s3manager;
-
-import android.annotation.SuppressLint;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
-import android.os.Bundle;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.WindowManager;
-import android.widget.ProgressBar;
-import android.widget.Toast;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import com.otaliastudios.zoom.ZoomImageView;
-
-import java.net.URL;
-
-public class ImageViewer extends AppCompatActivity {
- String videoURL, title;
- ZoomImageView iv;
- boolean controls = false;
- float cursorx, cursory;
-
- @SuppressLint("ClickableViewAccessibility")
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_image_viewer);
- videoURL = getIntent().getStringExtra("video_url");
- title = getIntent().getStringExtra("title");
- getSupportActionBar().setTitle(title);
- final ProgressBar simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
- iv = (ZoomImageView) findViewById(R.id.imageViewer);
- //System.out.println(videoURL);
- Thread imgread = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- URL thumb_u = new URL(videoURL);
- Drawable thumb_d = Drawable.createFromStream(thumb_u.openStream(), "src");
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.INVISIBLE);
- iv.setImageDrawable(thumb_d);
-
- }
- });
-
- } catch (OutOfMemoryError e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.picture_too_big), Toast.LENGTH_SHORT).show();
- finish();
- }
- });
- finish();
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- finish();
- }
- });
- finish();
- }
- }
- });
- imgread.start();
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
- getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
- }
- iv.setOnTouchListener((v, event) -> {
-
- if (event.getAction() == MotionEvent.ACTION_DOWN) {
- cursorx = event.getX();
- cursory = event.getY();
- iv.performClick();
-
- return true;
- } else if (event.getAction() == MotionEvent.ACTION_UP) {
- if(Math.abs(event.getX() - cursorx) < 5 || Math.abs(event.getY() - cursory) < 5) {
- if(controls) {
- controls = false;
- hideSystemBars();
- }
- else {
- controls = true;
- showSystemBars();
- }
- }
- return true;
- }
- return false;
- });
- }
-
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- super.onWindowFocusChanged(hasFocus);
- controls = false;
- hideSystemBars();
-
- }
-
- private void hideSystemBars() {
- // Set the IMMERSIVE flag.
- // Set the content to appear under the system bars so that the content
- // doesn't resize when the system bars hide and show.
- View decorView = getWindow().getDecorView();
- decorView.setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
- | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
- | View.SYSTEM_UI_FLAG_IMMERSIVE);
- }
-
- private void showSystemBars() {
- View decorView = getWindow().getDecorView();
- decorView.setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/MainActivity.java b/app/src/main/java/asgardius/page/s3manager/MainActivity.java
index 9447245..ba0298d 100644
--- a/app/src/main/java/asgardius/page/s3manager/MainActivity.java
+++ b/app/src/main/java/asgardius/page/s3manager/MainActivity.java
@@ -1,483 +1,68 @@
package asgardius.page.s3manager;
-import android.content.DialogInterface;
+import static com.amazonaws.regions.RegionUtils.getRegion;
+import static com.amazonaws.regions.Regions.US_EAST_1;
+import static com.amazonaws.services.s3.S3ClientOptions.DEFAULT_PATH_STYLE_ACCESS;
+
+import androidx.appcompat.app.AppCompatActivity;
+
import android.content.Intent;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
-import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
-import android.widget.PopupMenu;
-import android.widget.Toast;
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
+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;
+import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest;
-import java.util.ArrayList;
+import java.net.URL;
public class MainActivity extends AppCompatActivity {
- boolean style, isplaylist;
- String alias, username, password, endpoint, location, pdfendpoint;
- RecyclerView recyclerView;
- SQLiteDatabase db;
- ArrayList Name;
- ArrayList Img;
- MyDbHelper dbHelper;
- int videocache, videotime, buffersize, playlisttime;
+ static boolean DEFAULT_PATH_STYLE_ACCESS = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
-
- recyclerView = findViewById(R.id.alist);
-
- // layout for vertical orientation
- LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
- recyclerView.setLayoutManager(linearLayoutManager);
-
- dbHelper = new MyDbHelper(this);
- Thread getprefs = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- // Database Queries
- try {
- db = dbHelper.getWritableDatabase();
- String query = "SELECT value FROM preferences where setting='videocache'";
- Cursor cursor = db.rawQuery(query,null);
- while (cursor.moveToNext()){
- videocache = (Integer.parseInt(cursor.getString(0)));
- }
- db.close();
- if (videocache == 0) {
- try {
- db = dbHelper.getWritableDatabase();
- db.execSQL("INSERT INTO preferences VALUES ('videocache', '300')");
- videocache = 300;
- db.close();
- } catch (Exception e) {
- db = dbHelper.getWritableDatabase();
- db.execSQL("CREATE TABLE IF NOT EXISTS preferences(setting text UNIQUE, value text)");
- db.execSQL("INSERT INTO preferences VALUES ('videocache', '300')");
- db.execSQL("INSERT INTO preferences VALUES ('videotime', '3')");
- db.execSQL("INSERT INTO preferences VALUES ('buffersize', '12000')");
- db.execSQL("INSERT INTO preferences VALUES ('playlisttime', '5')");
- db.execSQL("INSERT INTO preferences VALUES ('isplaylist', '0')");
- videocache = 300;
- //videotime = 3;
- db.close();
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- try {
- db = dbHelper.getWritableDatabase();
- String query = "SELECT value FROM preferences where setting='videotime'";
- Cursor cursor = db.rawQuery(query,null);
- while (cursor.moveToNext()){
- videotime = (Integer.parseInt(cursor.getString(0)));
- }
- db.close();
- if (videotime == 0) {
- try {
- db = dbHelper.getWritableDatabase();
- db.execSQL("INSERT INTO preferences VALUES ('videotime', '3')");
- videotime = 3;
- db.close();
- } catch (Exception e) {
- db = dbHelper.getWritableDatabase();
- db.execSQL("CREATE TABLE IF NOT EXISTS preferences(setting text UNIQUE, value text)");
- db.close();
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- try {
- db = dbHelper.getWritableDatabase();
- String query = "SELECT value FROM preferences where setting='playlisttime'";
- Cursor cursor = db.rawQuery(query,null);
- while (cursor.moveToNext()){
- playlisttime = (Integer.parseInt(cursor.getString(0)));
- }
- db.close();
- if (playlisttime == 0) {
- try {
- db = dbHelper.getWritableDatabase();
- db.execSQL("INSERT INTO preferences VALUES ('playlisttime', '5')");
- playlisttime = 5;
- db.close();
- } catch (Exception e) {
- db = dbHelper.getWritableDatabase();
- db.execSQL("CREATE TABLE IF NOT EXISTS preferences(setting text UNIQUE, value text)");
- db.close();
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- try {
- db = dbHelper.getWritableDatabase();
- String query = "SELECT value FROM preferences where setting='isplaylist'";
- Cursor cursor = db.rawQuery(query,null);
- String update = null;
- while (cursor.moveToNext()){
- isplaylist = cursor.getString(0).equals("1");
- if(!isplaylist) {
- update = cursor.getString(0);
- }
- }
- db.close();
- if (!isplaylist && update == null) {
- try {
- db = dbHelper.getWritableDatabase();
- db.execSQL("INSERT INTO preferences VALUES ('isplaylist', '0')");
- isplaylist = false;
- db.close();
- } catch (Exception e) {
- db = dbHelper.getWritableDatabase();
- db.execSQL("CREATE TABLE IF NOT EXISTS preferences(setting text UNIQUE, value text)");
- db.close();
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- try {
- db = dbHelper.getWritableDatabase();
- String query = "SELECT value FROM preferences where setting='buffersize'";
- Cursor cursor = db.rawQuery(query,null);
- while (cursor.moveToNext()){
- buffersize = (Integer.parseInt(cursor.getString(0)));
- }
- db.close();
- if (buffersize == 0) {
- try {
- db = dbHelper.getWritableDatabase();
- db.execSQL("INSERT INTO preferences VALUES ('buffersize', '12000')");
- buffersize = 12000;
- db.close();
- } catch (Exception e) {
- db = dbHelper.getWritableDatabase();
- db.execSQL("CREATE TABLE IF NOT EXISTS preferences(setting text UNIQUE, value text)");
- db.close();
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
- Thread listaccount = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- db = dbHelper.getWritableDatabase();
- // Database Queries
- Name = new ArrayList();
- Img = new ArrayList();
- String query = "SELECT id FROM account";
- Cursor cursor = db.rawQuery(query,null);
- while (cursor.moveToNext()){
- Name.add(cursor.getString(0));
- Img.add(R.drawable.account);
- }
- db.close();
- getprefs.start();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- // Sending reference and data to Adapter
- Adapter adapter = new Adapter(MainActivity.this, Img, Name);
-
- // Setting Adapter to RecyclerView
- recyclerView.setAdapter(adapter);
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
-
- listaccount.start();
-
- recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getApplicationContext(), recyclerView, new RecyclerTouchListener.ClickListener() {
- @Override
- public void onClick(View view, int position) {
- //System.out.println("Click on "+Name.get(position).toString());
- db = dbHelper.getWritableDatabase();
- if (db != null) {
- // Database Queries
- try {
- //This retrieves credentials from selected account
- String query = "SELECT endpoint, username, password, region, pdfendpoint, style FROM account where id=\""+ Name.get(position).toString()+ "\"";
- Cursor cursor = db.rawQuery(query,null);
- if (cursor.moveToNext()){
- endpoint = cursor.getString(0);
- username = cursor.getString(1);
- password = cursor.getString(2);
- location = cursor.getString(3);
- pdfendpoint = cursor.getString(4);
- try {
- style = cursor.getString(5).equals("1");
- } catch (Exception e) {
- e.printStackTrace();
- style = false;
- }
-
- db.close();
- //This launch file explorer using selected account
- explorer();
- }
- } catch (Exception e) {
- e.printStackTrace();
- try {
- db = dbHelper.getWritableDatabase();
- db.execSQL("alter table account add column style text");
- db.close();
- } catch (Exception f) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
-
- }
- }
-
- @Override
- public void onLongClick(View view, int position) {
- //System.out.println("Long click on "+Name.get(position).toString());
- // Initializing the popup menu and giving the reference as current context
- PopupMenu popupMenu = new PopupMenu(recyclerView.getContext(), view);
-
- // Inflating popup menu from popup_menu.xml file
- popupMenu.getMenuInflater().inflate(R.menu.account_menu, popupMenu.getMenu());
- popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem menuItem) {
- // Toast message on menu item clicked
- //Toast.makeText(MainActivity.this, "You Clicked " + menuItem.getTitle(), Toast.LENGTH_SHORT).show();
- if (menuItem.getTitle() == getResources().getString(R.string.accountedit_button)) {
- try {
- db = dbHelper.getWritableDatabase();
- //This retrieves credentials from selected account
- String query = "SELECT id, endpoint, username, password, region, pdfendpoint, style FROM account where id=\""+ Name.get(position).toString()+ "\"";
- System.out.println(query);
- Cursor cursor = db.rawQuery(query,null);
- if (cursor.moveToNext()){
- alias = cursor.getString(0);
- endpoint = cursor.getString(1);
- username = cursor.getString(2);
- password = cursor.getString(3);
- location = cursor.getString(4);
- pdfendpoint = cursor.getString(5);
- try {
- style = cursor.getString(6).equals("1");
- } catch (Exception e) {
- e.printStackTrace();
- style = false;
- }
- }
- db.close();
- //This launch account editor
- addaccount(true);
- //Toast.makeText(MainActivity.this, "This feature is not yet implemented", Toast.LENGTH_SHORT).show();
- } catch (Exception e) {
- e.printStackTrace();
- try {
- db = dbHelper.getWritableDatabase();
- db.execSQL("alter table account add column style text");
- db.close();
- } catch (Exception f) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- }
- else if (menuItem.getTitle() == getResources().getString(R.string.accountdel_button)) {
- AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
- builder.setCancelable(true);
- builder.setTitle(Name.get(position).toString());
- builder.setMessage(getResources().getString(R.string.accountdel_confirm));
- builder.setPositiveButton(android.R.string.ok,
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- db = dbHelper.getWritableDatabase();
- if (db != null) {
- // This remove selected user account from local database
- try {
- db.execSQL("DELETE FROM account where id=\""+ Name.get(position).toString()+ "\"");
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountdel_success), Toast.LENGTH_SHORT).show();
- db.close();
- recreate();
- } catch (Exception e) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- }
- }
- }
- });
- builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- }
- });
-
- AlertDialog dialog = builder.create();
- dialog.show();
- /**/
- //Toast.makeText(MainActivity.this, "Delete Account", Toast.LENGTH_SHORT).show();
- }
- return true;
- }
- });
- // Showing the popup menu
- popupMenu.show();
- }
- }));
-
- //This is to add new user account
- Button addaccount = (Button)findViewById(R.id.addaccount);
- addaccount.setOnClickListener(new View.OnClickListener(){
+ //This is to launch video playback test
+ Button videotest = (Button)findViewById(R.id.vtest);
+ videotest.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view) {
//buttonaction
- //This launch account add screen
- addaccount(false);
- }
- });
-
- //This is to view app credits
- Button settings = (Button)findViewById(R.id.settings_button);
- settings.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- settingsPage();
+ s3test();
+ //videoplayer("https://video.asgardius.company/download/videos/41780585-a935-4d53-84c8-45ce97141231-480.mp4");
}
});
}
- private void explorer() {
+ private void s3test() {
- Intent intent = new Intent(this, BucketSelect.class);
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("region", location);
- intent.putExtra("pdfendpoint", pdfendpoint);
- intent.putExtra("style", style);
- intent.putExtra("videocache", videocache);
- intent.putExtra("videotime", videotime);
- intent.putExtra("buffersize", buffersize);
- intent.putExtra("playlisttime", playlisttime);
- intent.putExtra("isplaylist", isplaylist);
+ 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));
+ AmazonS3 s3client = new AmazonS3Client(myCredentials, region);
+ s3client.setEndpoint(getResources().getString(R.string.endpoint_url));
+ s3client.setS3ClientOptions(s3ClientOptions);
+ //s3client.setRegion(getRegion("asteroid"));
+ GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(getResources().getString(R.string.bucketname), getResources().getString(R.string.objectname));
+ URL objectURL = s3client.generatePresignedUrl(request);
+ videoplayer(objectURL.toString());
+
+ }
+
+ private void videoplayer(String url) {
+
+ Intent intent = new Intent(this, VideoPlayer.class);
+ intent.putExtra("video_url", url);
startActivity(intent);
}
- private void addaccount(boolean edit) {
-
- Intent intent = new Intent(this, AccountAdd.class);
- if (edit) {
- intent.putExtra("alias", alias);
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("region", location);
- intent.putExtra("pdfendpoint", pdfendpoint);
- intent.putExtra("style", style);
- }
- intent.putExtra("edit", edit);
- startActivity(intent);
-
- }
-
- private void settingsPage() {
-
- Intent intent = new Intent(this, Settings.class);
- //intent.putExtra("web_url", "file:///android_asset/about.htm");
- //intent.putExtra("title", getResources().getString(R.string.about_button));
- startActivity(intent);
-
- }
}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/MyDbHelper.java b/app/src/main/java/asgardius/page/s3manager/MyDbHelper.java
deleted file mode 100644
index 931c69f..0000000
--- a/app/src/main/java/asgardius/page/s3manager/MyDbHelper.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package asgardius.page.s3manager;
-
-import android.content.Context;
-import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteOpenHelper;
-
-public class MyDbHelper extends SQLiteOpenHelper {
- private static final String usertable = "CREATE TABLE IF NOT EXISTS account(id text UNIQUE, endpoint text, username text, password text, region text, pdfendpoint text, style text)";
- private static final String preftable = "CREATE TABLE IF NOT EXISTS preferences(setting text UNIQUE, value text)";
- private static final String setvideocache = "INSERT INTO preferences VALUES ('videocache', '300')";
- private static final String setvideotime = "INSERT INTO preferences VALUES ('videotime', '3')";
- private static final String setbuffersize = "INSERT INTO preferences VALUES ('buffersize', '12000')";
- private static final String setplaylisttime = "INSERT INTO preferences VALUES ('playlisttime', '5')";
- private static final String setisplaylist = "INSERT INTO preferences VALUES ('isplaylist', '0')";
- //private static final String upgrade = "ALTER TABLE account add column pdfendpoint text";
- private static final int DATABASE_VERSION = 1;
- private static final String dbname = "accounts.sqlite3";
- private static final int dbversion = 3;
- public MyDbHelper(Context context) {
- super(context, dbname, null, dbversion);
- }
- @Override
- public void onCreate(SQLiteDatabase db) {
- db.execSQL(usertable);
- db.execSQL(preftable);
- db.execSQL(setvideocache);
- db.execSQL(setvideotime);
- db.execSQL(setbuffersize);
- db.execSQL(setplaylisttime);
- db.execSQL(setisplaylist);
- }
- @Override
- public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
- //db.execSQL(upgrade);
- }
-}
diff --git a/app/src/main/java/asgardius/page/s3manager/ObjectInfo.java b/app/src/main/java/asgardius/page/s3manager/ObjectInfo.java
deleted file mode 100644
index fb034a8..0000000
--- a/app/src/main/java/asgardius/page/s3manager/ObjectInfo.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package asgardius.page.s3manager;
-
-import android.os.Bundle;
-import android.view.View;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-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;
-import com.amazonaws.services.s3.model.ListObjectsRequest;
-import com.amazonaws.services.s3.model.ObjectListing;
-import com.amazonaws.services.s3.model.S3ObjectSummary;
-
-import java.util.List;
-
-public class ObjectInfo extends AppCompatActivity {
- String username, password, endpoint, bucket, object, location, title;
- Region region;
- S3ClientOptions s3ClientOptions;
- AWSCredentials myCredentials;
- AmazonS3 s3client;
- ProgressBar simpleProgressBar;
- TextView filesize, filesizeinfo, objectcount;
- boolean isobject, isfolder, style;
- long totalSize = 0;
- int totalItems = 0;
- ListObjectsRequest orequest;
- long KiB, MiB, GiB;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_object_info);
- KiB = 1024;
- MiB = 1024 * KiB;
- GiB = 1024 * MiB;
- simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
- filesize = (TextView) findViewById(R.id.size);
- 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");
- style = getIntent().getBooleanExtra("style", false);
- location = getIntent().getStringExtra("region");
- object = getIntent().getStringExtra("object");
- if (object == null) {
- getSupportActionBar().setTitle(bucket+"/");
- } else {
- getSupportActionBar().setTitle(title);
- }
- region = Region.getRegion(location);
- s3ClientOptions = S3ClientOptions.builder().build();
- myCredentials = new BasicAWSCredentials(username, password);
- try {
- s3client = new AmazonS3Client(myCredentials, region);
- } catch (Exception e) {
- Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- s3client.setEndpoint(endpoint);
- s3ClientOptions.setPathStyleAccess(style);
- s3client.setS3ClientOptions(s3ClientOptions);
- Thread getInfo = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- if (object == null) {
- isobject = false;
- orequest = new ListObjectsRequest().withBucketName(bucket).withMaxKeys(1000);
- } else {
- isobject = true;
- if (object.endsWith("/")) {
- isfolder = true;
- } else {
- isfolder = false;
- }
- orequest = new ListObjectsRequest().withBucketName(bucket).withPrefix(object).withMaxKeys(1000);
- }
- ObjectListing result = s3client.listObjects(orequest);
- List objects = result.getObjectSummaries();
- for (S3ObjectSummary os : objects) {
- totalSize += os.getSize();
- totalItems++;
- }
- while (result.isTruncated()) {
- result = s3client.listNextBatchOfObjects (result);
- objects = result.getObjectSummaries();
- for (S3ObjectSummary os : objects) {
- totalSize += os.getSize();
- totalItems++;
- }
-
- }
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- if (isobject) {
- if (isfolder) {
- filesizeinfo.setText(getResources().getString(R.string.folder_size));
- objectcount.setText(totalItems+" "+getResources().getString(R.string.file_count));
- } else {
- filesizeinfo.setText(getResources().getString(R.string.file_size));
- }
- } else {
- filesizeinfo.setText(getResources().getString(R.string.bucket_size));
- objectcount.setText(totalItems+" "+getResources().getString(R.string.file_count));
- }
- if (totalSize >= GiB) {
- filesize.setText(Long.toString(totalSize/GiB)+" GiB");
- } else if (totalSize >= MiB) {
- filesize.setText(Long.toString(totalSize/MiB)+" MiB");
- } else if (totalSize >= KiB) {
- filesize.setText(Long.toString(totalSize/KiB)+" KiB");
- } else {
- filesize.setText(Long.toString(totalSize)+" Bytes");
- }
- simpleProgressBar.setVisibility(View.INVISIBLE);
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
- getInfo.start();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/ObjectPolicy.java b/app/src/main/java/asgardius/page/s3manager/ObjectPolicy.java
deleted file mode 100644
index 672301f..0000000
--- a/app/src/main/java/asgardius/page/s3manager/ObjectPolicy.java
+++ /dev/null
@@ -1,260 +0,0 @@
-package asgardius.page.s3manager;
-
-import androidx.appcompat.app.AppCompatActivity;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.Button;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.Toast;
-
-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 ObjectPolicy extends AppCompatActivity {
- String username, password, endpoint, bucket, location, filename, title, policy;
- Region region;
- S3ClientOptions s3ClientOptions;
- AWSCredentials myCredentials;
- AmazonS3 s3client;
- boolean style, publicbucket, publicobject, parent;
- ProgressBar simpleProgressBar;
- TextView permission;
- Button setpublic, setprivate;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_object_policy);
- simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
- permission = (TextView) findViewById(R.id.permission);
- endpoint = getIntent().getStringExtra("endpoint");
- filename = getIntent().getStringExtra("filename");
- username = getIntent().getStringExtra("username");
- password = getIntent().getStringExtra("password");
- bucket = getIntent().getStringExtra("bucket");
- title = getIntent().getStringExtra("title");
- style = getIntent().getBooleanExtra("style", false);
- location = getIntent().getStringExtra("region");
- getSupportActionBar().setTitle(title);
- region = Region.getRegion(location);
- s3ClientOptions = S3ClientOptions.builder().build();
- myCredentials = new BasicAWSCredentials(username, password);
- try {
- s3client = new AmazonS3Client(myCredentials, region);
- } catch (Exception e) {
- Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_SHORT).show();
- }
- s3client.setEndpoint(endpoint);
- s3ClientOptions.setPathStyleAccess(style);
- s3client.setS3ClientOptions(s3ClientOptions);
- setprivate = (Button)findViewById(R.id.set_private);
- setpublic = (Button)findViewById(R.id.set_public);
- Thread getPolicy = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- policy = s3client.getBucketPolicy(bucket).getPolicyText();
- publicbucket = policy.contains("arn:aws:s3:::"+bucket+"/*") && policy.contains("s3:GetObject");
- publicobject = false;
- parent = true;
- if(!publicbucket && policy.contains("s3:GetObject")) {
- if((policy.contains("\"arn:aws:s3:::"+bucket+"/"+filename+"\"") || policy.contains("\"arn:aws:s3:::"+bucket+"/"+filename+"*\"") || policy.contains("\"arn:aws:s3:::"+bucket+"/"+filename+"**\"")) && policy.contains("s3:GetObject")) {
- publicobject = true;
- parent = false;
- } else {
- String[] path = filename.split("/");
- String filepath = "";
- for (int i = 0; i < path.length-1; i++) {
- filepath = filepath+path[i]+"/";
- //System.out.println(filepath);
- if(policy.contains("\"arn:aws:s3:::"+bucket+"/"+filepath+"*\"") || policy.contains("\"arn:aws:s3:::"+bucket+"/"+filepath+"**\"")) {
- publicobject = true;
- i = path.length;
- }
- }
- }
- }
- //System.out.println(policy);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- //Your code goes here
- if(publicbucket){
- permission.setText(getResources().getString(R.string.public_object));
- setprivate.setEnabled(false);
- setprivate.setText(getResources().getString(R.string.parent_policy));
- setprivate.setVisibility(View.VISIBLE);
- }else if(publicobject) {
- permission.setText(getResources().getString(R.string.public_object));
- if(parent) {
- setprivate.setEnabled(false);
- setprivate.setText(getResources().getString(R.string.parent_policy));
- }
- setprivate.setVisibility(View.VISIBLE);
- }else {
- permission.setText(getResources().getString(R.string.private_object));
- setpublic.setVisibility(View.VISIBLE);
- }
- simpleProgressBar.setVisibility(View.INVISIBLE);
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- if(e.toString().contains("NoSuchBucketPolicy")) {
- permission.setText(getResources().getString(R.string.private_object));
- setpublic.setVisibility(View.VISIBLE);
- simpleProgressBar.setVisibility(View.INVISIBLE);
- }
- else {
- Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- }
- }
- });
- getPolicy.start();
- setpublic.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- simpleProgressBar.setVisibility(View.VISIBLE);
- setPublic();
- }
- });
- setprivate.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- simpleProgressBar.setVisibility(View.VISIBLE);
- setPrivate();
- }
- });
- }
-
- private void setPublic() {
- Thread setPublic = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- if(policy == null) {
- if(filename.endsWith("/")) {
- policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetObject\"],\"Resource\":[\"arn:aws:s3:::"+bucket+"/"+filename+"*\"]}]}";
- } else {
- policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"s3:GetObject\"],\"Resource\":[\"arn:aws:s3:::"+bucket+"/"+filename+"\"]}]}";
- }
- } else if(policy.endsWith("]}]}")) {
- if(filename.endsWith("/")) {
- policy = policy.substring(0, policy.length()-4)+",\"arn:aws:s3:::"+bucket+"/"+filename+"*\"]}]}";
- } else {
- policy = policy.substring(0, policy.length()-4)+",\"arn:aws:s3:::"+bucket+"/"+filename+"\"]}]}";
- }
- } else {
- if(filename.endsWith("/")) {
- policy = policy.substring(0, policy.length()-3)+",\"arn:aws:s3:::"+bucket+"/"+filename+"*\"}]}";
- } else {
- policy = policy.substring(0, policy.length()-3)+",\"arn:aws:s3:::"+bucket+"/"+filename+"\"}]}";
- }
- }
- s3client.setBucketPolicy(bucket, policy);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_ok), Toast.LENGTH_SHORT).show();
- finish();
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.INVISIBLE);
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_error), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- }
- }
- });
- setPublic.start();
- }
-
- private void setPrivate() {
- Thread setPrivate = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- String newpolicy = null;
- if(policy.contains(",\"arn:aws:s3:::"+bucket+"/"+filename+"*\"")) {
- newpolicy = policy.replace(",\"arn:aws:s3:::"+bucket+"/"+filename+"*\"", "");
- s3client.setBucketPolicy(bucket, newpolicy);
- } else if(policy.contains(",\"arn:aws:s3:::"+bucket+"/"+filename+"**\"")) {
- newpolicy = policy.replace(",\"arn:aws:s3:::"+bucket+"/"+filename+"**\"", "");
- s3client.setBucketPolicy(bucket, newpolicy);
- } else if(policy.contains(",\"arn:aws:s3:::"+bucket+"/"+filename+"\"")) {
- newpolicy = policy.replace(",\"arn:aws:s3:::"+bucket+"/"+filename+"\"", "");
- s3client.setBucketPolicy(bucket, newpolicy);
- } else if(policy.contains("\"arn:aws:s3:::"+bucket+"/"+filename+"*\",")) {
- newpolicy = policy.replace("\"arn:aws:s3:::"+bucket+"/"+filename+"*\",", "");
- s3client.setBucketPolicy(bucket, newpolicy);
- } else if(policy.contains("\"arn:aws:s3:::"+bucket+"/"+filename+"**\",")) {
- newpolicy = policy.replace("\"arn:aws:s3:::"+bucket+"/"+filename+"**\",", "");
- s3client.setBucketPolicy(bucket, newpolicy);
- } else if(policy.contains("\"arn:aws:s3:::"+bucket+"/"+filename+"\",")) {
- newpolicy = policy.replace("\"arn:aws:s3:::"+bucket+"/"+filename+"\",", "");
- s3client.setBucketPolicy(bucket, newpolicy);
- } else {
- s3client.deleteBucketPolicy(bucket);
- }
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_ok), Toast.LENGTH_SHORT).show();
- finish();
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.INVISIBLE);
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.policy_error), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- }
- }
- });
- setPrivate.start();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java b/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java
deleted file mode 100644
index 32a0c65..0000000
--- a/app/src/main/java/asgardius/page/s3manager/ObjectSelect.java
+++ /dev/null
@@ -1,867 +0,0 @@
-package asgardius.page.s3manager;
-
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-import android.content.ClipData;
-import android.content.ClipboardManager;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.os.Build;
-import android.os.Bundle;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.PopupMenu;
-import android.widget.ProgressBar;
-import android.widget.Toast;
-
-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;
-import com.amazonaws.services.s3.model.DeleteObjectRequest;
-import com.amazonaws.services.s3.model.DeleteObjectsRequest;
-import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest;
-import com.amazonaws.services.s3.model.ListObjectsRequest;
-import com.amazonaws.services.s3.model.ObjectListing;
-import com.amazonaws.services.s3.model.S3ObjectSummary;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-
-public class ObjectSelect extends AppCompatActivity {
-
- ArrayList Name;
- ArrayList Img;
- //ArrayList object;
- RecyclerView recyclerView;
- String username, password, endpoint, bucket, prefix, location, pdfendpoint, query, policy;
- boolean style, isplaylist;
- String[] filename;
- Region region;
- S3ClientOptions s3ClientOptions;
- AWSCredentials myCredentials;
- AmazonS3 s3client;
- ProgressBar simpleProgressBar;
- int videocache, videotime, buffersize, treelevel, playlisttime;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- endpoint = getIntent().getStringExtra("endpoint");
- username = getIntent().getStringExtra("username");
- password = getIntent().getStringExtra("password");
- bucket = getIntent().getStringExtra("bucket");
- location = getIntent().getStringExtra("region");
- pdfendpoint = getIntent().getStringExtra("pdfendpoint");
- style = getIntent().getBooleanExtra("style", false);
- prefix = getIntent().getStringExtra("prefix");
- treelevel = getIntent().getIntExtra("treelevel", 0);
- videocache = getIntent().getIntExtra("videocache", 40);
- videotime = getIntent().getIntExtra("videotime", 1);
- playlisttime = getIntent().getIntExtra("playlisttime", 1);
- buffersize = getIntent().getIntExtra("buffersize", 2000);
- isplaylist = getIntent().getBooleanExtra("isplaylist", false);
- setContentView(R.layout.activity_object_select);
- getSupportActionBar().setTitle(bucket+"/"+prefix);
- region = Region.getRegion(location);
- s3ClientOptions = S3ClientOptions.builder().build();
- myCredentials = new BasicAWSCredentials(username, password);
- try {
- s3client = new AmazonS3Client(myCredentials, region);
- } catch (Exception e) {
- Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- s3client.setEndpoint(endpoint);
- s3ClientOptions.setPathStyleAccess(style);
-
- s3client.setS3ClientOptions(s3ClientOptions);
-
-
- recyclerView = findViewById(R.id.olist);
- simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
-
- // layout for vertical orientation
- LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
- recyclerView.setLayoutManager(linearLayoutManager);
- Thread listobject = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- //List buckets = s3client.listBuckets();
- ListObjectsRequest orequest;
- if (treelevel == 0) {
- orequest = new ListObjectsRequest().withBucketName(bucket).withMaxKeys(1000).withDelimiter("/");
- } else {
- orequest = new ListObjectsRequest().withBucketName(bucket).withPrefix(prefix).withMaxKeys(1000).withDelimiter("/");
- }
- //List objects = (List) s3client.listObjects(bucket, "/");
- ObjectListing result = s3client.listObjects(orequest);
- //System.out.println(objects);
- //This convert bucket list to an array list
- Img = new ArrayList();
- ArrayList object = new ArrayList();
- // Print bucket names
- //System.out.println("Buckets:");
- //int i=0;
- //This get folder list
- List od = result.getCommonPrefixes();
- for (String os : od) {
- filename = os.split("/");
- if (filename.length == treelevel+1) {
- object.add(filename[treelevel]+"/");
- }
-
- //i++;
- }
- while (result.isTruncated()) {
- result = s3client.listNextBatchOfObjects (result);
- od = result.getCommonPrefixes();
- for (String os : od) {
- filename = os.split("/");
- if (filename.length == treelevel+1) {
- object.add(filename[treelevel]+"/");
- }
-
- //i++;
- }
-
- }
- //This get file list
- List ob = result.getObjectSummaries();
- for (S3ObjectSummary os : ob) {
- filename = os.getKey().split("/");
- if (filename.length == treelevel+1) {
- object.add(filename[treelevel]);
- }
- else {
- object.add(filename[treelevel]+"/");
- }
-
- //i++;
- }
- while (result.isTruncated()) {
- result = s3client.listNextBatchOfObjects (result);
- ob = result.getObjectSummaries();
- for (S3ObjectSummary os : ob) {
- filename = os.getKey().split("/");
- if (filename.length == treelevel+1) {
- object.add(filename[treelevel]);
- }
- else {
- object.add(filename[treelevel]+"/");
- }
-
- //i++;
- }
-
- }
-
- Name = new ArrayList(object);
- object.clear();
- //Img.add(R.drawable.unknownfile);
- //This set object icon based on its filetype
- int i = 0;
- while(i= 1) {
- Toast.makeText(ObjectSelect.this, getResources().getString(R.string.only_item_onlist), Toast.LENGTH_SHORT).show();
- } else {
- delete(prefix + Name.get(position).toString(), true);
- }
- }
- return true;
- }
- });
- // Showing the popup menu
- popupMenu.show();
- } else {
- // Initializing the popup menu and giving the reference as current context
- PopupMenu popupMenu = new PopupMenu(recyclerView.getContext(), view);
-
- // Inflating popup menu from popup_menu.xml file
- popupMenu.getMenuInflater().inflate(R.menu.object_menu, popupMenu.getMenu());
- popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
- @Override
- public boolean onMenuItemClick(MenuItem menuItem) {
- // Toast message on menu item clicked
- //Toast.makeText(MainActivity.this, "You Clicked " + menuItem.getTitle(), Toast.LENGTH_SHORT).show();
- if (menuItem.getTitle() == getResources().getString(R.string.download_file)) {
- //Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
- download(Name.get(position).toString(), false);
- } else if (menuItem.getTitle() == getResources().getString(R.string.bucket_policy)) {
- policyConfig(prefix + Name.get(position).toString(), Name.get(position).toString());
- } else if (menuItem.getTitle() == getResources().getString(R.string.upload_file_here)) {
- //Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
- upload(false);
- } else if (menuItem.getTitle() == getResources().getString(R.string.upload_folder_here)) {
- //Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
- upload(true);
- } else if (menuItem.getTitle() == getResources().getString(R.string.create_link)) {
- share(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(), Name.get(position).toString());
- } else if (menuItem.getTitle() == getResources().getString(R.string.copy_name)) {
- copyName(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) {
- Toast.makeText(ObjectSelect.this, getResources().getString(R.string.only_item_onlist), Toast.LENGTH_SHORT).show();
- } else {
- delete(prefix + Name.get(position).toString(), false);
- }
- }
- }
- return true;
- }
- });
- // Showing the popup menu
- popupMenu.show();
- }
- }
- }));
- }
-
- private void videoPlayer(String url, String title) {
- if (title.toLowerCase(Locale.ROOT).endsWith(".m3u")) {
- Thread mediaread = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //load media file
- ArrayList links = getPlaylist(url);
- ArrayList medialist = new ArrayList();
- for (int i = 0; i < links.size(); i++) {
- medialist.add(links.get(i).toString());
- }
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- // Sending reference and data to Adapter
- //videoPlayer(objectURL.toString(), Name.get(position).toString());
- Intent intent = new Intent(getApplicationContext(), VideoPlayer.class);
- intent.putExtra("video_url", url);
- intent.putExtra("title", title);
- intent.putExtra("videocache", videocache);
- intent.putExtra("buffersize", buffersize);
- intent.putExtra("isplaylist", true);
- intent.putExtra("queue", links);
- intent.putExtra("names", medialist);
- simpleProgressBar.setVisibility(View.INVISIBLE);
- startActivity(intent);
- }
- });
- //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(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- });
- }
- }
- });
- mediaread.start();
- }
- else if (isplaylist) {
- Thread mediaread = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //load media file
- ArrayList medialist = new ArrayList();
- for (int i = 0; i < Name.size(); i++) {
- if (Img.get(i).equals(R.drawable.audiofile) || Img.get(i).equals(R.drawable.videofile)) {
- medialist.add(Name.get(i).toString());
- }
- }
- ArrayList links = getLinks(medialist);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- if(links != null) {
- // Sending reference and data to Adapter
- //videoPlayer(objectURL.toString(), Name.get(position).toString());
- Intent intent = new Intent(getApplicationContext(), VideoPlayer.class);
- intent.putExtra("video_url", url);
- intent.putExtra("title", title);
- intent.putExtra("videocache", videocache);
- intent.putExtra("buffersize", buffersize);
- intent.putExtra("isplaylist", isplaylist);
- intent.putExtra("queue", links);
- intent.putExtra("names", medialist);
- simpleProgressBar.setVisibility(View.INVISIBLE);
- startActivity(intent);
- }
- }
- });
- //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(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- });
- }
- }
- });
- mediaread.start();
- } else {
- 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("isplaylist", isplaylist);
- simpleProgressBar.setVisibility(View.INVISIBLE);
- startActivity(intent);
- }
-
- }
-
- private void textViewer(String url) {
-
- Intent intent = new Intent(this, TextViewer.class);
- intent.putExtra("video_url", url);
- startActivity(intent);
-
- }
-
- private void imageViewer(String url, String title) {
-
- Intent intent = new Intent(this, ImageViewer.class);
- intent.putExtra("video_url", url);
- intent.putExtra("title", title);
- startActivity(intent);
-
- }
-
- private void webBrowser(String url, String pagetitle) {
-
- Intent intent = new Intent(this, WebBrowser.class);
- intent.putExtra("web_url", url);
- intent.putExtra("title", pagetitle);
- startActivity(intent);
-
- }
-
- private void explorer(String object) {
-
- Intent intent = new Intent(this, ObjectSelect.class);
- //treelevel ++;
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("bucket", bucket);
- intent.putExtra("prefix", prefix + object);
- intent.putExtra("treelevel", treelevel+1);
- intent.putExtra("region", location);
- intent.putExtra("pdfendpoint", pdfendpoint);
- intent.putExtra("style", style);
- intent.putExtra("videocache", videocache);
- intent.putExtra("videotime", videotime);
- intent.putExtra("buffersize", buffersize);
- intent.putExtra("playlisttime", playlisttime);
- intent.putExtra("isplaylist", isplaylist);
- startActivity(intent);
-
- }
-
- private void share(String object, boolean mediafile) {
-
- Intent intent = new Intent(this, Share.class);
- //treelevel ++;
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("bucket", bucket);
- intent.putExtra("object", prefix+object);
- intent.putExtra("title", object);
- intent.putExtra("region", location);
- intent.putExtra("mediafile", mediafile);
- intent.putExtra("videotime", videotime);
- intent.putExtra("playlisttime", playlisttime);
- intent.putExtra("style", style);
- startActivity(intent);
-
- }
-
- private void objectInfo(String object, String title) {
-
- Intent intent = new Intent(this, ObjectInfo.class);
- //treelevel ++;
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("bucket", bucket);
- intent.putExtra("object", object);
- intent.putExtra("title", title);
- intent.putExtra("region", location);
- intent.putExtra("style", style);
- startActivity(intent);
-
- }
-
- private void delete(String object, boolean folder) {
- AlertDialog.Builder builder = new AlertDialog.Builder(ObjectSelect.this);
- builder.setCancelable(true);
- builder.setTitle(object);
- if (folder) {
- builder.setMessage(getResources().getString(R.string.folder_del_confirm));
- } else {
- builder.setMessage(getResources().getString(R.string.file_del_confirm));
- }
- builder.setPositiveButton(android.R.string.ok,
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- //Toast.makeText(ObjectSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
- Thread deleteObject = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- //List buckets = s3client.listBuckets();
- if (folder) {
- ListObjectsRequest orequest = new ListObjectsRequest().withBucketName(bucket).withPrefix(object).withMaxKeys(1000);
- //List objects = (List) s3client.listObjects(bucket, "/");
- ObjectListing result = s3client.listObjects(orequest);
- ArrayList objectl = new ArrayList();
- List objects = result.getObjectSummaries();
- for (S3ObjectSummary os : objects) {
- objectl.add(os.getKey());
- }
- if (objectl.size() >= 1) {
- DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucket).withKeys(objectl.toArray(new String[0]));
- s3client.deleteObjects(deleteObjectsRequest);
- }
- while (result.isTruncated()) {
- objectl = new ArrayList();
- result = s3client.listNextBatchOfObjects (result);
- objects = result.getObjectSummaries();
- for (S3ObjectSummary os : objects) {
- objectl.add(os.getKey());
- //i++;
- }
- DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucket).withKeys(objectl.toArray(new String[0]));
- s3client.deleteObjects(deleteObjectsRequest);
-
- }
-
- } else {
- DeleteObjectRequest deleteObjectRequest = new DeleteObjectRequest(bucket, object);
- s3client.deleteObject(deleteObjectRequest);
- }
-
- //System.out.println(Name);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- // Sending reference and data to Adapter
- if (folder) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.folder_del_success), Toast.LENGTH_SHORT).show();
- } else {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.file_del_success), Toast.LENGTH_SHORT).show();
- }
- recreate();
-
- }
- });
- //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(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
- simpleProgressBar.setVisibility(View.VISIBLE);
- deleteObject.start();
- }
- });
- builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- }
- });
- AlertDialog dialog = builder.create();
- dialog.show();
- }
-
- private void upload(boolean isfolder) {
- Intent intent = new Intent(this, Uploader.class);
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("bucket", bucket);
- intent.putExtra("prefix", prefix);
- intent.putExtra("region", location);
- intent.putExtra("style", style);
- intent.putExtra("isfolder", isfolder);
- startActivity(intent);
- }
-
- private void download(String filename, boolean isfolder) {
-
- Intent intent = new Intent(this, Downloader.class);
- if(isfolder) {
- intent.putExtra("prefix", prefix+filename);
- } else {
- intent.putExtra("prefix", prefix);
- intent.putExtra("filename", filename);
- }
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("region", location);
- intent.putExtra("style", style);
- intent.putExtra("bucket", bucket);
- intent.putExtra("isfolder", isfolder);
- startActivity(intent);
- }
-
- private void policyConfig(String filename, String title) {
- Intent intent = new Intent(this, ObjectPolicy.class);
- intent.putExtra("endpoint", endpoint);
- intent.putExtra("username", username);
- intent.putExtra("password", password);
- intent.putExtra("bucket", bucket);
- intent.putExtra("filename", filename);
- intent.putExtra("region", location);
- intent.putExtra("style", style);
- intent.putExtra("title", title);
- intent.putExtra("pdfendpoint", pdfendpoint);
- startActivity(intent);
- }
-
- public void copyName (String name) {
- ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
- ClipData clip;
- if(name.endsWith("/")) {
- clip = ClipData.newPlainText("name", name.replace("/", ""));
- } else {
- clip = ClipData.newPlainText("name", name);
- }
- clipboard.setPrimaryClip(clip);
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.copy_ok), Toast.LENGTH_SHORT).show();
- }
- }
-
- public ArrayList getLinks (ArrayList medialist) throws InterruptedException {
- ArrayList links = new ArrayList();
- Date expiration = new Date();
- Calendar mycal = Calendar.getInstance();
- mycal.setTime(expiration);
- //System.out.println("today is " + mycal.getTime());
- mycal.add(Calendar.HOUR, playlisttime);
- //System.out.println("Expiration date: " + mycal.getTime());
- expiration = mycal.getTime();
- for (int i = 0; i < medialist.size(); i++) {
- //GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, prefix+medialist.get(i)).withExpiration(expiration);;
- //links.add(s3client.generatePresignedUrl(request).toString());
- links.add(PolicyCheck.getFileKey(s3client, bucket, prefix+medialist.get(i), expiration, policy));
- }
- return links;
- }
-
- public ArrayList getPlaylist(String playlist) {
- ArrayList links = new ArrayList();
- try {
- BufferedReader br = new BufferedReader(new InputStreamReader((new URL(playlist).openStream())));
- String strLine;
-
-//Read File Line By Line
- while ((strLine = br.readLine()) != null) {
- // Print the content on the console - do what you want to do
- if(!strLine.startsWith("#")) {
- links.add(strLine);
- }
- }
-
-//Close the input stream
- return links;
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/PolicyCheck.java b/app/src/main/java/asgardius/page/s3manager/PolicyCheck.java
deleted file mode 100644
index 3ce5fca..0000000
--- a/app/src/main/java/asgardius/page/s3manager/PolicyCheck.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package asgardius.page.s3manager;
-
-import com.amazonaws.services.s3.AmazonS3;
-import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest;
-
-import java.util.Date;
-
-public class PolicyCheck {
- public static String getFileKey(AmazonS3 s3client, String bucket, String object, Date expiration, String policy) {
- try {
- Boolean publicobject;
- String fileKey = null;
- publicobject = false;
- if(policy.contains("arn:aws:s3:::"+bucket+"/*") && policy.contains("s3:GetObject")) {
- publicobject = true;
- } else if(policy.contains("s3:GetObject")) {
- if((policy.contains("\"arn:aws:s3:::"+bucket+"/"+object+"\"") || policy.contains("\"arn:aws:s3:::"+bucket+"/"+object+"*\"") || policy.contains("\"arn:aws:s3:::"+bucket+"/"+object+"**\"")) && policy.contains("s3:GetObject")) {
- publicobject = true;
- } else {
- String[] path = object.split("/");
- String filepath = "";
- for (int i = 0; i < path.length-1; i++) {
- filepath = filepath+path[i]+"/";
- //System.out.println(filepath);
- if(policy.contains("\"arn:aws:s3:::"+bucket+"/"+filepath+"*\"") || policy.contains("\"arn:aws:s3:::"+bucket+"/"+filepath+"**\"")) {
- publicobject = true;
- i = path.length;
- }
- }
- }
- }
- if(publicobject) {
- fileKey = s3client.getUrl(bucket, object).toString();
- } else {
- GeneratePresignedUrlRequest request;
- request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
- fileKey = s3client.generatePresignedUrl(request).toString();
- }
- return fileKey;
- } catch (Exception e) {
- GeneratePresignedUrlRequest request;
- request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
- return s3client.generatePresignedUrl(request).toString();
- }
- }
-}
diff --git a/app/src/main/java/asgardius/page/s3manager/RecyclerTouchListener.java b/app/src/main/java/asgardius/page/s3manager/RecyclerTouchListener.java
deleted file mode 100644
index 1b566f5..0000000
--- a/app/src/main/java/asgardius/page/s3manager/RecyclerTouchListener.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package asgardius.page.s3manager;
-
-import android.content.Context;
-import android.view.GestureDetector;
-import android.view.MotionEvent;
-import android.view.View;
-
-import androidx.recyclerview.widget.RecyclerView;
-
-public class RecyclerTouchListener implements RecyclerView.OnItemTouchListener {
-
- private GestureDetector gestureDetector;
- private ClickListener clickListener;
-
- public RecyclerTouchListener(Context context, final RecyclerView recyclerView, final ClickListener clickListener) {
- this.clickListener = clickListener;
- gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
- @Override
- public boolean onSingleTapUp(MotionEvent e) {
- return true;
- }
-
- @Override
- public void onLongPress(MotionEvent e) {
- View child = recyclerView.findChildViewUnder(e.getX(), e.getY());
- if (child != null && clickListener != null) {
- clickListener.onLongClick(child, recyclerView.getChildPosition(child));
- }
- }
- });
- }
-
- @Override
- public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
-
- View child = rv.findChildViewUnder(e.getX(), e.getY());
- if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) {
- clickListener.onClick(child, rv.getChildPosition(child));
- }
- return false;
- }
-
- @Override
- public void onTouchEvent(RecyclerView rv, MotionEvent e) {
- }
-
- @Override
- public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
-
- }
-
- public interface ClickListener {
- void onClick(View view, int position);
-
- void onLongClick(View view, int position);
- }
-}
diff --git a/app/src/main/java/asgardius/page/s3manager/Settings.java b/app/src/main/java/asgardius/page/s3manager/Settings.java
deleted file mode 100644
index 4d373bb..0000000
--- a/app/src/main/java/asgardius/page/s3manager/Settings.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package asgardius.page.s3manager;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.google.android.exoplayer2.database.StandaloneDatabaseProvider;
-import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor;
-import com.google.android.exoplayer2.upstream.cache.SimpleCache;
-import com.google.android.material.switchmaterial.SwitchMaterial;
-
-import java.io.File;
-
-import asgardius.page.s3manager.databinding.ActivitySettingsBinding;
-
-public class Settings extends AppCompatActivity {
-
- private ActivitySettingsBinding binding;
- MyDbHelper dbHelper;
- SQLiteDatabase db;
- String videocache, videotime, buffersize, playlisttime;
- EditText vcachepick, vtimepick, bsizepick, ptimepick;
- Button saveprefs, about, clearcache;
- SwitchMaterial isplaylist;
- StandaloneDatabaseProvider standaloneDatabaseProvider;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- binding = ActivitySettingsBinding.inflate(getLayoutInflater());
- setContentView(binding.getRoot());
- vcachepick = (EditText)findViewById(R.id.videocache);
- vtimepick = (EditText)findViewById(R.id.videotime);
- bsizepick = (EditText)findViewById(R.id.buffersize);
- ptimepick = (EditText)findViewById(R.id.playlisttime);
- dbHelper = new MyDbHelper(this);
- isplaylist = (SwitchMaterial) findViewById(R.id.isplaylist);
- Thread getprefs = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- // Database Queries
- db = dbHelper.getWritableDatabase();
- String query = "SELECT value FROM preferences where setting='videocache'";
- Cursor cursor = db.rawQuery(query,null);
- while (cursor.moveToNext()){
- videocache = (cursor.getString(0));
- }
- query = "SELECT value FROM preferences where setting='videotime'";
- cursor = db.rawQuery(query,null);
- while (cursor.moveToNext()){
- videotime = (cursor.getString(0));
- }
- query = "SELECT value FROM preferences where setting='buffersize'";
- cursor = db.rawQuery(query,null);
- while (cursor.moveToNext()){
- buffersize = (cursor.getString(0));
- }
- query = "SELECT value FROM preferences where setting='isplaylist'";
- cursor = db.rawQuery(query,null);
- while (cursor.moveToNext()){
- isplaylist.setChecked(cursor.getString(0).equals("1"));
- }
- query = "SELECT value FROM preferences where setting='playlisttime'";
- cursor = db.rawQuery(query,null);
- while (cursor.moveToNext()){
- playlisttime = (cursor.getString(0));
- }
- db.close();
-
- runOnUiThread(new Runnable() {
-
- @SuppressLint("SetTextI18n")
- @Override
- public void run() {
- vcachepick.setText(videocache);
- vtimepick.setText(videotime);
- bsizepick.setText(buffersize);
- ptimepick.setText(playlisttime);
- }
- });
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
- getprefs.start();
-
- clearcache = (Button)findViewById(R.id.clearcache);
- clearcache.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- try {
- standaloneDatabaseProvider = new StandaloneDatabaseProvider(getApplicationContext());
- SimpleCache.delete(new File(getApplicationContext().getFilesDir(), "media"), standaloneDatabaseProvider);
- standaloneDatabaseProvider.close();
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.clearcache_ok), Toast.LENGTH_SHORT).show();
- } catch (Exception e) {
- e.printStackTrace();
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- }
- //This launch account add screen
- //addaccount(false);
- }
- });
-
- //This is to add new user account
- saveprefs = (Button)findViewById(R.id.saveprefs);
- saveprefs.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- try {
- videocache = vcachepick.getText().toString();
- videotime = vtimepick.getText().toString();
- buffersize = bsizepick.getText().toString();
- playlisttime = ptimepick.getText().toString();
- if (videocache.equals("") || videotime.equals("") || buffersize.equals("")) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_null), Toast.LENGTH_SHORT).show();
- } else if (videocache.equals("0") || videotime.equals("0") || playlisttime.equals("0")) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.not_zero), Toast.LENGTH_SHORT).show();
- } else if (Integer.parseInt(buffersize) <= 2000) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.buffersize_error), Toast.LENGTH_SHORT).show();
- } else if (Integer.parseInt(videotime) > 168 || Integer.parseInt(playlisttime) > 168) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show();
- } else {
- db = dbHelper.getWritableDatabase();
- db.execSQL("UPDATE preferences SET value='" + videocache + "' where setting='videocache'");
- db.execSQL("UPDATE preferences SET value='" + videotime + "' where setting='videotime'");
- db.execSQL("UPDATE preferences SET value='" + buffersize + "' where setting='buffersize'");
- db.execSQL("UPDATE preferences SET value='" + playlisttime + "' where setting='playlisttime'");
- if(isplaylist.isChecked()) {
- db.execSQL("UPDATE preferences SET value='1' where setting='isplaylist'");
- } else {
- db.execSQL("UPDATE preferences SET value='0' where setting='isplaylist'");
- }
- db.close();
- mainmenu();
- }
- } catch (Exception e) {
- e.printStackTrace();
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
- }
- //This launch account add screen
- //addaccount(false);
- }
- });
-
- //This is to view app credits
- about = (Button)findViewById(R.id.settings_button);
- about.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- aboutPage();
- }
- });
- }
-
- @Override
-
- public void onDestroy() {
- super.onDestroy();
- }
-
- private void aboutPage () {
-
- Intent intent = new Intent(this, WebBrowser.class);
- intent.putExtra("web_url", "file:///android_asset/about.htm");
- intent.putExtra("title", getResources().getString(R.string.about_button));
- startActivity(intent);
-
- }
-
- private void mainmenu() {
- Intent intent = new Intent(this, MainActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- intent.putExtra("EXIT", true);
- startActivity(intent);
-
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/Share.java b/app/src/main/java/asgardius/page/s3manager/Share.java
deleted file mode 100644
index 6f03cba..0000000
--- a/app/src/main/java/asgardius/page/s3manager/Share.java
+++ /dev/null
@@ -1,467 +0,0 @@
-package asgardius.page.s3manager;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import android.app.Activity;
-import android.content.ClipData;
-import android.content.ClipboardManager;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.Toast;
-
-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;
-import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest;
-import com.amazonaws.services.s3.model.ListObjectsRequest;
-import com.amazonaws.services.s3.model.ObjectListing;
-import com.amazonaws.services.s3.model.S3ObjectSummary;
-
-import java.io.OutputStreamWriter;
-import java.net.URL;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-public class Share extends AppCompatActivity {
- String username, password, endpoint, bucket, object, location, title, objectlist, policy;
- boolean mediafile, style, publicobject;
- TextView expirationtext;
- ProgressBar simpleProgressBar;
- Region region;
- S3ClientOptions s3ClientOptions;
- AWSCredentials myCredentials;
- AmazonS3 s3client;
- ListObjectsRequest orequest;
- Calendar mycal;
- EditText datepick, hourpick, minutepick;
- int date, hour, minute;
- Button share, copylinks, savelinks;
- GeneratePresignedUrlRequest request;
- Date expiration;
- URL objectURL;
- Uri fileuri;
- Intent intent;
- int videotime, playlisttime;
-
- public static String URLify(String str) {
- str = str.trim();
- int length = str.length();
- int trueL = length;
- if(str.contains(" ")) {
- for(int i = 0; i < length; i++) {
- if(str.charAt(i) == ' ') {
- trueL = trueL + 2;
- }
- }
- char[] oldArr = str.toCharArray();
- char[] newArr = new char[trueL];
- int x = 0;
- for(int i = 0; i < length; i++) {
- if(oldArr[i] == ' ') {
- newArr[x] = '%';
- newArr[x+1] = '2';
- newArr[x+2] = '0';
- x += 3;
- } else {
- newArr[x] = oldArr[i];
- x++;
- }
- }
- str = new String(newArr, 0, trueL);
- }
- return str;
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_share);
- simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
- expirationtext = (TextView) findViewById(R.id.expirationtext);
- mycal = Calendar.getInstance();
- datepick = (EditText)findViewById(R.id.Date);
- hourpick = (EditText)findViewById(R.id.Hour);
- minutepick = (EditText)findViewById(R.id.Minute);
- share = (Button)findViewById(R.id.share);
- copylinks = (Button)findViewById(R.id.copy_links);
- savelinks = (Button)findViewById(R.id.save_links);
- endpoint = getIntent().getStringExtra("endpoint");
- username = getIntent().getStringExtra("username");
- password = getIntent().getStringExtra("password");
- bucket = getIntent().getStringExtra("bucket");
- location = getIntent().getStringExtra("region");
- style = getIntent().getBooleanExtra("style", false);
- object = getIntent().getStringExtra("object");
- mediafile = getIntent().getBooleanExtra("mediafile", false);
- videotime = getIntent().getIntExtra("videotime", 1);
- playlisttime = getIntent().getIntExtra("playlisttime", 1);
- title = getIntent().getStringExtra("title");
- getSupportActionBar().setTitle(title);
- region = Region.getRegion(location);
- s3ClientOptions = S3ClientOptions.builder().build();
- myCredentials = new BasicAWSCredentials(username, password);
- try {
- s3client = new AmazonS3Client(myCredentials, region);
- } catch (Exception e) {
- Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- }
- s3client.setEndpoint(endpoint);
- s3ClientOptions.setPathStyleAccess(style);
- s3client.setS3ClientOptions(s3ClientOptions);
- Thread getPolicy = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- policy = s3client.getBucketPolicy(bucket).getPolicyText();
- publicobject = false;
- if(policy.contains("arn:aws:s3:::"+bucket+"/*") && policy.contains("s3:GetObject")) {
- publicobject = true;
- } else if(policy.contains("s3:GetObject")) {
- if((policy.contains("\"arn:aws:s3:::"+bucket+"/"+object+"\"") || policy.contains("\"arn:aws:s3:::"+bucket+"/"+object+"*\"") || policy.contains("\"arn:aws:s3:::"+bucket+"/"+object+"**\"")) && policy.contains("s3:GetObject")) {
- publicobject = true;
- } else {
- String[] path = object.split("/");
- String filepath = "";
- for (int i = 0; i < path.length-1; i++) {
- filepath = filepath+path[i]+"/";
- //System.out.println(filepath);
- if(policy.contains("\"arn:aws:s3:::"+bucket+"/"+filepath+"*\"") || policy.contains("\"arn:aws:s3:::"+bucket+"/"+filepath+"**\"")) {
- publicobject = true;
- i = path.length;
- }
- }
- }
- }
- //System.out.println(policy);
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- //Your code goes here
- if(publicobject){
- expirationtext.setText(getResources().getString(R.string.expiration_not_required));
-
- } else {
- datepick.setEnabled(true);
- hourpick.setEnabled(true);
- minutepick.setEnabled(true);
- expirationtext.setText(getResources().getString(R.string.expiration_time));
- }
- if(object == null || object.endsWith("/")) {
- copylinks.setVisibility(View.VISIBLE);
- savelinks.setVisibility(View.VISIBLE);
- } else {
- share.setVisibility(View.VISIBLE);
- copylinks.setVisibility(View.VISIBLE);
- }
- simpleProgressBar.setVisibility(View.INVISIBLE);
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- publicobject = false;
- datepick.setEnabled(true);
- hourpick.setEnabled(true);
- minutepick.setEnabled(true);
- expirationtext.setText(getResources().getString(R.string.expiration_time));
- if(object == null || object.endsWith("/")) {
- copylinks.setVisibility(View.VISIBLE);
- savelinks.setVisibility(View.VISIBLE);
- } else {
- share.setVisibility(View.VISIBLE);
- copylinks.setVisibility(View.VISIBLE);
- }
- simpleProgressBar.setVisibility(View.INVISIBLE);
- }
- });
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- }
- }
- });
- getPolicy.start();
- share.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- try {
- sharefile();
- //System.out.println(URLify(objectURL.toString()));
- Intent shareIntent = new Intent(Intent.ACTION_SEND);
- shareIntent.setType("text/plain");
- shareIntent.putExtra(Intent.EXTRA_TEXT, URLify(objectURL.toString()));
- startActivity(Intent.createChooser(shareIntent, "choose one"));
- } catch (Exception e) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show();
- }
- }
-
- });
- copylinks.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- if(object == null || object.endsWith("/")) {
- simpleProgressBar.setVisibility(View.VISIBLE);
- }
- Thread copyLinks = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //load media file
- if(object == null || object.endsWith("/")) {
- getLinks();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- // Sending reference and data to Adapter
- simpleProgressBar.setVisibility(View.INVISIBLE);
- ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
- ClipData clip;
- clip = ClipData.newPlainText("name", objectlist);
- clipboard.setPrimaryClip(clip);
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.copy_ok), Toast.LENGTH_SHORT).show();
- }
- }
- });
- } else {
- sharefile();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- // Sending reference and data to Adapter
- ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
- ClipData clip;
- clip = ClipData.newPlainText("name", URLify(objectURL.toString()));
- clipboard.setPrimaryClip(clip);
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.copy_ok), Toast.LENGTH_SHORT).show();
- }
- }
- });
- }
-
- //System.out.println("tree "+treelevel);
- //System.out.println("prefix "+prefix);
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.INVISIBLE);
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show();
- }
- });
- }
- }
- });
- copyLinks.start();
- }
-
- });
- savelinks.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- performFileSearch("Select download location");
- }
-
- });
- }
-
- private void performFileSearch(String messageTitle) {
- //uri = Uri.parse("content://com.android.externalstorage.documents/document/home");
- intent = new Intent();
- intent.setAction(Intent.ACTION_CREATE_DOCUMENT);
- //intent.addCategory(Intent.CATEGORY_OPENABLE);
- //intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
- //intent.putExtra("android.provider.extra.INITIAL_URI", uri);
- intent.putExtra(Intent.EXTRA_TITLE, "links.txt");
- intent.setType("*/*");
- ((Activity) this).startActivityForResult(intent, 70);
- }
-
- @Override
- public void onActivityResult(int requestCode, int resultCode, final Intent resultData) {
- // The ACTION_OPEN_DOCUMENT intent was sent with the request code OPEN_DIRECTORY_REQUEST_CODE.
- // If the request code seen here doesn't match, it's the response to some other intent,
- // and the below code shouldn't run at all.
- super.onActivityResult(requestCode, resultCode, resultData);
- if (requestCode == 70) {
- if (resultCode == Activity.RESULT_OK) {
- // The document selected by the user won't be returned in the intent.
- // Instead, a URI to that document will be contained in the return intent
- // provided to this method as a parameter. Pull that uri using "resultData.getData()"
- if (resultData != null && resultData.getData() != null) {
- fileuri = resultData.getData();
- System.out.println(fileuri.toString());
- savelinks();
- //System.out.println("File selected successfully");
- //System.out.println("content://com.android.externalstorage.documents"+file.getPath());
- } else {
- Toast.makeText(Share.this, getResources().getString(R.string.file_path_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- } else {
- //System.out.println("User cancelled file browsing {}");
- finish();
- }
- }
- }
-
- private void getLinks() {
- if (datepick.getText().toString().equals("")) {
- date = 0;
- } else {
- date = Integer.parseInt(datepick.getText().toString());
- }
- if (hourpick.getText().toString().equals("")) {
- hour = 0;
- } else {
- hour = Integer.parseInt(hourpick.getText().toString());
- }
- if (minutepick.getText().toString().equals("")) {
- minute = 0;
- } else {
- minute = Integer.parseInt(minutepick.getText().toString());
- }
- expiration = new Date();
- //System.out.println("today is " + mycal.getTime());
- mycal.setTime(expiration);
- if (date == 0 && hour == 0 && minute == 0) {
- mycal.add(Calendar.HOUR, playlisttime);
- } else {
- mycal.add(Calendar.DATE, date);
- mycal.add(Calendar.HOUR, hour);
- mycal.add(Calendar.MINUTE, minute);
- }
- //System.out.println("Expiration date: " + mycal.getTime());
- expiration = mycal.getTime();
- //System.out.println(expiration);
- if (object == null) {
- orequest = new ListObjectsRequest().withBucketName(bucket).withMaxKeys(1000);
- } else {
- orequest = new ListObjectsRequest().withBucketName(bucket).withPrefix(object).withMaxKeys(1000);
- }
- ObjectListing result = s3client.listObjects(orequest);
- objectlist = "";
- List objects = result.getObjectSummaries();
- for (S3ObjectSummary os : objects) {
- objectlist = objectlist+PolicyCheck.getFileKey(s3client, bucket, os.getKey(), expiration, policy)+"\n";
- }
- while (result.isTruncated()) {
- result = s3client.listNextBatchOfObjects (result);
- objects = result.getObjectSummaries();
- for (S3ObjectSummary os : objects) {
- objectlist = objectlist+PolicyCheck.getFileKey(s3client, bucket, os.getKey(), expiration, policy)+"\n";
- }
-
- }
- }
-
- private void sharefile() {
- if(publicobject) {
- objectURL = s3client.getUrl(bucket, object);
- } else {
- if (datepick.getText().toString().equals("")) {
- date = 0;
- } else {
- date = Integer.parseInt(datepick.getText().toString());
- }
- if (hourpick.getText().toString().equals("")) {
- hour = 0;
- } else {
- hour = Integer.parseInt(hourpick.getText().toString());
- }
- if (minutepick.getText().toString().equals("")) {
- minute = 0;
- } else {
- minute = Integer.parseInt(minutepick.getText().toString());
- }
- expiration = new Date();
- //System.out.println("today is " + mycal.getTime());
- mycal.setTime(expiration);
- if (date == 0 && hour == 0 && minute == 0) {
- if (mediafile) {
- mycal.add(Calendar.HOUR, videotime);
- } else {
- mycal.add(Calendar.MINUTE, 15);
- }
- } else {
- mycal.add(Calendar.DATE, date);
- mycal.add(Calendar.HOUR, hour);
- mycal.add(Calendar.MINUTE, minute);
- }
- //System.out.println("Expiration date: " + mycal.getTime());
- expiration = mycal.getTime();
- //System.out.println(expiration);
- request = new GeneratePresignedUrlRequest(bucket, object).withExpiration(expiration);
- objectURL = s3client.generatePresignedUrl(request);
- }
- }
-
- private void savelinks() {
- simpleProgressBar.setVisibility(View.VISIBLE);
- Thread saveLinks = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- getLinks();
- OutputStreamWriter outputStreamWriter = new OutputStreamWriter(getContentResolver().openOutputStream(fileuri));
- outputStreamWriter.write(objectlist);
- outputStreamWriter.close();
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- // Sending reference and data to Adapter
- simpleProgressBar.setVisibility(View.INVISIBLE);
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.save_ok), Toast.LENGTH_SHORT).show();
- }
- });
- //System.out.println("tree "+treelevel);
- //System.out.println("prefix "+prefix);
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- simpleProgressBar.setVisibility(View.INVISIBLE);
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_expiration_date), Toast.LENGTH_SHORT).show();
- }
- });
- }
- }
- });
- saveLinks.start();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/TextViewer.java b/app/src/main/java/asgardius/page/s3manager/TextViewer.java
deleted file mode 100644
index 9a25383..0000000
--- a/app/src/main/java/asgardius/page/s3manager/TextViewer.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package asgardius.page.s3manager;
-
-import android.os.Build;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.EditText;
-import android.widget.ProgressBar;
-import android.widget.Toast;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.stream.Collectors;
-
-public class TextViewer extends AppCompatActivity {
- EditText filecontent;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_text_viewer);
- filecontent = (EditText)findViewById(R.id.textShow);
- final ProgressBar simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- String videoURL = getIntent().getStringExtra("video_url");
- Thread textread = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- URL fileurl = new URL(videoURL);
-
- // Read all the text returned by the server
- BufferedReader in = new BufferedReader(new InputStreamReader(fileurl.openStream()));
- String str = in.lines().collect(Collectors.joining());
- in.close();
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- // Sending reference and data to Adapter
- simpleProgressBar.setVisibility(View.INVISIBLE);
- filecontent.setText(str);
-
- }
- });
- //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(),e.toString(), Toast.LENGTH_SHORT).show();
- finish();
- }
- });
- //Toast.makeText(getApplicationContext(),e.toString(), Toast.LENGTH_SHORT).show();
- finish();
- }
- }
- });
- textread.start();
- } else {
- finish();
- }
-
- /*try {
- // Create a URL for the desired page
- URL fileurl = new URL(videoURL);
-
- // Read all the text returned by the server
- BufferedReader in = new BufferedReader(new InputStreamReader(fileurl.openStream()));
- String str = in.readLine();
- in.close();
- filecontent.setText(str);
- } catch (MalformedURLException e) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_conn_fail), Toast.LENGTH_SHORT).show();
- } catch (IOException e) {
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_conn_fail), Toast.LENGTH_SHORT).show();
- }*/
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/Uploader.java b/app/src/main/java/asgardius/page/s3manager/Uploader.java
deleted file mode 100644
index 1e11899..0000000
--- a/app/src/main/java/asgardius/page/s3manager/Uploader.java
+++ /dev/null
@@ -1,575 +0,0 @@
-package asgardius.page.s3manager;
-
-import static android.content.ContentValues.TAG;
-
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.documentfile.provider.DocumentFile;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.database.Cursor;
-import android.net.Uri;
-import android.net.wifi.WifiManager;
-import android.os.Bundle;
-import android.os.PowerManager;
-import android.provider.MediaStore;
-import android.util.Log;
-import android.view.View;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.amazonaws.AbortedException;
-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;
-import com.amazonaws.services.s3.model.AbortMultipartUploadRequest;
-import com.amazonaws.services.s3.model.AmazonS3Exception;
-import com.amazonaws.services.s3.model.CompleteMultipartUploadRequest;
-import com.amazonaws.services.s3.model.InitiateMultipartUploadRequest;
-import com.amazonaws.services.s3.model.InitiateMultipartUploadResult;
-import com.amazonaws.services.s3.model.PartETag;
-import com.amazonaws.services.s3.model.PutObjectRequest;
-import com.amazonaws.services.s3.model.PutObjectResult;
-import com.amazonaws.services.s3.model.UploadPartRequest;
-import com.amazonaws.services.s3.model.UploadPartResult;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-public class Uploader extends AppCompatActivity {
- String username, password, endpoint, bucket, prefix, location;
- Uri fileuri, folder;
- EditText fprefix;
- TextView fprefixlabel;
- Region region;
- S3ClientOptions s3ClientOptions;
- AWSCredentials myCredentials;
- AmazonS3 s3client;
- ProgressBar simpleProgressBar;
- long filesize;
- File ufile;
- DocumentFile document;
- Intent intent;
- Button fileUpload;
- Thread uploadFile, uploadProgress, calculateProgress;
- boolean style, isfolder;
- boolean started = false;
- boolean cancel = false;
- long transfered = 0;
- private static final long MAX_SINGLE_PART_UPLOAD_BYTES = 5 * 1024 * 1024;
- private WifiManager.WifiLock mWifiLock;
- private PowerManager.WakeLock mWakeLock;
- private PowerManager powerManager;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_uploader);
- // create Wifi and wake locks
- mWifiLock = ((WifiManager) this.getApplicationContext().getSystemService(Context.WIFI_SERVICE)).createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "Transistor:wifi_lock");
- powerManager = (PowerManager) getSystemService(POWER_SERVICE);
- mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Transistor:wake_lock");
- endpoint = getIntent().getStringExtra("endpoint");
- username = getIntent().getStringExtra("username");
- password = getIntent().getStringExtra("password");
- bucket = getIntent().getStringExtra("bucket");
- location = getIntent().getStringExtra("region");
- style = getIntent().getBooleanExtra("style", false);
- isfolder = getIntent().getBooleanExtra("isfolder", false);
- prefix = getIntent().getStringExtra("prefix");
- if(isfolder) {
- getSupportActionBar().setTitle(getResources().getString(R.string.batch_upload_button));
- } else {
- getSupportActionBar().setTitle(getResources().getString(R.string.upload_button));
- }
- fprefix = (EditText)findViewById(R.id.fprefix);
- fprefixlabel = (TextView) findViewById(R.id.fprefixlabel);
- region = Region.getRegion(location);
- s3ClientOptions = S3ClientOptions.builder().build();
- s3ClientOptions.setPathStyleAccess(style);
- myCredentials = new BasicAWSCredentials(username, password);
- s3client = new AmazonS3Client(myCredentials, region);
- s3client.setEndpoint(endpoint);
- s3client.setS3ClientOptions(s3ClientOptions);
- fileUpload = (Button)findViewById(R.id.fileupload);
- simpleProgressBar = (ProgressBar) findViewById(R.id.simpleProgressBar);
- //Toast.makeText(Uploader.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
- performFileSearch("Select file to upload");
- //fprefix.setText(prefix);
- fileUpload.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View view) {
- //buttonaction
- if (started) {
- started = false;
- cancel = true;
- uploadFile.interrupt();
- //simpleProgressBar.setVisibility(View.INVISIBLE);
- } else {
- started = true;
- transfered = 0;
- //simpleProgressBar.setProgress(0);
- simpleProgressBar.setVisibility(View.VISIBLE);
- if (fileuri == null && folder == null) {
- Toast.makeText(Uploader.this, getResources().getString(R.string.no_file_selected), Toast.LENGTH_SHORT).show();
- } else {
- //Acquiring WakeLock and WifiLock if not held
- if (!mWifiLock.isHeld()) {
- mWifiLock.acquire();
- //System.out.println("WifiLock acquired");
- }
- if (!mWakeLock.isHeld()) {
- mWakeLock.acquire();
- //System.out.println("WakeLock acquired");
- }
- //eUpload.setEnabled(false);
- fileUpload.setText(getResources().getString(R.string.cancel_upload));
- fprefix.setEnabled(false);
- uploadFile = new Thread(new Runnable() {
-
- @Override
- public void run() {
- //System.out.println(fkey);
- //filesize = 0;
- try {
- //Your code goes here
- //s3client.createBucket(bucket, location);
- //System.out.println(fkey);
- if (isfolder) {
- if(prefix.endsWith("/")) {
- prefix = fprefix.getText().toString();
- } else {
- prefix = fprefix.getText().toString().concat("/");
- }
- document = DocumentFile.fromTreeUri(getApplicationContext(), fileuri);
- DocumentFile[] filelist = document.listFiles();
- ArrayList filepath = new ArrayList();
- int treelevel = 0;
- ArrayList fileindex = new ArrayList();
- fileindex.add(0);
- for (int i = 0; i < filelist.length && !cancel; i++) {
- filepath.add(filelist[i].getName());
- if(filelist[i].isDirectory()) {
- treelevel++;
- fileindex.add(0);
- document = filelist[i];
- filelist = document.listFiles();
- while (treelevel >= 1 && fileindex.get(treelevel) < filelist.length+1 && !cancel) {
- if(fileindex.get(treelevel) == filelist.length) {
- fileindex.remove(treelevel);
- document = document.getParentFile();
- filelist = document.listFiles();
- treelevel--;
- filepath.remove(treelevel);
- fileindex.set(treelevel, fileindex.get(treelevel)+1);
- } else {
- filepath.add(filelist[fileindex.get(treelevel)].getName());
- if (filelist[fileindex.get(treelevel)].isDirectory()) {
- document = filelist[fileindex.get(treelevel)];
- filelist = document.listFiles();
- treelevel++;
- fileindex.add(0);
- } else {
- ufile = readContentToFile(filelist[fileindex.get(treelevel)].getUri());
- putS3Object(bucket, prefix+String.join("/", filepath), ufile);
- filepath.remove(treelevel);
- fileindex.set(treelevel, fileindex.get(treelevel)+1);
- }
- }
- }
- } else {
- ufile = readContentToFile(filelist[i].getUri());
- putS3Object(bucket, prefix+String.join("/", filepath), ufile);
- }
- filepath.clear();
- fileindex.clear();
- fileindex.add(0);
- }
- } else {
- ufile = readContentToFile(fileuri);
- if(ufile.length()%MAX_SINGLE_PART_UPLOAD_BYTES == 0) {
- filesize = ufile.length()/MAX_SINGLE_PART_UPLOAD_BYTES;
- } else {
- filesize = (ufile.length()/MAX_SINGLE_PART_UPLOAD_BYTES)+1;
- }
- //PutObjectRequest request = new PutObjectRequest(bucket, fkey, ufile);
- //upload = s3client.putObject(request);
- putS3Object(bucket, fprefix.getText().toString(), ufile);
- }
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- //Releasing WifiLock and WakeLock if held
- if (mWifiLock.isHeld()) {
- mWifiLock.release();
- //System.out.println("WifiLock released");
- }
- if (mWakeLock.isHeld()) {
- mWakeLock.release();
- //System.out.println("WakeLock released");
- }
- if(!cancel) {
- simpleProgressBar.setProgress(100);
- }
- //simpleProgressBar.setVisibility(View.INVISIBLE);
- if (cancel) {
- fileUpload.setText(getResources().getString(R.string.upload_canceled));
- } else if (isfolder) {
- fileUpload.setText(getResources().getString(R.string.batch_upload_success));
- } else {
- fileUpload.setText(getResources().getString(R.string.upload_success));
- }
- started = false;
- fileUpload.setEnabled(false);
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.upload_success), Toast.LENGTH_SHORT).show();
- //simpleProgressBar.setVisibility(View.INVISIBLE);
- }
- });
- //System.out.println("tree "+treelevel);
- //System.out.println("prefix "+prefix);
-
- } catch (Exception e) {
- e.printStackTrace();
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- //Releasing WifiLock and WakeLock if held
- if (mWifiLock.isHeld()) {
- mWifiLock.release();
- //System.out.println("WifiLock released");
- }
- if (mWakeLock.isHeld()) {
- mWakeLock.release();
- //System.out.println("WakeLock released");
- }
- started = false;
- //simpleProgressBar.setVisibility(View.INVISIBLE);
- //fileUpload.setEnabled(true);
- if (cancel) {
- fileUpload.setText(getResources().getString(R.string.upload_canceled));
- } else {
- fileUpload.setText(getResources().getString(R.string.upload_failed));
- }
- fileUpload.setEnabled(false);
- //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();
- }
- }
- });
- uploadProgress = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- while (started) {
- try {
- if (filesize != 0) {
- //simpleProgressBar.setProgress((int)((transfered*100)/filesize));
- simpleProgressBar.setProgress((int)((transfered*100)/filesize));
- }
- Thread.sleep(500);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- //simpleProgressBar.setProgress(100);
- }
- });
- //System.out.println("tree "+treelevel);
- //System.out.println("prefix "+prefix);
-
- } catch (Exception e) {
- e.printStackTrace();
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- //finish();
- }
- }
- });
- //simpleProgressBar.setVisibility(View.VISIBLE);
- uploadFile.start();
- uploadProgress.start();
- /*while (progress <= 99) {
- System.out.println("Upload in progress");
- if (upload != null) {
- System.out.println(upload.getMetadata().getContentLength());
- if(upload.getMetadata().getContentLength() != 0) {
- progress = (int) (((int)filesize / (int)upload.getMetadata().getContentLength())*100);
- simpleProgressBar.setProgress(progress);
- }
- }
- System.out.println(filesize);
- try {
- TimeUnit.SECONDS.sleep(1);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }*/
- }
- }
- }
-
- });
- }
-
- private void performFileSearch(String messageTitle) {
- //uri = Uri.parse("content://com.android.externalstorage.documents/document/home");
- intent = new Intent();
- if (isfolder) {
- intent.setAction(Intent.ACTION_OPEN_DOCUMENT_TREE);
- } else {
- intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
- intent.addCategory(Intent.CATEGORY_OPENABLE);
- //intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
- //intent.putExtra("android.provider.extra.INITIAL_URI", uri);
- intent.setType("*/*");
- }
- ((Activity) this).startActivityForResult(intent, 100);
- }
-
- @SuppressLint("SetTextI18n")
- @Override
-
- public void onDestroy() {
- if (!mWifiLock.isHeld()) {
- mWifiLock.acquire();
- //System.out.println("WifiLock acquired");
- }
- if (!mWakeLock.isHeld()) {
- mWakeLock.acquire();
- //System.out.println("WakeLock acquired");
- }
- super.onDestroy();
- }
-
- public void onActivityResult(int requestCode, int resultCode, final Intent resultData) {
- // The ACTION_OPEN_DOCUMENT intent was sent with the request code OPEN_DIRECTORY_REQUEST_CODE.
- // If the request code seen here doesn't match, it's the response to some other intent,
- // and the below code shouldn't run at all.
- super.onActivityResult(requestCode, resultCode, resultData);
- if (requestCode == 100) {
- if (resultCode == Activity.RESULT_OK) {
- // The document selected by the user won't be returned in the intent.
- // Instead, a URI to that document will be contained in the return intent
- // provided to this method as a parameter. Pull that uri using "resultData.getData()"
- if (resultData != null && resultData.getData() != null) {
- fileuri = resultData.getData();
- System.out.println(fileuri.toString());
- if (isfolder) {
- fprefix.setText(prefix);
- fprefix.setHint(getResources().getString(R.string.upload_prefix));
- fprefixlabel.setText(getResources().getString(R.string.upload_prefix));
- fileUpload.setText(getResources().getString(R.string.upload_calculate));
- fileUpload.setEnabled(false);
- calculateSize();
- } else {
- fprefix.setText(prefix+getDisplayName(fileuri));
- }
- //System.out.println("File selected successfully");
- //System.out.println("content://com.android.externalstorage.documents"+file.getPath());
- } else {
- Toast.makeText(Uploader.this, getResources().getString(R.string.file_path_fail), Toast.LENGTH_SHORT).show();
- finish();
- }
- } else {
- //System.out.println("User cancelled file browsing {}");
- finish();
- }
- }
- }
-
- private File readContentToFile(Uri uri) throws IOException {
- final File file = new File(getCacheDir(), getDisplayName(uri));
- try (
- final InputStream in = getContentResolver().openInputStream(uri);
- final OutputStream out = new FileOutputStream(file, false);
- ) {
- byte[] buffer = new byte[1024];
- for (int len; (len = in.read(buffer)) != -1; ) {
- out.write(buffer, 0, len);
- }
- return file;
- }
- }
-
- private String getDisplayName(Uri uri) {
- final String[] projection = { MediaStore.Images.Media.DISPLAY_NAME };
- try (
- Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
- ){
- int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME);
- if (cursor.moveToFirst()) {
- return cursor.getString(columnIndex);
- }
- }
- // If the display name is not found for any reason, use the Uri path as a fallback.
- Log.w(TAG, "Couldnt determine DISPLAY_NAME for Uri. Falling back to Uri path: " + uri.getPath());
- return uri.getPath();
- }
-
- public void putS3Object(String bucket, String objectKey, File file) {
- if (file.length() <= MAX_SINGLE_PART_UPLOAD_BYTES) {
- putS3ObjectSinglePart(bucket, objectKey, file);
- } else {
- putS3ObjectMultiPart(bucket, objectKey, file);
- }
- }
-
- private void putS3ObjectSinglePart(String bucket, String objectKey, File file) {
- PutObjectRequest request = new PutObjectRequest(bucket, objectKey, file);
- PutObjectResult result = s3client.putObject(request);
- long bytesPushed = result.getMetadata().getContentLength();
- transfered++;
- //LOGGER.info("Pushed {} bytes to s3://{}/{}", bytesPushed, bucket, objectKey);
- }
-
- private void putS3ObjectMultiPart(String bucket, String objectKey, File file) {
- long contentLength = file.length();
- long partSize = MAX_SINGLE_PART_UPLOAD_BYTES;
- List partETags = new ArrayList<>();
-
- // Initiate the multipart upload.
- InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest(bucket, objectKey);
- InitiateMultipartUploadResult initResponse = s3client.initiateMultipartUpload(initRequest);
-
- // Upload the file parts.
- long fileOffset = 0;
- try{
- for (int partNumber = 1; fileOffset < contentLength && !cancel; ++partNumber) {
- // Because the last part could be less than 5 MB, adjust the part size as needed.
- partSize = Math.min(partSize, (contentLength - fileOffset));
-
- // Create the request to upload a part.
- UploadPartRequest uploadRequest = new UploadPartRequest()
- .withBucketName(bucket)
- .withKey(objectKey)
- .withUploadId(initResponse.getUploadId())
- .withPartNumber(partNumber)
- .withFileOffset(fileOffset)
- .withFile(file)
- .withPartSize(partSize);
-
- // Upload the part and add the response's ETag to our list.
- UploadPartResult uploadResult = s3client.uploadPart(uploadRequest);
- //LOGGER.info("Uploading part {} of Object s3://{}/{}", partNumber, bucket, objectKey);
- partETags.add(uploadResult.getPartETag());
-
- fileOffset += partSize;
- transfered++;
- }
-
- // Complete the multipart upload.
- CompleteMultipartUploadRequest compRequest = new CompleteMultipartUploadRequest(bucket, objectKey, initResponse.getUploadId(), partETags);
- s3client.completeMultipartUpload(compRequest);
- } catch (AbortedException | AmazonS3Exception e) {
- e.printStackTrace();
- AbortMultipartUploadRequest abort = new AbortMultipartUploadRequest(bucket, objectKey, initResponse.getUploadId());
- s3client.abortMultipartUpload(abort);
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- //finish();
- }
- }
-
- private void calculateSize() {
- calculateProgress = new Thread(new Runnable() {
-
- @Override
- public void run() {
- try {
- //Your code goes here
- document = DocumentFile.fromTreeUri(getApplicationContext(), fileuri);
- DocumentFile[] filelist = document.listFiles();
- ArrayList filepath = new ArrayList();
- int treelevel = 0;
- ArrayList fileindex = new ArrayList();
- fileindex.add(0);
- for (int i = 0; i < filelist.length; i++) {
- filepath.add(filelist[i].getName());
- if(filelist[i].isDirectory()) {
- treelevel++;
- fileindex.add(0);
- document = filelist[i];
- filelist = document.listFiles();
- while (treelevel >= 1 && fileindex.get(treelevel) < filelist.length+1) {
- if(fileindex.get(treelevel) == filelist.length) {
- fileindex.remove(treelevel);
- document = document.getParentFile();
- filelist = document.listFiles();
- treelevel--;
- filepath.remove(treelevel);
- fileindex.set(treelevel, fileindex.get(treelevel)+1);
- } else {
- filepath.add(filelist[fileindex.get(treelevel)].getName());
- if (filelist[fileindex.get(treelevel)].isDirectory()) {
- document = filelist[fileindex.get(treelevel)];
- filelist = document.listFiles();
- treelevel++;
- fileindex.add(0);
- } else {
- filepath.remove(treelevel);
- if(filelist[fileindex.get(treelevel)].length()%MAX_SINGLE_PART_UPLOAD_BYTES == 0) {
- filesize = filesize+(filelist[fileindex.get(treelevel)].length()/MAX_SINGLE_PART_UPLOAD_BYTES);
- } else {
- filesize = filesize+((filelist[fileindex.get(treelevel)].length()/MAX_SINGLE_PART_UPLOAD_BYTES)+1);
- }
- fileindex.set(treelevel, fileindex.get(treelevel)+1);
- }
- }
- }
- //document = document.getParentFile();
- //filelist = document.listFiles();
- //treelevel--;
- } else {
- if(filelist[i].length()%MAX_SINGLE_PART_UPLOAD_BYTES == 0) {
- filesize = filesize+(filelist[i].length()/MAX_SINGLE_PART_UPLOAD_BYTES);
- } else {
- filesize = filesize+((filelist[i].length()/MAX_SINGLE_PART_UPLOAD_BYTES)+1);
- }
- }
- filepath.clear();
- fileindex.clear();
- fileindex.add(0);
- }
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- fileUpload.setText(getResources().getString(R.string.batch_upload_button));
- fileUpload.setEnabled(true);
- }
- });
-
- } catch (Exception e) {
- e.printStackTrace();
- //Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_list_fail), Toast.LENGTH_SHORT).show();
- //finish();
- }
- }
- });
- calculateProgress.start();
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/VideoPlayer.java b/app/src/main/java/asgardius/page/s3manager/VideoPlayer.java
index cba85c7..8879125 100644
--- a/app/src/main/java/asgardius/page/s3manager/VideoPlayer.java
+++ b/app/src/main/java/asgardius/page/s3manager/VideoPlayer.java
@@ -1,49 +1,17 @@
package asgardius.page.s3manager;
-import android.app.AppOpsManager;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
-import android.app.PictureInPictureParams;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.hardware.display.DisplayManager;
-import android.net.Uri;
-import android.net.wifi.WifiManager;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.PowerManager;
-import android.support.v4.media.session.MediaSessionCompat;
-import android.util.Rational;
-import android.view.Display;
-import android.view.View;
-import android.view.WindowManager;
-import android.widget.Toast;
-
import androidx.appcompat.app.AppCompatActivity;
-import com.google.android.exoplayer2.C;
-import com.google.android.exoplayer2.DefaultLoadControl;
-import com.google.android.exoplayer2.DefaultRenderersFactory;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Toast;
+
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.Player;
-import com.google.android.exoplayer2.Tracks;
-import com.google.android.exoplayer2.audio.AudioAttributes;
-import com.google.android.exoplayer2.database.StandaloneDatabaseProvider;
-import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector;
-import com.google.android.exoplayer2.source.ProgressiveMediaSource;
-import com.google.android.exoplayer2.ui.PlayerNotificationManager;
import com.google.android.exoplayer2.ui.StyledPlayerView;
-import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
-import com.google.android.exoplayer2.upstream.cache.CacheDataSource;
-import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor;
-import com.google.android.exoplayer2.upstream.cache.SimpleCache;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Objects;
+import com.google.android.exoplayer2.upstream.HttpDataSource;
/**
* An example full-screen activity that shows and hides the system UI (i.e.
@@ -53,411 +21,70 @@ public class VideoPlayer extends AppCompatActivity {
// creating a variable for exoplayerview.
protected StyledPlayerView playerView;
- private WifiManager.WifiLock mWifiLock;
- private PowerManager.WakeLock mWakeLock;
- private PowerManager powerManager;
- private long maxCacheSize;
- ArrayList queue, names;
- LeastRecentlyUsedCacheEvictor evictor;
- StandaloneDatabaseProvider standaloneDatabaseProvider;
- SimpleCache simpleCache;
- int videocache, buffersize;
- ProgressiveMediaSource mediaSource;
- DefaultLoadControl loadControl;
- DefaultRenderersFactory renderersFactory;
+
+
+ // url of video which we are loading.
+ //String videoURL = "https://video.asgardius.company/download/videos/41780585-a935-4d53-84c8-45ce97141231-480.mp4";
+
ExoPlayer player;
- long videoPosition;
- MediaSessionCompat mediaSession;
- MediaSessionConnector mediaSessionConnector;
- StyledPlayerView.ControllerVisibilityListener control;
- AppOpsManager appOpsManager;
- private PlayerNotificationManager playerNotificationManager;
- private int notificationId = 1234;
- boolean isplaylist;
- boolean success = false;
- String videoURL, title;
- Rational ratio;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_player);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
- getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
- }
- if(Build.VERSION.SDK_INT >=Build.VERSION_CODES.O){
-
- NotificationChannel channel= new NotificationChannel("playback","Video Playback", NotificationManager.IMPORTANCE_DEFAULT);
- NotificationManager manager =getSystemService(NotificationManager.class);
- channel.setSound(null, null);
- manager.createNotificationChannel(channel);
- }
- appOpsManager = (AppOpsManager)getSystemService(Context.APP_OPS_SERVICE);
- mediaSession = new MediaSessionCompat(this, getPackageName());
- mediaSessionConnector = new MediaSessionConnector(mediaSession);
- hideSystemBars();
- AudioAttributes audioAttributes = new AudioAttributes.Builder()
- .setUsage(C.USAGE_MEDIA)
- .setContentType(C.AUDIO_CONTENT_TYPE_MOVIE)
- .build();
- // create Wifi and wake locks
- mWifiLock = ((WifiManager) this.getApplicationContext().getSystemService(Context.WIFI_SERVICE)).createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "S3Manager:wifi_lock");
- powerManager = (PowerManager) getSystemService(POWER_SERVICE);
- 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);
- isplaylist = getIntent().getBooleanExtra("isplaylist", false);
- queue = getIntent().getStringArrayListExtra("queue");
- names = getIntent().getStringArrayListExtra("names");
- getSupportActionBar().setTitle(title);
- loadControl = new DefaultLoadControl.Builder().setBufferDurationsMs(2000, buffersize, 1500, 2000).build();
-
- @DefaultRenderersFactory.ExtensionRendererMode int extensionRendererMode = DefaultRenderersFactory.EXTENSION_RENDERER_MODE_PREFER;
-
- renderersFactory = new DefaultRenderersFactory(this) .setExtensionRendererMode(extensionRendererMode);
- standaloneDatabaseProvider = new StandaloneDatabaseProvider(this);
- maxCacheSize = (long)videocache * 1024 * 1024;
+ String videoURL = getIntent().getStringExtra("video_url");
playerView = findViewById(R.id.player_view);
// creating a variable for exoplayer
- player = new ExoPlayer.Builder(this).setLoadControl(loadControl).build();
- player.setAudioAttributes(audioAttributes, true);
- mediaSessionConnector.setPlayer(player);
- mediaSession.setActive(true);
- evictor = new LeastRecentlyUsedCacheEvictor(maxCacheSize);
- simpleCache = new SimpleCache(
- new File(this.getFilesDir(), "media"),
- evictor,
- standaloneDatabaseProvider);
+ player = new ExoPlayer.Builder(this).build();
+ // Attach player to the view.
playerView.setPlayer(player);
- control = new StyledPlayerView.ControllerVisibilityListener() {
- @Override
- public void onVisibilityChanged(int visibility) {
- if (playerView.isControllerFullyVisible()) {
- showSystemBars();
- } else {
- hideSystemBars();
- }
- }
- };
- playerView.setControllerVisibilityListener(control);
- //MediaItem mediaItem = MediaItem.fromUri(videoURL);
+ MediaItem mediaItem = MediaItem.fromUri(videoURL);
// Set the media item to be played.
- //player.setMediaItem(mediaItem);
+ player.setMediaItem(mediaItem);
// Prepare the player.
- player.setPlayWhenReady(true);
- playerNotificationManager = new PlayerNotificationManager.Builder(this, notificationId, "playback").build();
- playerNotificationManager.setUseNextActionInCompactView(true);
- playerNotificationManager.setUsePreviousActionInCompactView(true);
- playerNotificationManager.setMediaSessionToken(mediaSession.getSessionToken());
- playerNotificationManager.setPlayer(player);
- if (isplaylist) {
- for (int i = 0; i < queue.size(); i++) {
- if (names.get(i).endsWith(".m3u8")) {
- MediaItem mediaItem = MediaItem.fromUri(Share.URLify(queue.get(i)));
- player.addMediaItem(mediaItem);
- } else {
- mediaSource = new ProgressiveMediaSource.Factory(
- new CacheDataSource.Factory()
- .setCache(simpleCache)
- .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory()
- .setUserAgent("S3 Manager"))
- .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR)
- ).createMediaSource(MediaItem.fromUri(Share.URLify(queue.get(i))));
- player.addMediaSource(mediaSource);
- }
- }
- getSupportActionBar().setTitle(names.get(player.getCurrentMediaItemIndex()));
- player.prepare();
- try {
- player.seekTo(names.indexOf(title), 0);
- }catch (Exception e) {
- System.out.println("Playing m3u file");
- }
- } else {
- if (title.endsWith(".m3u8")) {
- MediaItem mediaItem = MediaItem.fromUri(Share.URLify(videoURL));
- player.setMediaItem(mediaItem);
- } else {
- mediaSource = new ProgressiveMediaSource.Factory(
- new CacheDataSource.Factory()
- .setCache(simpleCache)
- .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory()
- .setUserAgent("S3 Manager"))
- .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR)
- ).createMediaSource(MediaItem.fromUri(Share.URLify(videoURL)));
- player.setMediaSource(mediaSource);
- }
- player.prepare();
- }
+ player.prepare();
// Start the playback.
player.play();
+
player.addListener(new Player.Listener() {
@Override
public void onPlayerError(PlaybackException error) {
Throwable cause = error.getCause();
- if(success) {
- player.pause();
- } else {
+ if (cause instanceof HttpDataSource.HttpDataSourceException) {
// An HTTP error occurred.
//System.out.println("Playback error F");
- Toast.makeText(getApplicationContext(), Objects.requireNonNull(error.getCause()).toString(), Toast.LENGTH_SHORT).show();
+ Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_load_fail), Toast.LENGTH_SHORT).show();
player.release();
finish();
}
}
- @Override
- public void onTracksChanged(Tracks tracks) {
- if(isplaylist) {
- getSupportActionBar().setTitle(names.get(player.getCurrentMediaItemIndex()));
- }
- Player.Listener.super.onTracksChanged(tracks);
- }
-
- });
-
- player.addListener(new Player.Listener() {
- @Override
- public void onPlaybackStateChanged(@Player.State int state) {
- if (state == 3) {
- // Active playback.
- success = true;
- //Acquiring WakeLock and WifiLock if not held
- if (!mWifiLock.isHeld()) {
- mWifiLock.acquire();
- //System.out.println("WifiLock acquired");
- }
- if (!mWakeLock.isHeld()) {
- mWakeLock.acquire();
- //System.out.println("WakeLock acquired");
- }
- } else if (state == 2) {
- // Buffering.
- //Acquiring WakeLock and WifiLock if not held
- if (!mWifiLock.isHeld()) {
- mWifiLock.acquire();
- //System.out.println("WifiLock acquired");
- }
- if (!mWakeLock.isHeld()) {
- mWakeLock.acquire();
- //System.out.println("WakeLock acquired");
- }
- } else {
- //Player inactive
- //Releasing WifiLock and WakeLock if held
- if (mWifiLock.isHeld()) {
- mWifiLock.release();
- //System.out.println("WifiLock released");
- }
- if (mWakeLock.isHeld()) {
- mWakeLock.release();
- //System.out.println("WakeLock released");
- }
- // Not playing because playback is paused, ended, suppressed, or the player
- // is buffering, stopped or failed. Check player.getPlayWhenReady,
- // player.getPlaybackState, player.getPlaybackSuppressionReason and
- // player.getPlaybackError for details.
- }
- }
});
}
- private void hideSystemBars() {
- // Set the IMMERSIVE flag.
- // Set the content to appear under the system bars so that the content
- // doesn't resize when the system bars hide and show.
- Objects.requireNonNull(getSupportActionBar()).hide();
+ @Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ super.onWindowFocusChanged(hasFocus);
+
+
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
- | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
- | View.SYSTEM_UI_FLAG_IMMERSIVE);
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
+
}
- private void showSystemBars() {
- View decorView = getWindow().getDecorView();
- decorView.setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
- Objects.requireNonNull(getSupportActionBar()).show();
- }
-
-
- protected void enterPIPMode() {
- try {
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
- && this.getPackageManager()
- .hasSystemFeature(
- PackageManager.FEATURE_PICTURE_IN_PICTURE) && appOpsManager.checkOpNoThrow(
- AppOpsManager.OPSTR_PICTURE_IN_PICTURE,
- this.getPackageManager().getApplicationInfo(this.getPackageName(),
- PackageManager.GET_META_DATA).uid, this.getPackageName())
- == AppOpsManager.MODE_ALLOWED) {
- videoPosition = player.getCurrentPosition();
- playerView.setUseController(false);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- if(player.getVideoFormat() != null) {
- ratio = new Rational(Math.round(player.getVideoFormat().width*20*player.getVideoSize().pixelWidthHeightRatio), Math.round(player.getVideoFormat().height*20));
- } else if(player.getAudioFormat() != null) {
- ratio = new Rational(player.getAudioFormat().width, player.getAudioFormat().height);
- } else {
- ratio = new Rational(1, 1);
- }
- PictureInPictureParams params = new PictureInPictureParams.Builder().setAspectRatio(ratio).build();
- this.enterPictureInPictureMode(params);
- }else {
- this.enterPictureInPictureMode();
- }
- }
- } catch (PackageManager.NameNotFoundException e) {
- e.printStackTrace();
- }
- }
-
- public boolean isScreenOn(Context context) {
- DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
- boolean screenOn = false;
- for (Display display : dm.getDisplays()) {
- if (display.getState() == Display.STATE_ON) {
- screenOn = true;
- }
- }
- return screenOn;
- }
-
- @Override
-
- public void onDestroy() {
- if (mWifiLock.isHeld()) {
- mWifiLock.release();
- //System.out.println("WifiLock acquired");
- }
- if (mWakeLock.isHeld()) {
- mWakeLock.release();
- //System.out.println("WakeLock acquired");
- }
- mediaSessionConnector.setPlayer(null);
- //deleteCache(this, standaloneDatabaseProvider);
- mediaSession.setActive(false);
- playerNotificationManager.setPlayer(null);
- player.release();
- playerView.setPlayer(null);
- simpleCache.release();
- standaloneDatabaseProvider.close();
- super.onDestroy();
- }
-
- public void onResume(){
- super.onResume();
- // put your code here...
- if (!playerView.getUseController()) {
- playerView.setUseController(true);
- }
- hideSystemBars();
- }
-
- public void onUserLeaveHint() {
- super.onUserLeaveHint();
- enterPIPMode();
- }
-
- protected void onNewIntent(Intent intent) {
- videoURL = intent.getStringExtra("video_url");
- title = intent.getStringExtra("title");
- videocache = intent.getIntExtra("videocache", 40);
- buffersize = intent.getIntExtra("buffersize", 2000);
- isplaylist = intent.getBooleanExtra("isplaylist", false);
- queue = intent.getStringArrayListExtra("queue");
- names = intent.getStringArrayListExtra("names");
- getSupportActionBar().setTitle(title);
- if (isplaylist) {
- player.clearMediaItems();
- for (int i = 0; i < queue.size(); i++) {
- if (names.get(i).endsWith(".m3u8")) {
- MediaItem mediaItem = MediaItem.fromUri(queue.get(i));
- player.addMediaItem(mediaItem);
- } else {
- mediaSource = new ProgressiveMediaSource.Factory(
- new CacheDataSource.Factory()
- .setCache(simpleCache)
- .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory()
- .setUserAgent("S3 Manager"))
- .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR)
- ).createMediaSource(MediaItem.fromUri(Uri.parse(queue.get(i))));
- player.addMediaSource(mediaSource);
- }
- }
- player.prepare();
- player.seekTo(names.indexOf(title), 0);
- } else {
- if (title.endsWith(".m3u8")) {
- MediaItem mediaItem = MediaItem.fromUri(videoURL);
- player.setMediaItem(mediaItem);
- } else {
- mediaSource = new ProgressiveMediaSource.Factory(
- new CacheDataSource.Factory()
- .setCache(simpleCache)
- .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory()
- .setUserAgent("S3 Manager"))
- .setFlags(CacheDataSource.FLAG_IGNORE_CACHE_ON_ERROR)
- ).createMediaSource(MediaItem.fromUri(Uri.parse(videoURL)));
- player.setMediaSource(mediaSource);
- }
- player.prepare();
- }
- // Start the playback.
- player.play();
- super.onNewIntent(intent);
- }
-
- public void onStop() {
- try {
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
- && this.getPackageManager()
- .hasSystemFeature(
- PackageManager.FEATURE_PICTURE_IN_PICTURE) && appOpsManager.checkOpNoThrow(
- AppOpsManager.OPSTR_PICTURE_IN_PICTURE,
- this.getPackageManager().getApplicationInfo(this.getPackageName(),
- PackageManager.GET_META_DATA).uid, this.getPackageName())
- == AppOpsManager.MODE_ALLOWED && isScreenOn(this) && this.isInPictureInPictureMode()) {
- finish();
- }
- } catch (PackageManager.NameNotFoundException e) {
- e.printStackTrace();
- }
- super.onStop();
- }
-
- /*static void deleteCache(Context context, StandaloneDatabaseProvider database) {
- SimpleCache.delete(new File(context.getCacheDir(), "media"), database);
- }*/
-
public void onBackPressed() {
- try {
- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
- && this.getPackageManager()
- .hasSystemFeature(
- PackageManager.FEATURE_PICTURE_IN_PICTURE) && appOpsManager.checkOpNoThrow(
- AppOpsManager.OPSTR_PICTURE_IN_PICTURE,
- this.getPackageManager().getApplicationInfo(this.getPackageName(),
- PackageManager.GET_META_DATA).uid, this.getPackageName())
- == AppOpsManager.MODE_ALLOWED) {
- enterPIPMode();
- } else {
- super.onBackPressed();
- }
- } catch (PackageManager.NameNotFoundException e) {
- e.printStackTrace();
- super.onBackPressed();
- }
+ player.release();
+ finish();
}
}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/WebBrowser.java b/app/src/main/java/asgardius/page/s3manager/WebBrowser.java
deleted file mode 100644
index a10afb4..0000000
--- a/app/src/main/java/asgardius/page/s3manager/WebBrowser.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package asgardius.page.s3manager;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import android.os.Bundle;
-import android.webkit.WebSettings;
-import android.webkit.WebView;
-import android.webkit.WebViewClient;
-
-public class WebBrowser extends AppCompatActivity {
-
- private WebView browser;
- WebSettings webSettings;
- String webURL, pagetitle;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_web_browser);
- //This initializes webview object
- try {
- webURL = getIntent().getStringExtra("web_url");
- pagetitle = getIntent().getStringExtra("title");
- getSupportActionBar().setTitle(pagetitle);
- browser =(WebView)findViewById(R.id.webview);
- webSettings = browser.getSettings();
- webSettings.setJavaScriptEnabled(true);
- browser.setWebViewClient(new MyBrowser());
- browser.loadUrl(webURL);
- } catch (Exception e) {
- e.printStackTrace();
- finish();
- }
- }
-
- private class MyBrowser extends WebViewClient {
- @Override
- public boolean shouldOverrideUrlLoading(WebView view, String url) {
- view.loadUrl(url);
- return true;
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/asgardius/page/s3manager/list_item.java b/app/src/main/java/asgardius/page/s3manager/list_item.java
deleted file mode 100644
index 0934a20..0000000
--- a/app/src/main/java/asgardius/page/s3manager/list_item.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package asgardius.page.s3manager;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import android.os.Bundle;
-
-public class list_item extends AppCompatActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_list_item);
- }
-}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
similarity index 100%
rename from app/src/main/res/drawable/ic_launcher_foreground.xml
rename to app/src/main/res/drawable-v24/ic_launcher_foreground.xml
diff --git a/app/src/main/res/drawable/account.png b/app/src/main/res/drawable/account.png
deleted file mode 100644
index bc5b4ca..0000000
Binary files a/app/src/main/res/drawable/account.png and /dev/null differ
diff --git a/app/src/main/res/drawable/audiofile.png b/app/src/main/res/drawable/audiofile.png
deleted file mode 100644
index 5e76111..0000000
Binary files a/app/src/main/res/drawable/audiofile.png and /dev/null differ
diff --git a/app/src/main/res/drawable/bucket.png b/app/src/main/res/drawable/bucket.png
deleted file mode 100644
index b554767..0000000
Binary files a/app/src/main/res/drawable/bucket.png and /dev/null differ
diff --git a/app/src/main/res/drawable/create_new.png b/app/src/main/res/drawable/create_new.png
deleted file mode 100644
index e321210..0000000
Binary files a/app/src/main/res/drawable/create_new.png and /dev/null differ
diff --git a/app/src/main/res/drawable/empty.png b/app/src/main/res/drawable/empty.png
deleted file mode 100644
index ceccebb..0000000
Binary files a/app/src/main/res/drawable/empty.png and /dev/null differ
diff --git a/app/src/main/res/drawable/folder.png b/app/src/main/res/drawable/folder.png
deleted file mode 100644
index b66ede4..0000000
Binary files a/app/src/main/res/drawable/folder.png and /dev/null differ
diff --git a/app/src/main/res/drawable/imagefile.png b/app/src/main/res/drawable/imagefile.png
deleted file mode 100644
index 6709bf6..0000000
Binary files a/app/src/main/res/drawable/imagefile.png and /dev/null differ
diff --git a/app/src/main/res/drawable/pdffile.png b/app/src/main/res/drawable/pdffile.png
deleted file mode 100644
index 547b124..0000000
Binary files a/app/src/main/res/drawable/pdffile.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ptextfile.png b/app/src/main/res/drawable/ptextfile.png
deleted file mode 100644
index 5e4b2c5..0000000
Binary files a/app/src/main/res/drawable/ptextfile.png and /dev/null differ
diff --git a/app/src/main/res/drawable/unknownfile.png b/app/src/main/res/drawable/unknownfile.png
deleted file mode 100644
index c507764..0000000
Binary files a/app/src/main/res/drawable/unknownfile.png and /dev/null differ
diff --git a/app/src/main/res/drawable/videofile.png b/app/src/main/res/drawable/videofile.png
deleted file mode 100644
index 9a17fc8..0000000
Binary files a/app/src/main/res/drawable/videofile.png and /dev/null differ
diff --git a/app/src/main/res/drawable/webpage.png b/app/src/main/res/drawable/webpage.png
deleted file mode 100644
index d3479ef..0000000
Binary files a/app/src/main/res/drawable/webpage.png and /dev/null differ
diff --git a/app/src/main/res/layout/activity_account_add.xml b/app/src/main/res/layout/activity_account_add.xml
deleted file mode 100644
index 9ac1c20..0000000
--- a/app/src/main/res/layout/activity_account_add.xml
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_bucket_policy.xml b/app/src/main/res/layout/activity_bucket_policy.xml
deleted file mode 100644
index 5912f8c..0000000
--- a/app/src/main/res/layout/activity_bucket_policy.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_bucket_select.xml b/app/src/main/res/layout/activity_bucket_select.xml
deleted file mode 100644
index 231d411..0000000
--- a/app/src/main/res/layout/activity_bucket_select.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_cors_config.xml b/app/src/main/res/layout/activity_cors_config.xml
deleted file mode 100644
index a5b6c51..0000000
--- a/app/src/main/res/layout/activity_cors_config.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_create_bucket.xml b/app/src/main/res/layout/activity_create_bucket.xml
deleted file mode 100644
index 701c67f..0000000
--- a/app/src/main/res/layout/activity_create_bucket.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_downloader.xml b/app/src/main/res/layout/activity_downloader.xml
deleted file mode 100644
index 000f473..0000000
--- a/app/src/main/res/layout/activity_downloader.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_image_viewer.xml b/app/src/main/res/layout/activity_image_viewer.xml
deleted file mode 100644
index 1ebad8f..0000000
--- a/app/src/main/res/layout/activity_image_viewer.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_list_item.xml b/app/src/main/res/layout/activity_list_item.xml
deleted file mode 100644
index 8e58117..0000000
--- a/app/src/main/res/layout/activity_list_item.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 92d8139..f45bc5e 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,48 +1,36 @@
-
-
+
+
+ android:layout_height="100dp"
+ android:layout_margin="20dp"
+ android:orientation="horizontal"
+ android:padding="10dp"
+ tools:ignore="MissingConstraints">
-
+
-
+
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_object_info.xml b/app/src/main/res/layout/activity_object_info.xml
deleted file mode 100644
index f38821d..0000000
--- a/app/src/main/res/layout/activity_object_info.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_object_policy.xml b/app/src/main/res/layout/activity_object_policy.xml
deleted file mode 100644
index 2325102..0000000
--- a/app/src/main/res/layout/activity_object_policy.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_object_select.xml b/app/src/main/res/layout/activity_object_select.xml
deleted file mode 100644
index b511bc6..0000000
--- a/app/src/main/res/layout/activity_object_select.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
deleted file mode 100644
index 4413e37..0000000
--- a/app/src/main/res/layout/activity_settings.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_share.xml b/app/src/main/res/layout/activity_share.xml
deleted file mode 100644
index f638260..0000000
--- a/app/src/main/res/layout/activity_share.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_text_viewer.xml b/app/src/main/res/layout/activity_text_viewer.xml
deleted file mode 100644
index 64d4b63..0000000
--- a/app/src/main/res/layout/activity_text_viewer.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_uploader.xml b/app/src/main/res/layout/activity_uploader.xml
deleted file mode 100644
index 41f1c65..0000000
--- a/app/src/main/res/layout/activity_uploader.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_web_browser.xml b/app/src/main/res/layout/activity_web_browser.xml
deleted file mode 100644
index 408dd98..0000000
--- a/app/src/main/res/layout/activity_web_browser.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/account_menu.xml b/app/src/main/res/menu/account_menu.xml
deleted file mode 100644
index 8a6f6db..0000000
--- a/app/src/main/res/menu/account_menu.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/bucket_menu.xml b/app/src/main/res/menu/bucket_menu.xml
deleted file mode 100644
index 5ff27bf..0000000
--- a/app/src/main/res/menu/bucket_menu.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/folder_menu.xml b/app/src/main/res/menu/folder_menu.xml
deleted file mode 100644
index caaf8b8..0000000
--- a/app/src/main/res/menu/folder_menu.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/object_menu.xml b/app/src/main/res/menu/object_menu.xml
deleted file mode 100644
index fc1082f..0000000
--- a/app/src/main/res/menu/object_menu.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
deleted file mode 100644
index 778359f..0000000
--- a/app/src/main/res/values-es/strings.xml
+++ /dev/null
@@ -1,130 +0,0 @@
-
-
- Lista de buckets
- Lista de cuentas
- Lista de objetos
- Imagen
- La base de datos está corrupta, favor de reinstalar la app
- Esta característica aún no es implementada
- Establezca el nombre del nuevo bucket
- Nombre del bucket
- Se requiere un nombre para el bucket
- Compartir archivo
- Descargar archivo
- Descargar archivos
- Cancelar descarga
- Archivo descargado exitosamente
- Subir archivo en este bucket
- Subir carpeta en este bucket
- Su dispositivo no es compatible con esta característica
- No se encuentra el uri del archivo
- Subir archivo
- Subir archivos
- Nombre del objeto
- Prefijo de los objetos
- Favor de seleccionar un archivo
- Archivo subido exitosamente
- Archivos subidos exitosamente
- Cancelar subida
- Reintentar
- Descarga fallida
- Subida fallida
- Éxito
- Crear nuevo bucket
- Bucket creado exitosamente
- Subir archivo en el directorio actual
- Subir carpeta en el directorio actual
- Eliminar
- ¿Desea eliminar este archivo?
- ¿Desea eliminar esta carpeta?
- ¿Desea eliminar este bucket?
- Bucket eliminado exitosamente
- Carpeta eliminada exitosamente
- Archivo eliminado exitosamente
- Este es el único elemento en esta carpeta, elimine la carpeta padre en su lugar
- Seleccione una cuenta
- Agregar cuenta
- Probar credenciales
- Las credenciales son correctas
- Alias de la cuenta
- URL del endpoint
- Región S3
- Clave de acceso S3
- Clave secreta S3
- Cuenta agregada exitosamente
- Este alias ya está en uso
- Todos los campos son obligatorios
- Quitar cuenta
- Se quitó la cuenta
- ¿Desea quitar esta cuenta?
- Editar cuenta
- Guardar cambios
- Cuenta editada exitosamente
- No se permiten las conexiones sin SSL
- La URL del endpoint debe iniciar con https://
- Tipo de archivo no soportado
- Acerca de esta app
- servidor pdfjs
- Necesita configurar un servidor pdf.js
- D
- HH
- MM
- Fecha de expiración
- Expira dentro de
- Crear enlace
- La fecha de caducidad debe ser inferior a 7 días
- Tamaño del archivo
- Propiedades
- Abir en
- Tamaño de la carpeta
- Tamaño del bucket
- Archivos
- Debe establecer una fecha de expiración para compartir archivos
- Descarga cancelada
- Subida cancelada
- Ajustes
- Guardar ajustes
- Tamaño máximo de cache multimedia (en MiB)
- Tiempo de expiración para visor multimedia (en horas)
- Habilitar listas de reproducción
- Tiempo de expiración para listas de reproducción (en horas)
- Tamaño del buffer del reproductor multimedia (en milisegundos)
- El tamaño del búfer debe ser de al menos 2001 milisegundos
- Solo se puede reproducir un archivo multimedia a la vez
- Reproduccion de video
- este valor no puede ser cero
- Acceso de estilo de ruta
- Política CORS
- Orígenes permitidos
- Permitidos todos los orígenes
- Uso de endpoint PDF permitido
- Uso de endpoint PDF no permitido
- Política CORS no encontrada
- Permitir todo
- Permitir pdf
- Eliminar CORS
- No se pudo cambiar la política
- Política cambiada exitosamente
- Descargar contenido del bucket
- Descargar contenido de la carpeta
- Archivos descargados exitosamente
- Copiar nombre al portapapeles
- Copiado al portapapeles
- Calculando tamaño de la carpeta
- Imagen demasiado grande
- Guardar enlaces en archivo
- Copiar enlaces al potapapeles
- Archivo guardado exitosamente
- Permisos de acceso
- Bucket público
- Bucket privado
- Objeto público
- Objeto privado
- Política personalizada
- Establecer como público
- Establecer como privado
- Política establecida por carpeta padre
- Fecha de expiración no requerida
- Limpiar Cache de Video
- Cache limpiada exitosamente
-
\ No newline at end of file
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
index 0fd5fd5..3494b48 100644
--- a/app/src/main/res/values-night/themes.xml
+++ b/app/src/main/res/values-night/themes.xml
@@ -8,7 +8,7 @@
- @color/teal_200
- @color/teal_200
- - @color/white
+ - @color/black
- ?attr/colorPrimaryVariant
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2c59bd1..1ca12ee 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,132 +1,14 @@
- S3 Manager
- .amazonaws.com
- https://office.asgardius.company/pdfjs
- You need to setup a pdf.js server
- Account list
- Bucket list
- Object list
- Image
- Expiration date
- Expires within
- HH
- MM
- D
- Create link
- Expiration date must be at most 7 days
- You must set an expiration date to share files
- Local database is corrupted. Please reinstall this app
- This feature is not implemented yet
- Set new bucket name
- Bucket name
- A bucket name is required
- Share file
- Open in
- Download file
- Download files
- Download bucket content
- Download folder content
- Cancel download
- File downloaded successfully
- Files downloaded successfully
- Upload file to this bucket
- Upload folder to this bucket
- Your device is not compatible with this feature
- File uri not found
- Upload file
- Upload files
- Object name
- Object prefix
- Please select a file
- File uploaded successfully
- Files uploaded successfully
- Cancel Upload
- Retry
- Download failed
- Download canceled
- Upload failed
- Upload canceled
- Success
- Properties
- File Size
- Folder Size
- Bucket Size
- Files
- Create new bucket
- Bucket created successfully
- Upload file in current folder
- Upload folder in current folder
- Delete
- Do you want to delete this file?
- Do you want to delete this folder?
- Do you want to delete this bucket?
- Bucket deleted successfully
- Folder deleted successfully
- File deleted successfully
- This is the only item on this folder, you should delete the parent folder instead
- Please choose an account
- Add Account
- Test credentials
- Credentials are correct
- Account Alias
- pdfjs server
- S3 Endpoint URL
- S3 Region
- S3 Access Key
- S3 Secret Key
- Account added successfully
- This alias is already in use
- All fields are required
- Remove Account
- Account removed successfully
- Do you want to remove this accunt?
- Edit Account
- Save Changes
- Account edited successfully
- Connections without SSL are not allowed
- Endpoint URL must start with https://
- Unsupported file type
- About this app
- Settings
- Save settings
- Max media cache size (in MiB)
- Expiration time for media viewer (in hours)
- Media player buffer size (in milliseconds)
- Buffer size must be at least 2001 milliseconds
- Enable playlists
- Expiration time for media playlists (in hours)
- Only one media file can be played at once
- Video Playback
- This value cannot be zero
- Path style access
- CORS policy
- Allowed origins
- All origins allowed
- PDF Endpoint allowed
- PDF Endpoint not allowed
- CORS policy not found
- Allow all
- Allow pdf
- Delete CORS
- Cannot change policy
- Policy changed successfully
- Copy name to clipboard
- Copied to clipboard
- Calculating folder size
- Picture too big
- Save links to file
- File saved successfully
- Copy links to clipboard
- Access permissions
- Public bucket
- Private bucket
- Public object
- Private object
- Custom policy
- Set as public
- Set as private
- Policy set by parent folder
- Expiration date not required
- Clear Video Cache
- Cache clean successfully
+ Asgardius S3 Manager
+ VideoPlayer
+
+ s3server
+ username
+ password
+ bucket
+ object
+ Video Test
+ Cannot load media file
+ Dummy Button
+ DUMMY\nCONTENT
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index a689e45..1a59a11 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -26,13 +26,4 @@
- @color/light_blue_600
- @color/light_blue_A200
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 4a0042b..5ae9a7b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
- id 'com.android.application' version '7.4.2' apply false
- id 'com.android.library' version '7.4.2' apply false
+ id 'com.android.application' version '7.2.2' apply false
+ id 'com.android.library' version '7.2.2' apply false
}
task clean(type: Delete) {
diff --git a/fastlane/metadata/android/en-US/changelogs/18.txt b/fastlane/metadata/android/en-US/changelogs/18.txt
deleted file mode 100644
index aa0a82f..0000000
--- a/fastlane/metadata/android/en-US/changelogs/18.txt
+++ /dev/null
@@ -1 +0,0 @@
-First F-Droid release
diff --git a/fastlane/metadata/android/en-US/changelogs/19.txt b/fastlane/metadata/android/en-US/changelogs/19.txt
deleted file mode 100644
index 300ea18..0000000
--- a/fastlane/metadata/android/en-US/changelogs/19.txt
+++ /dev/null
@@ -1 +0,0 @@
-Fix issue at playing long videos
diff --git a/fastlane/metadata/android/en-US/changelogs/20.txt b/fastlane/metadata/android/en-US/changelogs/20.txt
deleted file mode 100644
index 77abcb4..0000000
--- a/fastlane/metadata/android/en-US/changelogs/20.txt
+++ /dev/null
@@ -1 +0,0 @@
-Add cache to media player
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/21.txt b/fastlane/metadata/android/en-US/changelogs/21.txt
deleted file mode 100644
index a4db5a2..0000000
--- a/fastlane/metadata/android/en-US/changelogs/21.txt
+++ /dev/null
@@ -1 +0,0 @@
-Fix stability issue at loading videos
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/22.txt b/fastlane/metadata/android/en-US/changelogs/22.txt
deleted file mode 100644
index 28a274f..0000000
--- a/fastlane/metadata/android/en-US/changelogs/22.txt
+++ /dev/null
@@ -1 +0,0 @@
-Fix performance issue at main screen
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/23.txt b/fastlane/metadata/android/en-US/changelogs/23.txt
deleted file mode 100644
index ca1eb00..0000000
--- a/fastlane/metadata/android/en-US/changelogs/23.txt
+++ /dev/null
@@ -1 +0,0 @@
-Fix issue at file sharing screen
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/25.txt b/fastlane/metadata/android/en-US/changelogs/25.txt
deleted file mode 100644
index 3d4af03..0000000
--- a/fastlane/metadata/android/en-US/changelogs/25.txt
+++ /dev/null
@@ -1 +0,0 @@
-Add settings menu
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/26.txt b/fastlane/metadata/android/en-US/changelogs/26.txt
deleted file mode 100644
index 046c519..0000000
--- a/fastlane/metadata/android/en-US/changelogs/26.txt
+++ /dev/null
@@ -1 +0,0 @@
-Update aws sdk
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/27.txt b/fastlane/metadata/android/en-US/changelogs/27.txt
deleted file mode 100644
index 7b5757c..0000000
--- a/fastlane/metadata/android/en-US/changelogs/27.txt
+++ /dev/null
@@ -1 +0,0 @@
-Customizable media player buffer size
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/33.txt b/fastlane/metadata/android/en-US/changelogs/33.txt
deleted file mode 100644
index 4fa4385..0000000
--- a/fastlane/metadata/android/en-US/changelogs/33.txt
+++ /dev/null
@@ -1 +0,0 @@
-Picture in Picture support
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/34.txt b/fastlane/metadata/android/en-US/changelogs/34.txt
deleted file mode 100644
index fcd5ad6..0000000
--- a/fastlane/metadata/android/en-US/changelogs/34.txt
+++ /dev/null
@@ -1 +0,0 @@
-Playback notifications for media player
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/36.txt b/fastlane/metadata/android/en-US/changelogs/36.txt
deleted file mode 100644
index a82e1ef..0000000
--- a/fastlane/metadata/android/en-US/changelogs/36.txt
+++ /dev/null
@@ -1 +0,0 @@
-Fix Picture in Picture
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/37.txt b/fastlane/metadata/android/en-US/changelogs/37.txt
deleted file mode 100644
index d609ec1..0000000
--- a/fastlane/metadata/android/en-US/changelogs/37.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-* Better performance at listing buckets with 1000+ objects
-* Fix issue at deleting folders with 1000+ files
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/38.txt b/fastlane/metadata/android/en-US/changelogs/38.txt
deleted file mode 100644
index 1fb9ad5..0000000
--- a/fastlane/metadata/android/en-US/changelogs/38.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Fix delete dialog
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/39.txt b/fastlane/metadata/android/en-US/changelogs/39.txt
deleted file mode 100644
index e595950..0000000
--- a/fastlane/metadata/android/en-US/changelogs/39.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-* Fix settings screen
-* Fix file list
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/40.txt b/fastlane/metadata/android/en-US/changelogs/40.txt
deleted file mode 100644
index 58e36a0..0000000
--- a/fastlane/metadata/android/en-US/changelogs/40.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-* Add support for HLS playback
-* Code cleanup
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/41.txt b/fastlane/metadata/android/en-US/changelogs/41.txt
deleted file mode 100644
index bdd51c6..0000000
--- a/fastlane/metadata/android/en-US/changelogs/41.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-* Fix uploader and downloader
-* Fix video player error handling
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/42.txt b/fastlane/metadata/android/en-US/changelogs/42.txt
deleted file mode 100644
index 8072d5c..0000000
--- a/fastlane/metadata/android/en-US/changelogs/42.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Fix Picture in Picture
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/43.txt b/fastlane/metadata/android/en-US/changelogs/43.txt
deleted file mode 100644
index 3383ae5..0000000
--- a/fastlane/metadata/android/en-US/changelogs/43.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Fix background playback issues
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/44.txt b/fastlane/metadata/android/en-US/changelogs/44.txt
deleted file mode 100644
index 3383ae5..0000000
--- a/fastlane/metadata/android/en-US/changelogs/44.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Fix background playback issues
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/45.txt b/fastlane/metadata/android/en-US/changelogs/45.txt
deleted file mode 100644
index bc2355a..0000000
--- a/fastlane/metadata/android/en-US/changelogs/45.txt
+++ /dev/null
@@ -1 +0,0 @@
-* UI fixes
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/46.txt b/fastlane/metadata/android/en-US/changelogs/46.txt
deleted file mode 100644
index c4d90f8..0000000
--- a/fastlane/metadata/android/en-US/changelogs/46.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-* Account edit screen redesign
-* Add option to choose between virtual host style and path style for buckets (virtual host will be used by default)
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/47.txt b/fastlane/metadata/android/en-US/changelogs/47.txt
deleted file mode 100644
index 7352e9d..0000000
--- a/fastlane/metadata/android/en-US/changelogs/47.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-* CORS configuration (currently you can allow pdf endpoint, allow all origins or delete policy)
-* Fixed UI issues when using app in free form mode
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/48.txt b/fastlane/metadata/android/en-US/changelogs/48.txt
deleted file mode 100644
index 1870de1..0000000
--- a/fastlane/metadata/android/en-US/changelogs/48.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Fixed Picture in Picture issue when playing anamorphic videos
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/49.txt b/fastlane/metadata/android/en-US/changelogs/49.txt
deleted file mode 100644
index bc315ea..0000000
--- a/fastlane/metadata/android/en-US/changelogs/49.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Fixed video being closed when app is on freeform mode
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/50.txt b/fastlane/metadata/android/en-US/changelogs/50.txt
deleted file mode 100644
index 939c470..0000000
--- a/fastlane/metadata/android/en-US/changelogs/50.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-* Freeform mode improvements
-* User interface more consistent
-* File sharing easier to use
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/52.txt b/fastlane/metadata/android/en-US/changelogs/52.txt
deleted file mode 100644
index 97881ee..0000000
--- a/fastlane/metadata/android/en-US/changelogs/52.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Folder download function added
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/58.txt b/fastlane/metadata/android/en-US/changelogs/58.txt
deleted file mode 100644
index c2c0bed..0000000
--- a/fastlane/metadata/android/en-US/changelogs/58.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-* UI fixes
-* Copy file name to clipboard
-* Folder upload function added
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/59.txt b/fastlane/metadata/android/en-US/changelogs/59.txt
deleted file mode 100644
index be320a1..0000000
--- a/fastlane/metadata/android/en-US/changelogs/59.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Enhanced picture viewer
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/61.txt b/fastlane/metadata/android/en-US/changelogs/61.txt
deleted file mode 100644
index f8b8cdc..0000000
--- a/fastlane/metadata/android/en-US/changelogs/61.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-* Add option to play all media items on current folder
-* Add option to share entire folders and save on clipboard or txt file
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/62.txt b/fastlane/metadata/android/en-US/changelogs/62.txt
deleted file mode 100644
index a84f421..0000000
--- a/fastlane/metadata/android/en-US/changelogs/62.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Delete cached media when is not longer needed
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/63.txt b/fastlane/metadata/android/en-US/changelogs/63.txt
deleted file mode 100644
index 1686b39..0000000
--- a/fastlane/metadata/android/en-US/changelogs/63.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Fix app setting validation
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/64.txt b/fastlane/metadata/android/en-US/changelogs/64.txt
deleted file mode 100644
index bc2355a..0000000
--- a/fastlane/metadata/android/en-US/changelogs/64.txt
+++ /dev/null
@@ -1 +0,0 @@
-* UI fixes
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/65.txt b/fastlane/metadata/android/en-US/changelogs/65.txt
deleted file mode 100644
index bc2355a..0000000
--- a/fastlane/metadata/android/en-US/changelogs/65.txt
+++ /dev/null
@@ -1 +0,0 @@
-* UI fixes
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/66.txt b/fastlane/metadata/android/en-US/changelogs/66.txt
deleted file mode 100644
index bc2355a..0000000
--- a/fastlane/metadata/android/en-US/changelogs/66.txt
+++ /dev/null
@@ -1 +0,0 @@
-* UI fixes
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/68.txt b/fastlane/metadata/android/en-US/changelogs/68.txt
deleted file mode 100644
index bc2355a..0000000
--- a/fastlane/metadata/android/en-US/changelogs/68.txt
+++ /dev/null
@@ -1 +0,0 @@
-* UI fixes
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/69.txt b/fastlane/metadata/android/en-US/changelogs/69.txt
deleted file mode 100644
index 7cdcff7..0000000
--- a/fastlane/metadata/android/en-US/changelogs/69.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-* UI fixes
-* Better support for notched devices
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/71.txt b/fastlane/metadata/android/en-US/changelogs/71.txt
deleted file mode 100644
index f6e3e39..0000000
--- a/fastlane/metadata/android/en-US/changelogs/71.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Set bucket as public or private
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/74.txt b/fastlane/metadata/android/en-US/changelogs/74.txt
deleted file mode 100644
index aba4d8a..0000000
--- a/fastlane/metadata/android/en-US/changelogs/74.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Set object as public or private
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/76.txt b/fastlane/metadata/android/en-US/changelogs/76.txt
deleted file mode 100644
index 84cbde8..0000000
--- a/fastlane/metadata/android/en-US/changelogs/76.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-* Check policy per object at creating share links
-* Cache reuse for public media files
-* Button to remove media cache inside ths app
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/77.txt b/fastlane/metadata/android/en-US/changelogs/77.txt
deleted file mode 100644
index 6c06e07..0000000
--- a/fastlane/metadata/android/en-US/changelogs/77.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Fix wakelock not being released at closing video player
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/78.txt b/fastlane/metadata/android/en-US/changelogs/78.txt
deleted file mode 100644
index d889ea2..0000000
--- a/fastlane/metadata/android/en-US/changelogs/78.txt
+++ /dev/null
@@ -1 +0,0 @@
-* M3U Playlist support
diff --git a/fastlane/metadata/android/en-US/changelogs/79.txt b/fastlane/metadata/android/en-US/changelogs/79.txt
deleted file mode 100644
index 121ed13..0000000
--- a/fastlane/metadata/android/en-US/changelogs/79.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Fix UI issue at media player screen
diff --git a/fastlane/metadata/android/en-US/changelogs/80.txt b/fastlane/metadata/android/en-US/changelogs/80.txt
deleted file mode 100644
index b905409..0000000
--- a/fastlane/metadata/android/en-US/changelogs/80.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Libraries updated
diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt
deleted file mode 100644
index 61abb09..0000000
--- a/fastlane/metadata/android/en-US/full_description.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-File Explorer to manage servers compatible with S3 Object Storage Protocol
-
-Current feature list
-
-Audio and Video playback (opus, ogg, oga, mp3, m4a, flac, mka, mkv, mp4, m4v, webm)
-Picture preview (jpg, jpeg, png, gif, webp)
-Plain text file preview (txt, md)
-Webpage viewer (htm, html)
-Multiple account support
-Open object in external web browser
-Create buckets
-Delete buckets
-Delete files
-Delete folders
-File upload
-File download
-Download folder content
-Upload folder content
-pdf file reader using user provided pdf.js server
-file sharing links
-get object info
-get bucket info
-Set CORS policy
-Set bucket as public or private
-Set object as public or private
-
-Planned feature list
-
-Nothing for now
-
-This app is a work in progress, so it have some bugs that need to be fixed
-
-You need to setup a pdf.js server to use pdf viewer. Just download latest version from official website and upload to any web server with ssl on same root domain than S3 server (can be same subdomain or a different one). Then set url to pdfjs root folder like https://example.com/pdfjs-dist
-
-Supported languages
-
-English
-Spanish
-
-Knnown issues
-
-Slow user interface on some low-end devices
-Running screen restarts after toggling system dark mode
-
-Known supported providers
-
-Amazon Web Services
-Scaleway Elements
-Wasabi Cloud
-Backblaze B2
-Cloudflare R2 (partial)
-MinIO **
-Garage **
-
-Known not supported providers
-
-Google Cloud (Not compatible with S3v4)
-Oracle Cloud (compatibility issues with S3v4)
-
-** Extra steps required (read documentation)
-
-Please report all issues at https://forum.asgardius.company/t/s3-manager
-
-You can find app documentation at https://wiki.asgardius.company/shelves/asgardius-s3-manager-english (english) or https://wiki.asgardius.company/shelves/asgardius-s3-manager-espanol (spanish)
-
-You can use MinIO or Garage to have a FOSS selfhosted server to use with this app
diff --git a/fastlane/metadata/android/en-US/images/featureGraphic.png b/fastlane/metadata/android/en-US/images/featureGraphic.png
deleted file mode 100644
index bd3e5fa..0000000
Binary files a/fastlane/metadata/android/en-US/images/featureGraphic.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/icon.png b/fastlane/metadata/android/en-US/images/icon.png
deleted file mode 100644
index a1e4300..0000000
Binary files a/fastlane/metadata/android/en-US/images/icon.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png
deleted file mode 100644
index 620b088..0000000
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png
deleted file mode 100644
index 2a8d954..0000000
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png
deleted file mode 100644
index 2e76326..0000000
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png
deleted file mode 100644
index b37c6d2..0000000
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1.png b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1.png
deleted file mode 100644
index 73eb1ee..0000000
Binary files a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2.png b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2.png
deleted file mode 100644
index 2279997..0000000
Binary files a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3.png b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3.png
deleted file mode 100644
index b5aba61..0000000
Binary files a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4.png b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4.png
deleted file mode 100644
index 2f2d533..0000000
Binary files a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/tenInchScreenshots/1.png b/fastlane/metadata/android/en-US/images/tenInchScreenshots/1.png
deleted file mode 100644
index 77691f7..0000000
Binary files a/fastlane/metadata/android/en-US/images/tenInchScreenshots/1.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/tenInchScreenshots/2.png b/fastlane/metadata/android/en-US/images/tenInchScreenshots/2.png
deleted file mode 100644
index 7c902a4..0000000
Binary files a/fastlane/metadata/android/en-US/images/tenInchScreenshots/2.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/tenInchScreenshots/3.png b/fastlane/metadata/android/en-US/images/tenInchScreenshots/3.png
deleted file mode 100644
index f17f727..0000000
Binary files a/fastlane/metadata/android/en-US/images/tenInchScreenshots/3.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/tenInchScreenshots/4.png b/fastlane/metadata/android/en-US/images/tenInchScreenshots/4.png
deleted file mode 100644
index 01d9c5f..0000000
Binary files a/fastlane/metadata/android/en-US/images/tenInchScreenshots/4.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/short_description.txt b/fastlane/metadata/android/en-US/short_description.txt
deleted file mode 100644
index ee744c4..0000000
--- a/fastlane/metadata/android/en-US/short_description.txt
+++ /dev/null
@@ -1 +0,0 @@
-File explorer for S3 servers with file preview support
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/title.txt b/fastlane/metadata/android/en-US/title.txt
deleted file mode 100644
index 5f69c07..0000000
--- a/fastlane/metadata/android/en-US/title.txt
+++ /dev/null
@@ -1 +0,0 @@
-Asgardius S3 Manager
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 1cfb2ab..e606d51 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Sat Aug 27 12:12:23 MST 2022
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME