- apiVer -> apiVersionText.setText(apiVer.getDescription(getResources())));
- 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) -> {
+ apiVer -> binding.apiVersionText.setText(apiVer.getDescription(getResources())));
+ binding.apiVersionLabel.setOnClickListener(this::chooseAPIVersion);
+ binding.apiVersionText.setOnClickListener(this::chooseAPIVersion);
+
+ binding.serverVersionLabel.setOnClickListener(v -> model.triggerVersionDetection());
+ model.observeDetectedVersion(viewLifecycleOwner, ver -> {
+ if (ver == null)
+ binding.detectedServerVersionText.setText(context.getResources()
+ .getString(
+ R.string.server_version_unknown_label));
+ else if (ver.isPre_1_20_1())
+ binding.detectedServerVersionText.setText(context.getResources()
+ .getString(
+ R.string.detected_server_pre_1_20_1));
+ else
+ binding.detectedServerVersionText.setText(ver.toString());
+ });
+ 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();