- context.findViewById(R.id.api_version_layout)
- .setOnClickListener(v -> {
- MenuInflater mi = new MenuInflater(context);
- PopupMenu menu = new PopupMenu(context, v);
- menu.inflate(R.menu.api_version);
- menu.setOnMenuItemClickListener(item -> {
- SendTransactionTask.API apiVer;
- switch (item.getItemId()) {
- case R.id.api_version_menu_html:
- apiVer = SendTransactionTask.API.html;
- break;
- case R.id.api_version_menu_post_1_14:
- apiVer = SendTransactionTask.API.post_1_14;
- break;
- case R.id.api_version_menu_pre_1_15:
- apiVer = SendTransactionTask.API.pre_1_15;
- break;
- case R.id.api_version_menu_auto:
- default:
- apiVer = SendTransactionTask.API.auto;
- }
- model.setApiVersion(apiVer);
- apiVersionText.setText(apiVer.getDescription(getResources()));
- return true;
- });
- menu.show();
- });
- authParams = context.findViewById(R.id.auth_params);
-
- useAuthentication = context.findViewById(R.id.enable_http_auth);
- useAuthentication.setOnCheckedChangeListener((buttonView, isChecked) -> {
+ binding.detectedServerVersionText.setOnClickListener(v -> model.triggerVersionDetection());
+ binding.serverVersionDetectButton.setOnClickListener(v -> model.triggerVersionDetection());
+ model.observeDetectingHledgerVersion(viewLifecycleOwner,
+ running -> binding.serverVersionDetectButton.setVisibility(
+ running ? View.VISIBLE : View.INVISIBLE));
+
+ binding.enableHttpAuth.setOnCheckedChangeListener((buttonView, isChecked) -> {
+ boolean wasOn = model.getUseAuthentication();