X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FWaitingForProxyDialog.java;fp=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FWaitingForProxyDialog.java;h=0000000000000000000000000000000000000000;hb=031def95c6d9bfc14113fe86b4a5690233d93ce2;hp=d87385db5666f7fb7ea44a1a8298f08d29d20190;hpb=f3b9172adedd74f705ddc0beac80798ae84f2920;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/WaitingForProxyDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/WaitingForProxyDialog.java deleted file mode 100644 index d87385db..00000000 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/WaitingForProxyDialog.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright © 2019-2020 Soren Stoutner . - * - * This file is part of Privacy Browser . - * - * Privacy Browser is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Privacy Browser is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Privacy Browser. If not, see . - */ - -package com.stoutner.privacybrowser.dialogs; - -import android.annotation.SuppressLint; -import android.app.Dialog; -import android.content.Context; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.WindowManager; - -import androidx.annotation.NonNull; -import androidx.appcompat.app.AlertDialog; -import androidx.fragment.app.DialogFragment; -import androidx.preference.PreferenceManager; - -import com.stoutner.privacybrowser.R; - -public class WaitingForProxyDialog extends DialogFragment { - // `@SuppressLint("InflateParams")` removes the warning about using `null` as the parent view group when inflating the alert dialog. - @SuppressLint("InflateParams") - @Override - @NonNull - public Dialog onCreateDialog(Bundle savedInstanceState) { - // Get a handle for the context. - Context context = requireContext(); - - // Get the activity's layout inflater. - LayoutInflater layoutInflater = requireActivity().getLayoutInflater(); - - // Use a builder to create the alert dialog. - AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, R.style.PrivacyBrowserAlertDialog); - - // Set the layout. The parent view is `null` because it will be assigned by the alert dialog. - dialogBuilder.setView(layoutInflater.inflate(R.layout.waiting_for_proxy_dialog, null)); - - // Create an alert dialog from the alert dialog builder. - AlertDialog alertDialog = dialogBuilder.create(); - - // Get a handle for the shared preferences. - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); - - // Get the screenshot preference. - boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false); - - // Disable screenshots if not allowed. - if (!allowScreenshots) { - // Remove the warning below that `getWindow()` might be null. - assert alertDialog.getWindow() != null; - - // Disable screenshots. - alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); - } - - // The alert dialog must be shown before items in the layout can be modified. - alertDialog.show(); - - // Return the alert dialog. - return alertDialog; - } -} \ No newline at end of file