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);
// 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);