mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 09:33:06 +02:00
Cleanup: use .isEmpty() (except for CharSequence and StringBuilder as it requires SDK33).
This commit is contained in:
@@ -90,7 +90,7 @@ public class PreferencesUtilsTest {
|
||||
|
||||
// then
|
||||
assertEquals(1, recordingLayouts.size());
|
||||
assertTrue(recordingLayouts.get(0).getFields().size() > 0);
|
||||
assertFalse(recordingLayouts.get(0).getFields().isEmpty());
|
||||
assertEquals(recordingLayouts.get(0).getName(), context.getString(R.string.stats_custom_layout_default_layout));
|
||||
assertTrue(recordingLayouts.get(0).getFields().stream().anyMatch(DataField::isVisible));
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public class PreferencesUtilsTest {
|
||||
RecordingLayout recordingLayout = PreferencesUtils.getCustomLayout();
|
||||
|
||||
// then
|
||||
assertTrue(recordingLayout.getFields().size() > 0);
|
||||
assertFalse(recordingLayout.getFields().isEmpty());
|
||||
assertEquals(recordingLayout.getName(), context.getString(R.string.stats_custom_layout_default_layout));
|
||||
assertTrue(recordingLayout.getFields().stream().anyMatch(DataField::isVisible));
|
||||
}
|
||||
|
||||
@@ -880,7 +880,7 @@ public class ChartView extends View {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (firstChartValueSeries != null && chartPoints.size() > 0) {
|
||||
if (firstChartValueSeries != null && !chartPoints.isEmpty()) {
|
||||
int dx = getX(maxX) - pointer.getIntrinsicWidth() / 2;
|
||||
double value = firstChartValueSeries.extractDataFromChartPoint(last);
|
||||
int dy = getY(firstChartValueSeries, value) - pointer.getIntrinsicHeight();
|
||||
|
||||
@@ -88,7 +88,7 @@ public class DescriptionGenerator {
|
||||
* @param lineBreak the line break
|
||||
*/
|
||||
private void writeString(String text, StringBuilder builder, int resId, String lineBreak) {
|
||||
if (text == null || text.length() == 0) {
|
||||
if (text == null || text.isEmpty()) {
|
||||
text = context.getString(R.string.value_unknown);
|
||||
}
|
||||
builder.append(context.getString(resId, text));
|
||||
|
||||
@@ -49,13 +49,13 @@ public class ListItemUtils {
|
||||
*/
|
||||
private static String getTimeDistance(String totalTime, String totalDistance) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (totalTime != null && totalTime.length() != 0) {
|
||||
if (totalTime != null && !totalTime.isEmpty()) {
|
||||
if (builder.length() != 0) {
|
||||
builder.append(" ‧ ");
|
||||
}
|
||||
builder.append(totalTime);
|
||||
}
|
||||
if (totalDistance != null && totalDistance.length() != 0) {
|
||||
if (totalDistance != null && !totalDistance.isEmpty()) {
|
||||
if (builder.length() != 0) {
|
||||
builder.append(" ");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user