remove one more gs helper

This commit is contained in:
AdrianLxM 2018-05-02 13:28:58 +02:00
parent 20263c9fe4
commit cfaa26d337

View file

@ -95,7 +95,7 @@ public class Connector {
} else { } else {
log("PROTOCOL VERSION MISMATCH! local: " + COMPATIBILITY_VERSION + " remote: " + remoteVersion); log("PROTOCOL VERSION MISMATCH! local: " + COMPATIBILITY_VERSION + " remote: " + remoteVersion);
statusCallback.onStatusChange(Status.INCOMPATIBLE, 0, 0); statusCallback.onStatusChange(Status.INCOMPATIBLE, 0, 0);
compatabilityMessage = gs(R.string.insight_incompatible_compantion_app_we_need_version) + " " + getLocalVersion(); compatabilityMessage = MainApp.gs(R.string.insight_incompatible_compantion_app_we_need_version) + " " + getLocalVersion();
serviceConnector.disconnectFromService(); serviceConnector.disconnectFromService();
} }
@ -179,33 +179,29 @@ public class Connector {
switch (status) { switch (status) {
case EXCHANGING_KEYS: case EXCHANGING_KEYS:
return gs(R.string.connecting).toUpperCase(); return MainApp.gs(R.string.connecting).toUpperCase();
case WAITING_FOR_CODE_CONFIRMATION: case WAITING_FOR_CODE_CONFIRMATION:
return gs(R.string.insight_waiting_for_code).toUpperCase(); return MainApp.gs(R.string.insight_waiting_for_code).toUpperCase();
case CODE_REJECTED: case CODE_REJECTED:
return gs(R.string.insight_code_rejected).toUpperCase(); return MainApp.gs(R.string.insight_code_rejected).toUpperCase();
case APP_BINDING: case APP_BINDING:
return gs(R.string.insight_app_binding).toUpperCase(); return MainApp.gs(R.string.insight_app_binding).toUpperCase();
case CONNECTING: case CONNECTING:
return gs(R.string.connecting).toUpperCase(); return MainApp.gs(R.string.connecting).toUpperCase();
case CONNECTED: case CONNECTED:
return gs(R.string.connected).toUpperCase(); return MainApp.gs(R.string.connected).toUpperCase();
case DISCONNECTED: case DISCONNECTED:
return gs(R.string.disconnected).toUpperCase(); return MainApp.gs(R.string.disconnected).toUpperCase();
case NOT_AUTHORIZED: case NOT_AUTHORIZED:
return gs(R.string.insight_not_authorized).toUpperCase(); return MainApp.gs(R.string.insight_not_authorized).toUpperCase();
case INCOMPATIBLE: case INCOMPATIBLE:
return gs(R.string.insight_incompatible).toUpperCase(); return MainApp.gs(R.string.insight_incompatible).toUpperCase();
default: default:
return status.toString(); return status.toString();
} }
} }
private static String gs(int id) {
return MainApp.instance().getString(id);
}
private static synchronized void extendKeepAliveIfActive() { private static synchronized void extendKeepAliveIfActive() {
if (keepAliveActive()) { if (keepAliveActive()) {
if (Helpers.ratelimit("extend-insight-keepalive", 10)) { if (Helpers.ratelimit("extend-insight-keepalive", 10)) {
@ -384,7 +380,7 @@ public class Connector {
public String getLastStatusMessage() { public String getLastStatusMessage() {
if (!companionAppInstalled) { if (!companionAppInstalled) {
return gs(R.string.insight_companion_app_not_installed); return MainApp.gs(R.string.insight_companion_app_not_installed);
} }
if (!isConnected()) { if (!isConnected()) {
@ -398,13 +394,13 @@ public class Connector {
// if disconnected but previous state was incompatible // if disconnected but previous state was incompatible
return compatabilityMessage; return compatabilityMessage;
} else { } else {
return gs(R.string.insight_not_connected_to_companion_app); return MainApp.gs(R.string.insight_not_connected_to_companion_app);
} }
} }
} }
if (lastStatus == null) { if (lastStatus == null) {
return gs(R.string.insight_unknown); return MainApp.gs(R.string.insight_unknown);
} }
switch (lastStatus) { switch (lastStatus) {
@ -414,16 +410,16 @@ public class Connector {
} }
break; break;
case INCOMPATIBLE: case INCOMPATIBLE:
return statusToString(lastStatus) + " " + gs(R.string.insight_needs) + " " + getLocalVersion(); return statusToString(lastStatus) + " " + MainApp.gs(R.string.insight_needs) + " " + getLocalVersion();
} }
return statusToString(lastStatus); return statusToString(lastStatus);
} }
public String getNiceLastStatusTime() { public String getNiceLastStatusTime() {
if (lastStatusTime < 1) { if (lastStatusTime < 1) {
return gs(R.string.insight_startup_uppercase); return MainApp.gs(R.string.insight_startup_uppercase);
} else { } else {
return Helpers.niceTimeScalar(Helpers.msSince(lastStatusTime)) + " " + gs(R.string.ago); return Helpers.niceTimeScalar(Helpers.msSince(lastStatusTime)) + " " + MainApp.gs(R.string.ago);
} }
} }
@ -516,7 +512,7 @@ public class Connector {
} }
for (Map.Entry entry : statistics.entrySet()) { for (Map.Entry entry : statistics.entrySet()) {
if ((long) entry.getValue() > 1000) { if ((long) entry.getValue() > 1000) {
l.add(new StatusItem(gs(R.string.statistics) + " " + Helpers.capitalize(entry.getKey().toString()), l.add(new StatusItem(MainApp.gs(R.string.statistics) + " " + Helpers.capitalize(entry.getKey().toString()),
new Formatter().format("%4s %12s", new Formatter().format("%4s %12s",
percentage(getEntryTime(entry), total) + "%", percentage(getEntryTime(entry), total) + "%",
Helpers.niceTimeScalar(getEntryTime(entry))).toString())); Helpers.niceTimeScalar(getEntryTime(entry))).toString()));