account adding

This commit is contained in:
Page Asgardius 2022-09-04 16:11:15 -07:00
parent 0bb4869178
commit 6c31bb15e5
3 changed files with 44 additions and 23 deletions

View file

@ -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();
}
}
}
});
}
}

View file

@ -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");
}
});
}

View file

@ -11,6 +11,8 @@
<string name="accountadd_endpoint">S3 Endpoint URL</string>
<string name="accountadd_username">S3 Access Key</string>
<string name="accountadd_password">S3 Secret Key</string>
<string name="accountadd_success">Account added successfully</string>
<string name="accountadd_fail">Check your account details</string>
<string name="explorer_test_button">File Explorer Test</string>
<string name="video_test_button">Video Test</string>
<string name="media_conn_fail">Cannot retrieve media file</string>