Merge pull request #6 from MilosKozak/master

Update to Milos master
This commit is contained in:
AdrianLxM 2016-11-07 15:14:44 +01:00 committed by GitHub
commit 82443bc8ab
8 changed files with 45 additions and 11 deletions

View file

@ -23,8 +23,8 @@ android {
applicationId "info.nightscout.androidaps" applicationId "info.nightscout.androidaps"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 23 targetSdkVersion 23
versionCode 1019 versionCode 1020
versionName "1.0.19" versionName "1.0.20"
} }
lintOptions { lintOptions {
disable 'MissingTranslation' disable 'MissingTranslation'

View file

@ -76,7 +76,7 @@ public class MainActivity extends AppCompatActivity {
LocaleHelper.setLocale(getApplicationContext(), lang); LocaleHelper.setLocale(getApplicationContext(), lang);
recreate(); recreate();
try { // activity may be destroyed try { // activity may be destroyed
setUpTabs(true); setUpTabs(ev.isSwitchToLast());
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
e.printStackTrace(); e.printStackTrace();
} }

View file

@ -37,7 +37,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
String lang = sharedPreferences.getString("language", "en"); String lang = sharedPreferences.getString("language", "en");
LocaleHelper.setLocale(getApplicationContext(), lang); LocaleHelper.setLocale(getApplicationContext(), lang);
recreate(); recreate();
MainApp.bus().post(new EventRefreshGui()); MainApp.bus().post(new EventRefreshGui(true));
} }
updatePrefSummary(myPreferenceFragment.getPreference(key)); updatePrefSummary(myPreferenceFragment.getPreference(key));
} }

View file

@ -4,4 +4,15 @@ package info.nightscout.androidaps.events;
* Created by mike on 13.06.2016. * Created by mike on 13.06.2016.
*/ */
public class EventRefreshGui { public class EventRefreshGui {
public boolean isSwitchToLast() {
return switchToLast;
}
private final boolean switchToLast;
public EventRefreshGui(boolean switchToLast){
this.switchToLast = switchToLast;
}
} }

View file

