Merge pull request #29 from jotomo/combo-scripter-v2

Feb 9
This commit is contained in:
Simon Pauwels 2018-02-09 06:43:23 +01:00 committed by GitHub
commit 9e956cdf5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 10 deletions

View file

@ -57,7 +57,7 @@ android {
targetSdkVersion 23
multiDexEnabled true
versionCode 1500
version "1.57-combo-csv2-beta-2"
version "1.57-combo-csv2-beta-3"
buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", generateGitBuild()

View file

@ -19,6 +19,7 @@ import info.nightscout.androidaps.Services.AlarmSoundService;
public class ErrorDialog extends DialogFragment implements View.OnClickListener {
private static Logger log = LoggerFactory.getLogger(ErrorDialog.class);
Button muteButton;
Button okButton;
TextView statusView;
ErrorHelperActivity helperActivity;
@ -52,14 +53,14 @@ public class ErrorDialog extends DialogFragment implements View.OnClickListener
Bundle savedInstanceState) {
getDialog().setTitle(title);
View view = inflater.inflate(R.layout.overview_error_dialog, container, false);
muteButton = (Button) view.findViewById(R.id.overview_error_mute);
okButton = (Button) view.findViewById(R.id.overview_error_ok);
statusView = (TextView) view.findViewById(R.id.overview_error_status);
muteButton.setOnClickListener(this);
okButton.setOnClickListener(this);
setCancelable(false);
Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class);
alarm.putExtra("soundid", soundId);
MainApp.instance().startService(alarm);
startAlarm();
return view;
}
@ -77,13 +78,16 @@ public class ErrorDialog extends DialogFragment implements View.OnClickListener
if (helperActivity != null) {
helperActivity.finish();
}
Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class);
MainApp.instance().stopService(alarm);
stopAlarm();
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.overview_error_mute:
log.debug("Error dialog mute button pressed");
stopAlarm();
break;
case R.id.overview_error_ok:
log.debug("Error dialog ok button pressed");
dismiss();
@ -91,4 +95,14 @@ public class ErrorDialog extends DialogFragment implements View.OnClickListener
}
}
private void startAlarm() {
Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class);
alarm.putExtra("soundid", soundId);
MainApp.instance().startService(alarm);
}
private void stopAlarm() {
Intent alarm = new Intent(MainApp.instance().getApplicationContext(), AlarmSoundService.class);
MainApp.instance().stopService(alarm);
}
}

View file

@ -912,9 +912,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
private CommandResult runOnConnectChecks() {
// connect, get status and check if an alarm is active
CommandResult preCheckResult = ruffyScripter.readPumpState();
for (int retries = 2; !preCheckResult.success && retries > 0; retries--) {
preCheckResult = ruffyScripter.readPumpState();
}
if (!preCheckResult.success) {
return preCheckResult;
}

View file

@ -16,11 +16,19 @@
android:layout_gravity="center_horizontal" />
<Button
android:id="@+id/overview_error_ok"
android:id="@+id/overview_error_mute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:text="@string/mute" />
<Button
android:id="@+id/overview_error_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:text="@string/ok" />
</LinearLayout>

Binary file not shown.

View file

@ -875,5 +875,6 @@
<string name="combo_error_failure_reading_changed_basal_rate">Basal rate changed on pump, but reading it failed</string>
<string name="combo_activity_checking_for_history_changes">Checking for history changes</string>
<string name="combo_error_multiple_boluses_with_identical_timestamp">Multiple boluses with the same amount within the same minute were just imported. Only one record could be added to treatments. Please check the pump and manually add a bolus record using the Careportal tab. Make sure to create a bolus with a time no other bolus uses.</string>
<string name="mute">Mute</string>
</resources>