X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Ffragments%2FDomainSettingsFragment.java;h=474d01c23b9c9c960fd2121db9bc08d454de4019;hp=1ce0e3cccd5a7668b52f85738652ec8692f344a7;hb=38919c77d15eeacbee96ab337afc62b30ddc74ca;hpb=1b27ac6f2b7c046945fc97e2aff9adbde8a152ce diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java index 1ce0e3cc..474d01c2 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java @@ -201,8 +201,8 @@ public class DomainSettingsFragment extends Fragment { String startDateLabel = getString(R.string.start_date) + " "; String endDateLabel = getString(R.string.end_date) + " "; - // Initialize the database handler. The `0` specifies the database version, but that is ignored and set instead using a constant in `DomainsDatabaseHelper`. - DomainsDatabaseHelper domainsDatabaseHelper = new DomainsDatabaseHelper(context, null, null, 0); + // Initialize the database handler. + DomainsDatabaseHelper domainsDatabaseHelper = new DomainsDatabaseHelper(requireContext()); // Get the database cursor for this ID and move it to the first row. Cursor domainCursor = domainsDatabaseHelper.getCursorForId(databaseId); @@ -601,7 +601,8 @@ public class DomainSettingsFragment extends Fragment { // Get the user agent string from the user agent data array. userAgentTextView.setText(userAgentDataArray[defaultUserAgentArrayPosition]); } - } else if (userAgentArrayPosition == MainWebViewActivity.UNRECOGNIZED_USER_AGENT) { // A custom user agent is stored in the current user agent name. + } else if (userAgentArrayPosition == MainWebViewActivity.UNRECOGNIZED_USER_AGENT || currentUserAgentName.equals(getString(R.string.custom_user_agent))) { + // A custom user agent is stored in the current user agent name. The second check is necessary in case the user did not change the default custom text. // Set the user agent spinner to `Custom user agent`. userAgentSpinner.setSelection(MainWebViewActivity.DOMAINS_CUSTOM_USER_AGENT);