remove other gs helper methods

This commit is contained in:
AdrianLxM 2018-05-02 13:17:57 +02:00
parent 73b41a7162
commit 20263c9fe4
3 changed files with 8 additions and 16 deletions

View file

@ -221,7 +221,7 @@ public class Connector {
public static String getKeepAliveString() {
if (keepAliveActive()) {
return MainApp.instance().getString(R.string.insight_keepalive_format_string,
return MainApp.gs(R.string.insight_keepalive_format_string,
stayConnectedTime / 1000, Helpers.hourMinuteSecondString(stayConnectedTill));
} else {

View file

@ -17,7 +17,7 @@ public class LiveHistory {
public static String getStatus() {
if (status.equals("")) return status;
return status + " " + Helpers.niceTimeScalar(Helpers.msSince(status_time)) + " " + gs(R.string.ago);
return status + " " + Helpers.niceTimeScalar(Helpers.msSince(status_time)) + " " + MainApp.gs(R.string.ago);
}
public static long getStatusTime() {
@ -30,8 +30,4 @@ public class LiveHistory {
status = mystatus;
}
}
private static String gs(int id) {
return MainApp.instance().getString(id);
}
}

View file

@ -96,32 +96,28 @@ public class Helpers {
}
public static String niceTimeScalar(long t) {
String unit = gs(R.string.second);
String unit = MainApp.gs(R.string.second);
t = t / 1000;
if (t > 59) {
unit = gs(R.string.minute);
unit = MainApp.gs(R.string.minute);
t = t / 60;
if (t > 59) {
unit = gs(R.string.hour);
unit = MainApp.gs(R.string.hour);
t = t / 60;
if (t > 24) {
unit = gs(R.string.day);
unit = MainApp.gs(R.string.day);
t = t / 24;
if (t > 28) {
unit = gs(R.string.week);
unit = MainApp.gs(R.string.week);
t = t / 7;
}
}
}
}
if (t != 1) unit = unit + gs(R.string.time_plural);
if (t != 1) unit = unit + MainApp.gs(R.string.time_plural);
return qs((double) t, 0) + " " + unit;
}
private static String gs(int id) {
return MainApp.instance().getString(id);
}
public static String qs(double x, int digits) {
if (digits == -1) {