Add controls for displaying webpage images. Implements https://redmine.stoutner...
[PrivacyBrowser.git] / app / src / main / java / com / stoutner / privacybrowser / activities / DomainSettingsActivity.java
index ccb444a7fc8fea3269e594f5fd0cfb4872daf5c3..49364db391fde22c76b1156d4e4e3ccfde974b21 100644 (file)
@@ -22,7 +22,6 @@ package com.stoutner.privacybrowser.activities;
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
-import android.support.design.widget.BaseTransientBottomBar;
 import android.support.design.widget.CoordinatorLayout;
 import android.support.design.widget.Snackbar;
 import android.support.v4.app.NavUtils;
@@ -111,20 +110,22 @@ public class DomainSettingsActivity extends AppCompatActivity {
                 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 javaScriptEnabled = javaScriptEnabledSwitch.isChecked();
-                boolean firstPartyCookiesEnabled = firstPartyCookiesEnabledSwitch.isChecked();
-                boolean thirdPartyCookiesEnabled = thirdPartyCookiesEnabledSwitch.isChecked();
-                boolean domStorageEnabledEnabled = domStorageEnabledSwitch.isChecked();
-                boolean formDataEnabled = formDataEnabledSwitch.isChecked();
-                int userAgentPosition = userAgentSpinner.getSelectedItemPosition();
-                int fontSizePosition = fontSizeSpinner.getSelectedItemPosition();
+                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.user_agent_entry_values)[userAgentPosition];
-                int fontSizeInt = Integer.parseInt(getResources().getStringArray(R.array.default_font_size_entry_values)[fontSizePosition]);
+                String userAgentString = getResources().getStringArray(R.array.user_agent_entry_values)[userAgentPositionInt];
+                int fontSizeInt = Integer.parseInt(getResources().getStringArray(R.array.default_font_size_entry_values)[fontSizePositionInt]);
 
                 // Check to see if we are using a custom user agent.
                 if (userAgentString.equals("Custom user agent")) {
@@ -133,7 +134,8 @@ public class DomainSettingsActivity extends AppCompatActivity {
                 }
 
                 // Save the domain settings.
-                domainsDatabaseHelper.saveDomain(databaseId, domainNameString, javaScriptEnabled, firstPartyCookiesEnabled, thirdPartyCookiesEnabled, domStorageEnabledEnabled, formDataEnabled, userAgentString, fontSizeInt);
+                domainsDatabaseHelper.saveDomain(databaseId, domainNameString, javaScriptEnabledBoolean, firstPartyCookiesEnabledBoolean, thirdPartyCookiesEnabledBoolean, domStorageEnabledEnabledBoolean, formDataEnabledBoolean, userAgentString, fontSizeInt,
+                        displayWebpageImagesInt);
 
                 // Navigate to `DomainsActivity`.
                 NavUtils.navigateUpFromSameTask(this);