1616package de .symeda .sormas .app .epidata ;
1717
1818import static android .view .View .GONE ;
19+ import static android .view .View .VISIBLE ;
1920import static de .symeda .sormas .app .epidata .EpiDataFragmentHelper .getDiseaseOfCaseOrContact ;
2021import static de .symeda .sormas .app .epidata .EpiDataFragmentHelper .getEpiDataOfCaseOrContact ;
2122
2223import android .content .res .Resources ;
23- import android .view . View ;
24+ import android .text . Html ;
2425import android .view .ViewGroup ;
2526
2627import androidx .databinding .ObservableArrayList ;
2728
2829import de .symeda .sormas .api .epidata .EpiDataDto ;
2930import de .symeda .sormas .api .exposure .ExposureDto ;
31+ import de .symeda .sormas .api .i18n .I18nProperties ;
32+ import de .symeda .sormas .api .i18n .Strings ;
3033import de .symeda .sormas .api .utils .YesNoUnknown ;
3134import de .symeda .sormas .api .utils .fieldaccess .UiFieldAccessCheckers ;
3235import de .symeda .sormas .api .utils .fieldvisibility .FieldVisibilityCheckers ;
3538import de .symeda .sormas .app .backend .caze .Case ;
3639import de .symeda .sormas .app .backend .common .DatabaseHelper ;
3740import de .symeda .sormas .app .backend .common .PseudonymizableAdo ;
41+ import de .symeda .sormas .app .backend .contact .Contact ;
3842import de .symeda .sormas .app .backend .epidata .EpiData ;
3943import de .symeda .sormas .app .backend .exposure .Exposure ;
4044import de .symeda .sormas .app .caze .edit .CaseEditActivity ;
@@ -89,7 +93,7 @@ private void setUpControlListeners(final FragmentEditEpidLayoutBinding contentBi
8993
9094 contentBinding .epiDataExposureDetailsKnown .addValueChangedListener (field -> {
9195 YesNoUnknown value = (YesNoUnknown ) field .getValue ();
92- contentBinding .exposuresLayout .setVisibility (value == YesNoUnknown .YES ? View . VISIBLE : GONE );
96+ contentBinding .exposuresLayout .setVisibility (value == YesNoUnknown .YES ? VISIBLE : GONE );
9397 if (value != YesNoUnknown .YES ) {
9498 clearExposures ();
9599 }
@@ -117,6 +121,7 @@ private void removeExposure(Exposure exposure) {
117121 private void updateExposures () {
118122 getContentBinding ().setExposureList (getExposureList ());
119123 getContentBinding ().epiDataExposureDetailsKnown .setEnabled (getExposureList ().isEmpty ());
124+ updateAddExposuresButtonVisibility ();
120125 }
121126
122127 private void addExposure (Exposure exposure ) {
@@ -160,6 +165,7 @@ public void onAfterLayoutBinding(FragmentEditEpidLayoutBinding contentBinding) {
160165 if (!(getActivityRootData () instanceof Case )) {
161166 contentBinding .epiDataContactWithSourceCaseKnown .setVisibility (GONE );
162167 contentBinding .sourceContactsHeading .setVisibility (GONE );
168+ contentBinding .exposureInvestigationInfo .setText (Html .fromHtml (I18nProperties .getString (Strings .infoExposureInvestigationContacts )));
163169 }
164170 }
165171
@@ -178,4 +184,12 @@ public boolean isShowNewAction() {
178184 return false ;
179185 }
180186
187+ private void updateAddExposuresButtonVisibility () {
188+ if (getActivityRootData () instanceof Contact && !getExposureList ().isEmpty ()) {
189+ getContentBinding ().btnAddExposure .setVisibility (GONE );
190+ } else {
191+ getContentBinding ().btnAddExposure .setVisibility (VISIBLE );
192+ }
193+ }
194+
181195}
0 commit comments