Skip to content

Commit

Permalink
Revert Location translations
Browse files Browse the repository at this point in the history
- Revert the translation locations #870
  • Loading branch information
ndegwamartin committed May 26, 2022
1 parent 69a468b commit d68571d
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
import org.smartregister.R;
import org.smartregister.adapter.ServiceLocationsAdapter;
import org.smartregister.location.helper.LocationHelper;
import org.smartregister.util.Utils;
import org.smartregister.view.customcontrols.CustomFontTextView;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
* @author Jason Rogena - [email protected]
Expand Down Expand Up @@ -78,11 +76,7 @@ public void init() {
Collections.sort(sortedLocations);
sortedLocations.add(0, defaultLocation);

List<String> translatedLocations = sortedLocations.stream().map(e -> {
return Utils.getTranslatedLocation(e);
}).collect(Collectors.toList());

serviceLocationsAdapter = new ServiceLocationsAdapter(context, translatedLocations);
serviceLocationsAdapter = new ServiceLocationsAdapter(context, sortedLocations);
locationsLV.setAdapter(serviceLocationsAdapter);
locationsLV.setOnItemClickListener((parent, view, position, id) -> {
CoreLibrary.getInstance().context().allSharedPreferences().saveCurrentLocality(serviceLocationsAdapter.getLocationAt(position));
Expand All @@ -94,8 +88,7 @@ public void init() {
}
locationPickerDialog.dismiss();
});

this.setText(Utils.getTranslatedLocation(LocationHelper.getInstance().getOpenMrsReadableName(getSelectedItem())));
this.setText(LocationHelper.getInstance().getOpenMrsReadableName(getSelectedItem()));

setClickable(true);
setOnClickListener(this);
Expand All @@ -108,7 +101,7 @@ public String getSelectedItem() {
CoreLibrary.getInstance().context().allSharedPreferences().saveCurrentLocality(selectedLocation);
CoreLibrary.getInstance().context().allSharedPreferences().saveCurrentDataStrategy(AllConstants.DATA_CAPTURE_STRATEGY.NORMAL);
}
return Utils.getTranslatedLocation(selectedLocation);
return selectedLocation;
}

public void setOnLocationChangeListener(final OnLocationChangeListener onLocationChangeListener) {
Expand Down

0 comments on commit d68571d

Please sign in to comment.