remove unused functions

This commit is contained in:
Page Asgardius 2023-02-23 10:39:49 -07:00
parent b1db56938b
commit b261b8fdad
7 changed files with 15 additions and 52 deletions

View file

@ -55,8 +55,7 @@
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode|keyboardHidden"
android:exported="false"
android:launchMode="singleTask"
android:resizeableActivity="true"
android:supportsPictureInPicture="true" />
android:resizeableActivity="true" />
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode|keyboardHidden"

View file

@ -22,9 +22,9 @@ import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List;
public class AccountAdd extends AppCompatActivity {
EditText aapick, aupick, appick, aepick, arpick, pdfpick;
EditText aapick, aupick, appick, aepick, arpick;
SwitchMaterial pathstyle;
String alias, username, password, endpoint, id, location, pdfendpoint, style;
String alias, username, password, endpoint, id, location, style;
AWSCredentials myCredentials;
AmazonS3 s3client;
Region region;
@ -35,7 +35,6 @@ public class AccountAdd extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_account_add);
aapick = (EditText)findViewById(R.id.alias);
pdfpick = (EditText)findViewById(R.id.pdfendpoint);
aepick = (EditText)findViewById(R.id.endpoint);
arpick = (EditText)findViewById(R.id.region);
aupick = (EditText)findViewById(R.id.username);
@ -52,7 +51,6 @@ public class AccountAdd extends AppCompatActivity {
username = getIntent().getStringExtra("username");
password = getIntent().getStringExtra("password");
location = getIntent().getStringExtra("region");
pdfendpoint = getIntent().getStringExtra("pdfendpoint");
if (getIntent().getBooleanExtra("style", false)) {
pathstyle.setChecked(true);
} else {
@ -64,7 +62,6 @@ public class AccountAdd extends AppCompatActivity {
aupick.setText(username);
appick.setText(password);
arpick.setText(location);
pdfpick.setText(pdfendpoint);
} else{
getSupportActionBar().setTitle(getResources().getString(R.string.accountadd_button));
}
@ -76,7 +73,6 @@ public class AccountAdd extends AppCompatActivity {
public void onClick(View view) {
//buttonaction
alias = aapick.getText().toString();
pdfendpoint = pdfpick.getText().toString();
endpoint = aepick.getText().toString();
location = arpick.getText().toString();
username = aupick.getText().toString();
@ -90,7 +86,7 @@ public class AccountAdd extends AppCompatActivity {
SQLiteDatabase db = dbHelper.getWritableDatabase();
if (alias.equals("") || endpoint.equals("") || username.equals("") || password.equals("")) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_null), Toast.LENGTH_SHORT).show();
} else if (endpoint.startsWith("http://") || pdfendpoint.startsWith("http://")) {
} else if (endpoint.startsWith("http://")) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.nosslwarning), Toast.LENGTH_SHORT).show();
} else if (!endpoint.startsWith("https://")) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_url), Toast.LENGTH_SHORT).show();
@ -104,10 +100,10 @@ public class AccountAdd extends AppCompatActivity {
endpoint = endpoint.substring(0, endpoint.length()-1);
}
if (edit) {
db.execSQL("UPDATE account SET id=\""+alias+"\", endpoint=\""+endpoint+"\", username=\""+username+"\", password=\""+password+"\", region=\""+location+"\", pdfendpoint=\""+pdfendpoint+"\", style=\""+style+"\" WHERE id=\""+id+"\"");
db.execSQL("UPDATE account SET id=\""+alias+"\", endpoint=\""+endpoint+"\", username=\""+username+"\", password=\""+password+"\", region=\""+location+"\", 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+"\", \""+style+"\")");
db.execSQL("INSERT INTO account VALUES (\""+alias+"\", \""+endpoint+"\", \""+username+"\", \""+password+"\", \""+location+"\", \""+style+"\")");
Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_success), Toast.LENGTH_SHORT).show();
}
mainmenu();

View file

