share screen template
This commit is contained in:
parent
3142f99011
commit
935a368348
7 changed files with 80 additions and 4 deletions
|
@ -7,6 +7,7 @@
|
|||
<entry key="app/src/main/res/drawable/ic_launcher_background.xml" value="0.195" />
|
||||
<entry key="app/src/main/res/layout/activity_account_add.xml" value="0.1" />
|
||||
<entry key="app/src/main/res/layout/activity_bucket_select.xml" value="0.2" />
|
||||
<entry key="app/src/main/res/layout/activity_file_share.xml" value="0.19610507246376813" />
|
||||
<entry key="app/src/main/res/layout/activity_list_item.xml" value="0.19610507246376813" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.1" />
|
||||
<entry key="app/src/main/res/layout/activity_object_select.xml" value="0.1" />
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AsgardiusS3Manager"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".FileShare"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".TextViewer"
|
||||
android:exported="false" />
|
||||
|
|
36
app/src/main/java/asgardius/page/s3manager/FileShare.java
Normal file
36
app/src/main/java/asgardius/page/s3manager/FileShare.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package asgardius.page.s3manager;
|
||||
|
||||
import static com.amazonaws.regions.Regions.US_EAST_1;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.amazonaws.auth.AWSCredentials;
|
||||
import com.amazonaws.auth.BasicAWSCredentials;
|
||||
import com.amazonaws.regions.Region;
|
||||
import com.amazonaws.services.s3.AmazonS3;
|
||||
import com.amazonaws.services.s3.AmazonS3Client;
|
||||
import com.amazonaws.services.s3.S3ClientOptions;
|
||||
|
||||
public class FileShare extends AppCompatActivity {
|
||||
String username, password, endpoint, bucket, prefix;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_file_share);
|
||||
endpoint = getIntent().getStringExtra("endpoint");
|
||||
username = getIntent().getStringExtra("username");
|
||||
password = getIntent().getStringExtra("password");
|
||||
bucket = getIntent().getStringExtra("bucket");
|
||||
prefix = getIntent().getStringExtra("prefix");
|
||||
Region region = Region.getRegion(US_EAST_1);
|
||||
S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build();
|
||||
s3ClientOptions.setPathStyleAccess(true);
|
||||
AWSCredentials myCredentials = new BasicAWSCredentials(username, password);
|
||||
AmazonS3 s3client = new AmazonS3Client(myCredentials, region);
|
||||
s3client.setEndpoint(endpoint);
|
||||
s3client.setS3ClientOptions(s3ClientOptions);
|
||||
}
|
||||
}
|
|
@ -226,8 +226,8 @@ public class ObjectSelect extends AppCompatActivity {
|
|||
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.dummy_button)) {
|
||||
Toast.makeText(ObjectSelect.this, "This feature is not yet implemented", Toast.LENGTH_SHORT).show();
|
||||
if (menuItem.getTitle() == getResources().getString(R.string.file_share)) {
|
||||
share(Name.get(position).toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -275,4 +275,18 @@ public class ObjectSelect extends AppCompatActivity {
|
|||
startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
private void share(String object) {
|
||||
|
||||
Toast.makeText(ObjectSelect.this, "This feature is not yet implemented", Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(this, FileShare.class);
|
||||
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);
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
}
|
21
app/src/main/res/layout/activity_file_share.xml
Normal file
21
app/src/main/res/layout/activity_file_share.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".FileShare">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/textShow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:ems="10"
|
||||
android:focusable="false"
|
||||
android:gravity="start|top"
|
||||
android:inputType="textMultiLine"
|
||||
tools:ignore="MissingConstraints"
|
||||
tools:layout_editor_absoluteX="79dp"
|
||||
tools:layout_editor_absoluteY="25dp"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -2,8 +2,8 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/editaccount"
|
||||
android:title="@string/dummy_button" />
|
||||
android:id="@+id/sharefile"
|
||||
android:title="@string/file_share" />
|
||||
|
||||
|
||||
</menu>
|
|
@ -2,6 +2,7 @@
|
|||
<string name="app_name">S3 Manager</string>
|
||||
<string name="title_activity_video_player">VideoPlayer</string>
|
||||
<string name="broken_database">Local database is corrupted. Please reinstall this app</string>
|
||||
<string name="file_share">Share file</string>
|
||||
<string name="accountselect">Please choose an account</string>
|
||||
<string name="accountadd_button">Add Account</string>
|
||||
<string name="accounttest_button">Test credentials</string>
|
||||
|
|
Loading…
Reference in a new issue