- val requestDispositionTextView = alertDialog.findViewById<TextView>(R.id.request_disposition_textview)!!
- val webpageUrlTextView = alertDialog.findViewById<TextView>(R.id.webpage_url_textview)!!
- val requestUrlTextView = alertDialog.findViewById<TextView>(R.id.request_url_textview)!!
- val requestUrlWithSeparatorsTextView = alertDialog.findViewById<TextView>(R.id.request_url_with_separators_textview)!!
- val truncatedRequestUrlTextView = alertDialog.findViewById<TextView>(R.id.truncated_request_url_textview)!!
- val truncatedRequestUrlWithSeparatorsTextView = alertDialog.findViewById<TextView>(R.id.truncated_request_url_with_separators_textview)!!
- val thirdPartyRequestTextView = alertDialog.findViewById<TextView>(R.id.third_party_request_textview)!!
- val filterListEntryTextView = alertDialog.findViewById<TextView>(R.id.filterlist_entry_textview)!!
- val filterListLabelTextView = alertDialog.findViewById<TextView>(R.id.filterlist_label_textview)!!
- val filterListTextView = alertDialog.findViewById<TextView>(R.id.filterlist_textview)!!
- val sublistLabelTextView = alertDialog.findViewById<TextView>(R.id.sublist_label_textview)!!
- val sublistTextView = alertDialog.findViewById<TextView>(R.id.sublist_textview)!!
- val appliedEntryListLabelTextView = alertDialog.findViewById<TextView>(R.id.applied_entry_list_label_textview)!!
- val appliedEntryListTextView = alertDialog.findViewById<TextView>(R.id.applied_entry_list_textview)!!
- val domainLabelTextView = alertDialog.findViewById<TextView>(R.id.domain_label_textview)!!
- val domainTextView = alertDialog.findViewById<TextView>(R.id.domain_textview)!!
- val domainListLabelTextView = alertDialog.findViewById<TextView>(R.id.domain_list_label_textview)!!
- val domainListTextView = alertDialog.findViewById<TextView>(R.id.domain_list_textview)!!
- val thirdPartyFilterListEntryLabelTextView = alertDialog.findViewById<TextView>(R.id.third_party_filter_list_entry_label_textview)!!
- val thirdPartyFilterListEntryTextView = alertDialog.findViewById<TextView>(R.id.third_party_filter_list_entry_textview)!!
- val initialMatchLabelTextView = alertDialog.findViewById<TextView>(R.id.initial_match_label_textview)!!
- val initialMatchTextView = alertDialog.findViewById<TextView>(R.id.initial_match_textview)!!
- val finalMatchLabelTextView = alertDialog.findViewById<TextView>(R.id.final_match_label_textview)!!
- val finalMatchTextView = alertDialog.findViewById<TextView>(R.id.final_match_textview)!!
- val appliedFilterOptionsLabelTextView = alertDialog.findViewById<TextView>(R.id.applied_filter_options_label_textview)!!
- val appliedFilterOptionsTextView = alertDialog.findViewById<TextView>(R.id.applied_filter_options_textview)!!
- val originalFilterOptionsLabelTextView = alertDialog.findViewById<TextView>(R.id.original_filter_options_label_textview)!!
- val originalFilterOptionsTextView = alertDialog.findViewById<TextView>(R.id.original_filter_options_textview)!!
- val originalEntryLabelTextView = alertDialog.findViewById<TextView>(R.id.original_entry_label_textview)!!
- val originalEntryTextView = alertDialog.findViewById<TextView>(R.id.original_entry_textview)!!
- val previousButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE)
- val nextButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE)
+ requestDispositionTextView = alertDialog.findViewById(R.id.request_disposition_textview)!!
+ webpageUrlTextView = alertDialog.findViewById(R.id.webpage_url_textview)!!
+ requestUrlTextView = alertDialog.findViewById(R.id.request_url_textview)!!
+ requestUrlWithSeparatorsTextView = alertDialog.findViewById(R.id.request_url_with_separators_textview)!!
+ truncatedRequestUrlTextView = alertDialog.findViewById(R.id.truncated_request_url_textview)!!
+ truncatedRequestUrlWithSeparatorsTextView = alertDialog.findViewById(R.id.truncated_request_url_with_separators_textview)!!
+ thirdPartyRequestTextView = alertDialog.findViewById(R.id.third_party_request_textview)!!
+ filterListEntryTextView = alertDialog.findViewById(R.id.filterlist_entry_textview)!!
+ filterListLabelTextView = alertDialog.findViewById(R.id.filterlist_label_textview)!!
+ filterListTextView = alertDialog.findViewById(R.id.filterlist_textview)!!
+ sublistLabelTextView = alertDialog.findViewById(R.id.sublist_label_textview)!!
+ sublistTextView = alertDialog.findViewById(R.id.sublist_textview)!!
+ appliedEntryListLabelTextView = alertDialog.findViewById(R.id.applied_entry_list_label_textview)!!
+ appliedEntryListTextView = alertDialog.findViewById(R.id.applied_entry_list_textview)!!
+ domainLabelTextView = alertDialog.findViewById(R.id.domain_label_textview)!!
+ domainTextView = alertDialog.findViewById(R.id.domain_textview)!!
+ domainListLabelTextView = alertDialog.findViewById(R.id.domain_list_label_textview)!!
+ domainListTextView = alertDialog.findViewById(R.id.domain_list_textview)!!
+ thirdPartyFilterListEntryLabelTextView = alertDialog.findViewById(R.id.third_party_filter_list_entry_label_textview)!!
+ thirdPartyFilterListEntryTextView = alertDialog.findViewById(R.id.third_party_filter_list_entry_textview)!!
+ initialMatchLabelTextView = alertDialog.findViewById(R.id.initial_match_label_textview)!!
+ initialMatchTextView = alertDialog.findViewById(R.id.initial_match_textview)!!
+ finalMatchLabelTextView = alertDialog.findViewById(R.id.final_match_label_textview)!!
+ finalMatchTextView = alertDialog.findViewById(R.id.final_match_textview)!!
+ appliedFilterOptionsLabelTextView = alertDialog.findViewById(R.id.applied_filter_options_label_textview)!!
+ appliedFilterOptionsTextView = alertDialog.findViewById(R.id.applied_filter_options_textview)!!
+ originalFilterOptionsLabelTextView = alertDialog.findViewById(R.id.original_filter_options_label_textview)!!
+ originalFilterOptionsTextView = alertDialog.findViewById(R.id.original_filter_options_textview)!!
+ originalEntryLabelTextView = alertDialog.findViewById(R.id.original_entry_label_textview)!!
+ originalEntryTextView = alertDialog.findViewById(R.id.original_entry_textview)!!
+ previousButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE)
+ nextButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE)
+
+ // Set the previous button on click listener. This must be done here instead of in the builder to prevent the dialog from closing when the button is pressed.
+ previousButton.setOnClickListener {
+ // Decrement the current ID.
+ --currentId
+
+ // Repopulate the dialog.
+ populateDialog()
+ }
+
+ // Set the next button on click listener. This must be done here instead of in the builder to prevent the dialog from closing when the button is pressed.
+ nextButton.setOnClickListener {
+ // Increment the current ID.
+ ++currentId
+
+ // Repopulate the dialog.
+ populateDialog()
+ }
+
+ // Get a handle for the context.
+ val context = requireContext()
+
+ // Get handles for the colors.
+ blueColor = getColor(context, R.color.requests_blue_background)
+ redColor = getColor(context, R.color.red_background)
+ transparentColor = getColor(context, R.color.transparent)
+ yellowColor = getColor(context, R.color.yellow_background)
+
+ // Populate the dialog.
+ populateDialog()
+
+ // Return the alert dialog.
+ return alertDialog
+ }
+
+ private fun convertListToString(stringList: List<String>, separatorString: String): String {
+ // Create a string builder.
+ val stringBuilder = StringBuilder()
+
+ // Add each of the strings from the list.
+ for (string in stringList) {
+ // Append four space if the string builder is already populated.
+ if (stringBuilder.isNotEmpty())
+ stringBuilder.append(separatorString)
+
+ // Append the string.
+ stringBuilder.append(string)
+ }
+
+ // Return the string.
+ return stringBuilder.toString()
+ }
+
+ private fun populateDialog() {
+ // Get the request data class. The array list is 0 based.
+ val requestDataClass = requestDataClassArrayList[currentId - 1]
+
+ // Update the dialog title.
+ alertDialog.setTitle(resources.getString(R.string.request_details) + " - " + currentId)