- // Update the status of the save button whe the URL changes.
- urlEditText.addTextChangedListener(new TextWatcher() {
- @Override
- public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
- // Do nothing.
- }
+ // Remove the incorrect warnings that the views might be null.
+ assert urlTextInputLayout != null;
+ assert urlEditText != null;
+ assert fileNameEditText != null;
+ assert browseButton != null;
+ assert fileSizeTextView != null;
+ assert fileExistsWarningTextView != null;
+ assert storagePermissionTextView != null;
+
+ // Set the file size text view.
+ fileSizeTextView.setText(fileSizeString);
+
+ // Modify the layout based on the save type.
+ if (saveType == StoragePermissionDialog.SAVE_URL) { // A URL is being saved.
+ // Populate the URL edit text. This must be done before the text change listener is created below so that the file size isn't requested again.
+ urlEditText.setText(urlString);
+
+ // Update the file size and the status of the save button when the URL changes.
+ urlEditText.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+ // Do nothing.
+ }