formatTime static method
Implementation
static String formatTime(int seconds) {
if (seconds <= 60) {
return "1 ${AppHelper.getTr(TrKeys.min)}";
} else if (seconds < 3600) {
int minutes = seconds ~/ 60;
seconds = seconds % 60;
return "$minutes ${AppHelper.getTr(TrKeys.min)}";
} else {
int hours = seconds ~/ 3600;
int minutes = (seconds % 3600) ~/ 60;
seconds = seconds % 60;
if (minutes == 0 && seconds == 0) {
return "$hours ${AppHelper.getTr(TrKeys.hour)}";
} else if (seconds == 0) {
return "$hours ${AppHelper.getTr(TrKeys.hour)} $minutes ${AppHelper.getTr(TrKeys.min)}";
} else {
return "$hours ${AppHelper.getTr(TrKeys.hour)} $minutes ${AppHelper.getTr(TrKeys.min)}";
}
}
}