X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FViewRequestDialog.java;h=6d6401f3af24428ea0f6e457d33c39ac817ff3fb;hb=84989e138cb593d5a2f70be848db4889aaa8da88;hp=45bdbab689fa4a91a8f40ef0849ecd497597dd13;hpb=012e5595c82d6e8d0b8a46f1ef18a02a56341182;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java index 45bdbab6..6d6401f3 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.java @@ -1,5 +1,5 @@ /* - * Copyright © 2018 Soren Stoutner . + * Copyright © 2018-2019 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -25,17 +25,18 @@ import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v7.app.AppCompatDialogFragment; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.fragment.app.DialogFragment; + import com.stoutner.privacybrowser.R; import com.stoutner.privacybrowser.activities.MainWebViewActivity; -public class ViewRequestDialog extends AppCompatDialogFragment { +public class ViewRequestDialog extends DialogFragment { // The public interface is used to send information back to the parent activity. public interface ViewRequestListener { void onPrevious(int id); @@ -142,7 +143,7 @@ public class ViewRequestDialog extends AppCompatDialogFragment { alertDialog.show(); // Get handles for the dialog views. - TextView requestAction = alertDialog.findViewById(R.id.request_action); + TextView requestDisposition = alertDialog.findViewById(R.id.request_disposition); TextView requestUrl = alertDialog.findViewById(R.id.request_url); TextView requestBlockListLabel = alertDialog.findViewById(R.id.request_blocklist_label); TextView requestBlockList = alertDialog.findViewById(R.id.request_blocklist); @@ -165,33 +166,45 @@ public class ViewRequestDialog extends AppCompatDialogFragment { switch (Integer.valueOf(requestDetails[MainWebViewActivity.REQUEST_DISPOSITION])) { case MainWebViewActivity.REQUEST_DEFAULT: // Set the text. - requestAction.setText(R.string.default_allowed); + requestDisposition.setText(R.string.default_allowed); // Set the background color. - requestAction.setBackgroundColor(getResources().getColor(R.color.transparent)); + requestDisposition.setBackgroundColor(getResources().getColor(R.color.transparent)); break; case MainWebViewActivity.REQUEST_ALLOWED: // Set the text. - requestAction.setText(R.string.allowed); + requestDisposition.setText(R.string.allowed); + + // Set the background color. + if (MainWebViewActivity.darkTheme) { + requestDisposition.setBackgroundColor(getResources().getColor(R.color.blue_700_50)); + } else { + requestDisposition.setBackgroundColor(getResources().getColor(R.color.blue_100)); + } + break; + + case MainWebViewActivity.REQUEST_THIRD_PARTY: + // Set the text. + requestDisposition.setText(R.string.third_party_blocked); // Set the background color. if (MainWebViewActivity.darkTheme) { - requestAction.setBackgroundColor(getResources().getColor(R.color.blue_700_50)); + requestDisposition.setBackgroundColor(getResources().getColor(R.color.yellow_700_50)); } else { - requestAction.setBackgroundColor(getResources().getColor(R.color.blue_100)); + requestDisposition.setBackgroundColor(getResources().getColor(R.color.yellow_100)); } break; case MainWebViewActivity.REQUEST_BLOCKED: // Set the text. - requestAction.setText(R.string.blocked); + requestDisposition.setText(R.string.blocked); // Set the background color. if (MainWebViewActivity.darkTheme) { - requestAction.setBackgroundColor(getResources().getColor(R.color.red_700_50)); + requestDisposition.setBackgroundColor(getResources().getColor(R.color.red_700_40)); } else { - requestAction.setBackgroundColor(getResources().getColor(R.color.red_100)); + requestDisposition.setBackgroundColor(getResources().getColor(R.color.red_100)); } break; } @@ -239,7 +252,7 @@ public class ViewRequestDialog extends AppCompatDialogFragment { break; case MainWebViewActivity.THIRD_PARTY_WHITELIST: - requestSubList.setText(R.string.third_party_whiteist); + requestSubList.setText(R.string.third_party_whitelist); break; case MainWebViewActivity.THIRD_PARTY_DOMAIN_WHITELIST: