Skip to content

Commit

Permalink
Merge branch 'release/1.7.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Florianisme committed Mar 13, 2023
2 parents 7c15fe9 + c10ec4e commit 033f84e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply from: "$rootProject.projectDir/shared-build.gradle"

android {
defaultConfig {
versionCode 63
versionCode 69
wearAppUnbundled true
}
buildFeatures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ public class NetworkScanAdapter extends RecyclerView.Adapter<RecyclerView.ViewHo
private List<NetworkScanDevice> deviceList = new ArrayList<>(0);

public void clearDataset() {
updateList(new ArrayList<>());
deviceList = new ArrayList<>();
updateDeviceList();
}

public void updateList(List<NetworkScanDevice> updatedList) {
List<NetworkScanDevice> sortedList = updatedList.stream()
public synchronized void addDevice(NetworkScanDevice networkScanDevice) {
deviceList.add(networkScanDevice);
updateDeviceList();
}

private void updateDeviceList() {
List<NetworkScanDevice> sortedList = deviceList.stream()
.distinct()
.sorted(getScanDeviceComparator())
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

import de.florianisme.wakeonlan.databinding.FragmentNetworkScanBinding;
import de.florianisme.wakeonlan.ui.list.layoutmanager.LinearLayoutManagerWrapper;
import de.florianisme.wakeonlan.ui.scan.callbacks.ScanCallback;
Expand Down Expand Up @@ -54,7 +51,6 @@ private void setupSwipeToRefresh() {
}

private ScanCallback getScanCallback() {
final List<NetworkScanDevice> resultList = new ArrayList<>(20);

return new ScanCallback() {
@Override
Expand All @@ -71,10 +67,7 @@ public void onDeviceFound(String ip, String hostName) {
networkScanDevice.setName(hostName);
}

synchronized (resultList) {
resultList.add(networkScanDevice);
runOnUiThread(() -> networkScanAdapter.updateList(resultList));
}
runOnUiThread(() -> networkScanAdapter.addDevice(networkScanDevice));
}

private void runOnUiThread(Runnable runnable) {
Expand Down
2 changes: 1 addition & 1 deletion shared-build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
applicationId "de.florianisme.wakeonlan"
minSdk 24
targetSdk 33
versionName "1.7.0"
versionName "1.7.3"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
2 changes: 1 addition & 1 deletion wear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply from: "$rootProject.projectDir/shared-build.gradle"

android {
defaultConfig {
versionCode 62
versionCode 68
}
}

Expand Down

0 comments on commit 033f84e

Please sign in to comment.