database adapter fix

Signed-off-by: nuclearfog <hatespirit666@gmail.com>
This commit is contained in:
nuclearfog 2021-10-25 14:05:23 +02:00
parent 1339ee0d7d
commit 01f0037229
No known key found for this signature in database
GPG Key ID: AA0271FBE406DB98
2 changed files with 6 additions and 10 deletions

View File

@ -288,7 +288,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
}
// confirm delete database
else if (type == DialogType.DEL_DATABASE) {
DatabaseAdapter.deleteDatabase(getApplicationContext());
DatabaseAdapter.deleteDatabase(this);
setResult(RETURN_DB_CLEARED);
}
// confirm leaving without saving proxy changes

View File

@ -198,10 +198,7 @@ public class DatabaseAdapter {
*/
private SQLiteDatabase db;
private boolean isInitialized = false;
/**
*
*/
private DatabaseAdapter() {
}
@ -224,7 +221,7 @@ public class DatabaseAdapter {
* @return database instance
*/
public static DatabaseAdapter getInstance(@NonNull Context context) {
if (!INSTANCE.isInitialized)
if (INSTANCE.db == null)
INSTANCE.init(context.getApplicationContext());
return INSTANCE;
}
@ -249,7 +246,6 @@ public class DatabaseAdapter {
db = c.openOrCreateDatabase(databasePath.toString(), MODE_PRIVATE, null);
initTables();
updateTable();
isInitialized = true;
}
/**
@ -639,21 +635,21 @@ public class DatabaseAdapter {
}
/**
*
* table for user filter list
*/
public interface UserExcludeTable {
/**
*
* table name
*/
String NAME = "userExclude";
/**
*
* owner ID of the list
*/
String OWNER = "listOwner";
/**
*
* user ID to filter
*/
String ID = "userID";
}