Merge pull request #1794 from MilosKozak/pumpcontrol-fix

Pump control: Fix crash when opening Insight paring activity
This commit is contained in:
Milos Kozak 2019-05-12 14:56:56 +02:00 committed by GitHub
commit 2505999a25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 69 additions and 1 deletions

View file

@ -168,7 +168,8 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
.mainType(PluginType.PUMP)
.description(R.string.description_pump_insight_local)
.fragmentClass(LocalInsightFragment.class.getName())
.preferencesId(R.xml.pref_insight_local));
.preferencesId(MainApp.instance().getPackageName().equals("info.nightscout.androidaps")
? R.xml.pref_insight_local_full : R.xml.pref_insight_local_pumpcontrol));
pumpDescription = new PumpDescription();
pumpDescription.setPumpDescription(PumpType.AccuChekInsightBluetooth);

View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/insight_local">
<Preference android:title="@string/insight_pairing">
<intent
android:targetClass="info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingInformationActivity"
android:targetPackage="info.nightscout.aapspumpcontrol" />
</Preference>
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_reservoir_changes"
android:title="@string/log_reservoir_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_tube_changes"
android:title="@string/log_tube_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_site_changes"
android:title="@string/log_site_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_battery_changes"
android:title="@string/log_battery_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_operating_mode_changes"
android:title="@string/log_operating_mode_changes" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_log_alerts"
android:title="@string/log_alerts" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_enable_tbr_emulation"
android:summary="@string/enable_tbr_emulation_summary"
android:title="@string/enable_tbr_emulation" />
<EditTextPreference
android:defaultValue="5"
android:inputType="number"
android:key="insight_min_recovery_duration"
android:title="@string/min_recovery_duration" />
<EditTextPreference
android:defaultValue="20"
android:inputType="number"
android:key="insight_max_recovery_duration"
android:title="@string/max_recovery_duration" />
<EditTextPreference
android:defaultValue="5"
android:inputType="number"
android:key="insight_disconnect_delay"
android:title="@string/disconnect_delay" />
</PreferenceCategory>
</PreferenceScreen>

View file

@ -283,6 +283,8 @@ public class ConstraintsCheckerTest {
AAPSMocker.mockSP();
AAPSMocker.mockCommandQueue();
when(mainApp.getPackageName()).thenReturn("info.nightscout.androidaps");
// RS constructor
when(SP.getString(R.string.key_danars_address, "")).thenReturn("");