forked from upstream-mirrors/OpenTracks
Cleanup: use Java17 switch statements.
AndroidStudio code cleanup.
This commit is contained in:
@@ -29,6 +29,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.dennisguse.opentracks.BuildConfig;
|
||||
import de.dennisguse.opentracks.data.models.Track;
|
||||
@@ -162,34 +163,8 @@ public class FileUtils {
|
||||
* @param character the character
|
||||
*/
|
||||
private static boolean isSpecialFat32(char character) {
|
||||
switch (character) {
|
||||
case '$':
|
||||
case '%':
|
||||
case '\'':
|
||||
case '-':
|
||||
case '_':
|
||||
case '@':
|
||||
case '~':
|
||||
case '`':
|
||||
case '!':
|
||||
case '(':
|
||||
case ')':
|
||||
case '{':
|
||||
case '}':
|
||||
case '^':
|
||||
case '#':
|
||||
case '&':
|
||||
case '+':
|
||||
case ',':
|
||||
case ';':
|
||||
case '=':
|
||||
case '[':
|
||||
case ']':
|
||||
case ' ':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return List.of('$', '%', '\'', '-', '_', '@', '~', '`', '!', '(', ')', '{', '}', '^', '#', '&', '+', ',', ';', '=', '[', ']', ' ')
|
||||
.contains(character);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,11 +40,9 @@ public class TrackIconUtils {
|
||||
it -> it.getId().equals(activityTypeId)
|
||||
).findFirst();
|
||||
|
||||
if (found.isEmpty()) {
|
||||
return ActivityType.UNKNOWN.getIconId();
|
||||
}
|
||||
return found.map(ActivityType::getIconId)
|
||||
.orElseGet(ActivityType.UNKNOWN::getIconId);
|
||||
|
||||
return found.get().getIconId();
|
||||
}
|
||||
|
||||
public static int getIconActivityType(String activityTypeId) {
|
||||
@@ -52,11 +50,9 @@ public class TrackIconUtils {
|
||||
it -> it.getId().equals(activityTypeId)
|
||||
).findFirst();
|
||||
|
||||
if (found.isEmpty()) {
|
||||
return ActivityType.UNKNOWN.getFirstLocalizedStringId();
|
||||
}
|
||||
return found.map(ActivityType::getFirstLocalizedStringId)
|
||||
.orElseGet(ActivityType.UNKNOWN::getFirstLocalizedStringId);
|
||||
|
||||
return found.get().getFirstLocalizedStringId();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,10 +92,8 @@ public class TrackIconUtils {
|
||||
)
|
||||
.findFirst();
|
||||
|
||||
if (selected.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return selected.map(ActivityType::isShowSpeedPreferred)
|
||||
.orElse(false);
|
||||
|
||||
return selected.get().isShowSpeedPreferred();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user