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:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode|keyboardHidden"
android:exported="false" android:exported="false"
android:launchMode="singleTask" android:launchMode="singleTask"
android:resizeableActivity="true" android:resizeableActivity="true" />
android:supportsPictureInPicture="true" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout|uiMode|keyboardHidden" 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; import java.util.List;
public class AccountAdd extends AppCompatActivity { public class AccountAdd extends AppCompatActivity {
EditText aapick, aupick, appick, aepick, arpick, pdfpick; EditText aapick, aupick, appick, aepick, arpick;
SwitchMaterial pathstyle; SwitchMaterial pathstyle;
String alias, username, password, endpoint, id, location, pdfendpoint, style; String alias, username, password, endpoint, id, location, style;
AWSCredentials myCredentials; AWSCredentials myCredentials;
AmazonS3 s3client; AmazonS3 s3client;
Region region; Region region;
@ -35,7 +35,6 @@ public class AccountAdd extends AppCompatActivity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_account_add); setContentView(R.layout.activity_account_add);
aapick = (EditText)findViewById(R.id.alias); aapick = (EditText)findViewById(R.id.alias);
pdfpick = (EditText)findViewById(R.id.pdfendpoint);
aepick = (EditText)findViewById(R.id.endpoint); aepick = (EditText)findViewById(R.id.endpoint);
arpick = (EditText)findViewById(R.id.region); arpick = (EditText)findViewById(R.id.region);
aupick = (EditText)findViewById(R.id.username); aupick = (EditText)findViewById(R.id.username);
@ -52,7 +51,6 @@ public class AccountAdd extends AppCompatActivity {
username = getIntent().getStringExtra("username"); username = getIntent().getStringExtra("username");
password = getIntent().getStringExtra("password"); password = getIntent().getStringExtra("password");
location = getIntent().getStringExtra("region"); location = getIntent().getStringExtra("region");
pdfendpoint = getIntent().getStringExtra("pdfendpoint");
if (getIntent().getBooleanExtra("style", false)) { if (getIntent().getBooleanExtra("style", false)) {
pathstyle.setChecked(true); pathstyle.setChecked(true);
} else { } else {
@ -64,7 +62,6 @@ public class AccountAdd extends AppCompatActivity {
aupick.setText(username); aupick.setText(username);
appick.setText(password); appick.setText(password);
arpick.setText(location); arpick.setText(location);
pdfpick.setText(pdfendpoint);
} else{ } else{
getSupportActionBar().setTitle(getResources().getString(R.string.accountadd_button)); getSupportActionBar().setTitle(getResources().getString(R.string.accountadd_button));
} }
@ -76,7 +73,6 @@ public class AccountAdd extends AppCompatActivity {
public void onClick(View view) { public void onClick(View view) {
//buttonaction //buttonaction
alias = aapick.getText().toString(); alias = aapick.getText().toString();
pdfendpoint = pdfpick.getText().toString();
endpoint = aepick.getText().toString(); endpoint = aepick.getText().toString();
location = arpick.getText().toString(); location = arpick.getText().toString();
username = aupick.getText().toString(); username = aupick.getText().toString();
@ -90,7 +86,7 @@ public class AccountAdd extends AppCompatActivity {
SQLiteDatabase db = dbHelper.getWritableDatabase(); SQLiteDatabase db = dbHelper.getWritableDatabase();
if (alias.equals("") || endpoint.equals("") || username.equals("") || password.equals("")) { if (alias.equals("") || endpoint.equals("") || username.equals("") || password.equals("")) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_null), Toast.LENGTH_SHORT).show(); 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(); Toast.makeText(getApplicationContext(),getResources().getString(R.string.nosslwarning), Toast.LENGTH_SHORT).show();
} else if (!endpoint.startsWith("https://")) { } else if (!endpoint.startsWith("https://")) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.invalid_url), Toast.LENGTH_SHORT).show(); 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); endpoint = endpoint.substring(0, endpoint.length()-1);
} }
if (edit) { 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(); Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountsave_success), Toast.LENGTH_SHORT).show();
} else { } 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(); Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_success), Toast.LENGTH_SHORT).show();
} }
mainmenu(); mainmenu();

View file

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

View file

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

View file

@ -5,7 +5,7 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteOpenHelper;
public class MyDbHelper extends 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 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 setvideocache = "INSERT INTO preferences VALUES ('videocache', '300')";
private static final String setvideotime = "INSERT INTO preferences VALUES ('videotime', '3')"; 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 Img;
//ArrayList object; //ArrayList object;
RecyclerView recyclerView; RecyclerView recyclerView;
String username, password, endpoint, bucket, prefix, location, pdfendpoint, query, policy; String username, password, endpoint, bucket, prefix, location, policy;
boolean style, isplaylist; boolean style, isplaylist;
String[] filename; String[] filename;
Region region; Region region;
@ -50,7 +50,6 @@ public class ObjectSelect extends AppCompatActivity {
password = getIntent().getStringExtra("password"); password = getIntent().getStringExtra("password");
bucket = getIntent().getStringExtra("bucket"); bucket = getIntent().getStringExtra("bucket");
location = getIntent().getStringExtra("region"); location = getIntent().getStringExtra("region");
pdfendpoint = getIntent().getStringExtra("pdfendpoint");
style = getIntent().getBooleanExtra("style", false); style = getIntent().getBooleanExtra("style", false);
prefix = getIntent().getStringExtra("prefix"); prefix = getIntent().getStringExtra("prefix");
treelevel = getIntent().getIntExtra("treelevel", 0); treelevel = getIntent().getIntExtra("treelevel", 0);
@ -374,7 +373,6 @@ public class ObjectSelect extends AppCompatActivity {
intent.putExtra("prefix", prefix + object); intent.putExtra("prefix", prefix + object);
intent.putExtra("treelevel", treelevel+1); intent.putExtra("treelevel", treelevel+1);
intent.putExtra("region", location); intent.putExtra("region", location);
intent.putExtra("pdfendpoint", pdfendpoint);
intent.putExtra("style", style); intent.putExtra("style", style);
intent.putExtra("videocache", videocache); intent.putExtra("videocache", videocache);
intent.putExtra("videotime", videotime); intent.putExtra("videotime", videotime);

View file

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