filter recordings

This commit is contained in:
CiufudeanDani 2022-04-19 15:20:36 +03:00
parent ad5b4327d1
commit e1bcc44fbe

View File

@ -26,6 +26,7 @@ import com.safemobile.lib.AppParams;
import com.safemobile.lib.OperationCodes;
import com.safemobile.lib.Recording;
import com.safemobile.lib.SM;
import com.safemobile.lib.Vehicle;
import com.safemobile.lib.radio.RadioGW;
import com.safemobile.lib.sound.RecordingHandle;
@ -295,9 +296,27 @@ public class RecordingsActivity extends Activity {
private void updateResultsInUi() {
// clear played items
playingPositions = new ArrayList<>();
ArrayList<Recording> recordings = getAllRecordings();
ArrayList<Recording> filteredList = new ArrayList<>();
ArrayList<Vehicle> vehicles = getParentTab().getAllVehicle();
for (Recording recording : recordings) {
if (recording.callType == 0 || recording.callType == 4) {
for (Vehicle vehicle : vehicles)
if (vehicle.imei.equals(String.valueOf(recording.subID))) {
filteredList.add(recording);
break;
}
} else {
filteredList.add(recording);
}
}
setAllRecordings(filteredList);
for (int i = 0; i < getAllRecordings().size(); i++)
playingPositions.add(true);
// set adapter - where playingPositions stores exists values
adapter = new RecordingsGridViewAdapter(activity, getAllRecordings(), playingPositions);
// playing positions need to be false because no recording is played