fix unit selection

This commit is contained in:
CiufudeanDani 2022-04-08 14:48:07 +03:00
parent cc78f29f26
commit 97b7e2d9a7

View File

@ -687,7 +687,7 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
// change check image for selected value
VehiclesGridViewAdapter.ViewHolder viewLive = (VehiclesGridViewAdapter.ViewHolder) view.getTag();
if (Boolean.TRUE.equals(displayedVehicles.get(position)))
if (displayedVehicles.get(position))
viewLive.imgViewChecked.setImageResource(R.drawable.checked);
else
viewLive.imgViewChecked.setImageResource(R.drawable.unchecked);
@ -695,16 +695,16 @@ public class LiveActivity extends AbstractLiveActivity implements OnMapReadyCall
// check if all values are identical
boolean identical = true;
for (Boolean displ : displayedVehicles)
if (!Objects.equals(displ, displayedVehicles.get(0))) {
if (displ != displayedVehicles.get(0)) {
identical = false;
break;
}
// change image when all values are identical
if (identical && Boolean.TRUE.equals(displayedVehicles.get(0))) {
if (identical && displayedVehicles.get(0)) {
imageViewCheckAll.setSelected(true);
imageViewCheckAll.setBackgroundResource(R.drawable.check_all);
} else if (identical && Boolean.TRUE.equals(!displayedVehicles.get(0))) {
} else {
imageViewCheckAll.setSelected(false);
imageViewCheckAll.setBackgroundResource(R.drawable.uncheck_all);
}