@ -26,7 +26,7 @@ public class BucketSelect extends AppCompatActivity {
ArrayList Name;
ArrayList Img;
RecyclerView recyclerView;
String username, password, endpoint, prefix, location, pdfendpoint;
String username, password, endpoint, prefix, location;
boolean style, isplaylist;
Region region;
S3ClientOptions s3ClientOptions;
@ -42,7 +42,6 @@ public class BucketSelect extends AppCompatActivity {
username = getIntent().getStringExtra("username");
password = getIntent().getStringExtra("password");
location = getIntent().getStringExtra("region");
pdfendpoint = getIntent().getStringExtra("pdfendpoint");
style = getIntent().getBooleanExtra("style", false);
videocache = getIntent().getIntExtra("videocache", 40);
videotime = getIntent().getIntExtra("videotime", 1);
@ -153,7 +152,6 @@ public class BucketSelect extends AppCompatActivity {
intent.putExtra("prefix", prefix);
intent.putExtra("treelevel", treelevel);
intent.putExtra("region", location);
intent.putExtra("pdfendpoint", pdfendpoint);
intent.putExtra("style", style);
intent.putExtra("videocache", videocache);
intent.putExtra("videotime", videotime);

View file

@ -21,7 +21,7 @@ import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
boolean style, isplaylist;
String alias, username, password, endpoint, location, pdfendpoint;
String alias, username, password, endpoint, location;
RecyclerView recyclerView;
SQLiteDatabase db;
ArrayList Name;
@ -289,16 +289,15 @@ public class MainActivity extends AppCompatActivity {
// Database Queries
try {
//This retrieves credentials from selected account
String query = "SELECT endpoint, username, password, region, pdfendpoint, style FROM account where id=\""+ Name.get(position).toString()+ "\"";
String query = "SELECT endpoint, username, password, region, style FROM account where id=\""+ Name.get(position).toString()+ "\"";
Cursor cursor = db.rawQuery(query,null);
if (cursor.moveToNext()){
endpoint = cursor.getString(0);
username = cursor.getString(1);
password = cursor.getString(2);
location = cursor.getString(3);
pdfendpoint = cursor.getString(4);
try {
style = cursor.getString(5).equals("1");
style = cursor.getString(4).equals("1");
} catch (Exception e) {
e.printStackTrace();
style = false;
@ -340,7 +339,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, style FROM account where id=\""+ Name.get(position).toString()+ "\"";
String query = "SELECT id, endpoint, username, password, region, style FROM account where id=\""+ Name.get(position).toString()+ "\"";
System.out.println(query);
Cursor cursor = db.rawQuery(query,null);
if (cursor.moveToNext()){
@ -349,9 +348,8 @@ public class MainActivity extends AppCompatActivity {
username = cursor.getString(2);
password = cursor.getString(3);
location = cursor.getString(4);
pdfendpoint = cursor.getString(5);
try {
style = cursor.getString(6).equals("1");
style = cursor.getString(5).equals("1");
} catch (Exception e) {
e.printStackTrace();
style = false;
@ -363,14 +361,7 @@ public class MainActivity extends AppCompatActivity {
//Toast.makeText(MainActivity.this, "This feature is not yet implemented", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
try {
db = dbHelper.getWritableDatabase();
db.execSQL("alter table account add column style text");
db.close();
} catch (Exception f) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
finish();
}
Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
}
}
else if (menuItem.getTitle() == getResources().getString(R.string.accountdel_button)) {
@ -444,7 +435,6 @@ public class MainActivity extends AppCompatActivity {
intent.putExtra("username", username);
intent.putExtra("password", password);
intent.putExtra("region", location);
intent.putExtra("pdfendpoint", pdfendpoint);
intent.putExtra("style", style);
intent.putExtra("videocache", videocache);
intent.putExtra("videotime", videotime);
@ -464,7 +454,6 @@ public class MainActivity extends AppCompatActivity {
intent.putExtra("username", username);
intent.putExtra("password", password);
intent.putExtra("region", location);
intent.putExtra("pdfendpoint", pdfendpoint);
intent.putExtra("style", style);
}
intent.putExtra("edit", edit);

View file

@ -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, style text)";
private static final String usertable = "CREATE TABLE IF NOT EXISTS account(id text UNIQUE, endpoint text, username text, password text, region 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')";

View file

@ -32,7 +32,7 @@ public class ObjectSelect extends AppCompatActivity {
ArrayList Img;
//ArrayList object;
RecyclerView recyclerView;
String username, password, endpoint, bucket, prefix, location, pdfendpoint, query, policy;
String username, password, endpoint, bucket, prefix, location, policy;
boolean style, isplaylist;
String[] filename;
Region region;
@ -50,7 +50,6 @@ public class ObjectSelect extends AppCompatActivity {
password = getIntent().getStringExtra("password");
bucket = getIntent().getStringExtra("bucket");
location = getIntent().getStringExtra("region");
pdfendpoint = getIntent().getStringExtra("pdfendpoint");
style = getIntent().getBooleanExtra("style", false);
prefix = getIntent().getStringExtra("prefix");
treelevel = getIntent().getIntExtra("treelevel", 0);
@ -374,7 +373,6 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("prefix", prefix + object);
intent.putExtra("treelevel", treelevel+1);
intent.putExtra("region", location);
intent.putExtra("pdfendpoint", pdfendpoint);
intent.putExtra("style", style);
intent.putExtra("videocache", videocache);
intent.putExtra("videotime", videotime);

View file

@ -32,23 +32,6 @@
android:inputType="text"
android:textColorHint="?attr/colorOnSecondary"/>
<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/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"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"