]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blobdiff - app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.kt
Release 3.18.
[PrivacyBrowserAndroid.git] / app / src / main / java / com / stoutner / privacybrowser / activities / RequestsActivity.kt
index 8311f00372f54a3dff6e2924b8c68638835c5279..5a0d0ef596a3aef33ff895be360106437b0a5c6c 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * Copyright 2018-2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2018-2024 Soren Stoutner <soren@stoutner.com>.
  *
- * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
+ * This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
  *
  * Privacy Browser Android is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -42,7 +42,11 @@ import com.stoutner.privacybrowser.R
 import com.stoutner.privacybrowser.adapters.RequestsArrayAdapter
 import com.stoutner.privacybrowser.dialogs.ViewRequestDialog.Companion.request
 import com.stoutner.privacybrowser.dialogs.ViewRequestDialog.ViewRequestListener
-import com.stoutner.privacybrowser.helpers.BlocklistHelper
+import com.stoutner.privacybrowser.helpers.REQUEST_ALLOWED
+import com.stoutner.privacybrowser.helpers.REQUEST_BLOCKED
+import com.stoutner.privacybrowser.helpers.REQUEST_DEFAULT
+import com.stoutner.privacybrowser.helpers.REQUEST_DISPOSITION
+import com.stoutner.privacybrowser.helpers.REQUEST_THIRD_PARTY
 
 // Define the public constants.
 const val BLOCK_ALL_THIRD_PARTY_REQUESTS = "block_all_third_party_requests"
@@ -78,7 +82,7 @@ class RequestsActivity : AppCompatActivity(), ViewRequestListener {
         // Get the launching intent
         val intent = intent
 
-        // Get the status of the third-party blocklist.
+        // Get the status of the third-party filter list.
         val blockAllThirdPartyRequests = intent.getBooleanExtra(BLOCK_ALL_THIRD_PARTY_REQUESTS, false)
 
         // Set the content view.
@@ -119,23 +123,23 @@ class RequestsActivity : AppCompatActivity(), ViewRequestListener {
             // Add the request to the list of all requests.
             allResourceRequests.add(request)
 
-            when (request[BlocklistHelper.REQUEST_DISPOSITION]) {
-                BlocklistHelper.REQUEST_DEFAULT -> {
+            when (request[REQUEST_DISPOSITION]) {
+                REQUEST_DEFAULT -> {
                     // Add the request to the list of default requests.
                     defaultResourceRequests.add(request)
                 }
 
-                BlocklistHelper.REQUEST_ALLOWED -> {
+                REQUEST_ALLOWED -> {
                     // Add the request to the list of allowed requests.
                     allowedResourceRequests.add(request)
                 }
 
-                BlocklistHelper.REQUEST_THIRD_PARTY -> {
+                REQUEST_THIRD_PARTY -> {
                     // Add the request to the list of third-party requests.
                     thirdPartyResourceRequests.add(request)
                 }
 
-                BlocklistHelper.REQUEST_BLOCKED -> {
+               REQUEST_BLOCKED -> {
                     // Add the request to the list of blocked requests.
                     blockedResourceRequests.add(request)
                 }
@@ -173,7 +177,7 @@ class RequestsActivity : AppCompatActivity(), ViewRequestListener {
 
         // Handle clicks on the spinner dropdown.
         appBarSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
-            override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) {
+            override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
                 when (id.toInt()) {
                     0 -> {
                         // Get an adapter for all the requests.
@@ -241,15 +245,15 @@ class RequestsActivity : AppCompatActivity(), ViewRequestListener {
         }
     }
 
-    public override fun onSaveInstanceState(savedInstanceState: Bundle) {
+    public override fun onSaveInstanceState(outState: Bundle) {
         // Run the default commands.
-        super.onSaveInstanceState(savedInstanceState)
+        super.onSaveInstanceState(outState)
 
         // Get the listview position.
         val listViewPosition = requestsListView.firstVisiblePosition
 
         // Store the listview position in the bundle.
-        savedInstanceState.putInt(LISTVIEW_POSITION, listViewPosition)
+        outState.putInt(LISTVIEW_POSITION, listViewPosition)
     }
 
     override fun onPrevious(currentId: Int) {