style access selection
This commit is contained in:
parent
424caf8b87
commit
ddffa7ccfe
6 changed files with 155 additions and 111 deletions
|
@ -19,13 +19,15 @@ 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.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AccountAdd extends AppCompatActivity {
|
||||
EditText aapick, aupick, appick, aepick, arpick, pdfpick;
|
||||
String alias, username, password, endpoint, id, location, pdfendpoint;
|
||||
SwitchMaterial pathstyle;
|
||||
String alias, username, password, endpoint, id, location, pdfendpoint, style;
|
||||
AWSCredentials myCredentials;
|
||||
AmazonS3 s3client;
|
||||
Region region;
|
||||
|
@ -41,6 +43,7 @@ public class AccountAdd extends AppCompatActivity {
|
|||
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);
|
||||
|
@ -53,6 +56,11 @@ public class AccountAdd extends AppCompatActivity {
|
|||
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);
|
||||
|
@ -76,6 +84,11 @@ public class AccountAdd extends AppCompatActivity {
|
|||
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);
|
||||
if (alias.equals("") && endpoint.equals("") && username.equals(getResources().getString(R.string.access_key))) {
|
||||
endpoint = getResources().getString(R.string.endpoint_url);
|
||||
|
@ -96,10 +109,10 @@ public class AccountAdd extends AppCompatActivity {
|
|||
location = "us-east-1";
|
||||
}
|
||||
if (edit) {
|
||||
db.execSQL("UPDATE account SET id=\""+alias+"\", endpoint=\""+endpoint+"\", username=\""+username+"\", password=\""+password+"\", region=\""+location+"\", pdfendpoint=\""+pdfendpoint+"\" WHERE id=\""+id+"\"");
|
||||
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+"\")");
|
||||
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();
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.ArrayList;
|
|||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
static boolean DEFAULT_PATH_STYLE_ACCESS = true;
|
||||
boolean style;
|
||||
String alias, username, password, endpoint, location, pdfendpoint;
|
||||
RecyclerView recyclerView;
|
||||
SQLiteDatabase db;
|
||||
|
@ -219,7 +219,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
// Database Queries
|
||||
try {
|
||||
//This retrieves credentials from selected account
|
||||
String query = "SELECT endpoint, username, password, region, pdfendpoint FROM account where id=\""+ Name.get(position).toString()+ "\"";
|
||||
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);
|
||||
|
@ -227,6 +227,11 @@ public class MainActivity extends AppCompatActivity {
|
|||
password = cursor.getString(2);
|
||||
location = cursor.getString(3);
|
||||
pdfendpoint = cursor.getString(4);
|
||||
if (cursor.getString(5).equals("1")) {
|
||||
style = true;
|
||||
} else {
|
||||
style = false;
|
||||
}
|
||||
db.close();
|
||||
//This launch file explorer using selected account
|
||||
explorer();
|
||||
|
@ -255,7 +260,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
try {
|
||||
db = dbHelper.getWritableDatabase();
|
||||
//This retrieves credentials from selected account
|
||||
String query = "SELECT id, endpoint, username, password, region, pdfendpoint FROM account where id=\""+ Name.get(position).toString()+ "\"";
|
||||
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()){
|
||||
|
@ -265,6 +270,11 @@ public class MainActivity extends AppCompatActivity {
|
|||
password = cursor.getString(3);
|
||||
location = cursor.getString(4);
|
||||
pdfendpoint = cursor.getString(5);
|
||||
if (cursor.getString(6).equals("1")) {
|
||||
style = true;
|
||||
} else {
|
||||
style = false;
|
||||
}
|
||||
}
|
||||
db.close();
|
||||
//This launch account editor
|
||||
|
@ -363,6 +373,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
intent.putExtra("password", password);
|
||||
intent.putExtra("region", location);
|
||||
intent.putExtra("pdfendpoint", pdfendpoint);
|
||||
intent.putExtra("style", style);
|
||||
}
|
||||
intent.putExtra("edit", edit);
|
||||
startActivity(intent);
|
||||
|
|
|
@ -5,7 +5,7 @@ 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)";
|
||||
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')";
|
||||
|
|
|
@ -7,123 +7,141 @@
|
|||
android:orientation="vertical"
|
||||
tools:context=".AccountAdd">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/aliasLayout"
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp"
|
||||
tools:ignore="MissingConstraints"
|
||||
tools:layout_editor_absoluteX="20dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/alias"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_alias"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
android:textColorHint="?attr/colorOnSecondary"
|
||||
tools:ignore="MissingConstraints" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/pdfendpoint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_pdfendpoint"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textUri"
|
||||
android:textColorHint="?attr/colorOnSecondary"
|
||||
tools:ignore="MissingConstraints" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/accountadd_alias"
|
||||
android:textAlignment="center"
|
||||
android:textSize="25sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
<EditText
|
||||
android:id="@+id/alias"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_alias"
|
||||
android:inputType="text"
|
||||
android:textColorHint="?attr/colorOnSecondary"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/endpointLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp"
|
||||
tools:ignore="MissingConstraints"
|
||||
tools:layout_editor_absoluteX="20dp">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/accountadd_pdfendpoint"
|
||||
android:textAlignment="center"
|
||||
android:textSize="25sp"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/endpoint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_endpoint"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textUri"
|
||||
android:textColorHint="?attr/colorOnSecondary"
|
||||
tools:ignore="MissingConstraints" />
|
||||
<EditText
|
||||
android:id="@+id/pdfendpoint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_pdfendpoint"
|
||||
android:inputType="textUri"
|
||||
android:textColorHint="?attr/colorOnSecondary"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/region"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_region"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:textColorHint="?attr/colorOnSecondary"
|
||||
tools:ignore="MissingConstraints" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/accountadd_endpoint"
|
||||
android:textAlignment="center"
|
||||
android:textSize="25sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
<EditText
|
||||
android:id="@+id/endpoint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_endpoint"
|
||||
android:inputType="textUri"
|
||||
android:textColorHint="?attr/colorOnSecondary"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:autofillHints="username"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_username"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:textColorHint="?attr/colorOnSecondary"
|
||||
tools:ignore="MissingConstraints" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/accountadd_region"
|
||||
android:textAlignment="center"
|
||||
android:textSize="25sp"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:autofillHints="username"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_password"
|
||||
android:inputType="textPassword"
|
||||
android:textColorHint="?attr/colorOnSecondary"
|
||||
tools:ignore="MissingConstraints" />
|
||||
<EditText
|
||||
android:id="@+id/region"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_region"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:textColorHint="?attr/colorOnSecondary"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp"
|
||||
tools:ignore="MissingConstraints"
|
||||
tools:layout_editor_absoluteX="20dp">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/accountadd_username"
|
||||
android:textAlignment="center"
|
||||
android:textSize="25sp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/addaccount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/accountadd_button"
|
||||
tools:ignore="MissingConstraints" />
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:autofillHints="username"
|
||||
android:layout_weight="1"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_username"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:textColorHint="?attr/colorOnSecondary"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/testaccount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/accounttest_button"
|
||||
tools:ignore="MissingConstraints" />
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/accountadd_password"
|
||||
android:textAlignment="center"
|
||||
android:textSize="25sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:autofillHints="password"
|
||||
android:layout_weight="1"
|
||||
android:focusable="true"
|
||||
android:hint="@string/accountadd_password"
|
||||
android:inputType="textPassword"
|
||||
android:textColorHint="?attr/colorOnSecondary"/>
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/pathstyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:text="@string/path_style"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/addaccount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:text="@string/accountadd_button"
|
||||
android:textColor="?android:attr/colorBackground"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/testaccount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:text="@string/accounttest_button"
|
||||
android:textColor="?android:attr/colorBackground"
|
||||
android:textSize="24sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -94,4 +94,5 @@
|
|||
<string name="mediaplayer_multierror">Solo se puede reproducir un archivo multimedia a la vez</string>
|
||||
<string name="playback_channel_name">Reproduccion de video</string>
|
||||
<string name="not_zero">este valor no puede ser cero</string>
|
||||
<string name="path_style">Acceso de estilo de ruta</string>
|
||||
</resources>
|
|
@ -98,4 +98,5 @@
|
|||
<string name="mediaplayer_multierror">Only one media file can be played at once</string>
|
||||
<string name="playback_channel_name">Video Playback</string>
|
||||
<string name="not_zero">This value cannot be zero</string>
|
||||
<string name="path_style">Path style access</string>
|
||||
</resources>
|
Loading…
Reference in a new issue