diff --git a/app/src/main/java/asgardius/page/s3manager/AccountAdd.java b/app/src/main/java/asgardius/page/s3manager/AccountAdd.java
index fc0deab..6ac4b1e 100644
--- a/app/src/main/java/asgardius/page/s3manager/AccountAdd.java
+++ b/app/src/main/java/asgardius/page/s3manager/AccountAdd.java
@@ -2,13 +2,50 @@ package asgardius.page.s3manager;
import androidx.appcompat.app.AppCompatActivity;
+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;
public class AccountAdd extends AppCompatActivity {
+ EditText aapick, aupick, appick, aepick;
+ String alias, username, password, endpoint;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_account_add);
+ aapick = (EditText)findViewById(R.id.alias);
+ aepick = (EditText)findViewById(R.id.endpoint);
+ aupick = (EditText)findViewById(R.id.username);
+ appick = (EditText)findViewById(R.id.password);
+ Button register = (Button)findViewById(R.id.addaccount);
+ register.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();
+ System.out.println("Alias " + alias);
+ System.out.println("Endpoint " + endpoint);
+ System.out.println("Username " + username);
+ System.out.println("Password " + password);
+ MyDbHelper dbHelper = new MyDbHelper(AccountAdd.this);
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ if (db != null) {
+ // Database Queries
+ try {
+ db.execSQL("INSERT INTO account VALUES (\""+alias+"\", \""+endpoint+"\", \""+username+"\", \""+password+"\")");
+ Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_success), Toast.LENGTH_SHORT).show();
+ } catch (Exception e) {
+ Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_fail), Toast.LENGTH_SHORT).show();
+ }
+ }
+ }
+ });
}
}
\ 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 0cf1bb5..a94bf09 100644
--- a/app/src/main/java/asgardius/page/s3manager/MainActivity.java
+++ b/app/src/main/java/asgardius/page/s3manager/MainActivity.java
@@ -1,13 +1,5 @@
package asgardius.page.s3manager;
-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 androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
@@ -16,23 +8,16 @@ import android.view.View;
import android.widget.Button;
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.GeneratePresignedUrlRequest;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
-import java.net.URL;
import java.util.ArrayList;
-import java.util.List;
public class MainActivity extends AppCompatActivity {
static boolean DEFAULT_PATH_STYLE_ACCESS = true;
- String username, password, endpoint, aname;
+ String username, password, endpoint;
RecyclerView recyclerView;
ArrayList Name;
ArrayList Img;
@@ -106,8 +91,7 @@ public class MainActivity extends AppCompatActivity {
recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getApplicationContext(), recyclerView, new RecyclerTouchListener.ClickListener() {
@Override
public void onClick(View view, int position) {
- //aname = Name.get(position).toString();
- //System.out.println("Click on "+aname);
+ //System.out.println("Click on "+Name.get(position).toString());
if (db != null) {
// Database Queries
System.out.println("Database OK");
@@ -150,9 +134,7 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onClick(View view) {
//buttonaction
- //explorer();
testaccount();
- //videoplayer("https://video.asgardius.company/download/videos/41780585-a935-4d53-84c8-45ce97141231-480.mp4");
}
});
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a1af06f..a1f6185 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -11,6 +11,8 @@
S3 Endpoint URL
S3 Access Key
S3 Secret Key
+ Account added successfully
+ Check your account details
File Explorer Test
Video Test
Cannot retrieve media file