Search in sources :

Example 1 with DialogExposureReadLayoutBinding

use of de.symeda.sormas.app.databinding.DialogExposureReadLayoutBinding in project SORMAS-Project by hzi-braunschweig.

the class EpidemiologicalDataReadFragment method setUpControlListeners.

private void setUpControlListeners() {
    onExposureItemClickListener = (v, item) -> {
        InfoDialog infoDialog = new InfoDialog(getContext(), R.layout.dialog_exposure_read_layout, item, boundView -> FieldVisibilityAndAccessHelper.setFieldVisibilitiesAndAccesses(ExposureDto.class, (ViewGroup) boundView, new FieldVisibilityCheckers(), getFieldAccessCheckers()));
        final DialogExposureReadLayoutBinding exposureBinding = (DialogExposureReadLayoutBinding) infoDialog.getBinding();
        if (((Exposure) item).getMeansOfTransport() == MeansOfTransport.PLANE) {
            exposureBinding.exposureConnectionNumber.setCaption(I18nProperties.getCaption(Captions.exposureFlightNumber));
        }
        final FacilityType facilityType = ((Exposure) item).getLocation().getFacilityType();
        exposureBinding.exposureWorkEnvironment.setVisibility(facilityType == null || FacilityTypeGroup.WORKING_PLACE != facilityType.getFacilityTypeGroup() ? View.GONE : View.VISIBLE);
        FieldVisibilityAndAccessHelper.setFieldVisibilitiesAndAccesses(ExposureDto.class, (ViewGroup) infoDialog.getBinding().getRoot(), FieldVisibilityCheckers.withDisease(getDiseaseOfCaseOrContact(getActivityRootData())), UiFieldAccessCheckers.forSensitiveData(((PseudonymizableAdo) getActivityRootData()).isPseudonymized()));
        infoDialog.show();
    };
    onActivityAsCaseItemClickListener = (v, item) -> {
        InfoDialog infoDialog = new InfoDialog(getContext(), R.layout.dialog_activity_as_case_read_layout, item, boundView -> FieldVisibilityAndAccessHelper.setFieldVisibilitiesAndAccesses(ActivityAsCaseDto.class, (ViewGroup) boundView, getFieldVisibilityCheckers(), getFieldAccessCheckers()));
        final DialogActivityAsCaseReadLayoutBinding activityAsCaseBinding = (DialogActivityAsCaseReadLayoutBinding) infoDialog.getBinding();
        if (((ActivityAsCase) item).getMeansOfTransport() == MeansOfTransport.PLANE) {
            activityAsCaseBinding.activityAsCaseConnectionNumber.setCaption(I18nProperties.getCaption(Captions.activityAsCaseFlightNumber));
        }
        if (CountryHelper.isCountry(ConfigProvider.getServerCountryCode(), CountryHelper.COUNTRY_CODE_GERMANY)) {
            activityAsCaseBinding.activityAsCaseTypeOfPlace.setCaption(I18nProperties.getCaption(Captions.ActivityAsCase_typeOfPlaceIfSG));
        }
        final FacilityType facilityType = ((ActivityAsCase) item).getLocation().getFacilityType();
        activityAsCaseBinding.activityAsCaseWorkEnvironment.setVisibility(facilityType == null || FacilityTypeGroup.WORKING_PLACE != facilityType.getFacilityTypeGroup() ? View.GONE : View.VISIBLE);
        FieldVisibilityAndAccessHelper.setFieldVisibilitiesAndAccesses(ActivityAsCaseDto.class, (ViewGroup) infoDialog.getBinding().getRoot(), FieldVisibilityCheckers.withDisease(getDiseaseOfCaseOrContact(getActivityRootData())).andWithCountry(ConfigProvider.getServerCountryCode()), UiFieldAccessCheckers.forSensitiveData(((PseudonymizableAdo) getActivityRootData()).isPseudonymized()));
        infoDialog.show();
    };
}
Also used : DialogExposureReadLayoutBinding(de.symeda.sormas.app.databinding.DialogExposureReadLayoutBinding) InfoDialog(de.symeda.sormas.app.component.dialog.InfoDialog) ExposureDto(de.symeda.sormas.api.exposure.ExposureDto) ViewGroup(android.view.ViewGroup) ActivityAsCaseDto(de.symeda.sormas.api.activityascase.ActivityAsCaseDto) FieldVisibilityCheckers(de.symeda.sormas.api.utils.fieldvisibility.FieldVisibilityCheckers) PseudonymizableAdo(de.symeda.sormas.app.backend.common.PseudonymizableAdo) FacilityType(de.symeda.sormas.api.infrastructure.facility.FacilityType) DialogActivityAsCaseReadLayoutBinding(de.symeda.sormas.app.databinding.DialogActivityAsCaseReadLayoutBinding)

Aggregations

ViewGroup (android.view.ViewGroup)1 ActivityAsCaseDto (de.symeda.sormas.api.activityascase.ActivityAsCaseDto)1 ExposureDto (de.symeda.sormas.api.exposure.ExposureDto)1 FacilityType (de.symeda.sormas.api.infrastructure.facility.FacilityType)1 FieldVisibilityCheckers (de.symeda.sormas.api.utils.fieldvisibility.FieldVisibilityCheckers)1 PseudonymizableAdo (de.symeda.sormas.app.backend.common.PseudonymizableAdo)1 InfoDialog (de.symeda.sormas.app.component.dialog.InfoDialog)1 DialogActivityAsCaseReadLayoutBinding (de.symeda.sormas.app.databinding.DialogActivityAsCaseReadLayoutBinding)1 DialogExposureReadLayoutBinding (de.symeda.sormas.app.databinding.DialogExposureReadLayoutBinding)1