@ -178,7 +178,7 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
plugin.setFragmentVisible(type, cb.isChecked()); plugin.setFragmentVisible(type, cb.isChecked());
onEnabledCategoryChanged(plugin, type); onEnabledCategoryChanged(plugin, type);
configBuilderPlugin.storeSettings(); configBuilderPlugin.storeSettings();
MainApp.bus().post(new EventRefreshGui()); MainApp.bus().post(new EventRefreshGui(true));
} }
}); });
@ -188,7 +188,7 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase {
PluginBase plugin = (PluginBase) cb.getTag(); PluginBase plugin = (PluginBase) cb.getTag();
plugin.setFragmentVisible(type, cb.isChecked()); plugin.setFragmentVisible(type, cb.isChecked());
configBuilderPlugin.storeSettings(); configBuilderPlugin.storeSettings();
MainApp.bus().post(new EventRefreshGui()); MainApp.bus().post(new EventRefreshGui(true));
} }
}); });
} else { } else {

View file

@ -42,7 +42,7 @@ public class IobTotal {
public static IobTotal combine(IobTotal bolusIOB, IobTotal basalIob) { public static IobTotal combine(IobTotal bolusIOB, IobTotal basalIob) {
IobTotal result = new IobTotal(); IobTotal result = new IobTotal();
result.iob = bolusIOB.iob; result.iob = bolusIOB.iob + basalIob.basaliob;
result.activity = bolusIOB.activity; result.activity = bolusIOB.activity;
result.bolussnooze = bolusIOB.bolussnooze; result.bolussnooze = bolusIOB.bolussnooze;
result.basaliob = basalIob.basaliob; result.basaliob = basalIob.basaliob;

View file

@ -53,6 +53,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.events.EventRefreshGui;
import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.events.EventTreatmentChange; import info.nightscout.androidaps.events.EventTreatmentChange;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
@ -404,7 +405,7 @@ public class OverviewFragment extends Fragment {
if (Config.APS) { if (Config.APS) {
apsModeView.setVisibility(View.VISIBLE); apsModeView.setVisibility(View.VISIBLE);
apsModeView.setBackgroundResource(R.drawable.loopmodeborder); apsModeView.setBackgroundResource(R.drawable.loopmodeborder);
LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop(); final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
if(activeloop != null && activeloop.isEnabled(activeloop.getType())) { if(activeloop != null && activeloop.isEnabled(activeloop.getType())) {
if (MainApp.getConfigBuilder().isClosedModeEnabled()) { if (MainApp.getConfigBuilder().isClosedModeEnabled()) {
apsModeView.setText(MainApp.sResources.getString(R.string.closedloop)); apsModeView.setText(MainApp.sResources.getString(R.string.closedloop));
@ -415,6 +416,28 @@ public class OverviewFragment extends Fragment {
apsModeView.setBackgroundResource(R.drawable.loopmodedisabledborder); apsModeView.setBackgroundResource(R.drawable.loopmodedisabledborder);
apsModeView.setText(MainApp.sResources.getString(R.string.disabledloop)); apsModeView.setText(MainApp.sResources.getString(R.string.disabledloop));
} }
apsModeView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
if (activeloop == null){
log.error("no active loop?");
return true;
} else if (activeloop.isEnabled(PluginBase.LOOP)){
activeloop.setFragmentEnabled(PluginBase.LOOP, false);
activeloop.setFragmentVisible(PluginBase.LOOP, false);
} else {
activeloop.setFragmentEnabled(PluginBase.LOOP, true);
activeloop.setFragmentVisible(PluginBase.LOOP, true);
}
MainApp.getConfigBuilder().storeSettings();
MainApp.bus().post(new EventRefreshGui(false));
return true;
}
});
apsModeView.setLongClickable(true);
} else { } else {
apsModeView.setVisibility(View.GONE); apsModeView.setVisibility(View.GONE);
} }
@ -439,7 +462,7 @@ public class OverviewFragment extends Fragment {
TempBasal activeTemp = pump.getTempBasal(); TempBasal activeTemp = pump.getTempBasal();
cancelTempLayout.setVisibility(View.VISIBLE); cancelTempLayout.setVisibility(View.VISIBLE);
cancelTempButton.setText(MainApp.instance().getString(R.string.cancel) + ": " + activeTemp.toString()); cancelTempButton.setText(MainApp.instance().getString(R.string.cancel) + ": " + activeTemp.toString());
runningTempView.setText(activeTemp.toString()); runningTempView.setText(activeTemp.toString() + "\n(" + DecimalFormatter.to2Decimal(pump.getBaseBasalRate()) + " U/h" + ")");
} else { } else {
cancelTempLayout.setVisibility(View.GONE); cancelTempLayout.setVisibility(View.GONE);
Double currentBasal = pump.getBaseBasalRate(); Double currentBasal = pump.getBaseBasalRate();

View file

@ -242,7 +242,7 @@
<string name="waitingforpumpresult">결과 기다리는 중</string> <string name="waitingforpumpresult">결과 기다리는 중</string>
<string name="smscommunicator_allowednumbers">허가된 전화번호</string> <string name="smscommunicator_allowednumbers">허가된 전화번호</string>
<string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string> <string name="smscommunicator_allowednumbers_summary">+XXXXXXXXXX;+YYYYYYYYYY</string>
<string name="smscommunicator_bolusreplywithcode" formatted="false">식사주입 %.2fU 을 위해 %s 코드로 답메세지를 전송하세요</string> <string name="smscommunicator_bolusreplywithcode" formatted="false">To deliver bolus %.2fU reply with code %s</string>
<string name="bolusfailed">식사주입 실패</string> <string name="bolusfailed">식사주입 실패</string>
<string name="bolusdelivered" formatted="false">식사주입 %.2fU 성공적으로 전송됨</string> <string name="bolusdelivered" formatted="false">식사주입 %.2fU 성공적으로 전송됨</string>
<string name="bolusdelivering" formatted="false">%.2fU 주입중</string> <string name="bolusdelivering" formatted="false">%.2fU 주입중</string>