Improved MinimumDurationTask visualization
This commit is contained in:
parent
31cb68240b
commit
3ac10f4f7a
2 changed files with 8 additions and 11 deletions
|
@ -112,7 +112,7 @@ public abstract class Objective {
|
||||||
private long minimumDuration;
|
private long minimumDuration;
|
||||||
|
|
||||||
public MinimumDurationTask(long minimumDuration) {
|
public MinimumDurationTask(long minimumDuration) {
|
||||||
super(R.string.time_leftover);
|
super(R.string.time_elapsed);
|
||||||
this.minimumDuration = minimumDuration;
|
this.minimumDuration = minimumDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,19 +123,17 @@ public abstract class Objective {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getProgress() {
|
public String getProgress() {
|
||||||
long timeLeftover = minimumDuration - (System.currentTimeMillis() - getObjective().getStartedOn().getTime());
|
return getDurationText(System.currentTimeMillis() - getObjective().getStartedOn().getTime())
|
||||||
return getDurationText(timeLeftover) + " / " + getDurationText(minimumDuration);
|
+ " / " + getDurationText(minimumDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDurationText(long duration) {
|
private String getDurationText(long duration) {
|
||||||
int days = (int) (duration / (24L * 60L * 60L * 1000L));
|
int days = (int) Math.floor((double) duration / (24D * 60D * 60D * 1000D));
|
||||||
int hours = (int) (duration / (60L * 60L * 1000L));
|
int hours = (int) Math.floor((double) duration / (60D * 60D * 1000D));
|
||||||
int minutes = (int) (duration / (60L * 1000L));
|
int minutes = (int) Math.floor((double) duration / (60D * 1000D));
|
||||||
if (days > 0) return MainApp.gq(R.plurals.objective_days, days, days);
|
if (days > 0) return MainApp.gq(R.plurals.objective_days, days, days);
|
||||||
else if (hours > 0) return MainApp.gq(R.plurals.objective_hours, hours, hours);
|
else if (hours > 0) return MainApp.gq(R.plurals.objective_hours, hours, hours);
|
||||||
else if (minutes > 0) return MainApp.gq(R.plurals.objective_minutes, minutes, minutes);
|
else return MainApp.gq(R.plurals.objective_minutes, minutes, minutes);
|
||||||
else if (duration > 0) return MainApp.gq(R.plurals.objective_minutes, 1, 1);
|
|
||||||
else return MainApp.gs(R.string.time_none);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1141,8 +1141,7 @@
|
||||||
<string name="nav_plugin_preferences">Plugin preferences</string>
|
<string name="nav_plugin_preferences">Plugin preferences</string>
|
||||||
<string name="completed_well_done">Completed, well done!</string>
|
<string name="completed_well_done">Completed, well done!</string>
|
||||||
<string name="not_completed_yet">Not completed yet</string>
|
<string name="not_completed_yet">Not completed yet</string>
|
||||||
<string name="time_leftover">Time leftover</string>
|
<string name="time_elapsed">Time elapsed</string>
|
||||||
<string name="time_none">None</string>
|
|
||||||
<string name="nth_objective">%1$d. Objective</string>
|
<string name="nth_objective">%1$d. Objective</string>
|
||||||
|
|
||||||
<plurals name="objective_days">
|
<plurals name="objective_days">
|
||||||
|
|
Loading…
Reference in a new issue