X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Fdialogs%2FHttpAuthenticationDialog.java;h=4b68108987b22d62484d5ac0627c882c4832869a;hb=8f7e9b7db429568e26f00bc2eef88402d722bec7;hp=7ee7dd0136261da6e4b6be383cfc6be59220caeb;hpb=fa3b8b382eb5ed86c598e3b126d1ef5dd117c5be;p=PrivacyBrowserAndroid.git diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java index 7ee7dd01..4b681089 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/HttpAuthenticationDialog.java @@ -32,6 +32,7 @@ import android.text.style.ForegroundColorSpan; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; +import android.view.Window; import android.view.WindowManager; import android.webkit.HttpAuthHandler; import android.widget.EditText; @@ -161,16 +162,19 @@ public class HttpAuthenticationDialog extends DialogFragment{ // Create an alert dialog from the alert dialog builder. final AlertDialog alertDialog = dialogBuilder.create(); - // Remove the warning below that `getWindow()` might be null. - assert alertDialog.getWindow() != null; + // Get the alert dialog window. + Window dialogWindow = alertDialog.getWindow(); + + // Remove the incorrect lint warning below that the dialog window might be null. + assert dialogWindow != null; // Disable screenshots if not allowed. if (!allowScreenshots) { alertDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } - // Show the keyboard when the alert dialog is displayed on the screen. - alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); + // Display the keyboard. + dialogWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); // The alert dialog needs to be shown before the contents can be modified. alertDialog.show();