Skip to content
This repository has been archived by the owner on Feb 8, 2025. It is now read-only.

Commit

Permalink
database adapter fix
Browse files Browse the repository at this point in the history
Signed-off-by: nuclearfog <hatespirit666@gmail.com>
  • Loading branch information
nuclearfog committed Oct 25, 2021
1 parent 1339ee0 commit 01f0037
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public void onConfirm(DialogType type) {
}
// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,7 @@ public class DatabaseAdapter {
*/
private SQLiteDatabase db;

private boolean isInitialized = false;

/**
*
*/
private DatabaseAdapter() {
}
Expand All @@ -224,7 +221,7 @@ public synchronized SQLiteDatabase getDatabase() {
* @return database instance
*/
public static DatabaseAdapter getInstance(@NonNull Context context) {
if (!INSTANCE.isInitialized)
if (INSTANCE.db == null)
INSTANCE.init(context.getApplicationContext());
return INSTANCE;
}
Expand All @@ -249,7 +246,6 @@ private void init(Context c) {
db = c.openOrCreateDatabase(databasePath.toString(), MODE_PRIVATE, null);
initTables();
updateTable();
isInitialized = true;
}

/**
Expand Down Expand Up @@ -639,21 +635,21 @@ public interface UserRegisterTable {
}

/**
*
* 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";
}
Expand Down

0 comments on commit 01f0037

Please sign in to comment.