Fixed bug where history wasn't being deleted until the app was restarted

This commit is contained in:
Anthony Restaino 2015-08-21 17:15:08 -04:00
parent 119245a5fa
commit d5e1e06d84
2 changed files with 8 additions and 2 deletions

View File

@ -31,7 +31,7 @@ public class HistoryDatabase extends SQLiteOpenHelper {
private static final String KEY_TITLE = "title";
private static final String KEY_TIME_VISITED = "time";
private static SQLiteDatabase mDatabase;
private SQLiteDatabase mDatabase;
private static HistoryDatabase mInstance;
@ -65,6 +65,12 @@ public class HistoryDatabase extends SQLiteOpenHelper {
onCreate(db);
}
public void deleteHistory() {
mDatabase.delete(TABLE_HISTORY, null, null);
mDatabase.close();
mDatabase = this.getWritableDatabase();
}
public boolean isClosed() {
return mDatabase == null || !mDatabase.isOpen();
}

View File

@ -33,7 +33,7 @@ public class WebUtils {
}
public static void clearHistory(@NonNull Context context, boolean systemBrowserPresent) {
context.deleteDatabase(HistoryDatabase.DATABASE_NAME);
HistoryDatabase.getInstance(context).deleteHistory();
WebViewDatabase m = WebViewDatabase.getInstance(context);
m.clearFormData();
m.clearHttpAuthUsernamePassword();