account adding
This commit is contained in:
parent
0bb4869178
commit
6c31bb15e5
3 changed files with 44 additions and 23 deletions
|
@ -2,13 +2,50 @@ package asgardius.page.s3manager;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.os.Bundle;
|
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 {
|
public class AccountAdd extends AppCompatActivity {
|
||||||
|
EditText aapick, aupick, appick, aepick;
|
||||||
|
String alias, username, password, endpoint;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_account_add);
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,13 +1,5 @@
|
||||||
package asgardius.page.s3manager;
|
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.content.Intent;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
@ -16,23 +8,16 @@ import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.amazonaws.auth.AWSCredentials;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import com.amazonaws.auth.BasicAWSCredentials;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import com.amazonaws.regions.Region;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
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 java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
static boolean DEFAULT_PATH_STYLE_ACCESS = true;
|
static boolean DEFAULT_PATH_STYLE_ACCESS = true;
|
||||||
String username, password, endpoint, aname;
|
String username, password, endpoint;
|
||||||
RecyclerView recyclerView;
|
RecyclerView recyclerView;
|
||||||
ArrayList Name;
|
ArrayList Name;
|
||||||
ArrayList Img;
|
ArrayList Img;
|
||||||
|
@ -106,8 +91,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getApplicationContext(), recyclerView, new RecyclerTouchListener.ClickListener() {
|
recyclerView.addOnItemTouchListener(new RecyclerTouchListener(getApplicationContext(), recyclerView, new RecyclerTouchListener.ClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view, int position) {
|
public void onClick(View view, int position) {
|
||||||
//aname = Name.get(position).toString();
|
//System.out.println("Click on "+Name.get(position).toString());
|
||||||
//System.out.println("Click on "+aname);
|
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
// Database Queries
|
// Database Queries
|
||||||
System.out.println("Database OK");
|
System.out.println("Database OK");
|
||||||
|
@ -150,9 +134,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
//buttonaction
|
//buttonaction
|
||||||
//explorer();
|
|
||||||
testaccount();
|
testaccount();
|
||||||
//videoplayer("https://video.asgardius.company/download/videos/41780585-a935-4d53-84c8-45ce97141231-480.mp4");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
<string name="accountadd_endpoint">S3 Endpoint URL</string>
|
<string name="accountadd_endpoint">S3 Endpoint URL</string>
|
||||||
<string name="accountadd_username">S3 Access Key</string>
|
<string name="accountadd_username">S3 Access Key</string>
|
||||||
<string name="accountadd_password">S3 Secret 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="explorer_test_button">File Explorer Test</string>
|
||||||
<string name="video_test_button">Video Test</string>
|
<string name="video_test_button">Video Test</string>
|
||||||
<string name="media_conn_fail">Cannot retrieve media file</string>
|
<string name="media_conn_fail">Cannot retrieve media file</string>
|
||||||
|
|
Loading…
Reference in a new issue