Search in sources :

Example 1 with InfoDialog

use of de.symeda.sormas.app.component.dialog.InfoDialog in project SORMAS-Project by hzi-braunschweig.

the class CaseEditFragment method setUpButtonListeners.

private void setUpButtonListeners(FragmentCaseEditLayoutBinding contentBinding) {
    contentBinding.referCaseFromPoe.setOnClickListener(e -> {
        final CaseEditActivity activity = (CaseEditActivity) CaseEditFragment.this.getActivity();
        activity.saveData(caze -> {
            final Case caseClone = (Case) caze.clone();
            final ReferCaseFromPoeDialog referCaseFromPoeDialog = new ReferCaseFromPoeDialog(BaseActivity.getActiveActivity(), caze);
            referCaseFromPoeDialog.setPositiveCallback(() -> {
                record = caseClone;
                requestLayoutRebind();
            });
            referCaseFromPoeDialog.show();
        });
    });
    contentBinding.showClassificationRules.setOnClickListener(v -> {
        final InfoDialog classificationDialog = new InfoDialog(CaseEditFragment.this.getContext(), R.layout.dialog_classification_rules_layout, null);
        WebView classificationView = ((DialogClassificationRulesLayoutBinding) classificationDialog.getBinding()).content;
        classificationView.loadData(DiseaseClassificationAppHelper.buildDiseaseClassificationHtml(record.getDisease()), "text/html", "utf-8");
        classificationDialog.show();
    });
}
Also used : DialogClassificationRulesLayoutBinding(de.symeda.sormas.app.databinding.DialogClassificationRulesLayoutBinding) InfoDialog(de.symeda.sormas.app.component.dialog.InfoDialog) WebView(android.webkit.WebView) Case(de.symeda.sormas.app.backend.caze.Case)

Example 2 with InfoDialog

use of de.symeda.sormas.app.component.dialog.InfoDialog 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)

Example 3 with InfoDialog

use of de.symeda.sormas.app.component.dialog.InfoDialog in project SORMAS-Project by hzi-braunschweig.

the class PersonReadFragment method setUpControlListeners.

private void setUpControlListeners() {
    onAddressItemClickListener = (v, item) -> {
        InfoDialog infoDialog = new InfoDialog(getContext(), R.layout.dialog_location_read_layout, item, bindedView -> setFieldAccesses(LocationDto.class, bindedView));
        infoDialog.show();
    };
    onPersonContactDetailItemClickListener = (v, item) -> {
        InfoDialog infoDialog = new InfoDialog(getContext(), R.layout.dialog_person_contact_detail_read_layout, item, bindedView -> setFieldAccesses(PersonContactDetailDto.class, bindedView));
        infoDialog.show();
    };
}
Also used : PersonContactDetailDto(de.symeda.sormas.api.person.PersonContactDetailDto) InfoDialog(de.symeda.sormas.app.component.dialog.InfoDialog) LocationDto(de.symeda.sormas.api.location.LocationDto)

Example 4 with InfoDialog

use of de.symeda.sormas.app.component.dialog.InfoDialog in project SORMAS-Project by hzi-braunschweig.

the class BaseActivity method onOptionsItemSelected.

public boolean onOptionsItemSelected(MenuItem item) {
    if (!isSubActivity() && menuDrawerToggle.onOptionsItemSelected(item)) {
        return true;
    }
    switch(item.getItemId()) {
        case android.R.id.home:
            if (finishInsteadOfUpNav) {
                finish();
            } else {
                NavigationHelper.navigateUpFrom(this);
            }
            return true;
        case R.id.action_sync:
            synchronizeChangedData();
            return true;
        case R.id.action_new:
            goToNewView();
            return true;
        case R.id.action_readAll:
            // TODO
            return true;
        case R.id.action_help:
            StringBuilder helpStringBuilder = new StringBuilder();
            extendHelpString(helpStringBuilder, (ViewGroup) this.findViewById(R.id.main_content));
            InfoDialog infoDialog = new InfoDialog(getContext(), R.layout.dialog_screen_help_layout, Html.fromHtml(helpStringBuilder.toString()));
            infoDialog.show();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : InfoDialog(de.symeda.sormas.app.component.dialog.InfoDialog)

Aggregations

InfoDialog (de.symeda.sormas.app.component.dialog.InfoDialog)4 ViewGroup (android.view.ViewGroup)1 WebView (android.webkit.WebView)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 LocationDto (de.symeda.sormas.api.location.LocationDto)1 PersonContactDetailDto (de.symeda.sormas.api.person.PersonContactDetailDto)1 FieldVisibilityCheckers (de.symeda.sormas.api.utils.fieldvisibility.FieldVisibilityCheckers)1 Case (de.symeda.sormas.app.backend.caze.Case)1 PseudonymizableAdo (de.symeda.sormas.app.backend.common.PseudonymizableAdo)1 DialogActivityAsCaseReadLayoutBinding (de.symeda.sormas.app.databinding.DialogActivityAsCaseReadLayoutBinding)1 DialogClassificationRulesLayoutBinding (de.symeda.sormas.app.databinding.DialogClassificationRulesLayoutBinding)1 DialogExposureReadLayoutBinding (de.symeda.sormas.app.databinding.DialogExposureReadLayoutBinding)1