more static members

This commit is contained in:
Milos Kozak 2016-08-11 00:15:50 +02:00
parent 0e6185064a
commit 565e2a831b

View file

@ -67,15 +67,13 @@ public class DataService extends IntentService {
if (Config.logFunctionCalls) if (Config.logFunctionCalls)
log.debug("onHandleIntent " + intent); log.debug("onHandleIntent " + intent);
if (MainApp.getConfigBuilder() != null) { if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceXdripPlugin.class)) {
if (MainApp.getConfigBuilder().getActiveBgSource().getClass().equals(SourceXdripPlugin.class)) { xDripEnabled = true;
xDripEnabled = true; nsClientEnabled = false;
nsClientEnabled = false; }
} if (ConfigBuilderPlugin.getActiveBgSource().getClass().equals(SourceNSClientPlugin.class)) {
if (MainApp.getConfigBuilder().getActiveBgSource().getClass().equals(SourceNSClientPlugin.class)) { xDripEnabled = false;
xDripEnabled = false; nsClientEnabled = true;
nsClientEnabled = true;
}
} }
if (intent != null) { if (intent != null) {
@ -142,7 +140,7 @@ public class DataService extends IntentService {
bgReading.timeIndex = bundle.getLong(Intents.EXTRA_TIMESTAMP); bgReading.timeIndex = bundle.getLong(Intents.EXTRA_TIMESTAMP);
bgReading.raw = bundle.getDouble(Intents.EXTRA_RAW); bgReading.raw = bundle.getDouble(Intents.EXTRA_RAW);
if (bgReading.timeIndex < new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000l) { if (bgReading.timeIndex < new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) {
if (Config.logIncommingBG) if (Config.logIncommingBG)
log.debug("Ignoring old XDRIPREC BG " + bgReading.toString()); log.debug("Ignoring old XDRIPREC BG " + bgReading.toString());
return; return;
@ -152,7 +150,7 @@ public class DataService extends IntentService {
log.debug("XDRIPREC BG " + bgReading.toString()); log.debug("XDRIPREC BG " + bgReading.toString());
try { try {
MainApp.instance().getDbHelper().getDaoBgReadings().createIfNotExists(bgReading); MainApp.getDbHelper().getDaoBgReadings().createIfNotExists(bgReading);
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -170,16 +168,13 @@ public class DataService extends IntentService {
if (Config.logIncommingData) if (Config.logIncommingData)
log.debug("Received status: " + bundles); log.debug("Received status: " + bundles);
if (bundles.containsKey("nsclientversioncode")) { if (bundles.containsKey("nsclientversioncode")) {
ConfigBuilderPlugin configBuilder = MainApp.getConfigBuilder(); ConfigBuilderPlugin.nightscoutVersionCode = bundles.getInt("nightscoutversioncode"); // for ver 1.2.3 contains 10203
if (configBuilder != null) { ConfigBuilderPlugin.nightscoutVersionName = bundles.getString("nightscoutversionname");
configBuilder.nightscoutVersionCode = bundles.getInt("nightscoutversioncode"); // for ver 1.2.3 contains 10203 ConfigBuilderPlugin.nsClientVersionCode = bundles.getInt("nsclientversioncode"); // for ver 1.17 contains 117
configBuilder.nightscoutVersionName = bundles.getString("nightscoutversionname"); ConfigBuilderPlugin.nsClientVersionName = bundles.getString("nsclientversionname");
configBuilder.nsClientVersionCode = bundles.getInt("nsclientversioncode"); // for ver 1.17 contains 117 log.debug("Got versions: NSClient: " + ConfigBuilderPlugin.nsClientVersionName + " Nightscout: " + ConfigBuilderPlugin.nightscoutVersionName);
configBuilder.nsClientVersionName = bundles.getString("nsclientversionname"); if (ConfigBuilderPlugin.nsClientVersionCode < 118)
log.debug("Got versions: NSClient: " + configBuilder.nsClientVersionName + " Nightscout: " + configBuilder.nightscoutVersionName); ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.unsupportedclientver));
if (configBuilder.nsClientVersionCode < 118)
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.unsupportedclientver));
}
} else { } else {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.unsupportedclientver)); ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.unsupportedclientver));
} }
@ -404,7 +399,6 @@ public class DataService extends IntentService {
if (Config.logIncommingData) if (Config.logIncommingData)
log.debug("Records updated: " + updated); log.debug("Records updated: " + updated);
} }
return;
} else { } else {
if (Config.logIncommingData) if (Config.logIncommingData)
log.debug("ADD: New treatment: " + trstring); log.debug("ADD: New treatment: " + trstring);