+ }
+
+ private void saveDomainSettings() {
+ // Get handles for the domain settings.
+ EditText domainNameEditText = (EditText) findViewById(R.id.domain_settings_name_edittext);
+ Switch javaScriptEnabledSwitch = (Switch) findViewById(R.id.domain_settings_javascript_switch);
+ Switch firstPartyCookiesEnabledSwitch = (Switch) findViewById(R.id.domain_settings_first_party_cookies_switch);
+ Switch thirdPartyCookiesEnabledSwitch = (Switch) findViewById(R.id.domain_settings_third_party_cookies_switch);
+ Switch domStorageEnabledSwitch = (Switch) findViewById(R.id.domain_settings_dom_storage_switch);
+ Switch formDataEnabledSwitch = (Switch) findViewById(R.id.domain_settings_form_data_switch);
+ Spinner userAgentSpinner = (Spinner) findViewById(R.id.domain_settings_user_agent_spinner);
+ EditText customUserAgentEditText = (EditText) findViewById(R.id.domain_settings_custom_user_agent_edittext);
+ Spinner fontSizeSpinner = (Spinner) findViewById(R.id.domain_settings_font_size_spinner);
+ Spinner displayWebpageImagesSpinner = (Spinner) findViewById(R.id.domain_settings_display_webpage_images_spinner);
+
+ // Extract the data for the domain settings.
+ String domainNameString = domainNameEditText.getText().toString();
+ boolean javaScriptEnabledBoolean = javaScriptEnabledSwitch.isChecked();
+ boolean firstPartyCookiesEnabledBoolean = firstPartyCookiesEnabledSwitch.isChecked();
+ boolean thirdPartyCookiesEnabledBoolean = thirdPartyCookiesEnabledSwitch.isChecked();
+ boolean domStorageEnabledEnabledBoolean = domStorageEnabledSwitch.isChecked();
+ boolean formDataEnabledBoolean = formDataEnabledSwitch.isChecked();
+ int userAgentPositionInt = userAgentSpinner.getSelectedItemPosition();
+ int fontSizePositionInt = fontSizeSpinner.getSelectedItemPosition();
+ int displayWebpageImagesInt = displayWebpageImagesSpinner.getSelectedItemPosition();
+
+ // Get the data for the `Spinners` from the entry values string arrays.
+ String userAgentString = getResources().getStringArray(R.array.domain_settings_user_agent_entry_values)[userAgentPositionInt];
+ int fontSizeInt = Integer.parseInt(getResources().getStringArray(R.array.domain_settings_font_size_entry_values)[fontSizePositionInt]);
+
+ // Check to see if we are using a custom user agent.
+ if (userAgentString.equals("Custom user agent")) {
+ // Set `userAgentString` to the custom user agent string.
+ userAgentString = customUserAgentEditText.getText().toString();
+ }
+
+ // Save the domain settings.
+ domainsDatabaseHelper.saveDomain(currentDomainDatabaseId, domainNameString, javaScriptEnabledBoolean, firstPartyCookiesEnabledBoolean, thirdPartyCookiesEnabledBoolean, domStorageEnabledEnabledBoolean, formDataEnabledBoolean, userAgentString, fontSizeInt,
+ displayWebpageImagesInt);
+ }
+
+ private void populateDomainsListView(final int highlightedDomainDatabaseId) {
+ // get a handle for the current `domains_listview`.
+ domainsListView = (ListView) findViewById(R.id.domains_listview);