Skip to content

Commit

Permalink
Updated ChartView (#13)
Browse files Browse the repository at this point in the history
The current implementation of empty collection check in the code depends
on size()==0 which introduces unnecessary complexity to the code. So, I
updated it with isEmpty() method which checks whether the collection is
empty or not. After this, the code should exhibit improved clarity and,
in some cases, a potential performance boost due to the constant time
complexity of the isEmpty() method. Adopting isEmpty() over size() == 0
aligns with best practices and can make future code maintenance and
modifications more straightforward.
  • Loading branch information
krispatel1001 authored Feb 14, 2024
2 parents 72359b5 + 24bf067 commit 370398f
Show file tree
Hide file tree
Showing 2 changed files with 187 additions and 180 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void clearTrackPoints() {
});
}
}

@Override
public void onSampledInTrackPoint(@NonNull TrackPoint trackPoint, @NonNull TrackStatistics trackStatistics) {
if (isResumed()) {
ChartPoint point = ChartPoint.create(trackStatistics, trackPoint, trackPoint.getSpeed(), chartByDistance, viewBinding.chartView.getUnitSystem());
Expand Down Expand Up @@ -253,6 +253,7 @@ private synchronized void pauseTrackDataHub() {
}

/**
* @deprecated
* Returns true if the selected track is recording.
* Needs to be synchronized because trackDataHub can be accessed by multiple threads.
*/
Expand Down
Loading

0 comments on commit 370398f

Please sign in to comment.