use of org.odk.collect.android.databinding.ServerAuthDialogBinding in project collect by opendatakit.
the class ServerAuthDialogFragment method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
ServerAuthDialogBinding binding = ServerAuthDialogBinding.inflate(requireActivity().getLayoutInflater());
dialogView = binding.getRoot();
Settings generalSettings = settingsProvider.getUnprotectedSettings();
binding.usernameEdit.setText(generalSettings.getString(ProjectKeys.KEY_USERNAME));
binding.passwordEdit.setText(generalSettings.getString(ProjectKeys.KEY_PASSWORD));
return new MaterialAlertDialogBuilder(requireContext()).setTitle(R.string.server_requires_auth).setMessage(requireContext().getString(R.string.server_auth_credentials, generalSettings.getString(ProjectKeys.KEY_SERVER_URL))).setView(dialogView).setPositiveButton(R.string.ok, (dialogInterface, i) -> {
generalSettings.save(ProjectKeys.KEY_USERNAME, binding.usernameEdit.getText().toString());
generalSettings.save(ProjectKeys.KEY_PASSWORD, binding.passwordEdit.getText().toString());
}).create();
}
Aggregations