+ // Set the EasyList spinner listener.
+ easyListSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
+ // Update the icon and the text view settings.
+ setIconAndTextViewSettings(position, easyListDefault, easyListLinearLayout, easyListImageView, easyListTextView)
+ }
+
+ override fun onNothingSelected(parent: AdapterView<*>?) {
+ // Do nothing.
+ }
+ }
+
+ // Set the EasyPrivacy spinner listener.
+ easyPrivacySpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
+ // Update the icon and the text view settings.
+ setIconAndTextViewSettings(position, easyPrivacyDefault, easyPrivacyLinearLayout, easyPrivacyImageView, easyPrivacyTextView)
+ }
+
+ override fun onNothingSelected(parent: AdapterView<*>?) {
+ // Do nothing.
+ }
+ }
+
+ // Set the Fanboy's Annoyance List spinner listener.
+ fanboysAnnoyanceListSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
+ // Update the icon and the text view settings.
+ setIconAndTextViewSettings(position, fanboysAnnoyanceListDefault, fanboysAnnoyanceListLinearLayout, fanboysAnnoyanceListImageView, fanboysAnnoyanceListTextView)
+
+ // Calculate if Fanboy's Annoyance List is enabled, either because it is the system default and that default is enabled, or because it is explicitly set to be enabled for this domain.
+ val updatedFanboysAnnoyanceListEnabled = (((position == 0) && fanboysAnnoyanceListDefault) || (position == 1))
+
+ // Set Fanboy's Social Blocking List spinner and test view status based on the Annoyance List status.
+ fanboysSocialBlockingListSpinner.isEnabled = !updatedFanboysAnnoyanceListEnabled
+ fanboysSocialBlockingListTextView.isEnabled = !updatedFanboysAnnoyanceListEnabled
+
+ // Set the Social Blocking List icon ghosted status based on the Annoyance List status.
+ fanboysSocialBlockingListImageView.isEnabled = !updatedFanboysAnnoyanceListEnabled
+ }
+
+ override fun onNothingSelected(parent: AdapterView<*>?) {
+ // Do nothing.
+ }
+ }
+
+ // Set the Fanboy's Social Blocking List spinner listener.
+ fanboysSocialBlockingListSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
+ // Update the icon and the text view settings.
+ setIconAndTextViewSettings(position, fanboysSocialBlockingListDefault, fanboysSocialBlockingListLinearLayout, fanboysSocialBlockingListImageView, fanboysSocialBlockingListTextView)
+ }
+
+ override fun onNothingSelected(parent: AdapterView<*>?) {
+ // Do nothing.
+ }
+ }
+
+ // Set the UltraList spinner listener.
+ ultraListSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
+ // Update the icon and the text view settings.
+ setIconAndTextViewSettings(position, ultraListDefault, ultraListLinearLayout, ultraListImageView, ultraListTextView)
+ }
+
+ override fun onNothingSelected(parent: AdapterView<*>?) {
+ // Do nothing.
+ }
+ }
+
+ // Set the UltraPrivacy spinner listener.
+ ultraPrivacySpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
+ // Update the icon and the text view settings.
+ setIconAndTextViewSettings(position, ultraPrivacyDefault, ultraPrivacyLinearLayout, ultraPrivacyImageView, ultraPrivacyTextView)
+ }
+
+ override fun onNothingSelected(parent: AdapterView<*>?) {
+ // Do nothing.
+ }
+ }
+
+ // Set the block all third-party requests spinner listener.
+ blockAllThirdPartyRequestsSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
+ override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
+ // Update the icon and the text view settings.
+ setIconAndTextViewSettings(position, blockAllThirdPartyRequestsDefault, blockAllThirdPartyRequestsLinearLayout, blockAllThirdPartyRequestsImageView, blockAllThirdPartyRequestsTextView)
+ }
+
+ override fun onNothingSelected(parent: AdapterView<*>?) {
+ // Do nothing.
+ }
+ }
+