X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fhelpers%2FImportExportDatabaseHelper.java;h=c8638e08dd4e1eff1599661f16dc4dd55b961c7f;hb=2bf00b70e1626bb941ec517fc6749f18ddb255c6;hp=22968adcf23591f8f272501fec77f68969c0684e;hpb=4c00dd29a0a8592dff337d8b01870f06134c070b;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java index 22968adc..c8638e08 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/ImportExportDatabaseHelper.java @@ -80,7 +80,9 @@ public class ImportExportDatabaseHelper { private static final String FONT_SIZE = "font_size"; private static final String OPEN_INTENTS_IN_NEW_TAB = "open_intents_in_new_tab"; private static final String SWIPE_TO_REFRESH = "swipe_to_refresh"; + private static final String DOWNLOAD_WITH_EXTERNAL_APP = "download_with_external_app"; private static final String SCROLL_APP_BAR = "scroll_app_bar"; + private static final String BOTTOM_APP_BAR = "bottom_app_bar"; private static final String DISPLAY_ADDITIONAL_APP_BAR_ICONS = "display_additional_app_bar_icons"; private static final String APP_THEME = "app_theme"; private static final String WEBVIEW_THEME = "webview_theme"; @@ -318,7 +320,7 @@ public class ImportExportDatabaseHelper { // Get the current clear logcat value. boolean clearLogcat = sharedPreferences.getBoolean(CLEAR_LOGCAT, true); - // Populate the preference table with the current clear logcat value. + // Populate the preferences table with the current clear logcat value. if (clearLogcat) { importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + CLEAR_LOGCAT + " = " + 1); } else { @@ -344,6 +346,28 @@ public class ImportExportDatabaseHelper { // Copy the data from the old cookies columns to the new ones. importDatabase.execSQL("UPDATE " + DomainsDatabaseHelper.DOMAINS_TABLE + " SET " + DomainsDatabaseHelper.COOKIES + " = enablefirstpartycookies"); importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + COOKIES + " = first_party_cookies"); + + // Create the new columns. + importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + DOWNLOAD_WITH_EXTERNAL_APP + " BOOLEAN"); + importDatabase.execSQL("ALTER TABLE " + PREFERENCES_TABLE + " ADD COLUMN " + BOTTOM_APP_BAR + " BOOLEAN"); + + // Get the current values for the new columns. + boolean downloadWithExternalApp = sharedPreferences.getBoolean(DOWNLOAD_WITH_EXTERNAL_APP, false); + boolean bottomAppBar = sharedPreferences.getBoolean(BOTTOM_APP_BAR, false); + + // Populate the preferences table with the current download with external app value. + if (downloadWithExternalApp) { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + DOWNLOAD_WITH_EXTERNAL_APP + " = " + 1); + } else { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + DOWNLOAD_WITH_EXTERNAL_APP + " = " + 0); + } + + // Populate the preferences table with the current bottom app bar value. + if (bottomAppBar) { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + BOTTOM_APP_BAR + " = " + 1); + } else { + importDatabase.execSQL("UPDATE " + PREFERENCES_TABLE + " SET " + BOTTOM_APP_BAR + " = " + 0); + } } } @@ -493,7 +517,9 @@ public class ImportExportDatabaseHelper { .putString(FONT_SIZE, importPreferencesCursor.getString(importPreferencesCursor.getColumnIndex(FONT_SIZE))) .putBoolean(OPEN_INTENTS_IN_NEW_TAB, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(OPEN_INTENTS_IN_NEW_TAB)) == 1) .putBoolean(SWIPE_TO_REFRESH, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(SWIPE_TO_REFRESH)) == 1) + .putBoolean(DOWNLOAD_WITH_EXTERNAL_APP, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(DOWNLOAD_WITH_EXTERNAL_APP)) == 1) .putBoolean(SCROLL_APP_BAR, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(SCROLL_APP_BAR)) == 1) + .putBoolean(BOTTOM_APP_BAR, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(BOTTOM_APP_BAR)) == 1) .putBoolean(DISPLAY_ADDITIONAL_APP_BAR_ICONS, importPreferencesCursor.getInt(importPreferencesCursor.getColumnIndex(DISPLAY_ADDITIONAL_APP_BAR_ICONS)) == 1) .putString(APP_THEME, importPreferencesCursor.getString(importPreferencesCursor.getColumnIndex(APP_THEME))) .putString(WEBVIEW_THEME, importPreferencesCursor.getString(importPreferencesCursor.getColumnIndex(WEBVIEW_THEME))) @@ -660,7 +686,9 @@ public class ImportExportDatabaseHelper { FONT_SIZE + " TEXT, " + OPEN_INTENTS_IN_NEW_TAB + " BOOLEAN, " + SWIPE_TO_REFRESH + " BOOLEAN, " + + DOWNLOAD_WITH_EXTERNAL_APP + " BOOLEAN, " + SCROLL_APP_BAR + " BOOLEAN, " + + BOTTOM_APP_BAR + " BOOLEAN, " + DISPLAY_ADDITIONAL_APP_BAR_ICONS + " BOOLEAN, " + APP_THEME + " TEXT, " + WEBVIEW_THEME + " TEXT, " + @@ -709,7 +737,9 @@ public class ImportExportDatabaseHelper { preferencesContentValues.put(FONT_SIZE, sharedPreferences.getString(FONT_SIZE, context.getString(R.string.font_size_default_value))); preferencesContentValues.put(OPEN_INTENTS_IN_NEW_TAB, sharedPreferences.getBoolean(OPEN_INTENTS_IN_NEW_TAB, true)); preferencesContentValues.put(SWIPE_TO_REFRESH, sharedPreferences.getBoolean(SWIPE_TO_REFRESH, true)); + preferencesContentValues.put(DOWNLOAD_WITH_EXTERNAL_APP, sharedPreferences.getBoolean(DOWNLOAD_WITH_EXTERNAL_APP, false)); preferencesContentValues.put(SCROLL_APP_BAR, sharedPreferences.getBoolean(SCROLL_APP_BAR, true)); + preferencesContentValues.put(BOTTOM_APP_BAR, sharedPreferences.getBoolean(BOTTOM_APP_BAR, false)); preferencesContentValues.put(DISPLAY_ADDITIONAL_APP_BAR_ICONS, sharedPreferences.getBoolean(DISPLAY_ADDITIONAL_APP_BAR_ICONS, false)); preferencesContentValues.put(APP_THEME, sharedPreferences.getString(APP_THEME, context.getString(R.string.app_theme_default_value))); preferencesContentValues.put(WEBVIEW_THEME, sharedPreferences.getString(WEBVIEW_THEME, context.getString(R.string.webview_theme_default_value)));